When mulitple ROs appear within a step that have the same units, the units will be excluded from the RO value. In edit mode, the units are displayed. In Print or Display mode, the units are excluded. Thus the phrase "between 25 GPM and 35 GPM" becomes "between 25 and 35 GPM".
This commit is contained in:
parent
0d99f81701
commit
d194f751d9
@ -417,12 +417,12 @@ namespace Volian.Controls.Library
|
|||||||
if (m != null && m.Groups.Count > 7 && m.Groups[7].ToString() == "ReferencedObject")
|
if (m != null && m.Groups.Count > 7 && m.Groups[7].ToString() == "ReferencedObject")
|
||||||
{
|
{
|
||||||
// if previous processed (next ro) was found, then see if it has an 'and' between it and the previous
|
// if previous processed (next ro) was found, then see if it has an 'and' between it and the previous
|
||||||
if (prevValue != null)
|
//if (prevValue != null)
|
||||||
{
|
//{
|
||||||
int endIndx = m.Index + m.Length;
|
// int endIndx = m.Index + m.Length;
|
||||||
string tr = text.Substring(endIndx).Replace(@"\v0","").TrimStart();
|
// string tr = text.Substring(endIndx).Replace(@"\v0","").TrimStart();
|
||||||
if (!tr.ToUpper().StartsWith("AND")) prevValue = null;
|
// if (!tr.ToUpper().StartsWith("AND")) prevValue = null;
|
||||||
}
|
//}
|
||||||
int myIndex = m.Groups[4].Index;
|
int myIndex = m.Groups[4].Index;
|
||||||
int myLength = m.Groups[4].Length;
|
int myLength = m.Groups[4].Length;
|
||||||
if (m.Groups[3].Value != " ")
|
if (m.Groups[3].Value != " ")
|
||||||
@ -441,8 +441,9 @@ namespace Volian.Controls.Library
|
|||||||
int rodbid = int.Parse(myMatch.Groups[3].Value);
|
int rodbid = int.Parse(myMatch.Groups[3].Value);
|
||||||
ROFstInfo myROFst = _MyItemInfo.MyDocVersion.GetROFst(rodbid);
|
ROFstInfo myROFst = _MyItemInfo.MyDocVersion.GetROFst(rodbid);
|
||||||
bool isSetpoint=myROFst.IsSetpointDB(dbid, _MyItemInfo.MyDocVersion);
|
bool isSetpoint=myROFst.IsSetpointDB(dbid, _MyItemInfo.MyDocVersion);
|
||||||
string newvalue = DoROFormatFlags(gg, beforeRO, afterRO, isSetpoint, prevValue);
|
string newvalue1 = DoROFormatFlags(gg, beforeRO, afterRO, isSetpoint);
|
||||||
if (!_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.AllUnits) prevValue = newvalue;
|
string newvalue = RemoveMultipleUnits(prevValue, newvalue1);
|
||||||
|
if (!_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.AllUnits) prevValue = newvalue1;
|
||||||
newvalue = DoROReplaceWords(_MyFormat.PlantFormat.FormatData.SectData.ReplaceStrList, newvalue, _MyItemInfo.IsHigh);
|
newvalue = DoROReplaceWords(_MyFormat.PlantFormat.FormatData.SectData.ReplaceStrList, newvalue, _MyItemInfo.IsHigh);
|
||||||
if (isSetpoint) newvalue = ReplaceSpaceWithHardspace(newvalue);
|
if (isSetpoint) newvalue = ReplaceSpaceWithHardspace(newvalue);
|
||||||
if (gg != newvalue)
|
if (gg != newvalue)
|
||||||
@ -1265,7 +1266,7 @@ namespace Volian.Controls.Library
|
|||||||
// string spaces = @" \u160?";
|
// string spaces = @" \u160?";
|
||||||
// return (spaces.IndexOf(ch) >= 0);
|
// return (spaces.IndexOf(ch) >= 0);
|
||||||
//}
|
//}
|
||||||
private string DoROFormatFlags(string roText, string beforeRO, string afterRO, bool isSetpoint, string prevValue)
|
private string DoROFormatFlags(string roText, string beforeRO, string afterRO, bool isSetpoint)
|
||||||
{
|
{
|
||||||
string rtnstr = roText;
|
string rtnstr = roText;
|
||||||
// The RO text is being changed to match it's context. Since it is changed in reverse order, the text before the RO
|
// The RO text is being changed to match it's context. Since it is changed in reverse order, the text before the RO
|
||||||
@ -1354,15 +1355,25 @@ namespace Volian.Controls.Library
|
|||||||
rtnstr = tstr;
|
rtnstr = tstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return rtnstr;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string RemoveMultipleUnits(string prevValue, string rtnstr)
|
||||||
|
{
|
||||||
//In a sequence of RO values, the unit appears with every value
|
//In a sequence of RO values, the unit appears with every value
|
||||||
//(e.g., "25 gpm and 30 gpm" vs. "25 and 30 gpm")
|
//(e.g., "25 gpm and 30 gpm" vs. "25 and 30 gpm")
|
||||||
if (!_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.AllUnits && prevValue != null)
|
if (!_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.AllUnits && prevValue != null)
|
||||||
{
|
{
|
||||||
string units = null;
|
string units = null;
|
||||||
Match m = Regex.Match(prevValue, "[^0-9]");
|
//Match m = Regex.Match(prevValue, "[^0-9]");
|
||||||
if (m.Success)
|
int ind = prevValue.LastIndexOfAny("0123456789".ToCharArray());
|
||||||
|
if (ind>=0)
|
||||||
{
|
{
|
||||||
units = prevValue.Substring(m.Index);
|
string mynum = prevValue.Substring(0, ind+1);
|
||||||
|
// Handle Hex characters which are part of the Units such as the degree character
|
||||||
|
if (Regex.IsMatch(mynum, @".*\\'[A-Fa-f0-9]{2,2}$"))
|
||||||
|
ind -= 4;
|
||||||
|
units = prevValue.Substring(ind+1);
|
||||||
if (rtnstr.EndsWith(units))
|
if (rtnstr.EndsWith(units))
|
||||||
{
|
{
|
||||||
rtnstr = rtnstr.Replace(units, "");
|
rtnstr = rtnstr.Replace(units, "");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user