B2017-085 Added hard returns back into the template
B2017-085 Added logic to handle hard returns in the templates. Fix logic that grabs template titles that contain spaces.
This commit is contained in:
parent
4020477158
commit
6e94a74803
Binary file not shown.
@ -79,6 +79,15 @@ namespace VEPROMS.CSLA.Library
|
|||||||
_CPI = new LazyLoad<float?>(CPI);
|
_CPI = new LazyLoad<float?>(CPI);
|
||||||
}
|
}
|
||||||
private LazyLoad<string> _Family;
|
private LazyLoad<string> _Family;
|
||||||
|
private static Dictionary<string, Font> _WinFontLookup = new Dictionary<string, Font>();
|
||||||
|
// put the fonts in a dictionary so that we don't call new Font each time we reference it
|
||||||
|
private static Font GetFont(string family, float size, FontStyle style)
|
||||||
|
{
|
||||||
|
string key = string.Format("{0}_{1}_{2}", family, size, style);
|
||||||
|
if (!_WinFontLookup.ContainsKey(key))
|
||||||
|
_WinFontLookup.Add(key, new Font(family, size, style));
|
||||||
|
return _WinFontLookup[key];
|
||||||
|
}
|
||||||
private Font _WindowsFont;
|
private Font _WindowsFont;
|
||||||
public Font WindowsFont
|
public Font WindowsFont
|
||||||
{
|
{
|
||||||
@ -99,9 +108,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
// for now - check size to be 0 and set to 10 if so, error in fmtxml?
|
// for now - check size to be 0 and set to 10 if so, error in fmtxml?
|
||||||
if (Family == null) // Need to get inherited font
|
if (Family == null) // Need to get inherited font
|
||||||
_WindowsFont = new Font("Arial", 10, FontStyle.Regular);
|
_WindowsFont = GetFont("Arial", 10, FontStyle.Regular);
|
||||||
else
|
else
|
||||||
_WindowsFont = new Font(Family, Size == 0 ? 10 : (float)Size, style);
|
_WindowsFont = GetFont(Family, Size == 0 ? 10 : (float)Size, style);
|
||||||
}
|
}
|
||||||
return _WindowsFont;
|
return _WindowsFont;
|
||||||
}
|
}
|
||||||
@ -291,7 +300,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
short nocol = 0;
|
short nocol = 0;
|
||||||
int row = 0;
|
int row = 0;
|
||||||
string stmp = null;
|
string stmp = null;
|
||||||
if (!NewTemplateFormat)
|
if (!NewTemplateFormat) // not the smart template
|
||||||
{
|
{
|
||||||
string[] tmpOld = tpl.Split(" ".ToCharArray());
|
string[] tmpOld = tpl.Split(" ".ToCharArray());
|
||||||
level = Convert.ToInt32(tmpOld[0]);
|
level = Convert.ToInt32(tmpOld[0]);
|
||||||
@ -300,14 +309,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
stmp = null;
|
stmp = null;
|
||||||
else if (tmpOld.Length > 3)
|
else if (tmpOld.Length > 3)
|
||||||
{
|
{
|
||||||
// Braidwood has spaces as part of the text in the 3rd field, i.e. (See Deviation Document)
|
// Wolf Creek and Turkey Point Background formats have spaces as part of the text in the 3rd field,
|
||||||
// handle this special case
|
// handle this special case
|
||||||
int indxx = tpl.IndexOf(" ");
|
int indxx = tpl.IndexOf(" "); //skip past "level"
|
||||||
if (indxx < 0) stmp = null;
|
if (indxx < 0) stmp = null; // template incomplete set text to a null
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
indxx = tpl.IndexOf(" ", indxx+1);
|
indxx = tpl.IndexOf(" ", indxx + 1); //skip past "type"
|
||||||
stmp = (indxx > -1) ? tpl.Substring(indxx) : null;
|
stmp = (indxx > -1) ? tpl.Substring(indxx+1) : null; //if valid index grab text after "type" (+1 skips past the space char after the "type" number)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -329,6 +338,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
nocol = Convert.ToInt16(tmpNew[5]);
|
nocol = Convert.ToInt16(tmpNew[5]);
|
||||||
stmp = tmpNew.Length <= 6 ? null : tmpNew[6];
|
stmp = tmpNew.Length <= 6 ? null : tmpNew[6];
|
||||||
}
|
}
|
||||||
|
// some plants (Wolf Creek, Turkey Point) have two line titles in their templates with "[(0014])" representing the hard return in the title
|
||||||
|
if (stmp != null)
|
||||||
|
stmp = stmp.Replace("[(0014])", "\\line "); // Hard Return
|
||||||
TPlate tp = new TPlate(level, type, start, width, row, nocol, stmp);
|
TPlate tp = new TPlate(level, type, start, width, row, nocol, stmp);
|
||||||
_Templates.Add(tp);
|
_Templates.Add(tp);
|
||||||
cnt++;
|
cnt++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user