Logic for Comanche Peak’s Step Designator and boxed Cautions and Notes

Supporting logic for used by the redefined “WidthOverride”
Added support the “{UNITNUMBER}” pagelist token
This commit is contained in:
John Jenko 2013-10-02 22:15:04 +00:00
parent 512db4b89e
commit e0b20d8ab1
3 changed files with 82 additions and 28 deletions

View File

@ -1084,6 +1084,10 @@ namespace Volian.Print.Library
plstr = plstr.Replace(token, MySection.MyDocVersion.DocVersionConfig.Unit_Text); plstr = plstr.Replace(token, MySection.MyDocVersion.DocVersionConfig.Unit_Text);
//svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, MySection.MyDocVersion.DocVersionConfig.Unit_Text))); //svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, MySection.MyDocVersion.DocVersionConfig.Unit_Text)));
break; break;
case "{UNITNUMBER}":
case "[UNITNUMBER]":
plstr = plstr.Replace(token, MySection.MyDocVersion.DocVersionConfig.Unit_Number);
break;
case "{ATTACHNUM}": case "{ATTACHNUM}":
case "[ATTACHNUM]": case "[ATTACHNUM]":
plstr = plstr.Replace(token, "1"); // used by SHESDD - but 16bit returns '1' unless has format flag 'MoveParensToToken' that was only in SCE (San Onofre) plstr = plstr.Replace(token, "1"); // used by SHESDD - but 16bit returns '1' unless has format flag 'MoveParensToToken' that was only in SCE (San Onofre)

View File

@ -28,6 +28,28 @@ namespace Volian.Print.Library
{ {
_Parent = parent; _Parent = parent;
} }
// Step Designators are used by Comanche Peak and stored in their CAUTION2 type
// We need to save this information and not process it like a normal Caution.
private string _StepDesignator;
public string StepDesignator
{
get { return _StepDesignator; }
set { _StepDesignator = value; }
}
private float? _StepDesignatorColumn;
public float? StepDesignatorColumn
{
get { return _StepDesignatorColumn; }
set { _StepDesignatorColumn = value; }
}
private VE_Font _StepDesignatorFont;
public VE_Font StepDesignatorFont
{
get { return _StepDesignatorFont; }
set { _StepDesignatorFont = value; }
}
public float Add(PdfContentByte cb, ItemInfoList itemInfoList, float xoff, float yoff, float yoffRight, int rnoLevel, int maxRNO, FormatInfo formatInfo) public float Add(PdfContentByte cb, ItemInfoList itemInfoList, float xoff, float yoff, float yoffRight, int rnoLevel, int maxRNO, FormatInfo formatInfo)
{ {
int? bxIndex = null; int? bxIndex = null;
@ -93,7 +115,7 @@ namespace Volian.Print.Library
else // Change Box Style else // Change Box Style
{ {
bool handleSeparateBox = true; bool handleSeparateBox = true;
if (childItemInfo.IsCaution && !childItemInfo.FormatStepData.SeparateBoxCautions) handleSeparateBox = false; if (childItemInfo.IsCaution && !childItemInfo.FormatStepData.SeparateBox && !childItemInfo.FormatStepData.SeparateBoxCautions) handleSeparateBox = false;
if (childItemInfo.IsNote && !childItemInfo.FormatStepData.SeparateBox) handleSeparateBox = false; if (childItemInfo.IsNote && !childItemInfo.FormatStepData.SeparateBox) handleSeparateBox = false;
if (bxIndx != null && (handleSeparateBox || bxIndex != bxIndx)) if (bxIndx != null && (handleSeparateBox || bxIndex != bxIndx))
@ -109,14 +131,27 @@ namespace Volian.Print.Library
box = new vlnBox(); box = new vlnBox();
box.MyBox = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx]; box.MyBox = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx];
int ln = 1; // a format flag determines whether there is a space before the note/caution. int ln = 1; // a format flag determines whether there is a space before the note/caution.
if (childItemInfo.FormatStepData.OneLineBeforeTab) ln++; //if (childItemInfo.FormatStepData.OneLineBeforeTab) ln++;
if (childItemInfo.MixCautionNotesDiffType()) ln += 2; if (childItemInfo.MixCautionNotesDiffType()) ln += 2;
box.YOffset = yoff + ((ln - 1) * vlnPrintObject.SixLinesPerInch); box.YOffset = yoff + ((ln - 1) * vlnPrintObject.SixLinesPerInch);
if (childItemInfo.FormatStepData.OneLineBeforeTab) ln++;
yoff += ln * vlnPrintObject.SixLinesPerInch; yoff += ln * vlnPrintObject.SixLinesPerInch;
} }
} }
bxIndex = bxIndx; bxIndex = bxIndx;
} }
// Comanche peak Step Designator
if (childItemInfo.IsCaution2 && childItemInfo.SameRowAsParent)
{
// Save the Step Designator information
_StepDesignator = childItemInfo.DisplayText;
int typ = ((int)childItemInfo.MyContent.Type) % 10000;
_StepDesignatorColumn = formatInfo.PlantFormat.FormatData.StepDataList[typ].ColOverride;
E_Style es = (E_Style)childItemInfo.FormatStepData.Font.Style;
_StepDesignatorFont = new VE_Font(childItemInfo.FormatStepData.Font.Family, (int)childItemInfo.FormatStepData.Font.Size, es, (float)childItemInfo.FormatStepData.Font.CPI);
}
else
{
if (childItemInfo is SectionInfo) formatInfo = (childItemInfo as SectionInfo).LocalFormat ?? formatInfo; if (childItemInfo is SectionInfo) formatInfo = (childItemInfo as SectionInfo).LocalFormat ?? formatInfo;
if (rnoLevel < maxRNO && childItemInfo.RNOs != null) yoff = Math.Max(yoff, yoffRight); if (rnoLevel < maxRNO && childItemInfo.RNOs != null) yoff = Math.Max(yoff, yoffRight);
vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null); vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null);
@ -142,6 +177,7 @@ namespace Volian.Print.Library
box.Height = para.YBottomMost - box.YOffset; // para.YTop - (1.1F * vlnPrintObject.SixLinesPerInch); box.Height = para.YBottomMost - box.YOffset; // para.YTop - (1.1F * vlnPrintObject.SixLinesPerInch);
box = null; box = null;
} }
}
boxHLS = false; boxHLS = false;
lastChild = childItemInfo; lastChild = childItemInfo;
} }
@ -1303,6 +1339,8 @@ namespace Volian.Print.Library
if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab) if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab)
yoff += SetHeader(this, cb, itemInfo, formatInfo); yoff += SetHeader(this, cb, itemInfo, formatInfo);
float yoffLeft = yoff; float yoffLeft = yoff;
if (ChildrenAbove != null)
ChildrenAbove.StepDesignator = null; //reset StepDesignator
if (itemInfo.Cautions != null && !(itemInfo.IsCaution || itemInfo.IsNote)) if (itemInfo.Cautions != null && !(itemInfo.IsCaution || itemInfo.IsNote))
{ {
if (itemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format) if (itemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format)
@ -1317,6 +1355,18 @@ namespace Volian.Print.Library
else else
yoff = ChildrenAbove.Add(cb, itemInfo.Notes, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); yoff = ChildrenAbove.Add(cb, itemInfo.Notes, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
} }
// Comanche Peak uses CAUTION2 type to enter a Step Designator, which is placed to the left of the step number.
// The Step Designator information is saved during the processing of the Cautions (ChildrenAbove)
// defined in the vlnParagraphs class (of which ChildrenAbove is defined)
if (ChildrenAbove.StepDesignator != null)
{
string pref = ChildrenAbove.StepDesignator;
float colOvrd = (float)(ChildrenAbove.StepDesignatorColumn??0);
float xPref = (colOvrd > 0)? colOvrd : mytab.XOffset - (pref.Length * (72 / (float)_MyItemInfo.FormatStepData.Font.CPI));
PartsLeft.Add(new vlnText(cb, this, pref, pref, xPref, yoff, ChildrenAbove.StepDesignatorFont));
ChildrenAbove.StepDesignator = null;
ChildrenAbove.StepDesignatorColumn = null;
}
// if this is a hls with a box, adjust the starting y location for the hls. this is done here // if this is a hls with a box, adjust the starting y location for the hls. this is done here
// in case this hls had a boxed caution and/or note before it. Also, this code is here rather // in case this hls had a boxed caution and/or note before it. Also, this code is here rather
@ -1517,7 +1567,6 @@ namespace Volian.Print.Library
VE_Font tmpFont = new VE_Font(_MyItemInfo.FormatStepData.Font.Family, (int)_MyItemInfo.FormatStepData.Font.Size, es, (float)_MyItemInfo.FormatStepData.Font.CPI); VE_Font tmpFont = new VE_Font(_MyItemInfo.FormatStepData.Font.Family, (int)_MyItemInfo.FormatStepData.Font.Size, es, (float)_MyItemInfo.FormatStepData.Font.CPI);
PartsLeft.Add(new vlnText(cb, this, pref, pref, xPref, yoff, tmpFont)); PartsLeft.Add(new vlnText(cb, this, pref, pref, xPref, yoff, tmpFont));
} }
} }
// If checklists, the substeps are printed in a row, need to keep track of the 'longest' in // If checklists, the substeps are printed in a row, need to keep track of the 'longest' in
// y direction (bottommost) across the row. // y direction (bottommost) across the row.
@ -2500,7 +2549,8 @@ namespace Volian.Print.Library
if (itemInfo.IsStep && itemInfo.MyHLS != null && itemInfo.MyHLS.FormatStepData.UseSmartTemplate && (xwid = GetWidthFromTemplate(itemInfo, formatInfo)) > 0) if (itemInfo.IsStep && itemInfo.MyHLS != null && itemInfo.MyHLS.FormatStepData.UseSmartTemplate && (xwid = GetWidthFromTemplate(itemInfo, formatInfo)) > 0)
widOvrd = xwid; widOvrd = xwid;
else else
widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride; widOvrd = itemInfo.FormatStepData == null ? null : (float?)ToInt(itemInfo.FormatStepData.WidthOverride, maxRNO);
//widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride;
if (itemInfo.IsRNOPart && itemInfo.MyParent.IsHigh && itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthAlt != null) if (itemInfo.IsRNOPart && itemInfo.MyParent.IsHigh && itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthAlt != null)
{ {
string[] splitRNOWidthAlt = itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthAlt.Split(','); string[] splitRNOWidthAlt = itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthAlt.Split(',');

View File

@ -250,7 +250,7 @@ namespace Volian.Print.Library
/// <returns></returns> /// <returns></returns>
public static int ToInt(string value, int i) public static int ToInt(string value, int i)
{ {
string s = value.Split(",".ToCharArray())[i]; string s = (value.Contains(",")) ? value.Split(",".ToCharArray())[i] : value;
return ToInt(s); return ToInt(s);
} }
public static string GetRtf(string text, VE_Font vFont) public static string GetRtf(string text, VE_Font vFont)