From ececbb7a350007ceb1315c6002ef697ad62474eb Mon Sep 17 00:00:00 2001 From: mschill Date: Thu, 20 Aug 2026 10:22:11 -0400 Subject: [PATCH] Remove in use files - Group 4 --- PROMS/Volian.Svg.Library/FontFind.cs | 30 - PROMS/Volian.Svg.Library/Graphics.cs | 195 -- .../Properties/AssemblyInfo.cs | 35 - PROMS/Volian.Svg.Library/Svg.cs | 137 -- PROMS/Volian.Svg.Library/SvgArc.cs | 77 - PROMS/Volian.Svg.Library/SvgCircle.cs | 75 - PROMS/Volian.Svg.Library/SvgDefine.cs | 14 - PROMS/Volian.Svg.Library/SvgEllipse.cs | 91 - PROMS/Volian.Svg.Library/SvgFillSettings.cs | 73 - PROMS/Volian.Svg.Library/SvgFontSettings.cs | 165 -- PROMS/Volian.Svg.Library/SvgGroup.cs | 75 - PROMS/Volian.Svg.Library/SvgImage.cs | 99 - .../SvgInheritedSettings.cs | 88 - PROMS/Volian.Svg.Library/SvgLine.cs | 158 -- PROMS/Volian.Svg.Library/SvgLinePart.cs | 61 - PROMS/Volian.Svg.Library/SvgLineSettings.cs | 167 -- PROMS/Volian.Svg.Library/SvgMeasurement.cs | 251 -- PROMS/Volian.Svg.Library/SvgPart.cs | 57 - .../Volian.Svg.Library/SvgPartInheritance.cs | 91 - PROMS/Volian.Svg.Library/SvgParts.cs | 394 ---- PROMS/Volian.Svg.Library/SvgRectangle.cs | 101 - PROMS/Volian.Svg.Library/SvgScale.cs | 126 - PROMS/Volian.Svg.Library/SvgSerializer.cs | 96 - PROMS/Volian.Svg.Library/SvgShapePart.cs | 41 - PROMS/Volian.Svg.Library/SvgTest.cs | 84 - PROMS/Volian.Svg.Library/SvgText.cs | 156 -- PROMS/Volian.Svg.Library/SvgUse.cs | 107 - PROMS/Volian.Svg.Library/SvgViewBox.cs | 79 - PROMS/Volian.Svg.Library/SvgXMLConverter.cs | 22 - .../Volian.Svg.Library.csproj | 137 -- PROMS/Volian.Svg.Library/iTextSharp.cs | 1491 ------------ .../IniReader/IniReader.cs | 383 --- .../IniReader/IniReader.csproj | 55 - .../Volian.Utils.Library/MSWord/MSWord.csproj | 81 - PROMS/Volian.Utils.Library/MSWord/WordDoc.cs | 138 -- .../Properties/AssemblyInfo.cs | 35 - .../Volian.Utils.Library.csproj | 98 - .../vlnObject/vlnObject.cs | 282 --- .../vlnObject/vlnObjectLibrary.csproj | 64 - .../vlnServerLibrary/vlnServer.cs | 248 -- .../vlnServerLibrary/vlnServerLibrary.csproj | 63 - PROMS/XYPlots/AssemblyInfo.cs | 58 - PROMS/XYPlots/XYPlots.cs | 2069 ----------------- PROMS/XYPlots/XYPlots.csproj | 194 -- PROMS/XYPlots/frmXYPlot.cs | 63 - PROMS/XYPlots/frmXYPlot.designer.cs | 61 - PROMS/XYPlots/frmXYPlot.resx | 120 - 47 files changed, 8785 deletions(-) delete mode 100644 PROMS/Volian.Svg.Library/FontFind.cs delete mode 100644 PROMS/Volian.Svg.Library/Graphics.cs delete mode 100644 PROMS/Volian.Svg.Library/Properties/AssemblyInfo.cs delete mode 100644 PROMS/Volian.Svg.Library/Svg.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgArc.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgCircle.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgDefine.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgEllipse.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgFillSettings.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgFontSettings.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgGroup.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgImage.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgInheritedSettings.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgLine.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgLinePart.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgLineSettings.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgMeasurement.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgPart.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgPartInheritance.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgParts.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgRectangle.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgScale.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgSerializer.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgShapePart.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgTest.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgText.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgUse.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgViewBox.cs delete mode 100644 PROMS/Volian.Svg.Library/SvgXMLConverter.cs delete mode 100644 PROMS/Volian.Svg.Library/Volian.Svg.Library.csproj delete mode 100644 PROMS/Volian.Svg.Library/iTextSharp.cs delete mode 100644 PROMS/Volian.Utils.Library/IniReader/IniReader.cs delete mode 100644 PROMS/Volian.Utils.Library/IniReader/IniReader.csproj delete mode 100644 PROMS/Volian.Utils.Library/MSWord/MSWord.csproj delete mode 100644 PROMS/Volian.Utils.Library/MSWord/WordDoc.cs delete mode 100644 PROMS/Volian.Utils.Library/Properties/AssemblyInfo.cs delete mode 100644 PROMS/Volian.Utils.Library/Volian.Utils.Library.csproj delete mode 100644 PROMS/Volian.Utils.Library/vlnObject/vlnObject.cs delete mode 100644 PROMS/Volian.Utils.Library/vlnObject/vlnObjectLibrary.csproj delete mode 100644 PROMS/Volian.Utils.Library/vlnServerLibrary/vlnServer.cs delete mode 100644 PROMS/Volian.Utils.Library/vlnServerLibrary/vlnServerLibrary.csproj delete mode 100644 PROMS/XYPlots/AssemblyInfo.cs delete mode 100644 PROMS/XYPlots/XYPlots.cs delete mode 100644 PROMS/XYPlots/XYPlots.csproj delete mode 100644 PROMS/XYPlots/frmXYPlot.cs delete mode 100644 PROMS/XYPlots/frmXYPlot.designer.cs delete mode 100644 PROMS/XYPlots/frmXYPlot.resx diff --git a/PROMS/Volian.Svg.Library/FontFind.cs b/PROMS/Volian.Svg.Library/FontFind.cs deleted file mode 100644 index 1ddad575..00000000 --- a/PROMS/Volian.Svg.Library/FontFind.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using Microsoft.Win32; - -namespace Volian.Svg.Library -{ - //public static class FontFind - //{ - // public static string FileName(string fontName) - // { - // string baseFont = string.Empty; - // Regex find = new Regex(fontName + @".* ?\(.*\)", RegexOptions.IgnoreCase); - // RegistryKey regKey = Registry.LocalMachine.CreateSubKey(@"Software\Microsoft\Windows NT\CurrentVersion\Fonts"); - // string[] values = regKey.GetValueNames(); - // baseFont = regKey.GetValue(values[0]).ToString(); - // foreach (string valueName in regKey.GetValueNames()) - // { - // if (find.IsMatch(valueName)) - // return regKey.GetValue(valueName).ToString(); - // } - // return baseFont; - // } - // public static string FullFileName(string fontName) - // { - // return @"c:\windows\fonts\" + FileName(fontName); - // } - //} -} diff --git a/PROMS/Volian.Svg.Library/Graphics.cs b/PROMS/Volian.Svg.Library/Graphics.cs deleted file mode 100644 index 0b04d26b..00000000 --- a/PROMS/Volian.Svg.Library/Graphics.cs +++ /dev/null @@ -1,195 +0,0 @@ -using System; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Collections; - -namespace Volian.Svg.Library -{ - public abstract partial class SvgPart - { - public abstract void Draw(Graphics graphics, SvgScale scale, Svg mySvg, SvgPartInheritance myParent); - } - public partial class SvgPartInheritance : SvgPart - { - public override void Draw(System.Drawing.Graphics graphics, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - } - } - public partial class Svg : SvgGroup - { - public void Draw(Graphics graphics) - { - //SetupInheritance(); - //Console.WriteLine("{0}, DPI {1}", graphics.VisibleClipBounds, graphics.DpiX); - SvgParts.Draw(graphics, new SvgScale(DeviceDPI(graphics), graphics.VisibleClipBounds, _Width, _Height, _ViewBox), this, this); - //SvgParts.Draw(graphics, new SvgScale(100, graphics.VisibleClipBounds, _Width, _Height, _ViewBox)); - } - public static float DeviceDPI(Graphics g) - { - PointF[] tmp = { new PointF(g.DpiX, g.DpiY) }; - g.TransformPoints(CoordinateSpace.World, CoordinateSpace.Device, tmp); - return (float)Math.Round((double)tmp[0].X, 0); - } - } - public partial class SvgArc : SvgShapePart - { - public override void Draw(System.Drawing.Graphics graphics, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - //_MyLineSettings.Scale = scale.M(1F); - if (FillColor != Color.Transparent) - using (Brush brush = new SolidBrush(FillColor)) - graphics.FillEllipse(brush, scale.X(CX - Radius), scale.Y(CY - Radius), scale.M(Radius * 2), scale.M(Radius * 2)); - if (OutlineWidth.Value != 0F && OutlineColor != Color.Empty) - using (Pen pen = new Pen(OutlineColor, scale.M(OutlineWidth))) - graphics.DrawEllipse(pen, scale.X(CX - Radius), scale.Y(CY - Radius), scale.M(Radius * 2), scale.M(Radius * 2)); - } - } - public partial class SvgCircle : SvgShapePart - { - public override void Draw(System.Drawing.Graphics graphics, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - //_MyLineSettings.Scale = scale.M(1F); - if (FillColor != Color.Transparent) - using (Brush brush = new SolidBrush(FillColor)) - graphics.FillEllipse(brush, scale.X(CX - Radius), scale.Y(CY - Radius), scale.M(Radius * 2), scale.M(Radius * 2)); - if (OutlineWidth.Value != 0F && OutlineColor != Color.Empty) - using (Pen pen = new Pen(OutlineColor, scale.M(OutlineWidth))) - graphics.DrawEllipse(pen, scale.X(CX - Radius), scale.Y(CY - Radius), scale.M(Radius * 2), scale.M(Radius * 2)); - } - } - public partial class SvgDefine : SvgGroup - { - public override void Draw(Graphics graphics, SvgScale myScale, Svg mySvg, SvgPartInheritance myParent) - { - // Don't draw - //_SvgParts.Draw(graphics, myScale); - } - } - public partial class SvgEllipse : SvgShapePart - { - public override void Draw(System.Drawing.Graphics graphics, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - if (FillColor != Color.Transparent) - using (Brush brush = new SolidBrush(FillColor)) - graphics.FillEllipse(brush, scale.X(CX - RX), scale.Y(CY - RY), scale.M(2 * RX), scale.M(2 * RY)); - if (OutlineWidth.Value != 0F && OutlineColor != Color.Empty) - using (Pen pen = new Pen(OutlineColor, scale.M(OutlineWidth))) - graphics.DrawEllipse(pen, scale.X(CX - RX), scale.Y(CY - RY), scale.M(2 * RX), scale.M(2 * RY)); - } - } - public partial class SvgGroup : SvgPartInheritance - { - public override void Draw(Graphics graphics, SvgScale myScale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - _SvgParts.Draw(graphics, myScale, mySvg, this); - } - } - public partial class SvgImage : SvgPart - { - public override void Draw(System.Drawing.Graphics graphics, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - graphics.DrawImage(Image.FromFile(ImagePath), scale.X(X), scale.Y(Y), scale.M(Width), scale.M(Height)); - } - } - public partial class SvgLine : SvgLinePart - { - public override void Draw(System.Drawing.Graphics graphics, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - if (LineColor != Color.Empty) - { - Color myColor = AdjustColorForWidth(LineColor, scale.M(LineWidth)); - using (Pen pen = new Pen(LineColor, scale.M(LineWidth))) - graphics.DrawLine(pen, scale.X(X1), scale.Y(Y1), scale.X(X2), scale.Y(Y2)); - } - } - } - public partial class SvgParts : CollectionBase - { - public void Draw(Graphics graphics, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - foreach (SvgPart svgPart in List) - svgPart.Draw(graphics,scale,mySvg, myParent); - } - } - public partial class SvgRectangle : SvgShapePart - { - public override void Draw(System.Drawing.Graphics graphics, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - if (FillColor != Color.Transparent) - using (Brush brush = new SolidBrush(FillColor)) - graphics.FillRectangle(brush, scale.X(X),scale.Y(Y),scale.M(Width),scale.M(Height)); - if (OutlineWidth.Value != 0F && OutlineColor != Color.Empty) - using (Pen pen = new Pen(OutlineColor, scale.M(OutlineWidth))) - graphics.DrawRectangle(pen, scale.X(X),scale.Y(Y), scale.M(Width), scale.M(Height)); - } - } - //public partial class SvgRtf : SvgShapePart - //{ - // //private static float _Factor = 1.085F; // 20 point Arial Font - // public override void Draw(System.Drawing.Graphics graphics, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - // { - // SetupInheritance(myParent.MyInheritedSettings); - // _MyFontSettings.Scale = scale.M(1F); - // } - // private float YAdjustment(Graphics gr, Font fnt) - // { - // int yAsc = fnt.FontFamily.GetCellAscent(fnt.Style); - // int yLS = fnt.FontFamily.GetLineSpacing(fnt.Style); - // float gth = fnt.GetHeight(gr); - // float fAsc = (yAsc * gth) / yLS; - // return -fAsc; - // } - //} - public partial class SvgText : SvgShapePart - { - //private static float _Factor = 1.085F; // 20 point Arial Font - public override void Draw(System.Drawing.Graphics graphics, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - _MyFontSettings.Scale = scale.M(1F); - StringFormat stringFormat = StringFormat.GenericTypographic; - float YAdj = YAdjustment(graphics, Font); - using (Brush brush = new System.Drawing.SolidBrush(FillColor)) - graphics.DrawString(Text, Font, brush, scale.X(X), scale.Y(Y) + YAdj, stringFormat); - SizeF sf = graphics.MeasureString(Text, Font, graphics.VisibleClipBounds.Size, stringFormat); - if (OutlineWidth.Value != 0 && OutlineColor != Color.Empty) - using (GraphicsPath path = GetStringPath(Text, Svg.DeviceDPI(graphics), new PointF(scale.X(X), scale.Y(Y) + YAdj), Font, stringFormat)) - using (Pen myPen = new Pen(OutlineColor, scale.M(OutlineWidth))) - graphics.DrawPath(myPen, path); - } - GraphicsPath GetStringPath(string s, float dpi, PointF loc, Font font, StringFormat format) - { - GraphicsPath path = new GraphicsPath(); - // Convert font size into appropriate coordinates - float emSize = dpi * font.SizeInPoints / 72; - path.AddString(s, font.FontFamily, (int)font.Style, emSize, loc, format); - return path; - } - private float YAdjustment(Graphics gr, Font fnt) - { - int yAsc = fnt.FontFamily.GetCellAscent(fnt.Style); - //int yDesc = fnt.FontFamily.GetCellDescent(fnt.Style); - //int yEm = fnt.FontFamily.GetEmHeight(fnt.Style); - int yLS = fnt.FontFamily.GetLineSpacing(fnt.Style); - float gth = fnt.GetHeight(gr); - float fh = fnt.Size; - float fAsc = (yAsc * gth) / yLS; - return -fAsc; - } - } - public partial class SvgUse : SvgPartInheritance - { - public override void Draw(System.Drawing.Graphics graphics, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - mySvg[_UseID.Substring(1)].Draw(graphics, scale.AdjustOrigin(X, Y), mySvg, this); - } - } -} diff --git a/PROMS/Volian.Svg.Library/Properties/AssemblyInfo.cs b/PROMS/Volian.Svg.Library/Properties/AssemblyInfo.cs deleted file mode 100644 index 9a9e17d9..00000000 --- a/PROMS/Volian.Svg.Library/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Volian.Svg.Library")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Volian.Svg.Library")] -[assembly: AssemblyCopyright("Copyright © 2010")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("40108f1d-d071-4978-9859-0c20c6b4b9cf")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PROMS/Volian.Svg.Library/Svg.cs b/PROMS/Volian.Svg.Library/Svg.cs deleted file mode 100644 index 982a7029..00000000 --- a/PROMS/Volian.Svg.Library/Svg.cs +++ /dev/null @@ -1,137 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; -using System.ComponentModel; - -namespace Volian.Svg.Library -{ - [XmlRoot("svg")] - public partial class Svg : SvgGroup - { - private static System.Drawing.PointF _AbsoluteOffset; - public static System.Drawing.PointF AbsoluteOffset - { - get { return Svg._AbsoluteOffset; } - set { Svg._AbsoluteOffset = value; } - } - private static System.Drawing.Color _OverrrideColor = System.Drawing.Color.Empty; - public static System.Drawing.Color OverrideColor - { - get { return Svg._OverrrideColor; } - set { Svg._OverrrideColor = value; } - } - #region XML Serializer Namespaces - private XmlSerializerNamespaces _Namespaces = null; - [XmlNamespaceDeclarations] - public XmlSerializerNamespaces Namespaces - { - get - { - if (_Namespaces == null) - { - _Namespaces = new XmlSerializerNamespaces(); - _Namespaces.Add("xlink", "http://www.w3.org/1999/xlink"); - } - return _Namespaces; - } - set { _Namespaces = value; } - } - #endregion - #region Width - private SvgMeasurement _Width = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement Width - { - get { return _Width; } - set { _Width = value; } - } - [System.ComponentModel.DefaultValueAttribute("0")] - [XmlAttribute("width")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string Width_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_Width); } - set { _Width = SvgXmlConverter.GetObject(value); } - } - //private string _Watermark=""; - //[XmlAttribute("watermark")] - //public string Watermark - //{ - // get { return _Watermark; } - // set { _Watermark = value; } - //} - //public void SetValidWaterMark(string token, string watermark) - //{ - // if (token == "{" + watermark.ToUpper() + "PAGE}" ) - // _Watermark = watermark; - //} - #endregion - #region Height - private SvgMeasurement _Height = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement Height - { - get { return _Height; } - set { _Height = value; } - } - [System.ComponentModel.DefaultValueAttribute("0")] - [XmlAttribute("height")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string Height_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_Height); } - set { _Height = SvgXmlConverter.GetObject(value); } - } - #endregion - #region ViewBox - private SvgViewBox _ViewBox = new SvgViewBox("0 0 0 0"); - [XmlIgnore] - public SvgViewBox ViewBox - { - get { return _ViewBox; } - set { _ViewBox = value; } - } - [System.ComponentModel.DefaultValueAttribute("0 0 0 0")] - [XmlAttribute("viewBox")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string SVGViewBox_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_ViewBox); } - set { _ViewBox = SvgXmlConverter.GetObject(value); } - } - #endregion - //#region Setup Inheritance - //private void SetupInheritance() - //{ - // SvgParts.SetupInheritance(_MyInheritedSettings); - //} - ////override internal void SetupInheritance(SvgInheritedSettings myParentsSettings) - ////{ - //// _MyInheritedSettings.MyParentsSettings = myParentsSettings; - //// SvgParts.SetupInheritance(_MyInheritedSettings); - ////} - //#endregion - #region Part Lookup - private Dictionary _LookUp; - [XmlIgnore] - internal Dictionary LookUp - { - get - { - if (_LookUp == null) - { - _LookUp = new Dictionary(); - AddLookup(_LookUp); - } - return _LookUp; - } - } - public SvgPart this[string id] - { get { return LookUp[id]; } } - #endregion - } -} diff --git a/PROMS/Volian.Svg.Library/SvgArc.cs b/PROMS/Volian.Svg.Library/SvgArc.cs deleted file mode 100644 index 407d26d1..00000000 --- a/PROMS/Volian.Svg.Library/SvgArc.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; -using System.ComponentModel; -using System.Drawing; - -namespace Volian.Svg.Library -{ - public partial class SvgArc : SvgShapePart - { - #region ctor - public SvgArc() { ;} - public SvgArc(PointF location, float radius, float startAngle, float endAngle, Color fillColor, Color lineColor, float lineWidth) - { - _CX.Value = location.X; - _CY.Value = location.Y; - _Radius.Value = radius; - FillColor = fillColor; - LineColor = lineColor; - LineWidth = new SvgMeasurement(lineWidth); - } - //XMLElementAttribute(ElementName = "PREFIX", IsNullable = false) - #endregion - #region Location - private SvgMeasurement _CX = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement CX - { - get { return _CX; } - set { _CX = value; } - } - [XmlAttribute("cx")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string CX_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_CX); } - set { _CX = SvgXmlConverter.GetObject(value); } - } - private SvgMeasurement _CY = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement CY - { - get { return _CY; } - set { _CY = value; } - } - [XmlAttribute("cy")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string CY_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_CY); } - set { _CY = SvgXmlConverter.GetObject(value); } - } - #endregion - #region Radius - private SvgMeasurement _Radius = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement Radius - { - get { return _Radius; } - set { _Radius = value; } - } - [XmlAttribute("r")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string X_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_Radius); } - set { _Radius = SvgXmlConverter.GetObject(value); } - } - #endregion - #region Angles - #endregion - } -} diff --git a/PROMS/Volian.Svg.Library/SvgCircle.cs b/PROMS/Volian.Svg.Library/SvgCircle.cs deleted file mode 100644 index 5c1b8500..00000000 --- a/PROMS/Volian.Svg.Library/SvgCircle.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; -using System.ComponentModel; -using System.Drawing; - -namespace Volian.Svg.Library -{ - public partial class SvgCircle : SvgShapePart - { - #region ctor - public SvgCircle() { ;} - public SvgCircle(PointF location, float radius, Color fillColor, Color lineColor, float lineWidth) - { - _CX.Value = location.X; - _CY.Value = location.Y; - _Radius.Value = radius; - FillColor = fillColor; - LineColor = lineColor; - LineWidth = new SvgMeasurement(lineWidth); - } - //XMLElementAttribute(ElementName = "PREFIX", IsNullable = false) - #endregion - #region Location - private SvgMeasurement _CX = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement CX - { - get { return _CX; } - set { _CX = value; } - } - [XmlAttribute("cx")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string CX_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_CX); } - set { _CX = SvgXmlConverter.GetObject(value); } - } - private SvgMeasurement _CY = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement CY - { - get { return _CY; } - set { _CY = value; } - } - [XmlAttribute("cy")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string CY_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_CY); } - set { _CY = SvgXmlConverter.GetObject(value); } - } - #endregion - #region Radius - private SvgMeasurement _Radius = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement Radius - { - get { return _Radius; } - set { _Radius = value; } - } - [XmlAttribute("r")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string X_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_Radius); } - set { _Radius = SvgXmlConverter.GetObject(value); } - } - #endregion - } -} diff --git a/PROMS/Volian.Svg.Library/SvgDefine.cs b/PROMS/Volian.Svg.Library/SvgDefine.cs deleted file mode 100644 index 30a64e56..00000000 --- a/PROMS/Volian.Svg.Library/SvgDefine.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; -using System.ComponentModel; -using System.Drawing; - -namespace Volian.Svg.Library -{ - public partial class SvgDefine : SvgGroup - { - // Nothing here - Draw definitions in individual modules - } -} diff --git a/PROMS/Volian.Svg.Library/SvgEllipse.cs b/PROMS/Volian.Svg.Library/SvgEllipse.cs deleted file mode 100644 index bd72768d..00000000 --- a/PROMS/Volian.Svg.Library/SvgEllipse.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; -using System.ComponentModel; -using System.Drawing; - -namespace Volian.Svg.Library -{ - public partial class SvgEllipse : SvgShapePart - { - #region ctor - public SvgEllipse() { ;} - public SvgEllipse(PointF location, float radiusX, float radiusY, Color fillColor, Color lineColor, float lineWidth) - { - _CX.Value = location.X; - _CY.Value = location.Y; - _RX.Value = radiusX; - _RY.Value = radiusY; - FillColor = fillColor; - LineColor = lineColor; - LineWidth = new SvgMeasurement(lineWidth); - } - //XMLElementAttribute(ElementName = "PREFIX", IsNullable = false) - #endregion - #region Location - private SvgMeasurement _CX = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement CX - { - get { return _CX; } - set { _CX = value; } - } - [XmlAttribute("cx")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string CX_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_CX); } - set { _CX = SvgXmlConverter.GetObject(value); } - } - private SvgMeasurement _CY = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement CY - { - get { return _CY; } - set { _CY = value; } - } - [XmlAttribute("cy")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string CY_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_CY); } - set { _CY = SvgXmlConverter.GetObject(value); } - } - #endregion - #region Size - private SvgMeasurement _RX = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement RX - { - get { return _RX; } - set { _RX = value; } - } - [XmlAttribute("rx")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string RX_RXmlSurrogate - { - get { return SvgXmlConverter.GetString(_RX); } - set { _RX = SvgXmlConverter.GetObject(value); } - } - private SvgMeasurement _RY = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement RY - { - get { return _RY; } - set { _RY = value; } - } - [XmlAttribute("ry")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string RY_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_RY); } - set { _RY = SvgXmlConverter.GetObject(value); } - } - #endregion - } -} diff --git a/PROMS/Volian.Svg.Library/SvgFillSettings.cs b/PROMS/Volian.Svg.Library/SvgFillSettings.cs deleted file mode 100644 index 5c371699..00000000 --- a/PROMS/Volian.Svg.Library/SvgFillSettings.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; - -namespace Volian.Svg.Library -{ - public class SvgFillSettings - { - #region ctor - public SvgFillSettings() { ;} - public SvgFillSettings(Color myColor) - { - _Fill = ColorTranslator.ToHtml(myColor); - } - //public SvgFillSettings(string myFill) - //{ - // _Fill = myFill; - //} - #endregion - #region Inheritance - private SvgFillSettings _MyParentsSettings = null; - public SvgFillSettings MyParentsSettings - { - get { return _MyParentsSettings; } - set - { - _MyParentsSettings = value; - } - } - #endregion - #region Internal Inherited Properties - protected string InheritedFill - { - get - { - // Fill = "", "0" - Default, otherwise the value - if (_Fill != "" && _Fill != "0" && _Fill.ToLower() != "empty") return _Fill; // Current Value - if (_MyParentsSettings != null) return _MyParentsSettings.InheritedFill; // Inherited - return "Black"; // Default - } - } - #endregion - #region Inherited Values - public Color FillColor - { - get - { - // Fill = "None" - Eliminate, otherwise the value - string myFill = InheritedFill; - if (myFill.ToLower() == "none") // Eliminate - return Color.Transparent; - return ColorTranslator.FromHtml(myFill); - } - set - { - if (value == Color.Transparent || value == Color.Empty) - _Fill = "none"; - else - _Fill = ColorTranslator.ToHtml(value); - } - } - #endregion - #region Properties - private string _Fill = string.Empty; // Default value is None - public string Fill - { - get { return _Fill; } - set { _Fill = value; } - } - #endregion - } -} diff --git a/PROMS/Volian.Svg.Library/SvgFontSettings.cs b/PROMS/Volian.Svg.Library/SvgFontSettings.cs deleted file mode 100644 index d151c16e..00000000 --- a/PROMS/Volian.Svg.Library/SvgFontSettings.cs +++ /dev/null @@ -1,165 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; - -namespace Volian.Svg.Library -{ - class SvgFontSettings - { - #region ctor - public SvgFontSettings() { ;} - public SvgFontSettings(Font myFont) - { - _FontFamily = myFont.FontFamily.Name; - _FontSize = myFont.SizeInPoints.ToString() + "PT"; - _SVGFontStyle = ((myFont.Style & FontStyle.Italic) == FontStyle.Italic ? "italic" : "normal"); - _FontWeight = ((myFont.Style & FontStyle.Bold) == FontStyle.Bold ? "bold" : "normal"); - _TextDecoration = ((myFont.Style & FontStyle.Underline) == FontStyle.Underline ? "underline" : "normal"); - } - //public SvgFontSettings(string myFontFamily, string myFontSize, string mySvgStyle, string myFontWeight, string myTextDecoration) - //{ - // _FontFamilyName = myFontFamily; - // _FontSize = myFontSize; - // _SVGFontStyle = mySvgStyle; - // _FontWeight = myFontWeight; - // _TextDecoration = myTextDecoration; - //} - #endregion - #region Inheritance - private SvgFontSettings _MyParentsSettings = null; - public SvgFontSettings MyParentsSettings - { - get { return _MyParentsSettings; } - set - { - _MyParentsSettings = value; - } - } - #endregion - #region Internal Inherited Properties - protected string InheritedFontFamily - { - get - { - if (_FontFamily != "") return _FontFamily; - if (_MyParentsSettings != null) return _MyParentsSettings.InheritedFontFamily; // Default - return "Arial"; // Absolute Default - } - } - protected string InheritedFontSize - { - get - { - if (_FontSize != "") return _FontSize; // Current Value - if (_MyParentsSettings != null) return _MyParentsSettings.InheritedFontSize; // Default - return "9PT"; // Absolute Default - } - } - protected string InheritedFontStyle - { - get - { - if (_SVGFontStyle != "") return _SVGFontStyle; // Current Value - if (_MyParentsSettings != null) return _MyParentsSettings.InheritedFontStyle;// Default - return "normal"; // Absolute Default - } - } - protected string InheritedFontWeight - { - get - { - if (_FontWeight != "") return _FontWeight;// Current Value - if (_MyParentsSettings != null) return _MyParentsSettings.InheritedFontWeight;// Default - return "normal"; // Absolute Default - } - } - protected string InheritedTextDecoration - { - get - { - if (_TextDecoration != "") return _TextDecoration;// Current Value - if (_MyParentsSettings != null) return _MyParentsSettings.InheritedTextDecoration;// Default - return "normal"; // Absolute Default - } - } - #endregion - #region Scale - private float _Scale = 1; - internal float Scale - { - get { return _Scale; } - set { _Scale = value; Font = null; } - } - #endregion - #region Inherited Values - private Font _Font=null; - public Font Font - { - get - { - if (_Font == null) - { - _Font = new Font(InheritedFontFamily, _Scale * SvgMeasurement.StringToPoints(InheritedFontSize), - (InheritedFontStyle == "italic" ? FontStyle.Italic : FontStyle.Regular) | - (InheritedFontWeight == "bold" ? FontStyle.Bold : FontStyle.Regular) | - (InheritedTextDecoration == "underline" ? FontStyle.Underline : FontStyle.Regular) - , GraphicsUnit.Point); - } - return _Font; - } - set - { - // This was disposing fonts that are saved in our static dictionary. - // caused problems with the step editor display after printing (found with Wolf Creek Chem procedure RW-G02 Step 6.1.17) - jsj 7/14/2017 - //if (_Font != null) - //{ - // Console.WriteLine("font dispose {0}, {1}", _Font, _Font.Style); - // //_Font.Dispose(); - //} - if (value != null) - { - _FontFamily = value.FontFamily.Name; - _FontSize = value.SizeInPoints.ToString() + "PT"; - _SVGFontStyle = ((value.Style & FontStyle.Italic) == FontStyle.Italic ? "italic" : "normal"); - _FontWeight = ((value.Style & FontStyle.Bold) == FontStyle.Bold ? "bold" : "normal"); - _TextDecoration = ((value.Style & FontStyle.Underline) == FontStyle.Underline ? "underline" : "normal"); - } - _Font = value; - } - } - #endregion - #region Public Properties - private string _FontFamily = string.Empty; - public string FontFamily - { - get { return _FontFamily; } - set { _FontFamily = value; Font = null; } - } - private string _FontSize = string.Empty; - public string FontSize - { - get { return _FontSize; } - set { _FontSize = value; Font = null; } - } - private string _SVGFontStyle = string.Empty; - public string SVGFontStyle - { - get { return _SVGFontStyle; } - set { _SVGFontStyle = value; Font = null; } - } - private string _FontWeight = string.Empty; - public string FontWeight - { - get { return _FontWeight; } - set { _FontWeight = value; Font = null; } - } - private string _TextDecoration = string.Empty; - public string TextDecoration - { - get { return _TextDecoration; } - set { _TextDecoration = value; Font = null; } - } - #endregion - } -} diff --git a/PROMS/Volian.Svg.Library/SvgGroup.cs b/PROMS/Volian.Svg.Library/SvgGroup.cs deleted file mode 100644 index 69a49907..00000000 --- a/PROMS/Volian.Svg.Library/SvgGroup.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; -using System.ComponentModel; -using System.Drawing; - -namespace Volian.Svg.Library -{ - public partial class SvgGroup : SvgPartInheritance - { - #region Description - private string _Description = string.Empty; - [System.ComponentModel.DefaultValueAttribute("")] - [XmlElement("desc")] - public string Description - { - get { return _Description; } - set { _Description = value; } - } - #endregion - #region Title - private string _Title = string.Empty; - [System.ComponentModel.DefaultValueAttribute("")] - [XmlElement("title")] - public string Title - { - get { return _Title; } - set { _Title = value; } - } - #endregion - #region Parts - // SVG Parts - SvgParts _SvgParts = new SvgParts(); - //[XmlElement("foreignObject", typeof(SvgRtf))] - [XmlElement("use", typeof(SvgUse))] - [XmlElement("image", typeof(SvgImage))] - [XmlElement("text", typeof(SvgText))] - [XmlElement("line", typeof(SvgLine))] - [XmlElement("circle", typeof(SvgCircle))] - [XmlElement("rect", typeof(SvgRectangle))] - [XmlElement("ellipse", typeof(SvgEllipse))] - [XmlElement("svg", typeof(Svg))] - [XmlElement("g", typeof(SvgGroup))] - [XmlElement("defs", typeof(SvgDefine))] - public SvgParts SvgParts - { - get { return _SvgParts; } - set { _SvgParts = value; } - } - public SvgPart Add(SvgPart svgPart) - { - _SvgParts.Add(svgPart); - return svgPart; - } - public void RemoveAt(int i) - { - _SvgParts.RemoveAt(i); - } - public int Count - { get { return _SvgParts.Count; } } - #endregion - #region Dictionary of Parts - internal override void AddLookup(Dictionary lookUp) - { - base.AddLookup(lookUp); - SvgParts.AddLookup(lookUp); - } - #endregion - public override string ToString() - { - return ID; - } - } -} \ No newline at end of file diff --git a/PROMS/Volian.Svg.Library/SvgImage.cs b/PROMS/Volian.Svg.Library/SvgImage.cs deleted file mode 100644 index 012cae61..00000000 --- a/PROMS/Volian.Svg.Library/SvgImage.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; -using System.ComponentModel; -using System.Drawing; - -namespace Volian.Svg.Library -{ - public partial class SvgImage : SvgPart - { - #region ctor - public SvgImage() { ;} - public SvgImage(PointF location, SizeF size, string path) - { - _X.Value = location.X; - _Y.Value = location.Y; - _Width.Value = size.Width; - _Height.Value = size.Height; - _ImagePath = path; - } - #endregion - #region Location - private SvgMeasurement _X = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement X - { - get { return _X; } - set { _X = value; } - } - [XmlAttribute("x")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string X_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_X); } - set { _X = SvgXmlConverter.GetObject(value); } - } - private SvgMeasurement _Y = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement Y - { - get { return _Y; } - set { _Y = value; } - } - [XmlAttribute("y")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string Y_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_Y); } - set { _Y = SvgXmlConverter.GetObject(value); } - } - #endregion - #region Size - private SvgMeasurement _Width = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement Width - { - get { return _Width; } - set { _Width = value; } - } - [XmlAttribute("width")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string Width_WidthmlSurrogate - { - get { return SvgXmlConverter.GetString(_Width); } - set { _Width = SvgXmlConverter.GetObject(value); } - } - private SvgMeasurement _Height = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement Height - { - get { return _Height; } - set { _Height = value; } - } - [XmlAttribute("height")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string Height_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_Height); } - set { _Height = SvgXmlConverter.GetObject(value); } - } - #endregion - #region Path to Image File - private string _ImagePath = null; - [XmlAttribute(AttributeName = "href", Namespace = "http://www.w3.org/1999/xlink")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string ImagePath - { - get { return _ImagePath; } - set { _ImagePath = value; } - } - #endregion - } -} \ No newline at end of file diff --git a/PROMS/Volian.Svg.Library/SvgInheritedSettings.cs b/PROMS/Volian.Svg.Library/SvgInheritedSettings.cs deleted file mode 100644 index 702ad9cc..00000000 --- a/PROMS/Volian.Svg.Library/SvgInheritedSettings.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Volian.Svg.Library -{ - internal class SvgInheritedSettings - { - #region MyParent - SvgInheritedSettings _MyParentsSettings = null; - internal SvgInheritedSettings MyParentsSettings - { - get { return _MyParentsSettings; } - set - { - _MyParentsSettings = value; - MyLineSettings.MyParentsSettings = value.MyLineSettings; - MyFillSettings.MyParentsSettings = value.MyFillSettings; - MyFontSettings.MyParentsSettings = value.MyFontSettings; - } - } - #endregion - #region Line Settings - private SvgLineSettings _MyLineSettings = new SvgLineSettings(); - public SvgLineSettings MyLineSettings - { - get { return _MyLineSettings; } - set { _MyLineSettings = value; } - } - public string Stroke - { - get { return _MyLineSettings.Stroke; } - set { _MyLineSettings.Stroke = value; } - } - public string StrokeWidth - { - get { return _MyLineSettings.StrokeWidth; } - set { _MyLineSettings.StrokeWidth = value; } - } - #endregion - #region Fill Settings - private SvgFillSettings _MyFillSettings = new SvgFillSettings(); - internal SvgFillSettings MyFillSettings - { - get { return _MyFillSettings; } - set { _MyFillSettings = value; } - } - public string Fill - { - get { return _MyFillSettings.Fill; } - set { _MyFillSettings.Fill = value; } - } - #endregion - #region Font Settings - private SvgFontSettings _MyFontSettings = new SvgFontSettings(); - internal SvgFontSettings MyFontSettings - { - get { return _MyFontSettings; } - set { _MyFontSettings = value; } - } - public string FontFamily - { - get { return _MyFontSettings.FontFamily; } - set { _MyFontSettings.FontFamily = value; } - } - public string FontSize - { - get { return _MyFontSettings.FontSize; } - set { _MyFontSettings.FontSize = value; } - } - public string SVGFontStyle - { - get { return _MyFontSettings.SVGFontStyle; } - set { _MyFontSettings.SVGFontStyle = value; } - } - public string FontWeight - { - get { return _MyFontSettings.FontWeight; } - set { _MyFontSettings.FontWeight = value; } - } - public string TextDecoration - { - get { return _MyFontSettings.TextDecoration; } - set { _MyFontSettings.TextDecoration = value; } - } - #endregion - } -} diff --git a/PROMS/Volian.Svg.Library/SvgLine.cs b/PROMS/Volian.Svg.Library/SvgLine.cs deleted file mode 100644 index c613d60a..00000000 --- a/PROMS/Volian.Svg.Library/SvgLine.cs +++ /dev/null @@ -1,158 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; -using System.ComponentModel; -using System.Drawing; - -namespace Volian.Svg.Library -{ - public partial class SvgLine : SvgLinePart - { - #region ctor - public SvgLine() { ;} - public SvgLine(PointF location1, PointF location2, Color lineColor, float lineWidth) - { - _X1.Value = location1.X; - _Y1.Value = location1.Y; - _X2.Value = location2.X; - _Y2.Value = location2.Y; - LineColor = lineColor; - LineWidth = new SvgMeasurement(lineWidth); - } - //XMLElementAttribute(ElementName = "PREFIX", IsNullable = false) - #endregion - #region Location1 - private SvgMeasurement _X1 = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement X1 - { - get { return _X1; } - set { _X1 = value; } - } - [XmlAttribute("x1")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string X1_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_X1); } - set { _X1 = SvgXmlConverter.GetObject(value); } - } - private SvgMeasurement _Y1 = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement Y1 - { - get { return _Y1; } - set { _Y1 = value; } - } - [XmlAttribute("y1")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string Y1_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_Y1); } - set { _Y1 = SvgXmlConverter.GetObject(value); } - } - #endregion - #region Location2 - private SvgMeasurement _X2 = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement X2 - { - get { return _X2; } - set { _X2 = value; } - } - [XmlAttribute("x2")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string X2_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_X2); } - set { _X2 = SvgXmlConverter.GetObject(value); } - } - private SvgMeasurement _Y2 = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement Y2 - { - get { return _Y2; } - set { _Y2 = value; } - } - [XmlAttribute("y2")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string Y_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_Y2); } - set { _Y2 = SvgXmlConverter.GetObject(value); } - } - #endregion - #region Description - private string _Description = string.Empty; - [System.ComponentModel.DefaultValueAttribute("")] - [XmlElement("desc")] - public string Description - { - get { return _Description; } - set { _Description = value; } - } - #endregion - #region LineColor - //protected Color _LineColor = Color.Empty; - //[XmlIgnoreAttribute()] - //public Color LineColor - //{ - // get { return _LineWidth.Value == 0 ? Color.LightGray : _LineColor == Color.Empty ? Color.Gray : _LineColor; } - // set { _LineColor = value; } - //} - private Color AdjustColorForWidth(Color myColor, float myWidth) - { - if (myWidth > 1F) return myColor; - //Console.WriteLine("Line Width = {0}, Alpha = {1}", myWidth, Convert.ToInt32(myWidth * 255)); - return Color.FromArgb(Convert.ToInt32(myWidth * 255), myColor); - } - // Serializes the 'BackgroundColor' Color to XML. - //[System.ComponentModel.DefaultValueAttribute("none")] - //[XmlAttribute("stroke")] - //public string Stroke - //{ - // get { return _LineColor == Color.Empty ? "none" : _LineColor == Color.Black ? "" : ColorTranslator.ToHtml(_LineColor); } - // set { _LineColor = (value == "none" ? Color.Empty : (value == "" ? Color.Empty : ColorTranslator.FromHtml(value))); } - //} - #endregion - #region LineWidth - //private SvgMeasurement GetLineWidth() - //{ - // if (_LineWidth.Value == -1) return new SvgMeasurement(1F);// Minimum Strokewidth - // if (_LineWidth.Value == 0) return new SvgMeasurement(.01F);// Minimum Strokewidth - // if (_LineColor == Color.Empty) return new SvgMeasurement( .01F);// No Color - Minimum Strokewidth - // return _LineWidth; - //} - //private SvgMeasurement _LineWidth = new SvgMeasurement(); - //[XmlIgnore] - //public SvgMeasurement LineWidth - //{ - // get { return _LineWidth; } - // set { _LineWidth = value; } - //} - //[XmlAttribute("stroke-width")] - //[Browsable(false)] - //[EditorBrowsable(EditorBrowsableState.Never)] - //public string LineWidth_XmlSurrogate - //{ - // get - // { - // if (_LineWidth.Value == -1) - // return "none"; - // return VolianXmlConverter.GetString(_LineWidth); - // } - // set - // { - // if (value == "none") - // _LineWidth = VolianXmlConverter.GetObject("-1"); - // else - // _LineWidth = VolianXmlConverter.GetObject(value); - // } - //} - #endregion - } -} diff --git a/PROMS/Volian.Svg.Library/SvgLinePart.cs b/PROMS/Volian.Svg.Library/SvgLinePart.cs deleted file mode 100644 index f0c859a7..00000000 --- a/PROMS/Volian.Svg.Library/SvgLinePart.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; -using System.Xml.Serialization; -using System.ComponentModel; - -namespace Volian.Svg.Library -{ - [TypeConverter(typeof(ExpandableObjectConverter))] - public abstract class SvgLinePart : SvgPart - { - #region Line Settings - protected SvgLineSettings _MyLineSettings = new SvgLineSettings(); - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("stroke")] - public string Stroke - { - get { return _MyLineSettings.Stroke; } - set { _MyLineSettings.Stroke = value; } - } - [XmlIgnore] - protected Color LineColor - { - get { return Svg.OverrideColor != System.Drawing.Color.Empty ? Svg.OverrideColor : _MyLineSettings.LineColor; } - set { _MyLineSettings.LineColor = value; } - } - [XmlIgnore] - protected Color OutlineColor - { - get { return Svg.OverrideColor != System.Drawing.Color.Empty ? Svg.OverrideColor :_MyLineSettings.OutlineColor; } - set { _MyLineSettings.OutlineColor = value; } - } - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("stroke-width")] - public string StrokeWidth - { - get { return _MyLineSettings.StrokeWidth; } - set { _MyLineSettings.StrokeWidth = value; } - } - [XmlIgnore] - protected SvgMeasurement LineWidth - { - get { return _MyLineSettings.LineWidth; } - set { _MyLineSettings.LineWidth = value; } - } - [XmlIgnore] - protected SvgMeasurement OutlineWidth - { - get { return _MyLineSettings.OutlineWidth; } - set { _MyLineSettings.OutlineWidth = value; } - } - #endregion - #region Setup Inheritance - override internal void SetupInheritance(SvgInheritedSettings myParentsSettings) - { - _MyLineSettings.MyParentsSettings = myParentsSettings.MyLineSettings; - } - #endregion - } -} diff --git a/PROMS/Volian.Svg.Library/SvgLineSettings.cs b/PROMS/Volian.Svg.Library/SvgLineSettings.cs deleted file mode 100644 index b995d0d7..00000000 --- a/PROMS/Volian.Svg.Library/SvgLineSettings.cs +++ /dev/null @@ -1,167 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; -using System.ComponentModel; -using System.Xml.Serialization; - -namespace Volian.Svg.Library -{ - public class SvgLineSettings - { - #region ctor - public SvgLineSettings() { ;} - public SvgLineSettings(Color myColor, SvgMeasurement myWidth) - { - _Stroke = ColorTranslator.ToHtml(myColor); - _StrokeWidth = myWidth.ToString(); - } - //public SvgLineSettings(string myStroke, string myStrokeWidth) - //{ - // _Stroke = myStroke; - // _StrokeWidth = myStrokeWidth; - //} - #endregion - #region Inheritance - private SvgLineSettings _MyParentsSettings = null; - public SvgLineSettings MyParentsSettings - { - get { return _MyParentsSettings; } - set - { - _MyParentsSettings = value; - } - } - #endregion - #region Internal Inherited Properties - protected string InheritedStroke - { - get - { - // Stroke = "", "0" - Default, otherwise the value - if (_Stroke != "" && _Stroke != "0") return _Stroke; // Current Value - if (_MyParentsSettings != null) return _MyParentsSettings.InheritedStroke;// Inherited - return "None"; // Default - } - } - protected string InheritedLineWidth - { - get - { - // StrokeWidth = "", "none" - Default, otherwise the value - if (_StrokeWidth != "" && _StrokeWidth != "none") return _StrokeWidth; // Current Value - if (_MyParentsSettings != null) return _MyParentsSettings.InheritedLineWidth; // Inherited - return "1PX"; // Default - } - } - //protected string InheritedOutlineWidth - //{ - // get - // { - // // StrokeWidth = "", "none" - Default, otherwise the value - // if (_StrokeWidth != "" && _StrokeWidth.ToLower() != "none") return _StrokeWidth; // Current Value - // if (_MyParent != null) return _MyParent.InheritedLineWidth; // Inherited - // return "1PX"; // Default - // } - //} - #endregion - #region Inherited Values - public SvgMeasurement LineWidth - { - get - { - // Stroke = "None" - Light, otherwise the value - // StrokeWidth = "None" Light, otherwise the value - string myStroke = InheritedStroke; - string myWidth = InheritedLineWidth; - //if (myStroke.ToLower() == "none" || myWidth.ToLower() == "none") // Light - // return new SvgMeasurement(.001F, E_MeasurementUnits.PX); - SvgMeasurement myMeasurement = new SvgMeasurement(myWidth); - //myMeasurement.Value *= _Scale; - return myMeasurement; - } - set - { - _StrokeWidth = value.ToString(); - } - } - public SvgMeasurement OutlineWidth - { - get - { - // Stroke = "None" - Eliminate, otherwise the value - // StrokeWidth = "0" Eliminate, otherwise the value - string myStroke = InheritedStroke; - //string myWidth = InheritedOutlineWidth; - string myWidth = InheritedLineWidth; - if (myStroke.ToLower() == "none" || myWidth == "0") // Eliminate - return new SvgMeasurement(0, E_MeasurementUnits.PX); - SvgMeasurement myMeasurement = new SvgMeasurement(myWidth); - //myMeasurement.Value *= _Scale; - return myMeasurement; - } - set - { - _StrokeWidth = value.ToString(); - } - } - public Color LineColor - { - get - { - // Stroke = "None" - Eliminate, otherwise the value - // StrokeWidth = "None" Eliminate, otherwise the value - string myStroke = InheritedStroke; - string myWidth = InheritedLineWidth; - if (myStroke.ToLower() == "none" || myWidth.ToLower() == "none" || myWidth == "0") // Light - return Color.LightGray; - return ColorTranslator.FromHtml(myStroke); - } - set - { - if (value == Color.Empty) - _Stroke = "none"; - else - _Stroke = ColorTranslator.ToHtml(value); - } - - } - public Color OutlineColor - { - get - { - // Stroke = "None" - Eliminate, otherwise the value - // StrokeWidth = "0" Eliminate, otherwise the value - string myStroke = InheritedStroke; - //string myWidth = InheritedOutlineWidth; - string myWidth = InheritedLineWidth; - if (myStroke.ToLower() == "none" || myWidth == "0") // Eliminate - return Color.Empty; - return ColorTranslator.FromHtml(myStroke); - } - set - { - if (value == Color.Empty) - _Stroke = "none"; - else - _Stroke = ColorTranslator.ToHtml(value); - } - - } - #endregion - #region Properties - private string _Stroke = string.Empty; // Default value is None - public string Stroke - { - get { return _Stroke; } - set { _Stroke = value; } - } - private string _StrokeWidth = string.Empty; // Default value is 1PX - public string StrokeWidth - { - get { return _StrokeWidth; } - set { _StrokeWidth = value; } - } - #endregion - } -} diff --git a/PROMS/Volian.Svg.Library/SvgMeasurement.cs b/PROMS/Volian.Svg.Library/SvgMeasurement.cs deleted file mode 100644 index e953cf6e..00000000 --- a/PROMS/Volian.Svg.Library/SvgMeasurement.cs +++ /dev/null @@ -1,251 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms; -using System.Text.RegularExpressions; - -namespace Volian.Svg.Library -{ - [TypeConverter(typeof(MeasurementTypeConverter))] - public class SvgMeasurement - { - #region Operators - public static SvgMeasurement operator +(SvgMeasurement x1, SvgMeasurement x2) - { - E_MeasurementUnits tmpUnits = x1.Units; - SvgMeasurement tmp = new SvgMeasurement(x1.GetSizeInPoints(DPI) + x2.GetSizeInPoints(DPI),E_MeasurementUnits.PT); - tmp.Units = x1.Units; - return tmp; - } - public static SvgMeasurement operator -(SvgMeasurement x1, SvgMeasurement x2) - { - E_MeasurementUnits tmpUnits = x1.Units; - SvgMeasurement tmp = new SvgMeasurement(x1.GetSizeInPoints(DPI) - x2.GetSizeInPoints(DPI), E_MeasurementUnits.PT); - tmp.Units = x1.Units; - return tmp; - } - public static SvgMeasurement operator *(SvgMeasurement x1, float scaler) - { - E_MeasurementUnits tmpUnits = x1.Units; - SvgMeasurement tmp = new SvgMeasurement(x1.GetSizeInPoints(DPI) * scaler, E_MeasurementUnits.PT); - tmp.Units = x1.Units; - return tmp; - } - public static SvgMeasurement operator *(float scaler, SvgMeasurement x1) - { - E_MeasurementUnits tmpUnits = x1.Units; - SvgMeasurement tmp = new SvgMeasurement(x1.GetSizeInPoints(DPI) * scaler, E_MeasurementUnits.PT); - tmp.Units = x1.Units; - return tmp; - } - #endregion - #region DPI - private static float _DPI; - public static float DPI - { - get - { - if (_DPI == 0) - _DPI = 96; - return _DPI; - } - } - #endregion - #region ctor - public SvgMeasurement() { ;} - public SvgMeasurement(int value) - { - _Value = Convert.ToSingle(value); - _Units = E_MeasurementUnits.PX; - } - public SvgMeasurement(float value) - { - _Value = value; - _Units = E_MeasurementUnits.PX; - } - public SvgMeasurement(float value, E_MeasurementUnits units) - { - _Value = value; - _Units = units; - } - public SvgMeasurement(string val) - { - val = val.Replace("{size}", "10");// B2020-145 BWD SAMG TSG-6 Fix for Base Format {size} parameter rather than font size - MatchCollection mc = Regex.Matches(val.ToLower(), "([+-]?[.0-9]+)|(in|cm|mm|em|ex|pc|pt|px|percentage)"); - _Value = Convert.ToSingle(mc[0].Value); - if (mc.Count == 2) - { - //Console.WriteLine("{0} - '{1}'", val, mc[1].Value.ToUpper()); - _Units = (E_MeasurementUnits)Enum.Parse(typeof(E_MeasurementUnits), mc[1].Value.ToUpper()); - } - else - _Units = E_MeasurementUnits.PX; - } - #endregion - #region Properties - private E_MeasurementUnits _Units; - public E_MeasurementUnits Units - { - get { return _Units; } - set - { - float tmp = GetSizeInPoints(DPI); - _Units = value; - _Value *= (tmp / GetSizeInPoints(DPI)); - } - } - private float _Value; - public float Value - { - get { return _Value; } - set { _Value = value; } - } - #endregion - #region ToString - public override string ToString() - { - switch (_Units) - { - case E_MeasurementUnits.PX: // Default - return string.Format("{0}", _Value); - case E_MeasurementUnits.PERCENTAGE: // Precentage is preceded by a space - return string.Format("{0} {1}", _Value, _Units); - } - return string.Format("{0}{1}", _Value, _Units); - } - #endregion - //public float SizeInPixels - //{ - // get - // { - // switch (_Units) - // { - // case E_MeasurementUnits.PT: //Points - 72 per inch - // return _Value * DPI / 72F; - // case E_MeasurementUnits.PC: //Picas - 6 per inch - // return _Value * DPI / 6F; - // case E_MeasurementUnits.IN: //inches - // return _Value * DPI; - // case E_MeasurementUnits.CM: // Centimeter - // return _Value * DPI / 2.54F; - // case E_MeasurementUnits.MM: // Millimeter - // return _Value * DPI / 25.4F; - // case E_MeasurementUnits.EM: // EMs - // return _Value * DPI / 8; - // case E_MeasurementUnits.EX: // EXs - // return _Value * DPI / 16; - // default: - // return _Value; - // } - // } - //} - public float GetSizeInPoints(float myDPI) - { - switch (_Units) - { - case E_MeasurementUnits.PX: //Pixels myDPI per inch - return _Value * 72F / myDPI; - case E_MeasurementUnits.PC: //Picas - 6 per inch - return _Value * 72F / 6F; - case E_MeasurementUnits.IN: //inches - return _Value * 72F; - case E_MeasurementUnits.CM: // Centimeter - return _Value * 72F / 2.54F; - case E_MeasurementUnits.MM: // Millimeter - return _Value * 72F / 25.4F; - case E_MeasurementUnits.EM: // EMs - return _Value * 72F / 8; - case E_MeasurementUnits.EX: // EXs - return _Value * 72F / 16; - default: // Points - return _Value; - } - } - //public float SizeInPoints - //{ get { return SizeInPixels * 72 / DPI; } } - //public float SizeInInches - //{ get { return SizeInPixels / DPI; } } - //public float SizeInCentimeters - //{ get { return SizeInPixels * 2.54F / DPI; } } - //public float SizeInMillimeters - //{ get { return SizeInPixels * 25.4F / DPI; } } - //public float SizeInEms - //{ get { return SizeInPixels * 5 / (6 * DPI); } } - //public float SizeInExs - //{ get { return SizeInPixels * 5 / (6 * DPI); } } - //public float SizeInPicas - //{ get { return SizeInPixels * 6 / DPI; } } - //public Unit SizeInUnits - //{ get { return new Unit((double)SizeInPoints, UnitTypeEnum.Point); } } - public float GetSizeInPixels(float myDPI) - { return GetSizeInPoints(myDPI) * myDPI / 72F;} - public float GetSizeInInches(float myDPI) - { return GetSizeInPoints(myDPI) / 72F; } - public float GetSizeInCentimeters(float myDPI) - { return GetSizeInPoints(myDPI) * 2.54F / 72F; } - public float GetSizeInMillimeters(float myDPI) - { return GetSizeInPoints(myDPI) * 25.4F / 72F; } - public float GetSizeInEms(float myDPI) - { return GetSizeInPoints(myDPI) * 5 / (6 * 72F); } - public float GetSizeInExs(float myDPI) - { return GetSizeInPoints(myDPI) * 5 / (6 * 72F); } - public float GetSizeInPicas(float myDPI) - { return GetSizeInPoints(myDPI) * 6 / 72F; } - //public Unit GetSizeInUnits(float myDPI) - //{ return new Unit((double)GetSizeInPoints(myDPI), UnitTypeEnum.Point); } - public static float StringToPoints(string value) - { - SvgMeasurement tmp = new SvgMeasurement(value); - float myPoints = tmp.GetSizeInPoints(72); - return myPoints; - } - - } - public enum E_MeasurementUnits : int - { - [Description("Pixels")] - PX, - [Description("Points")] - PT, - [Description("Inches")] - IN, - [Description("Centimeters")] - CM, - [Description("Millimeters")] - MM, - [Description("EMs")] - EM, - [Description("EXs")] - EX, - [Description("Percentage")] - PERCENTAGE, - [Description("Picas")] - PC - } - public class MeasurementTypeConverter : ExpandableObjectConverter - { - public override bool CanConvertTo(ITypeDescriptorContext context, Type t) - { - return t == typeof(String); - } - public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType) - { - if (destType == typeof(string) && value is SvgMeasurement) - { - return value.ToString(); - } - return base.ConvertTo(context, culture, value, destType); - } - public override bool CanConvertFrom(ITypeDescriptorContext context, Type t) - { - return t == typeof(String); - } - public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object val) - { - SvgMeasurement measurement = new SvgMeasurement((string)val); - return measurement; - } - } -} diff --git a/PROMS/Volian.Svg.Library/SvgPart.cs b/PROMS/Volian.Svg.Library/SvgPart.cs deleted file mode 100644 index 2f509335..00000000 --- a/PROMS/Volian.Svg.Library/SvgPart.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.IO; -using System.Xml.Serialization; -using System.Drawing; -using System.ComponentModel; -using System.Collections.Generic; - -namespace Volian.Svg.Library -{ - - [TypeConverter(typeof(ExpandableObjectConverter))] - public abstract partial class SvgPart - { - #region ID - protected string _ID = string.Empty; - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("id")] - public string ID - { - get { return _ID; } - set { _ID = value; } - } - #endregion - //#region Parent and Containing Svg - //// ToDo: MyParent - //private SvgPartGrouping _MyParent; - //[XmlIgnore()] - //public SvgPartGrouping MyParent - //{ - // get { return _MyParent; } - // set { _MyParent = value; } - //} - //// ToDo: MySvg - //private Svg _MySvg; - //public Svg MySvg - //{ - // get { return _MySvg; } - // set { _MySvg = value; } - //} - //internal void SetParent(SvgPartGrouping myParent) - //{ - // _MyParent = myParent; - // _MySvg = myParent.MySvg == null? MyParent : myParent.MySvg; - //} - //#endregion - #region Setup Inheritance - virtual internal void SetupInheritance(SvgInheritedSettings myParentsSettings) { ; } - #endregion - #region Dictionary of Parts - internal virtual void AddLookup(Dictionary lookUp) - { - if (_ID != string.Empty && !lookUp.ContainsKey(_ID)) - lookUp.Add(_ID, this); - } - #endregion - } -} \ No newline at end of file diff --git a/PROMS/Volian.Svg.Library/SvgPartInheritance.cs b/PROMS/Volian.Svg.Library/SvgPartInheritance.cs deleted file mode 100644 index aaf48f24..00000000 --- a/PROMS/Volian.Svg.Library/SvgPartInheritance.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; -using System.ComponentModel; -using System.Drawing; - -namespace Volian.Svg.Library -{ - public partial class SvgPartInheritance : SvgPart - { - #region InheritedSettings - internal SvgInheritedSettings _MyInheritedSettings = new SvgInheritedSettings(); - [XmlIgnore()] - internal SvgInheritedSettings MyInheritedSettings - { - get { return _MyInheritedSettings; } - set { _MyInheritedSettings = value; } - } - #region Line Settings - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("stroke")] - public string Stroke - { - get { return _MyInheritedSettings.Stroke; } - set { _MyInheritedSettings.Stroke = value; } - } - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("stroke-width")] - public string StrokeWidth - { - get { return _MyInheritedSettings.StrokeWidth; } - set { _MyInheritedSettings.StrokeWidth = value; } - } - #endregion - #region Fill Settings - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("fill")] - public string Fill - { - get { return _MyInheritedSettings.Fill; } - set { _MyInheritedSettings.Fill = value; } - } - #endregion - #region Font Settings - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("font-family")] - public string FontFamily - { - get { return _MyInheritedSettings.FontFamily; } - set { _MyInheritedSettings.FontFamily = value; } - } - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("font-size")] - public string FontSize - { - get { return _MyInheritedSettings.FontSize; } - set { _MyInheritedSettings.FontSize = value; } - } - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("font-style")] - public string SVGFontStyle - { - get { return _MyInheritedSettings.SVGFontStyle; } - set { _MyInheritedSettings.SVGFontStyle = value; } - } - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("font-weight")] - public string FontWeight - { - get { return _MyInheritedSettings.FontWeight; } - set { _MyInheritedSettings.FontWeight = value; } - } - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("text-decoration")] - public string TextDecoration - { - get { return _MyInheritedSettings.TextDecoration; } - set { _MyInheritedSettings.TextDecoration = value; } - } - #endregion - #endregion - #region Setup Inheritance - override internal void SetupInheritance(SvgInheritedSettings myParentsSettings) - { - _MyInheritedSettings.MyParentsSettings = myParentsSettings; - //_SvgParts.SetupInheritance(_MyInheritedSettings); - } - #endregion - } -} diff --git a/PROMS/Volian.Svg.Library/SvgParts.cs b/PROMS/Volian.Svg.Library/SvgParts.cs deleted file mode 100644 index 18cbb24f..00000000 --- a/PROMS/Volian.Svg.Library/SvgParts.cs +++ /dev/null @@ -1,394 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Drawing; -using System.ComponentModel; -using System.Text; - -namespace Volian.Svg.Library -{ - /// - /// - /// A collection that stores objects. - /// - /// - /// - [Serializable()] - [TypeConverter(typeof(SVGPartsConverter))] - public partial class SvgParts : CollectionBase, ICustomTypeDescriptor - { - /// Notifies when the collection has been modified. - public event EventHandler OnItemsChanged; - - /// Notifies that an item has been added. - public event SVGPartHandler OnItemAdd; - - /// Notifies that items have been added. - public event SVGPartHandler OnItemsAdd; - - /// Notifies that an item has been removed. - public event SVGPartHandler OnItemRemove; - - /// - /// - /// Initializes a new instance of . - /// - /// - public SvgParts() - { - } - - /// - /// - /// Initializes a new instance of based on another . - /// - /// - /// - /// A from which the contents are copied - /// - public SvgParts(SvgParts value) - { - this.AddRange(value); - } - - /// - /// - /// Initializes a new instance of containing any array of objects. - /// - /// - /// - /// A array of objects with which to intialize the collection - /// - public SvgParts(SvgPart[] value) - { - this.AddRange(value); - } - - /// - /// Represents the entry at the specified index of the . - /// - /// The zero-based index of the entry to locate in the collection. - /// - /// The entry at the specified index of the collection. - /// - /// is outside the valid range of indexes for the collection. - public SvgPart this[int index] - { - get { return ((SvgPart)(List[index])); } - set { List[index] = value; } - } - //#region SetupInheritance - //internal void SetupInheritance(SvgInheritedSettings myParentsSettings) - //{ - // foreach (SvgPart svgPart in List) - // svgPart.SetupInheritance(myParentsSettings); - //} - //#endregion - #region Dictionary of Parts - internal void AddLookup(Dictionary lookUp) - { - foreach (SvgPart svgPart in List) - svgPart.AddLookup(lookUp); - } - #endregion - internal static void ShowException(Exception ex) - { - StringBuilder sb = new StringBuilder(); - string sep = ""; - for (Exception ex1 = ex; ex1 != null; ex1 = ex1.InnerException) - { - sb.Append(sep + string.Format("ShowException {0} - {1}", ex1.GetType().Name, ex1.Message)); - sep = "\r\n"; - } - Console.WriteLine(sb); - } - /// - /// Adds a with the specified value to the - /// . - /// - /// The to add. - /// - /// The index at which the new element was inserted. - /// - /// - public int Add(SvgPart value) - { - int ndx = List.Add(value); - if (OnItemAdd != null) { OnItemAdd(this, new SVGPartArgs(value)); } - if (OnItemsChanged != null) { OnItemsChanged(value, EventArgs.Empty); } - return ndx; - } - - /// - /// Copies the elements of an array to the end of the . - /// - /// - /// An array of type containing the objects to add to the collection. - /// - /// - /// None. - /// - /// - public void AddRange(SvgPart[] value) - { - for (int i = 0; i < value.Length; i++) - { - this.Add(value[i]); - } - if (OnItemsAdd != null) { OnItemsAdd(this, new SVGPartArgs(value)); } - if (OnItemsChanged != null) { OnItemsChanged(value, EventArgs.Empty); } - } - - /// - /// - /// Adds the contents of another to the end of the collection. - /// - /// - /// - /// A containing the objects to add to the collection. - /// - /// - /// None. - /// - /// - public void AddRange(SvgParts value) - { - for (int i = 0; i < value.Count; i++) - { - this.Add(value[i]); - } - if (OnItemsAdd != null) { OnItemsAdd(this, new SVGPartArgs(value)); } - if (OnItemsChanged != null) { OnItemsChanged(value, EventArgs.Empty); } - } - - /// - /// Gets a value indicating whether the - /// contains the specified . - /// - /// The to locate. - /// - /// if the is contained in the collection; - /// otherwise, . - /// - /// - public bool Contains(SvgPart value) - { - return List.Contains(value); - } - - /// - /// Copies the values to a one-dimensional instance at the - /// specified index. - /// - /// The one-dimensional that is the destination of the values copied from . - /// The index in where copying begins. - /// - /// None. - /// - /// is multidimensional. -or- The number of elements in the is greater than the available space between and the end of . - /// is . - /// is less than 's lowbound. - /// - public void CopyTo(SvgPart[] array, int index) - { - List.CopyTo(array, index); - } - - /// - /// Returns the index of a in - /// the . - /// - /// The to locate. - /// - /// The index of the of in the - /// , if found; otherwise, -1. - /// - /// - public int IndexOf(SvgPart value) - { - return List.IndexOf(value); - } - - /// - /// Inserts a into the at the specified index. - /// - /// The zero-based index where should be inserted. - /// The to insert. - /// None. - /// - public void Insert(int index, SvgPart value) - { - List.Insert(index, value); - if (OnItemAdd != null) { OnItemAdd(this, new SVGPartArgs(value)); } - if (OnItemsChanged != null) { OnItemsChanged(value, EventArgs.Empty); } - } - - /// - /// Removes a specific from the - /// . - /// - /// The to remove from the . - /// None. - /// is not found in the Collection. - public void Remove(SvgPart value) - { - List.Remove(value); - if (OnItemRemove != null) { OnItemRemove(this, new SVGPartArgs(value)); } - if (OnItemsChanged != null) { OnItemsChanged(value, EventArgs.Empty); } - } - #region ICustomTypeDescriptor impl - public String GetClassName() - { return TypeDescriptor.GetClassName(this, true); } - public AttributeCollection GetAttributes() - { return TypeDescriptor.GetAttributes(this, true); } - public String GetComponentName() - { return TypeDescriptor.GetComponentName(this, true); } - public TypeConverter GetConverter() - { return TypeDescriptor.GetConverter(this, true); } - public EventDescriptor GetDefaultEvent() - { return TypeDescriptor.GetDefaultEvent(this, true); } - public PropertyDescriptor GetDefaultProperty() - { return TypeDescriptor.GetDefaultProperty(this, true); } - public object GetEditor(Type editorBaseType) - { return TypeDescriptor.GetEditor(this, editorBaseType, true); } - public EventDescriptorCollection GetEvents(Attribute[] attributes) - { return TypeDescriptor.GetEvents(this, attributes, true); } - public EventDescriptorCollection GetEvents() - { return TypeDescriptor.GetEvents(this, true); } - public object GetPropertyOwner(PropertyDescriptor pd) - { return this; } - /// - /// Called to get the properties of this type. Returns properties with certain - /// attributes. this restriction is not implemented here. - /// - /// - /// - public PropertyDescriptorCollection GetProperties(Attribute[] attributes) - { return GetProperties(); } - /// - /// Called to get the properties of this type. - /// - /// - public PropertyDescriptorCollection GetProperties() - { - // Create a collection object to hold property descriptors - PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null); - // Iterate the list - for (int i = 0; i < this.Count; i++) - { - // Create a property descriptor for the item and add to the property descriptor collection - SvgPartsPropertyDescriptor pd = new SvgPartsPropertyDescriptor(this, i); - pds.Add(pd); - } - // return the property descriptor collection - return pds; - } - #endregion - - /// Event arguments for the SVGParts collection class. - public class SVGPartArgs : EventArgs - { - private SvgParts t; - - /// Default constructor. - public SVGPartArgs() - { - t = new SvgParts(); - } - - /// Initializes with a SVGPart. - /// Data object. - public SVGPartArgs(SvgPart t) - : this() - { - this.t.Add(t); - } - - /// Initializes with a collection of SVGPart objects. - /// Collection of data. - public SVGPartArgs(SvgParts ts) - : this() - { - this.t.AddRange(ts); - } - - /// Initializes with an array of SVGPart objects. - /// Array of data. - public SVGPartArgs(SvgPart[] ts) - : this() - { - this.t.AddRange(ts); - } - - /// Gets or sets the data of this argument. - public SvgParts SVGParts - { - get { return t; } - set { t = value; } - } - } - - /// SVGParts event handler. - public delegate void SVGPartHandler(object sender, SVGPartArgs e); - #region Property Descriptor - /// - /// Summary description for CollectionPropertyDescriptor. - /// - public partial class SvgPartsPropertyDescriptor : vlnListPropertyDescriptor - { - private SvgPart Item { get { return (SvgPart)_Item; } } - public SvgPartsPropertyDescriptor(SvgParts collection, int index) : base(collection, index) { ;} - public override string DisplayName - { get { return Item.GetType().Name; } } - } - #endregion - [Serializable()] - public partial class vlnListPropertyDescriptor : PropertyDescriptor - { - protected object _Item = null; - public vlnListPropertyDescriptor(System.Collections.IList collection, int index) - : base("#" + index.ToString(), null) - { _Item = collection[index]; } - public override bool CanResetValue(object component) - { return true; } - public override Type ComponentType - { get { return _Item.GetType(); } } - public override object GetValue(object component) - { return _Item; } - public override bool IsReadOnly - { get { return false; } } - public override Type PropertyType - { get { return _Item.GetType(); } } - public override void ResetValue(object component) - { ;} - public override bool ShouldSerializeValue(object component) - { return true; } - public override void SetValue(object component, object value) - { /*_Item = value*/;} - //public override AttributeCollection Attributes - //{ get { return new AttributeCollection(null); } } - public override string DisplayName - { get { return _Item.ToString(); } } - public override string Description - { get { return _Item.ToString(); } } - public override string Name - { get { return _Item.ToString(); } } - - } // Class - #region Converter - internal class SVGPartsConverter : ExpandableObjectConverter - { - public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType) - { - if (destType == typeof(string) && value is SvgParts) - { - // Return department and department role separated by comma. - return ((SvgParts)value).List.Count.ToString() + " SVG Drawing Parts"; - } - return base.ConvertTo(context, culture, value, destType); - } - } - #endregion - - } -} \ No newline at end of file diff --git a/PROMS/Volian.Svg.Library/SvgRectangle.cs b/PROMS/Volian.Svg.Library/SvgRectangle.cs deleted file mode 100644 index 2e34ed35..00000000 --- a/PROMS/Volian.Svg.Library/SvgRectangle.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; -using System.ComponentModel; -using System.Drawing; - -namespace Volian.Svg.Library -{ - public partial class SvgRectangle : SvgShapePart - { - #region ctor - public SvgRectangle() { ;} - public SvgRectangle(PointF location, SizeF size, Color fillColor, Color lineColor, float lineWidth) - { - _X.Value = location.X; - _Y.Value = location.Y; - _Width.Value = size.Width; - _Height.Value = size.Height; - FillColor = fillColor; - LineColor = lineColor; - LineWidth = new SvgMeasurement(lineWidth); - } - //XMLElementAttribute(ElementName = "PREFIX", IsNullable = false) - #endregion - #region Description - private string _Description = string.Empty; - [System.ComponentModel.DefaultValueAttribute("")] - [XmlElement("desc")] - public string Description - { - get { return _Description; } - set { _Description = value; } - } - #endregion - #region Location - private SvgMeasurement _X = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement X - { - get { return _X; } - set { _X = value; } - } - [XmlAttribute("x")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string X_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_X); } - set { _X = SvgXmlConverter.GetObject(value); } - } - private SvgMeasurement _Y = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement Y - { - get { return _Y; } - set { _Y = value; } - } - [XmlAttribute("y")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string Y_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_Y); } - set { _Y = SvgXmlConverter.GetObject(value); } - } - #endregion - #region Size - private SvgMeasurement _Width = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement Width - { - get { return _Width; } - set { _Width = value; } - } - [XmlAttribute("width")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string Width_WidthmlSurrogate - { - get { return SvgXmlConverter.GetString(_Width); } - set { _Width = SvgXmlConverter.GetObject(value); } - } - private SvgMeasurement _Height = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement Height - { - get { return _Height; } - set { _Height = value; } - } - [XmlAttribute("height")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string Height_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_Height); } - set { _Height = SvgXmlConverter.GetObject(value); } - } - #endregion - } -} diff --git a/PROMS/Volian.Svg.Library/SvgScale.cs b/PROMS/Volian.Svg.Library/SvgScale.cs deleted file mode 100644 index 94c523b0..00000000 --- a/PROMS/Volian.Svg.Library/SvgScale.cs +++ /dev/null @@ -1,126 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; - -namespace Volian.Svg.Library -{ - public class SvgScale - { - private float _XLowerLimit; - public float XLowerLimit - { - get { return _XLowerLimit; } - set { _XLowerLimit = value; } - } - private float _YLowerLimit; - public float YLowerLimit - { - get { return _YLowerLimit; } - set { _YLowerLimit = value; } - } - private float _Scale; // Scale from Logical to Physical - public float Scale - { get { return _Scale; } } - private float _Width; // Physical Width - public float Width - { get { return _Width; } } - private float _Height; // Physical Height - public float Height - { get { return _Height; } } - public float XUpperLimit - { get { return _Width * _Scale + _XLowerLimit; } } - public float YUpperLimit - { get { return _Height * _Scale + _YLowerLimit; } } - private float _DPI; - public float DPI - { get { return _DPI; } } - private SvgScale(SvgScale tmp,SvgMeasurement newX, SvgMeasurement newY) - { - _DPI = tmp.DPI; - _Scale = tmp.Scale; - _Width = tmp.Width; - _Height = tmp.Height; - _XLowerLimit = tmp.XLowerLimit - newX.GetSizeInPixels(DPI); - _YLowerLimit = tmp.YLowerLimit - newY.GetSizeInPixels(DPI); - } - public SvgScale(float myDPI, RectangleF bounds,SvgMeasurement width, SvgMeasurement height, SvgViewBox myViewBox) - { - // TODO: Should I convert to pixels or something fixed (Inches, Points, Picas, CMs, MMs, Twips) - _DPI = myDPI; - float outputWidth = width.GetSizeInPixels(100); - if(outputWidth == 0) outputWidth = bounds.Width; - float outputHeight = height.GetSizeInPixels(100); - if (outputHeight == 0) outputHeight = bounds.Height; - float inputWidth = myViewBox.Width; - if (inputWidth == 0) inputWidth = outputWidth; - float scalex = outputWidth / inputWidth; - float inputHeight = myViewBox.Height; - if (inputHeight == 0) inputHeight = outputHeight; - float scaley = outputHeight / inputHeight; - _Scale = (scalex < scaley) ? scaley : scalex; - //Console.WriteLine("'Scale',{0}",_Scale); - _Width = outputWidth / _Scale; - _Height = outputHeight / _Scale; - _XLowerLimit = myViewBox.X + (inputWidth - _Width) / 2; - _YLowerLimit = myViewBox.Y + (inputHeight - _Height) / 2; - //if (myDPI != 96) Console.WriteLine("DPI {0}", myDPI); - //Console.WriteLine("Scale,{0},{1},{2},{3},{4},{5},{6}", Scale, Width, Height, XLowerLimit, XUpperLimit, YLowerLimit, YUpperLimit); - } - public SvgScale AdjustOrigin(SvgMeasurement newX, SvgMeasurement newY) - { - return new SvgScale(this, newX, newY); - } - public float X(float x) - { - return _Scale * (x - XLowerLimit); - } - public float Y(float y) - { - return _Scale * (y - YLowerLimit); - } - public float AbsX(SvgMeasurement x) - { - return x.GetSizeInPixels(DPI) + Svg.AbsoluteOffset.X; - } - public float AbsY(iTextSharp.text.pdf.PdfContentByte cb, SvgMeasurement y) - { - // the following line of code is 'taken' from the 16bit code: \promsnt\exe\wined\togdi.cpp - // whenever doing an 'Absolute' macro. - float yOffset = 54 * 4.8f + 0.5f; // yOffset starts in 'twips' (twip = 1/20 point) - yOffset = yOffset / 20; // convert from twips to points (point = 1/72 inch) - return cb.PdfDocument.PageSize.Height - y.GetSizeInPixels(DPI) + yOffset + Svg.AbsoluteOffset.Y; - } - public float Y(iTextSharp.text.pdf.PdfContentByte cb, float y) - { - return cb.PdfDocument.PageSize.Height - _Scale * (y - YLowerLimit); - } - public float M(float m) - { - return _Scale * m; - } - public float X(SvgMeasurement x) - { - float retval = _Scale * (x.GetSizeInPixels(DPI) - XLowerLimit); - return retval; - } - public float Y(SvgMeasurement y) - { - return _Scale * (y.GetSizeInPixels(DPI) - YLowerLimit); - } - public float Y(iTextSharp.text.pdf.PdfContentByte cb, SvgMeasurement y) - { - float yOffset = 0; // = (cb.PdfWriter.CurrentPageNumber -1) * .8F * cb.PdfDocument.PageSize.Height; - float myY = yOffset + cb.PdfDocument.PageSize.Height - _Scale * (y.GetSizeInPixels(DPI) - YLowerLimit); - return myY; - } - public float YY(SvgMeasurement y) - { - return -_Scale * y.GetSizeInPixels(DPI); - } - public float M(SvgMeasurement m) - { - return _Scale * m.GetSizeInPixels(DPI); - } - } -} diff --git a/PROMS/Volian.Svg.Library/SvgSerializer.cs b/PROMS/Volian.Svg.Library/SvgSerializer.cs deleted file mode 100644 index c04a7754..00000000 --- a/PROMS/Volian.Svg.Library/SvgSerializer.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; -using System.Xml; -using System.Xml.Schema; -using System.IO; - -namespace Volian.Svg.Library -{ - public static class SvgSerializer where T : class - { - public static string StringSerialize(T t) - { - string strOutput = string.Empty; - XmlSerializer xs = new XmlSerializer(typeof(T),"http://www.w3.org/2000/svg"); - using (MemoryStream ms = new MemoryStream()) - { - xs.Serialize( new NonXsiTextWriter(ms,Encoding.UTF8), t); - //xs.Serialize(ms, t); - ms.Position = 0; - StreamReader sr = new StreamReader(ms); - strOutput = sr.ReadToEnd(); - ms.Close(); - } - return strOutput; - } - public static T StringDeserialize(string s) - { - T t; - XmlSerializer xs = new XmlSerializer(typeof(T), "http://www.w3.org/2000/svg"); - UTF8Encoding enc = new UTF8Encoding(); - Byte[] arrBytData = enc.GetBytes(s); - using (MemoryStream ms = new MemoryStream(arrBytData)) - { - t = (T)xs.Deserialize(ms); - } - return t; - } - public static void WriteFile(T t, string fileName) - { - string strOutput = string.Empty; - XmlSerializer xs = new XmlSerializer(typeof(T), "http://www.w3.org/2000/svg"); - using (FileStream fs = new FileStream(fileName, FileMode.Create)) - { - xs.Serialize(new NonXsiTextWriter(fs,Encoding.UTF8), t); - fs.Close(); - } - } - public static T ReadFile(string fileName) - { - T t; - XmlSerializer xs = new XmlSerializer(typeof(T), "http://www.w3.org/2000/svg"); - using (FileStream fs = new FileStream(fileName, FileMode.Open)) - { - t = (T)xs.Deserialize(fs); - } - return t; - } - } - public class NonXsiTextWriter : XmlTextWriter - { - public NonXsiTextWriter( TextWriter w ) : base( w ) {} - public NonXsiTextWriter( Stream w, Encoding encoding ) : base( w, encoding ) { - this.Formatting = Formatting.Indented; - } - public NonXsiTextWriter( string filename, Encoding encoding ) : base( filename, encoding ) {} - bool _skip = false; - public override void WriteStartAttribute( string prefix, string localName, string ns ) - { - if ((prefix == "xmlns" && (localName == "xsd" || localName == "xsi")) || // Omits XSD and XSI declarations. - ns == XmlSchema.InstanceNamespace ) // Omits all XSI attributes. - { - _skip = true; - return; - } - if(localName == "xlink_href") - base.WriteStartAttribute(prefix, "xlink:href", ns); - else - base.WriteStartAttribute( prefix, localName, ns ); - } - public override void WriteString( string text ) { - if ( _skip ) return; - base.WriteString( text ); - } - public override void WriteEndAttribute() - { - if ( _skip ) - { // Reset the flag, so we keep writing. - _skip = false; - return; - } - base.WriteEndAttribute(); - } - } -} diff --git a/PROMS/Volian.Svg.Library/SvgShapePart.cs b/PROMS/Volian.Svg.Library/SvgShapePart.cs deleted file mode 100644 index c1429167..00000000 --- a/PROMS/Volian.Svg.Library/SvgShapePart.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.IO; -using System.Xml.Serialization; -using System.Drawing; -using System.ComponentModel; - -namespace Volian.Svg.Library -{ - [TypeConverter(typeof(ExpandableObjectConverter))] - public abstract class SvgShapePart : SvgLinePart - { - #region Fill Settings - protected SvgFillSettings _MyFillSettings = new SvgFillSettings(); - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("fill")] - public string Fill - { - get { return _MyFillSettings.Fill; } - set { _MyFillSettings.Fill = value; } - } - [XmlIgnore] - public Color FillColor - { - get - { - if (_MyFillSettings.Fill.ToUpper() == "NONE") return _MyFillSettings.FillColor; - return Svg.OverrideColor != System.Drawing.Color.Empty ? Svg.OverrideColor : _MyFillSettings.FillColor; - } - - set { _MyFillSettings.FillColor = value; } - } - #endregion - #region Setup Inheritance - override internal void SetupInheritance(SvgInheritedSettings myParentsSettings) - { - base.SetupInheritance(myParentsSettings); - _MyFillSettings.MyParentsSettings = myParentsSettings.MyFillSettings; - } - #endregion - } -} \ No newline at end of file diff --git a/PROMS/Volian.Svg.Library/SvgTest.cs b/PROMS/Volian.Svg.Library/SvgTest.cs deleted file mode 100644 index a0eaaab2..00000000 --- a/PROMS/Volian.Svg.Library/SvgTest.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; -using System.Drawing; - -namespace Volian.Svg.Library -{ - [XmlRoot("svg-test")] - public class SvgTest - { - public SvgTest() - { - _MyLineSettings = new SvgLineSettings(Color.Red,new SvgMeasurement(3, E_MeasurementUnits.PX)); - _MyFillSettings = new SvgFillSettings(Color.Cyan); - _MyFontSettings = new SvgFontSettings(new Font("Cambria", 20, FontStyle.Bold | FontStyle.Italic | FontStyle.Underline, GraphicsUnit.Point)); - } - #region Line Settings - private SvgLineSettings _MyLineSettings; - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("stroke")] - public string Stroke - { - get { return _MyLineSettings.Stroke; } - set { _MyLineSettings.Stroke = value; } - } - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("stroke-width")] - public string StrokeWidth - { - get { return _MyLineSettings.StrokeWidth; } - set { _MyLineSettings.StrokeWidth = value; } - } - #endregion - #region Fill Settings - private SvgFillSettings _MyFillSettings; - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("fill")] - public string Fill - { - get { return _MyFillSettings.Fill; } - set { _MyFillSettings.Fill = value; } - } - #endregion - #region Font Settings - private SvgFontSettings _MyFontSettings; - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("font-family")] - public string FontFamily - { - get { return _MyFontSettings.FontFamily; } - set { _MyFontSettings.FontFamily = value; } - } - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("font-size")] - public string FontSize - { - get { return _MyFontSettings.FontSize; } - set { _MyFontSettings.FontSize = value; } - } - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("font-style")] - public string SVGFontStyle - { - get { return _MyFontSettings.SVGFontStyle; } - set { _MyFontSettings.SVGFontStyle = value; } - } - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("font-weight")] - public string FontWeight - { - get { return _MyFontSettings.FontWeight; } - set { _MyFontSettings.FontWeight = value; } - } - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("text-decoration")] - public string TextDecoration - { - get { return _MyFontSettings.TextDecoration; } - set { _MyFontSettings.TextDecoration = value; } - } - #endregion - } -} diff --git a/PROMS/Volian.Svg.Library/SvgText.cs b/PROMS/Volian.Svg.Library/SvgText.cs deleted file mode 100644 index 41988c87..00000000 --- a/PROMS/Volian.Svg.Library/SvgText.cs +++ /dev/null @@ -1,156 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Xml.Serialization; -using System.ComponentModel; - -namespace Volian.Svg.Library -{ - public partial class SvgText : SvgShapePart - { - #region ctor - public SvgText() { ;} - public SvgText(PointF location, string text, Font font, Color fillColor) - { - _X.Value = location.X; - _Y.Value = location.Y; - Text = text; - Font = font; - FillColor = fillColor; - LineColor = Color.Empty; - LineWidth = new SvgMeasurement(0); - } - #endregion - #region Location - private SvgJustify _Justify = SvgJustify.Left; - [XmlAttribute("Justify")] - public SvgJustify Justify - { - get { return _Justify; } - set { _Justify = value; } - } - private SvgMeasurement _X = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement X - { - get { return _X; } - set { _X = value; } - } - [XmlAttribute("x")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string X_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_X); } - set { _X = SvgXmlConverter.GetObject(value); } - } - private SvgMeasurement _Y = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement Y - { - get { return _Y; } - set { _Y = value; } - } - [XmlAttribute("y")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string Y_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_Y); } - set { _Y = SvgXmlConverter.GetObject(value); } - } - #endregion - #region Text - private string _Text; - [XmlText()] - public string Text - { - get { return _Text; } - set { _Text = value.Replace("{sp}"," "); } - } - #endregion - #region Font Settings - private SvgFontSettings _MyFontSettings = new SvgFontSettings(); - [XmlIgnore] - public Font Font - { - get - { - //if (_MyFontSettings.Font.Size < 10) - // Console.WriteLine("It didn't work!"); - return _MyFontSettings.Font; - } - set - { - //if (value.Size < 10) - // Console.WriteLine("It didn't work!"); - _MyFontSettings.Font = value; - } - } - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("font-family")] - public string FontFamily - { - get { return _MyFontSettings.FontFamily; } - set { _MyFontSettings.FontFamily = value; } - } - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("font-size")] - public string FontSize - { - get { return _MyFontSettings.FontSize; } - set { _MyFontSettings.FontSize = value; } - } - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("font-style")] - public string SVGFontStyle - { - get { return _MyFontSettings.SVGFontStyle; } - set { _MyFontSettings.SVGFontStyle = value; } - } - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("font-weight")] - public string FontWeight - { - get { return _MyFontSettings.FontWeight; } - set { _MyFontSettings.FontWeight = value; } - } - [System.ComponentModel.DefaultValueAttribute("")] - [XmlAttribute("text-decoration")] - public string TextDecoration - { - get { return _MyFontSettings.TextDecoration; } - set { _MyFontSettings.TextDecoration = value; } - } - #endregion - #region Description - private string _Description = string.Empty; - [System.ComponentModel.DefaultValueAttribute("")] - [XmlElement("desc")] - public string Description - { - get { return _Description; } - set { _Description = value; } - } - #endregion - #region Setup Inheritance - override internal void SetupInheritance(SvgInheritedSettings myParentsSettings) - { - base.SetupInheritance(myParentsSettings); - _MyFontSettings.MyParentsSettings = myParentsSettings.MyFontSettings; - } - #endregion - public override string ToString() - { - return string.Format("({0}, {1}) - '{2}'",this.X,this.Y,this.Text); - } - } - public enum SvgJustify - { - Left = 0, - Center = 1, - Right =2 - } -} diff --git a/PROMS/Volian.Svg.Library/SvgUse.cs b/PROMS/Volian.Svg.Library/SvgUse.cs deleted file mode 100644 index 26054bef..00000000 --- a/PROMS/Volian.Svg.Library/SvgUse.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; -using System.ComponentModel; -using System.Drawing; - -namespace Volian.Svg.Library -{ - public partial class SvgUse : SvgPartInheritance - { - #region ctor - public SvgUse() { ;} - public SvgUse(PointF location, SizeF size, string id) - { - _X.Value = location.X; - _Y.Value = location.Y; - _Width.Value = size.Width; - _Height.Value = size.Height; - _ID = id; - } - #endregion - #region Location - private SvgMeasurement _X = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement X - { - get { return _X; } - set { _X = value; } - } - [XmlAttribute("x")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string X_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_X); } - set { _X = SvgXmlConverter.GetObject(value); } - } - private SvgMeasurement _Y = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement Y - { - get { return _Y; } - set { _Y = value; } - } - [XmlAttribute("y")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string Y_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_Y); } - set { _Y = SvgXmlConverter.GetObject(value); } - } - #endregion - #region Size - private SvgMeasurement _Width = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement Width - { - get { return _Width; } - set { _Width = value; } - } - [XmlAttribute("width")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string Width_WidthmlSurrogate - { - get { return SvgXmlConverter.GetString(_Width); } - set { _Width = SvgXmlConverter.GetObject(value); } - } - private SvgMeasurement _Height = new SvgMeasurement(); - [XmlIgnore] - public SvgMeasurement Height - { - get { return _Height; } - set { _Height = value; } - } - [XmlAttribute("height")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string Height_XmlSurrogate - { - get { return SvgXmlConverter.GetString(_Height); } - set { _Height = SvgXmlConverter.GetObject(value); } - } - #endregion - #region ID to be used - private string _UseID = null; - [XmlAttribute(AttributeName = "href", Namespace = "http://www.w3.org/1999/xlink")] - public string UseID - { - get { return _UseID; } - set { _UseID = value; } - } - #endregion - #region Setup Inheritance - override internal void SetupInheritance(SvgInheritedSettings myParentsSettings) - { - _MyInheritedSettings.MyParentsSettings = myParentsSettings; - } - #endregion - public override string ToString() - { - return string.Format("({0}, {1}) Template '{2}'", this.X, this.Y, this.UseID); - } - } -} diff --git a/PROMS/Volian.Svg.Library/SvgViewBox.cs b/PROMS/Volian.Svg.Library/SvgViewBox.cs deleted file mode 100644 index 1098d550..00000000 --- a/PROMS/Volian.Svg.Library/SvgViewBox.cs +++ /dev/null @@ -1,79 +0,0 @@ - using System; - using System.Collections.Generic; - using System.Text; - using System.Drawing; - using System.ComponentModel; - -namespace Volian.Svg.Library -{ - [TypeConverter(typeof(ViewBoxTypeConverter))] - public class SvgViewBox - { - #region ctor - public SvgViewBox() { ;} - public SvgViewBox(float x, float y, float width, float height) - { - _MyRectangleF = new RectangleF(x, y, width, height); - } - public SvgViewBox(string val) - { - string[] parms = ((string)val).Split(' '); - _MyRectangleF = new RectangleF(Convert.ToSingle(parms[0]), Convert.ToSingle(parms[1]), Convert.ToSingle(parms[2]), Convert.ToSingle(parms[3])); - } - #endregion - #region Public Properties - private RectangleF _MyRectangleF = new RectangleF(); - public float X - { - get { return _MyRectangleF.X; } - set { _MyRectangleF.X = value; } - } - public float Y - { - get { return _MyRectangleF.Y; } - set { _MyRectangleF.Y = value; } - } - public float Width - { - get { return _MyRectangleF.Width; } - set { _MyRectangleF.Width = value; } - } - public float Height - { - get { return _MyRectangleF.Height; } - set { _MyRectangleF.Height = value; } - } - #endregion - #region ToString - public override string ToString() - { - return string.Format("{0} {1} {2} {3}", X, Y, Width, Height); - } - #endregion - } - public class ViewBoxTypeConverter : ExpandableObjectConverter - { - public override bool CanConvertTo(ITypeDescriptorContext context, Type t) - { - return t == typeof(String); - } - public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType) - { - if (destType == typeof(string) && value is SvgViewBox) - { - return value.ToString(); - } - return base.ConvertTo(context, culture, value, destType); - } - public override bool CanConvertFrom(ITypeDescriptorContext context, Type t) - { - return t == typeof(String); - } - public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object val) - { - string[] parms = ((string)val).Split(' '); - SvgViewBox viewBox = new SvgViewBox(Convert.ToSingle(parms[0]), Convert.ToSingle(parms[1]), Convert.ToSingle(parms[2]), Convert.ToSingle(parms[3])); - return viewBox; - } - } -} diff --git a/PROMS/Volian.Svg.Library/SvgXMLConverter.cs b/PROMS/Volian.Svg.Library/SvgXMLConverter.cs deleted file mode 100644 index 815e7d9d..00000000 --- a/PROMS/Volian.Svg.Library/SvgXMLConverter.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.ComponentModel; - -namespace Volian.Svg.Library -{ - public static class SvgXmlConverter where T : class - { - public static string GetString(T myObject) - { - if (myObject == null) return null; - TypeConverter FontConverter = TypeDescriptor.GetConverter(typeof(T)); - return FontConverter.ConvertToInvariantString(myObject); - } - public static T GetObject(string value) - { - TypeConverter converter = TypeDescriptor.GetConverter(typeof(T)); - return (T)converter.ConvertFromInvariantString(value); - } - } -} diff --git a/PROMS/Volian.Svg.Library/Volian.Svg.Library.csproj b/PROMS/Volian.Svg.Library/Volian.Svg.Library.csproj deleted file mode 100644 index 9beda668..00000000 --- a/PROMS/Volian.Svg.Library/Volian.Svg.Library.csproj +++ /dev/null @@ -1,137 +0,0 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {293911B5-C602-483F-A97F-F962EEFB3CAE} - Library - Properties - Volian.Svg.Library - Volian.Svg.Library - - - - - - - - - v4.8.1 - - - - - 2.0 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - x64 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - x64 - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - prompt - false - - - bin\x86\Release\ - TRACE - true - pdbonly - x64 - prompt - false - - - - ..\..\..\..\3rdPartyLibraries\RtfConverter\bin\Debug\Itenso.Rtf.Interpreter.dll - - - ..\..\..\..\3rdPartyLibraries\RtfConverter\bin\Debug\Itenso.Rtf.Parser.dll - - - False - ..\..\..\..\3rdPartyLibraries\iTechSharp\itextsharp.dll - - - ..\..\..\..\3rdPartyLibraries\Log4Net\log4net.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {AEEE9FD1-6892-45E2-A67E-418C06D46FF9} - Volian.Base.Library - - - - - \ No newline at end of file diff --git a/PROMS/Volian.Svg.Library/iTextSharp.cs b/PROMS/Volian.Svg.Library/iTextSharp.cs deleted file mode 100644 index 0be29927..00000000 --- a/PROMS/Volian.Svg.Library/iTextSharp.cs +++ /dev/null @@ -1,1491 +0,0 @@ -using System; -using System.Collections; -using System.Text; -using System.Collections.Generic; -using System.Xml.Serialization; -using iTextSharp.text; -using iTextSharp.text.pdf; -using iTextSharp.text.factories; -using Itenso.Rtf; -using Itenso.Rtf.Parser; -using Itenso.Rtf.Interpreter; -using Itenso.Rtf.Support; -using Microsoft.Win32; -using System.Text.RegularExpressions; -using System.Xml; -using System.IO; -using Volian.Base.Library; - -namespace Volian.Svg.Library -{ - public static class VolianPdf - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - public static int PageCount(string fileName) - { - PdfReader pdfr = new PdfReader(fileName); - int retval = pdfr.NumberOfPages; - pdfr.Close(); - return retval; - } - // keep for debug - //private static List _RegFonts = new List(); - public static iTextSharp.text.Font GetFont(string fontName, int size, int style) - { - //if (!_RegFonts.Contains(fontName)) - //{ - //_MyLog.WarnFormat("Registering Font {0}", fontName); - //_RegFonts.Add(fontName); - //} - // B2019-116 Use Volian.Base.Library.VlnItextFont - // This is a generic class for dealing with iTextSharp Fonts - // Code moved and consolidated from Volian.Print.Library, Volian PDF.Library and VG - VlnItextFont.RegisterFont(fontName); - return iTextSharp.text.FontFactory.GetFont(fontName, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, size / 2, style); - } - public static iTextSharp.text.Font GetFont(System.Drawing.Font font) // fontName, int size, int style) - { - // B2019-116 Use Volian.Base.Library.VlnItextFont - // This is a generic class for dealing with iTextSharp Fonts - // Code moved and consolidated from Volian.Print.Library, Volian PDF.Library and VG - VlnItextFont.RegisterFont(font.Name); - int style = (font.Bold ? iTextSharp.text.Font.BOLD : 0) + (font.Italic ? iTextSharp.text.Font.ITALIC : 0); - return iTextSharp.text.FontFactory.GetFont(font.Name, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, font.Size, style); - } - } - internal static class SvgITextLibrary - { - public static void StrokeAndFill(PdfContentByte cb, bool stroke, bool fill) - { - switch ((stroke ? 1 : 0) + (fill ? 2 : 0)) - { - case 0: // No Stroke or Fill - break; - case 1: // Stroke - cb.Stroke(); - break; - case 2: // Fill - cb.Fill(); - break; - case 3: // Stroke and Fill - cb.FillStroke(); - break; - } - } - } - public abstract partial class SvgPart - { - public abstract void Draw(PdfContentByte cb, SvgScale scale, Svg mySvg, SvgPartInheritance myParent); - public abstract void Draw(PdfTemplate tmp, SvgScale scale, Svg mySvg, SvgPartInheritance myParent); - } - public partial class SvgPartInheritance : SvgPart - { - public override void Draw(PdfContentByte cb, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - } - public override void Draw(PdfTemplate tmp, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - } - } - // TODO: Pages - // TODO: Page Background - public delegate string SvgProcessTextEvent(object sender, SvgProcessTextArgs args); - public class SvgProcessTextArgs - { - private string _MyText; - public string MyText - { - get { return _MyText; } - } - private SvgText _MySvgText; - public SvgText MySvgText - { - get { return _MySvgText; } - set { _MySvgText = value; } - } - private SvgScale _MySvgScale; - public SvgScale MySvgScale - { - get { return _MySvgScale; } - set { _MySvgScale = value; } - } - public SvgProcessTextArgs(string myText, SvgText mySvgText, SvgScale mySvgScale) - { - _MyText = myText; - _MySvgText = mySvgText; - _MySvgScale = mySvgScale; - } - } - public partial class Svg : SvgGroup - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - public void DrawMacro(string macroDef, float x, float y, PdfContentByte cb) - { - _MyContentByte = cb; - SvgMeasurement X = new SvgMeasurement(x, E_MeasurementUnits.PT); - SvgMeasurement Y = new SvgMeasurement(Height.GetSizeInPoints(72) - y, E_MeasurementUnits.PT); - if (!this.LookUp.ContainsKey(macroDef)) return; // AEP - DU1 (missing C22 macro for AEP) - SvgGroup macro = this[macroDef] as SvgGroup; - macro.SvgParts.Draw(cb, MyScale.AdjustOrigin(X, Y), this,this); - } - public event SvgProcessTextEvent ProcessText; - internal string OnProcessText(string myText, SvgText mySvgText, SvgScale scale) - { - if (ProcessText != null) - return ProcessText(this, new SvgProcessTextArgs(myText, mySvgText, scale)); - return myText; - } - private Dictionary _Templates; - public PdfTemplate GetTemplate(string name, PdfContentByte cb) - { - if (!_Templates.ContainsKey(name)) - { - PdfTemplate tmp = cb.CreateTemplate(100, 100); - _Templates.Add(name, tmp); - } - return _Templates[name]; - } - public static void FixBoundingBox(PdfTemplate tmp, float xll, float yll, float xul, float yul) - { - float left = tmp.BoundingBox.Left; - float bottom = tmp.BoundingBox.Bottom; - float right = tmp.BoundingBox.Right; - float top = tmp.BoundingBox.Top; - left = (xll < xul ? (xll < left ? xll : left) : (xul < left ? xul : left)); - right = (xll > xul ? (xll > right ? xll : right) : (xul > right ? xul : right)); - bottom = (yll < yul ? (yll < bottom ? yll : bottom) : (yul < bottom ? yul : bottom)); - top = (yll > yul ? (yll > top ? yll : top) : (yul > top ? yul : top)); - tmp.BoundingBox = new iTextSharp.text.Rectangle(xll, yll, xul, yul); - } - private PdfContentByte _MyContentByte; - [XmlIgnore] - public PdfContentByte MyContentByte - { - get { return _MyContentByte; } - set { _MyContentByte = value; } - } - private float _LeftMargin = 0; - public float LeftMargin - { - get { return _LeftMargin; } - set { _LeftMargin = value; } - } - private float _TopMargin = 0; - public float TopMargin - { - get { return _TopMargin; } - set { _TopMargin = value; } - } - private SvgScale _MyScale; - public SvgScale MyScale - { - get - { - if (_MyScale == null) - { - _MyScale = new SvgScale(72, new System.Drawing.RectangleF(0, 0, _MyContentByte.PdfWriter.PageSize.Width, _MyContentByte.PdfWriter.PageSize.Height), _Width, _Height, _ViewBox); - _MyScale.XLowerLimit -= _LeftMargin; - _MyScale.YLowerLimit -= _TopMargin; - } - return _MyScale; - } - } - public void Draw(PdfContentByte cb) - { - //myPdf.Clear(); - _MyContentByte = cb; - _Templates = new Dictionary(); - //RegisterFonts(); - SvgParts.Draw(cb, MyScale, this, this); //72 - Points - } - public static iTextSharp.text.Font GetFont(string fontName) - { - // B2019-116 Use Volian.Base.Library.VlnItextFont - // This is a generic class for dealing with iTextSharp Fonts - // Code moved and consolidated from Volian.Print.Library, Volian PDF.Library and VG - VlnItextFont.RegisterFont(fontName); - return FontFactory.GetFont(fontName, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 10); - } - public static iTextSharp.text.Font GetFont(string fontName, float size, int style, System.Drawing.Color color) - { - // B2019-116 Use Volian.Base.Library.VlnItextFont - // This is a generic class for dealing with iTextSharp Fonts - // Code moved and consolidated from Volian.Print.Library, Volian PDF.Library and VG - VlnItextFont.RegisterFont(fontName); - return FontFactory.GetFont(fontName, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, size, style, new iTextSharp.text.Color(color)); - } - //private static string _FontFolder = null; - //public static string FontFolder - //{ - // get - // { - // if (_FontFolder == null) - // { - // _FontFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Fonts); - // if (_FontFolder == null) _FontFolder = (String)Registry.CurrentUser.OpenSubKey("Software").OpenSubKey("Microsoft").OpenSubKey("Windows").OpenSubKey("CurrentVersion").OpenSubKey("Explorer").OpenSubKey("Shell Folders").GetValue("Fontz"); - // _MyLog.WarnFormat("FontFolder set to {0}", _FontFolder); - // } - // return _FontFolder; - // } - //} - private static int _StackTraceSkip = 1; - private static DateTime _LastTime = DateTime.Now; - private static DateTime _StartTime = DateTime.Now; - public static void ResetWhen() - { - _StartTime = _LastTime = DateTime.Now; - } - public static void WhenAndWhere() - { - DateTime thisTime = DateTime.Now; - System.Diagnostics.StackFrame sf = new System.Diagnostics.StackFrame(_StackTraceSkip, true); - Console.WriteLine("{0:000000},{1:000000},'{2}',{3},'{4}'", TimeSpan.FromTicks(thisTime.Ticks - _StartTime.Ticks).TotalMilliseconds, - TimeSpan.FromTicks(thisTime.Ticks - _LastTime.Ticks).TotalMilliseconds, sf.GetMethod().Name, sf.GetFileLineNumber() - ,sf.GetFileName()); - _LastTime = thisTime; - } - } - public partial class SvgArc : SvgShapePart - { - public override void Draw(PdfContentByte cb, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - cb.SaveState(); - SetupInheritance(myParent.MyInheritedSettings); - if (FillColor != System.Drawing.Color.Transparent) - cb.SetColorFill(new Color(FillColor)); - if (OutlineWidth.Value != 0F && OutlineColor != System.Drawing.Color.Empty) - { - cb.SetLineWidth(scale.M(OutlineWidth)); - cb.SetColorStroke(new Color(OutlineColor)); - } - cb.Ellipse(scale.X(CX - Radius), scale.Y(cb, CY - Radius), scale.M(Radius * 2), scale.M(Radius * 2)); - SvgITextLibrary.StrokeAndFill(cb, (OutlineWidth.Value != 0F && OutlineColor != System.Drawing.Color.Empty), (FillColor != System.Drawing.Color.Transparent)); - cb.RestoreState(); - } - public override void Draw(PdfTemplate tmp, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - tmp.SaveState(); - SetupInheritance(myParent.MyInheritedSettings); - if (FillColor != System.Drawing.Color.Transparent) - tmp.SetColorFill(new Color(FillColor)); - if (OutlineWidth.Value != 0F && OutlineColor != System.Drawing.Color.Empty) - { - tmp.SetLineWidth(scale.M(OutlineWidth)); - tmp.SetColorStroke(new Color(OutlineColor)); - } - tmp.Ellipse(scale.X(CX - Radius), scale.Y(CY - Radius), scale.M(Radius * 2), scale.M(Radius * 2)); - SvgITextLibrary.StrokeAndFill(tmp, (OutlineWidth.Value != 0F && OutlineColor != System.Drawing.Color.Empty), (FillColor != System.Drawing.Color.Transparent)); - tmp.RestoreState(); - } - } - public partial class SvgCircle : SvgShapePart - { - public override void Draw(PdfContentByte cb, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - cb.SaveState(); - bool fill = FillColor != System.Drawing.Color.Transparent; - bool stroke = OutlineWidth.Value != 0F && OutlineColor != System.Drawing.Color.Empty; - if (fill) - cb.SetColorFill(new Color(FillColor)); - if (stroke) - { - cb.SetLineWidth(scale.M(OutlineWidth)); - cb.SetColorStroke(new Color(OutlineColor)); - } - float x1 = scale.X(CX - Radius); - float y1 = scale.Y(cb, CY - Radius); - float x2 = scale.X(CX + Radius); - float y2 = scale.Y(cb, CY + Radius); - cb.Ellipse(x1, y1, x2, y2); - SvgITextLibrary.StrokeAndFill(cb, stroke, fill); - cb.RestoreState(); - } - public override void Draw(PdfTemplate tmp, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - tmp.SaveState(); - bool fill = FillColor != System.Drawing.Color.Transparent; - bool stroke = OutlineWidth.Value != 0F && OutlineColor != System.Drawing.Color.Empty; - if (fill) - tmp.SetColorFill(new Color(FillColor)); - if (stroke) - { - tmp.SetLineWidth(scale.M(OutlineWidth)); - tmp.SetColorStroke(new Color(OutlineColor)); - } - tmp.Ellipse(scale.X(CX - Radius), scale.Y(CY - Radius), scale.X(CX + Radius), scale.Y(CY + Radius)); - SvgITextLibrary.StrokeAndFill(tmp, stroke, fill); - tmp.RestoreState(); - Svg.FixBoundingBox(tmp, scale.X(CX - Radius), scale.Y(CY - Radius), scale.X(CX + Radius), scale.Y(CY + Radius)); - } - } - public partial class SvgDefine : SvgGroup - { - public override void Draw(PdfContentByte cb, SvgScale myScale, Svg mySvg, SvgPartInheritance myParent) - { - // TODO: Could I try creating a template - // Don't draw - // SvgParts.Draw(cb, myScale, mySvg, myParent); - PdfTemplate tmp = null; - if (ID != "") tmp = mySvg.GetTemplate(ID, cb); // the size will be adjusted as items are added. - SvgParts.Draw(tmp, myScale, mySvg, myParent); - } - public override void Draw(PdfTemplate tmp, SvgScale myScale, Svg mySvg, SvgPartInheritance myParent) - { - // TODO: Could I try creating a template - // Don't draw - // SvgParts.Draw(cb, myScale, mySvg, myParent); - //PdfTemplate tmp2 = mySvg.GetTemplate(ID); // the size will be adjusted as items are added. - //SvgParts.Draw(tmp2, myScale, mySvg, myParent); - } - } - public partial class SvgUse : SvgPartInheritance - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - private static List _MissingMacros = new List(); - public override void Draw(PdfContentByte cb, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - // TODO: Could I use the template - SetupInheritance(myParent.MyInheritedSettings); - if (mySvg.LookUp.ContainsKey(_UseID)) - mySvg[_UseID].Draw(cb, scale.AdjustOrigin(X, Y), mySvg, this); - else - { - if (!_MissingMacros.Contains(_UseID)) - { - _MissingMacros.Add(_UseID); - _MyLog.WarnFormat("Missing Macro '{0}'", _UseID); - } - } - //cb.AddTemplate(mySvg.GetTemplate(_UseID.Substring(1),cb), scale.X(X), scale.Y(cb, Y)); - } - public override void Draw(PdfTemplate tmp, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - // TODO: Could I use the template - SetupInheritance(myParent.MyInheritedSettings); - //mySvg[_UseID.Substring(1)].Draw(tmp, scale.AdjustOrigin(X, Y), mySvg, this); - mySvg[_UseID].Draw(tmp, scale.AdjustOrigin(X, Y), mySvg, this); - } - } - public partial class SvgEllipse : SvgShapePart - { - public override void Draw(PdfContentByte cb, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - cb.SaveState(); - bool fill = FillColor != System.Drawing.Color.Transparent; - bool stroke = OutlineWidth.Value != 0F && OutlineColor != System.Drawing.Color.Empty; - if (fill) - cb.SetColorFill(new Color(FillColor)); - if (stroke) - { - cb.SetLineWidth(scale.M(OutlineWidth)); - cb.SetColorStroke(new Color(OutlineColor)); - } - cb.Ellipse(scale.X(CX - RX), scale.Y(cb, CY - RY), scale.X(CX + RX), scale.Y(cb, CY + RY)); - SvgITextLibrary.StrokeAndFill(cb, stroke, fill); - cb.RestoreState(); - } - public override void Draw(PdfTemplate tmp, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - tmp.SaveState(); - bool fill = FillColor != System.Drawing.Color.Transparent; - bool stroke = OutlineWidth.Value != 0F && OutlineColor != System.Drawing.Color.Empty; - if (fill) - tmp.SetColorFill(new Color(FillColor)); - if (stroke) - { - tmp.SetLineWidth(scale.M(OutlineWidth)); - tmp.SetColorStroke(new Color(OutlineColor)); - } - tmp.Ellipse(scale.X(CX - RX), scale.Y(CY - RY), scale.X(CX + RX), scale.Y(CY + RY)); - SvgITextLibrary.StrokeAndFill(tmp, stroke, fill); - tmp.RestoreState(); - } - } - public partial class SvgGroup : SvgPartInheritance - { - public override void Draw(PdfContentByte cb, SvgScale myScale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - _SvgParts.Draw(cb, myScale, mySvg, this); - } - public override void Draw(PdfTemplate tmp, SvgScale myScale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - if (ID != "") tmp = mySvg.GetTemplate(ID, mySvg.MyContentByte); // the size will be adjusted as items are added. - SvgParts.Draw(tmp, myScale, mySvg, this); - } - } - public partial class SvgImage : SvgPart - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - public override void Draw(PdfContentByte cb, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - cb.SaveState(); - iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(ImagePath); - if (Height.Value != 0) - img.ScaleAbsoluteHeight(scale.M(Height)); - if (Width.Value != 0) - img.ScaleAbsoluteWidth(scale.M(Width)); - img.SetAbsolutePosition(scale.X(X), scale.Y(cb, Y) - scale.M(img.ScaledHeight)); - // The next three lines set the image opacity for testing - //PdfGState gState = new PdfGState(); - //gState.FillOpacity = .2f; - //cb.SetGState(gState); - cb.AddImage(img); - cb.RestoreState(); - } - public override void Draw(PdfTemplate tmp, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - tmp.SaveState(); - try - { - if (ImagePath != null) - { - iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(ImagePath); - img.ScaleAbsolute(scale.M(Width), scale.M(Height)); - img.SetAbsolutePosition(scale.X(X), scale.Y(Y) - scale.M(img.ScaledHeight)); - tmp.AddImage(img); - } - } - catch (Exception ex) - { - //_MyLog.WarnFormat("SvgImage.Draw '{0}' {1} - {2}", ImagePath, ex.GetType().Name, ex.Message); - } - tmp.RestoreState(); - } - } - public partial class SvgLine : SvgLinePart - { - public override void Draw(PdfContentByte cb, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - cb.SaveState(); - bool stroke = LineColor != System.Drawing.Color.Empty; - if (stroke) - { - cb.SetLineWidth(LineWidth.Value); - cb.SetColorStroke(new Color(LineColor)); - } - cb.SetLineCap(PdfContentByte.LINE_CAP_ROUND); - if (myParent is SvgGroup && (myParent as SvgGroup).Description.ToUpper() == "ABSOLUTE") - { - cb.MoveTo(scale.AbsX(X1), scale.AbsY(cb, Y1)); - cb.LineTo(scale.AbsX(X2), scale.AbsY(cb, Y2)); - } - else - { - cb.MoveTo(scale.X(X1), scale.Y(cb, Y1)); - cb.LineTo(scale.X(X2), scale.Y(cb, Y2)); - } - cb.Stroke(); - cb.RestoreState(); - } - public override void Draw(PdfTemplate tmp, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - tmp.SaveState(); - bool stroke = LineColor != System.Drawing.Color.Empty; - if (stroke) - { - tmp.SetLineWidth(scale.M(LineWidth)); - tmp.SetColorStroke(new Color(LineColor)); - } - tmp.MoveTo(scale.X(X1), scale.Y(Y1)); - tmp.LineTo(scale.X(X2), scale.Y(Y2)); - tmp.Stroke(); - tmp.RestoreState(); - Svg.FixBoundingBox(tmp, scale.X(X1), scale.Y(Y1), scale.X(X2), scale.Y(Y2)); - } - } - public partial class SvgParts : CollectionBase - { - public void Draw(PdfContentByte cb, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - foreach (SvgPart svgPart in List) - svgPart.Draw(cb, scale, mySvg, myParent); - } - public void Draw(PdfTemplate tmp, SvgScale myScale, Svg mySvg, SvgPartInheritance myParent) - { - foreach (SvgPart svgPart in List) - svgPart.Draw(tmp, myScale, mySvg, myParent); - } - } - public partial class SvgRectangle : SvgShapePart - { - public override void Draw(PdfContentByte cb, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - cb.SaveState(); - bool fill = FillColor != System.Drawing.Color.Transparent; - bool stroke = OutlineWidth.Value != 0F && OutlineColor != System.Drawing.Color.Empty; - if (fill) - cb.SetColorFill(new Color(FillColor)); - if (stroke) - { - cb.SetLineWidth(scale.M(OutlineWidth)); - cb.SetColorStroke(new Color(OutlineColor)); - } - if (myParent is SvgGroup && (myParent as SvgGroup).Description.ToUpper() == "ABSOLUTE") - cb.RoundRectangle(scale.AbsX(X), scale.AbsY(cb, Y), scale.M(Width), -scale.M(Height), .005F); - else - cb.RoundRectangle(scale.X(X), scale.Y(cb, Y), scale.M(Width), -scale.M(Height), .005F); - SvgITextLibrary.StrokeAndFill(cb, stroke, fill); - cb.RestoreState(); - } - public override void Draw(PdfTemplate tmp, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - SetupInheritance(myParent.MyInheritedSettings); - if (ID != "") tmp = mySvg.GetTemplate(ID, mySvg.MyContentByte); // the size will be adjusted as items are added. - tmp.SaveState(); - bool fill = FillColor != System.Drawing.Color.Transparent; - bool stroke = OutlineWidth.Value != 0F && OutlineColor != System.Drawing.Color.Empty; - if (fill) - tmp.SetColorFill(new Color(FillColor)); - if (stroke) - { - tmp.SetLineWidth(scale.M(OutlineWidth)); - tmp.SetColorStroke(new Color(OutlineColor)); - } - tmp.Rectangle(scale.X(X), scale.Y(Y), scale.M(Width), -scale.M(Height)); - SvgITextLibrary.StrokeAndFill(tmp, stroke, fill); - Svg.FixBoundingBox(tmp, scale.X(X), scale.Y(Y), scale.X(X) + scale.M(Width), scale.Y(Y) - scale.M(Height)); - tmp.RestoreState(); - } - } - public partial class SvgText : SvgShapePart - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - private static string ReplaceSpecialCharacter(Match m) - { - int i = int.Parse(m.ToString().Substring(2, m.ToString().Length - 3)); - char c = (char)i; - return c.ToString(); - } - private static string ReplaceHexCharacter(Match m) - { - int i = int.Parse(m.ToString().Substring(2, 2), System.Globalization.NumberStyles.HexNumber); - char c = (char)i; - return c.ToString(); - } - public int Align - { - get - { - switch (Justify) - { - case SvgJustify.Left: - return Element.ALIGN_LEFT; - break; - case SvgJustify.Center: - return Element.ALIGN_CENTER; - break; - case SvgJustify.Right: - return Element.ALIGN_RIGHT; - break; - } - return Element.ALIGN_LEFT; - } - } - public class VlnSplitCharacter : ISplitCharacter - { - public bool IsSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck) - { - return (cc[current] == ' '); - } - public bool IsSplitCharacter(char c) - { - return (c == ' '); - } - } - public static VlnSplitCharacter mySplitter = new VlnSplitCharacter(); - // Draw's using PdfContentByte are for drawing PageList items. - public override void Draw(PdfContentByte cb, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - string text = mySvg.OnProcessText(Text, this, scale); - if (text == string.Empty) return; - // Replace hard hyphen with hyphen when printing pagelist items - // this will enable the hyphens to be found in a PDF search - if(text.Contains("\\u8209?")) - text = text.Replace("\\u8209?", "-"); - // Replace symbol backslash with a text backslash when printing pagelist items - // this will enable the backslash to be found in a PDF search - if (text.Contains("\\u9586?")) - text = text.Replace("\\u9586?", "\\"); - SetupInheritance(myParent.MyInheritedSettings); - float yScale = (myParent is SvgGroup && (myParent as SvgGroup).Description.ToUpper() == "ABSOLUTE") ? scale.AbsY(cb, Y): scale.Y(cb, Y); - cb.SaveState(); - bool fill = FillColor != System.Drawing.Color.Transparent; - bool stroke = OutlineWidth.Value != 0F && OutlineColor != System.Drawing.Color.Empty; - - // Strip out inline commands that are overridden by the fontStyle - if (Font.Bold) text = StripCommands(text, @"\\b0", @"\\b"); - if (Font.Italic) text = StripCommands(text, @"\\i0", @"\\i"); - if (Font.Underline) text = StripCommands(text, @"\\ulnone", @"\\ul0", @"\\ul"); - - float fontSize = scale.M(new SvgMeasurement(Font.SizeInPoints, E_MeasurementUnits.PT)); - int fontStyle = (Font.Bold ? iTextSharp.text.Font.BOLD : 0) + (Font.Italic ? iTextSharp.text.Font.ITALIC : 0); - // B2019-116 Use Volian.Base.Library.VlnItextFont - // This is a generic class for dealing with iTextSharp Fonts - // Code moved and consolidated from Volian.Print.Library, Volian PDF.Library and VG - VlnItextFont.RegisterFont(Font.Name); - iTextSharp.text.Font font = FontFactory.GetFont(Font.Name, BaseFont.IDENTITY_H,BaseFont.EMBEDDED, fontSize, fontStyle, new Color(FillColor)); - - Phrase ph = BuildPhrase(text, fontSize, fontStyle, font); - ColumnText ct = new ColumnText(cb); - float x = (myParent is SvgGroup && (myParent as SvgGroup).Description.ToUpper() == "ABSOLUTE") ? scale.AbsX(X): scale.X(X); - float w = 0; // chk.GetWidthPoint(); - // Change the chunks to only split on spaces rather than spaces and hyphens - foreach (Chunk chk in ph.Chunks) - { - w += chk.GetWidthPoint(); - // Change the chunks to only split on spaces rather than spaces and hyphens - if (chk.Attributes == null || !chk.Attributes.ContainsKey("NoSplit")) - { - if (chk.Attributes == null) chk.Attributes = new Hashtable(); - chk.SetSplitCharacter(mySplitter); - chk.Attributes.Add("NoSplit", false); - } - } - switch (Justify) - { - //case SvgJustify.Left: - // x = x; - // break; - case SvgJustify.Center: - x-=w/2; - break; - case SvgJustify.Right: - x-=w; - break; - } - float y = yScale; - float xRight = x + w; - float Offset = 0; - if (Font.Underline) - { - foreach (Chunk chk in ph.Chunks) - chk.SetUnderline(new Color(FillColor), 0, 0.047F, 0, -.1373F, PdfContentByte.LINE_CAP_ROUND); - } - // The following line was changed so that a 6.5 size font would print, i.e. the 2 was changed to a 3 to make the - // 6.5 size work. - ct.SetSimpleColumn(x, y + ph.Leading + Offset, xRight + 1F, y + ph.Leading + Offset - 3 * font.Size);//2 * font.Size); - ct.AddElement(ph); - cb.SaveState(); - cb.SetColorFill(new Color(FillColor)); - ct.Go(); - cb.RestoreState(); - } - // F2021-053: Do replace words for Page List items. Format flags to use for compressing and locating sub/super scripts - public static bool CompressSuper = false; - public static bool CompressSub = false; - public static bool CompressPropSubSup = false; - private Phrase BuildPhrase(string text, float fontSize, int fontStyle, iTextSharp.text.Font font) - { - //if (text == "Caution") - //{ - // if (iTextSharp.text.FontFactory.IsRegistered("VolianScript")) - // Console.WriteLine("Is Registered"); - // Console.WriteLine("stop"); - //} - bool fontUnderline = false; - float fontTextRise = 0; - - text = Regex.Replace(text, @"\\[Uu][0-9]+[?]", new MatchEvaluator(ReplaceSpecialCharacter)); - text = Regex.Replace(text, @"\\'[0-9a-fA-F][0-9a-fA-F]", new MatchEvaluator(ReplaceHexCharacter)); - text += " "; - - //if (text.Contains("\\")) -- these 2 lines made \ul and \ulnone in page list text not get resolved and would then print - //text = text.Replace("\\", ((char)9586).ToString()); // B2016-155 convert backslash char to the unicode symbol - to allow processing rtf commands \ul, \up, \dn, etc. - // B2016-167: handle backslashes but don't do if the backslash is an underline rtf command - int stindx = text.IndexOf("\\"); - while (stindx != -1) - { - if ((stindx + 2 < text.Length - 1 && text.ToUpper().IndexOf("UL", stindx + 1) == stindx + 1) || //don't replace it - // B2020-041: PSI (this happened for all pagelist items) print doesn't resolve super/sub script, bold, italics: - (stindx + 2 < text.Length - 1 && text.ToUpper().IndexOf("UP", stindx + 1) == stindx + 1) || - (stindx + 1 < text.Length - 1 && text.ToUpper().IndexOf("B", stindx + 1) == stindx + 1) || - (stindx + 2 < text.Length - 1 && text.ToUpper().IndexOf("B0", stindx + 1) == stindx + 1) || - (stindx + 2 < text.Length - 1 && text.ToUpper().IndexOf("DN", stindx + 1) == stindx + 1) || - (stindx + 1 < text.Length - 1 && text.ToUpper().IndexOf("I", stindx + 1) == stindx + 1) || - (stindx + 2 < text.Length - 1 && text.ToUpper().IndexOf("I0", stindx + 1) == stindx + 1)) - stindx = text.IndexOf("\\", stindx + 1); - else - { - text = text.Remove(stindx,1); - text = text.Insert(stindx, ((char)9586).ToString()); - stindx = text.IndexOf("\\",stindx); - } - } - Phrase ph = new Phrase(); - while (text.Length > 0) - { - string next = ""; - Match m = Regex.Match(text, @"\\[^ ]*?[ $]"); - if (m.Success) - { - // text is portion of text and next is remaining portion to process next - next = text.Substring(m.Index + m.Length); - text = text.Substring(0, m.Index); - } - else - if (text[text.Length - 1] == ' ') text = text.Substring(0, text.Length - 1); - // B2016-155 convert the backslash symbol back to the backslash character since we look for specific rft commands below - foreach (Chunk chk in BuildPartialPhrase(text.Replace(((char)9586).ToString(),"\\"), fontSize, fontStyle, font).Chunks) - { - if (fontUnderline) chk.SetUnderline(font.Color, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); - if (fontTextRise != 0) chk.SetTextRise(fontTextRise * chk.Font.Size); - ph.Add(chk); - } - if (m.Success) - { - // bold, underline, italics, subscript, superscript - if (m.Value.Contains(@"\ulnone") || m.Value.Contains(@"\ul0")) // off - fontUnderline = false; - else if (m.Value.Contains(@"\ul")) - fontUnderline = true; - if (m.Value.Contains(@"\up0") || m.Value.Contains(@"\dn0")) - { - fontTextRise = 0; - // B2021-133 need to reset the font size after doing a compressed super or sub script - if (CompressSuper || CompressPropSubSup || CompressSub) - font = FontFactory.GetFont(font.Familyname, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, fontSize, fontStyle, new Color(FillColor)); ; - } - else if (m.Value.Contains(@"\up")) - { - fontTextRise = .25F; - // F2021-053: Do replace words for Page List items. size and locate superscript - if (CompressSuper || CompressPropSubSup) - { - font = FontFactory.GetFont(font.Familyname, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, fontSize * .75f, fontStyle, new Color(FillColor)); ; - fontTextRise = .33F; - } - } - else if (m.Value.Contains(@"\dn")) - { - fontTextRise = -.25F; - // F2021-053: Do replace words for Page List items. size subscript - if (CompressSub || CompressPropSubSup) - font = FontFactory.GetFont(font.Familyname, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, fontSize * .75f, fontStyle, new Color(FillColor)); ; - } - if (m.Value.Contains(@"\b0")) - { - fontStyle ^= iTextSharp.text.Font.BOLD; - font = FontFactory.GetFont(font.Familyname, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, fontSize, fontStyle, new Color(FillColor)); - } - else if (m.Value.Contains(@"\b")) - { - fontStyle |= iTextSharp.text.Font.BOLD; - font = FontFactory.GetFont(font.Familyname, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, fontSize, fontStyle, new Color(FillColor)); - } - if (m.Value.Contains(@"\i0")) - { - fontStyle ^= iTextSharp.text.Font.ITALIC; - font = FontFactory.GetFont(font.Familyname, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, fontSize, fontStyle, new Color(FillColor)); - } - else if (m.Value.Contains(@"\i")) - { - fontStyle |= iTextSharp.text.Font.ITALIC; - font = FontFactory.GetFont(font.Familyname, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, fontSize, fontStyle, new Color(FillColor)); - } - } - text = next; - } - return ph; - } - - private Phrase BuildPartialPhrase(string text, float fontSize, int fontStyle, iTextSharp.text.Font font) - { - iTextSharp.text.pdf.FontSelector fs = new FontSelector(); - fs.AddFont(font); - if (font.BaseFont != null && font.BaseFont.GetWidthPoint("m", 12) == font.BaseFont.GetWidthPoint(".", 12)) - { - // B2019-116 Use Volian.Base.Library.VlnItextFont - // This is a generic class for dealing with iTextSharp Fonts - // Code moved and consolidated from Volian.Print.Library, Volian PDF.Library and VG - VlnItextFont.RegisterFont("VESymbFix"); - fs.AddFont(FontFactory.GetFont("VESymbFix", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, fontSize, fontStyle, new Color(FillColor))); - } - else - { - // C2017-036 get best available proportional font for symbols - // B2019-116 Use Volian.Base.Library.VlnItextFont - // This is a generic class for dealing with iTextSharp Fonts - // Code moved and consolidated from Volian.Print.Library, Volian PDF.Library and VG - VlnItextFont.RegisterFont(Volian.Base.Library.vlnFont.ProportionalSymbolFont); - fs.AddFont(FontFactory.GetFont(Volian.Base.Library.vlnFont.ProportionalSymbolFont, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, fontSize, fontStyle, new Color(FillColor))); - } - Phrase ph = fs.Process(text); - return ph; - } - - private string StripCommands(string text, params string [] rtfCommands) - { - foreach (string rtfCommand in rtfCommands) - { - // remove rtf command preceeded by another rtf command with previous - // rtf ending with a space, i.e. "\ulnone\b0 " removing the "b0", leaves " " - // * - as many as there are, ? - minimum number that results in a match - text = Regex.Replace(text, @"(\\[^ ]*?)" + rtfCommand + " ", "$1 "); - // remove rtf command follwed by a space - text = Regex.Replace(text, rtfCommand + " ", ""); - // remove just the rtf command - text = Regex.Replace(text, rtfCommand, ""); - } - return text; - } - // Draw's using PdfTemplate are for drawing SVG (16-bit genmac). - public override void Draw(PdfTemplate tmp, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) - { - string text = mySvg.OnProcessText(Text, this, scale); - if (text == string.Empty) return; - SetupInheritance(myParent.MyInheritedSettings); - float yScale = -scale.Y(Y); - tmp.SaveState(); - bool fill = FillColor != System.Drawing.Color.Transparent; - bool stroke = OutlineWidth.Value != 0F && OutlineColor != System.Drawing.Color.Empty; - tmp.BeginText(); - if (fill) - tmp.SetColorFill(new Color(FillColor)); - if (stroke) - { - tmp.SetLineWidth(scale.M(OutlineWidth)); - tmp.SetColorStroke(new Color(OutlineColor)); - } - iTextSharp.text.Font font = Svg.GetFont(Font.Name); - BaseFont baseFont = font.BaseFont; - if (baseFont == null) - { - // B2019-116 Use Volian.Base.Library.VlnItextFont - // This is a generic class for dealing with iTextSharp Fonts - // Code moved and consolidated from Volian.Print.Library, Volian PDF.Library and VG - VlnItextFont.RegisterFont(Font.Name); - font = Svg.GetFont(Font.Name); - baseFont = font.BaseFont; - if(baseFont==null) - _MyLog.WarnFormat("Missing Font {0}", Font.Name); - } - tmp.MoveText(scale.X(X), yScale); - tmp.SetFontAndSize(baseFont, scale.M(new SvgMeasurement(Font.SizeInPoints, E_MeasurementUnits.PT))); - switch ((stroke ? 1 : 0) + (fill ? 2 : 0)) - { - case 0: // No Stroke or Fill - tmp.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_INVISIBLE); - break; - case 1: // Stroke - tmp.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_STROKE); - break; - case 2: // Fill - tmp.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL); - break; - case 3: // Stroke and Fill - tmp.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE); - break; - } - tmp.ShowTextKerned(text); - tmp.EndText(); - tmp.RestoreState(); - } - } - public class SvgPageTotal - { - public SvgPageTotal(System.Drawing.Font myFont, PdfContentByte cb) - { - _MyFont = myFont; - _MyTemplate = cb.CreateTemplate(100, 100); - _MyTemplate.BoundingBox= new Rectangle(-20, -20, 100, 100); - } - private int _PageCount=1; - private System.Drawing.Font _MyFont; - private PdfTemplate _MyTemplate; - public PdfTemplate MyTemplate - { - get { return _MyTemplate; } - } - public void Draw() - { - // Output Page Count - _MyTemplate.BeginText(); - iTextSharp.text.Font font = Svg.GetFont(_MyFont.Name); - BaseFont baseFont = font.BaseFont; - _MyTemplate.SetFontAndSize(baseFont,_MyFont.Size); - _MyTemplate.SetTextMatrix(0, 0); - _MyTemplate.ShowText(_PageCount.ToString()); - _MyTemplate.EndText(); - } - } - public class SvgPageHelper : PdfPageEventHelper - { - private bool _SpecialCAS; // B2023-005: CAS page, rotate watermark - public bool SpecialCAS - { - get { return _SpecialCAS; } - set { _SpecialCAS = value; } - } - private bool _IsLandscape; - public bool IsLandscape - { - get { return _IsLandscape; } - set { _IsLandscape = value; } - } - // B2019-145: added the following property so that the code would know that an adjustment should be made to print the watermark - // in landscape mode. Note that 'IsLandscape' could not be used because it also does the pagelist items. - private bool _IsWatermarkLandscape; - public bool IsWatermarkLandscape - { - get { return _IsWatermarkLandscape; } - set { _IsWatermarkLandscape = value; } - } - // B2018-124 we no longer need is list was not hanling "Information Only" water mark - //private List _AllowedWatermarks = new List(); - //public List AllowedWatermarks - //{ - // get { return _AllowedWatermarks; } - // set { _AllowedWatermarks = value; } - //} - private Svg _MySvg; - public Svg MySvg - { - get { return _MySvg; } - set { _MySvg = value; } - } - private PdfLayer _PageListLayer; - public PdfLayer PageListLayer - { - get { return _PageListLayer; } - set { _PageListLayer = value; } - } - private PdfLayer _WatermarkLayer; - public PdfLayer WatermarkLayer - { - get { return _WatermarkLayer; } - set { _WatermarkLayer = value; } - } - private string _Watermark=string.Empty; - public string Watermark - { - get { return _Watermark; } - set { _Watermark = value; } - } - private string _WatermarkColor = "BLUE"; - public string WatermarkColor - { - get { return _WatermarkColor; } - set { _WatermarkColor = value; } - } - private PdfLayer _PROMSVersionLayer; //C2018-009 print PROMS version - public PdfLayer PROMSVersionLayer - { - get { return _PROMSVersionLayer; } - set { _PROMSVersionLayer = value; } - } - private string _PROMSVersion = string.Empty; - public string PROMSVersion - { - get { return _PROMSVersion; } - set { _PROMSVersion = value; } - } - private bool _DoZoomOMatic = false; - public bool DoZoomOMatic - { - get { return _DoZoomOMatic; } - set { _DoZoomOMatic = value; } - } - private int _CurrentPageNumber = 0; - public int CurrentPageNumber - { - get { return _CurrentPageNumber; } - set { _CurrentPageNumber = value; } - } - private int _CurrentPageNumberNoFoldouts = 0; - public int CurrentPageNumberNoFoldouts - { - get { return _CurrentPageNumberNoFoldouts; } - set { _CurrentPageNumberNoFoldouts = value; } - } - private int _CurrentTOCPageNumber = 0; - public int CurrentTOCPageNumber - { - get { return _CurrentTOCPageNumber; } - set { _CurrentTOCPageNumber = value; } - } - private bool _OnFoldoutPage = false; - public bool OnFoldoutPage - { - get { return _OnFoldoutPage; } - set { _OnFoldoutPage = value; } - } - private bool _CreatingFoldoutPage = false; - public bool CreatingFoldoutPage - { - get { return _CreatingFoldoutPage; } - set { _CreatingFoldoutPage = value; } - } - private bool _CreatingSupInfoPage = false; - public bool CreatingSupInfoPage - { - get { return _CreatingSupInfoPage; } - set { _CreatingSupInfoPage = value; } - } - public SvgPageHelper(Svg mySvg) - { - _MySvg = mySvg; - } - public SvgPageHelper() - { - } - private int _BGPageOffset = 0; - public int BackgroundPageOffset - { - get { return _BGPageOffset; } - set { _BGPageOffset = value; } - } - protected virtual string ReplacePageListToken(Match match) - { - return string.Empty; - } - - public override void OnOpenDocument(PdfWriter writer, Document document) - { - //base.OnOpenDocument(writer, document); - //tmpTotal = writer.DirectContent.CreateTemplate(100, 100); - //tmpTotal.BoundingBox = new Rectangle(-20, -20, 100, 100); - //PdfContentByte cb = writer.DirectContent; - } - public override void OnEndPage(PdfWriter writer, Document document) - { - if (!OnFoldoutPage) - { - base.OnEndPage(writer, document); - // note that pagelist items are not done for Foldout & SupInfo (facing pages) - they get merged onto pages that have this - if (!CreatingFoldoutPage && !CreatingSupInfoPage) - { - DrawBackground(writer.DirectContentUnder); - DrawPageList(writer.DirectContent); - DrawWatermark(writer.DirectContent); - DrawPROMSVersion(writer.DirectContent); //C2018-009 print PROMS version - if (DoZoomOMatic) DrawZoomOMatic(writer.DirectContent); - } - CurrentPageNumber++; - CurrentPageNumberNoFoldouts++; - } - else - { - // note that pagelist items are not done for Foldout & SupInfo (facing pages) - they get merged onto pages that have this - if (!CreatingFoldoutPage && !CreatingSupInfoPage) - { - DrawBackground(writer.DirectContentUnder); - DrawPageList(writer.DirectContent); - DrawWatermark(writer.DirectContent); - DrawPROMSVersion(writer.DirectContent); //C2018-009 print PROMS version - if (DoZoomOMatic) DrawZoomOMatic(writer.DirectContent); - CurrentPageNumber++; - } - } - } - private PdfReader _BackgroundReader = null; - public PdfReader BackgroundReader - { - get - { - if (_BackgroundReader == null && _BackgroundFile != null && File.Exists(_BackgroundFile)) - _BackgroundReader = new PdfReader(_BackgroundFile); - return _BackgroundReader; - } - } - public bool Back32BitPROMS - { - get - { - if (BackgroundReader == null) return false; - return BackgroundReader.Info["Producer"].ToString().StartsWith("iTextSharp"); - } - } - private string _BackgroundFile = null; - public string BackgroundFile - { - get { return _BackgroundFile; } - set { _BackgroundFile = value; } - } - private PdfLayer _BackgroundLayer = null; - public PdfLayer BackgroundLayer - { - get { return _BackgroundLayer; } - set { _BackgroundLayer = value; } - } - private System.Drawing.PointF _BackgroundOffset = new System.Drawing.PointF(0, 0); - public System.Drawing.PointF BackgroundOffset - { - get { return _BackgroundOffset; } - set { _BackgroundOffset = value; } - } - public int BackgroundPageCount - { - get { return BackgroundReader == null ? 0 : BackgroundReader.NumberOfPages; } - } - private PdfImportedPage GetBackgroundPage(PdfContentByte cb) - { - if (BackgroundReader == null) return null; - int page = cb.PdfWriter.CurrentPageNumber + BackgroundPageOffset; - if (page < 1 || page > BackgroundPageCount) return null; - return cb.PdfWriter.GetImportedPage(BackgroundReader, page); - } - private void DrawBackground(PdfContentByte cb) - { - PdfImportedPage backgroundPage = GetBackgroundPage(cb); - if (backgroundPage == null) return; - if(BackgroundLayer != null) cb.BeginLayer(BackgroundLayer); - iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(backgroundPage); - image.SetAbsolutePosition(BackgroundOffset.X,BackgroundOffset.Y); - cb.AddImage(image); - if (BackgroundLayer != null) cb.EndLayer(); - } - private void DrawZoomOMatic(PdfContentByte cb) - { - cb.SaveState(); - ZoomOMatic(cb, 36); - cb.RestoreState(); - } - private bool _AllowAllWatermarks = false; - public bool AllowAllWatermarks - { - get { return _AllowAllWatermarks; } - set { _AllowAllWatermarks = value; } - } - //C2022-004 This will return the system drawing color from either the color name or ARGB values - public System.Drawing.Color GetWatermarkColor(string colorDescription) - { - System.Drawing.Color systemColor; - if (colorDescription.StartsWith("[A=")) // if color is ARGB representation, parse out the values - { - // initialize the ARGB value to white - int Alpha = 255; - int Red = 255; - int Green = 255; - int Blue = 255; - // The color is formatted as ARGB in a string (i.e. "[A=255, R=157, G=187, B=97]") in the format file - string argbColor = colorDescription.Replace("[", "").Replace("]", "").Replace(" ", ""); // remove starting and ending square brackets - // split the string on the commas and find each ARGB value - string[] argbSplit = argbColor.Split(','); - foreach (string s in argbSplit) - { - if (s[0] == 'A') - Alpha = Convert.ToInt32(s.Substring(2)); - else if (s[0] == 'R') - Red = Convert.ToInt32(s.Substring(2)); - else if (s[0] == 'G') - Green = Convert.ToInt32(s.Substring(2)); - else if (s[0] == 'B') - Blue = Convert.ToInt32(s.Substring(2)); - } - systemColor = System.Drawing.Color.FromArgb(Alpha, Red, Green, Blue); - } - else - systemColor = System.Drawing.Color.FromName(colorDescription); // get from color name that was passed in - return systemColor; - } - private void DrawWatermark(PdfContentByte cb) - { - if (Watermark == null || Watermark.ToLower().Contains("none") || Watermark == "") return; - //if (!AllowAllWatermarks && !AllowedWatermarks.Contains(Watermark)) return; -- B2018-124 not needed anymore with above if statement - this does not hanle "Information Only" - cb.SaveState(); - if (_WatermarkLayer != null) cb.BeginLayer(_WatermarkLayer); - // B2023-005: Beaver Valley, second page of CAS page is a 'foldout' on large paper - need to rotate the - // watermark - if (SpecialCAS) - { - double a = -180 * (Math.PI / 180); - System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix((float)Math.Cos(a), (float)Math.Sin(a), (float)-Math.Sin(a), (float)Math.Cos(a), cb.PdfDocument.PageSize.Width, cb.PdfDocument.PageSize.Height); - cb.Transform(myMatrix); - - } - else if (IsLandscape || IsWatermarkLandscape) // B2019-145: Added for printing landscape watermark on step section pages. - { - // The watermark needs to be rotated back for landscape pagelist - B2016-191 - //double a = -33 * (Math.PI / 180); - //System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix((float)Math.Cos(a), (float)Math.Sin(a), (float)-Math.Sin(a), (float)Math.Cos(a), -60, 320); - double a = -90 * (Math.PI / 180); - System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix((float)Math.Cos(a), (float)Math.Sin(a), (float)-Math.Sin(a), (float)Math.Cos(a), 0, cb.PdfDocument.PageSize.Height); - cb.Transform(myMatrix); - } - SvgWatermark myWatermark = new SvgWatermark(cb, Watermark, GetWatermarkColor(WatermarkColor), .15F); - //myWatermark.SetSquareDotPattern(.7F); - myWatermark.Draw(); - if (_WatermarkLayer != null) cb.EndLayer(); - cb.RestoreState(); - } - //C2018-009 print PROMS version - private void DrawPROMSVersion(PdfContentByte cb) - { - cb.SaveState(); - string text = PROMSVersion; - float textBase =cb.PdfDocument.Top + 19; - float textLeft = cb.PdfDocument.Right - 15; - if (_PROMSVersionLayer != null) cb.BeginLayer(_PROMSVersionLayer); - cb.BeginText(); - cb.SetFontAndSize(BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED), 6f); - cb.SetTextMatrix(textLeft, textBase); - cb.SetColorFill(new iTextSharp.text.Color(System.Drawing.Color.Indigo)); - cb.ShowText(text); - cb.EndText(); - if (_PROMSVersionLayer != null) cb.EndLayer(); - cb.RestoreState(); - } - private void DrawPageList(PdfContentByte cb) - { - if (_MySvg != null) - { - cb.SaveState(); - if (_PageListLayer != null) cb.BeginLayer(_PageListLayer); - // Do anything needed to finish off the page - //System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix(); - //myMatrix.Rotate(90); // Rotate the Pagelist items by 90 Degrees. - //// Translate by the Height of the page. - //myMatrix.Translate(cb.PdfDocument.PageSize.Height, 0, System.Drawing.Drawing2D.MatrixOrder.Append); - //// This was for fun - //// myMatrix.Scale(.75F, .75F, System.Drawing.Drawing2D.MatrixOrder.Append); - //cb.Transform(myMatrix); - //// You can look at the value of the Matrix at this point, to create the matrix directly like I did below - //OR - // Rotate 90 Degrees and Translate by the Height of the Page - - if (IsLandscape) - { - System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Height, 0); - cb.Transform(myMatrix); - } - _MySvg.Draw(cb); - if (_PageListLayer != null) cb.EndLayer(); - cb.RestoreState(); - } - } - private void ZoomOMatic(PdfContentByte cb, float size) - { - for (float xx = 0; xx < cb.PdfDocument.PageSize.Width; xx += size) - { - for (float yy = 0; yy < cb.PdfDocument.PageSize.Height; yy += size) - { - PdfDestination dest = new PdfDestination(PdfDestination.FITR, xx - 1.5F * size, yy - 1.5F * size, xx + 1.5F * size, yy + 1.5F * size); - cb.SetAction(PdfAction.GotoLocalPage(cb.PdfWriter.CurrentPageNumber, dest, cb.PdfWriter), xx - size, yy - size, xx + size, yy + size); - } - } - } - public override void OnStartPage(PdfWriter writer, Document document) - { - //base.OnStartPage(writer, document); - } - public override void OnCloseDocument(PdfWriter writer, Document document) - { - // Build Templates for Page Count - } - } - public class SvgWatermark - { - private PdfContentByte _ContentByte; - private string _Text; - private System.Drawing.Color _Color; - private PdfPatternPainter _PatternPainter; - private BaseFont _Basefont; - private float _Fontsize; - private float _XOffset; - private float _YOffset; - private float _TextAngle; - private float _Opacity; - public SvgWatermark(PdfContentByte contentByte, string text, System.Drawing.Color color, float opacity) - { - _ContentByte = contentByte; - _Text = text; - //float radius = .5F; - //float space = 3; - // B2021-081: Blue was too intense with an alpha of 255 Read was too light with an alpha of 96 - if (color != System.Drawing.Color.Red) - _Color = System.Drawing.Color.FromArgb(96, color); - else - _Color = color; // C2021-019: save color for color override - _Opacity = opacity; - //SetDotPattern(radius, space); - //SetTextLayout(); - } - #region commentedout - //private void SetTextLayout() - //{ - // Rectangle pageSize = _ContentByte.PdfWriter.PageSize; // Get page size - // _Basefont = BaseFont.CreateFont(BaseFont.HELVETICA_BOLD, Encoding.ASCII.EncodingName, BaseFont.EMBEDDED); - // float hgtA = _Basefont.GetAscentPoint(_Text, 12); - // //float hgtD = basefont.GetDescentPoint(text,20); - // float wid = _Basefont.GetWidthPointKerned(_Text, 12); - // //Console.WriteLine("{0} {1} {2}",hgtA,hgtD,wid); - // float rho = wid / hgtA; - // float x2 = (rho * pageSize.Height - pageSize.Width) / (rho * rho - 1); - // float y1 = x2 * rho; - // float y2 = pageSize.Height - y1; - // float x1 = pageSize.Width - x2; - // _XOffset = x2 + x1 / 2; - // _YOffset = y1 / 2; - // _TextAngle = CalcAngle(y1, x1); - // _Fontsize = (float)(10 * Math.Sqrt(x2 * x2 + y2 * y2) / hgtA); - //} - //public void SetDotPattern(float radius, float space) - //{ - // _PatternPainter = _ContentByte.CreatePattern(radius * 2, radius * 2, radius * 2 + space, radius * 2 + space); - // PdfGState gState = new PdfGState(); - // gState.FillOpacity = _Opacity; - // _PatternPainter.SetGState(gState); - // _PatternPainter.SetColorFill(_Color); - // _PatternPainter.Circle(radius, radius, radius); - // _PatternPainter.Fill(); - //} - //public void SetSquareDotPattern(float radius) - //{ - // _PatternPainter = _ContentByte.CreatePattern(radius * 4, radius * 2, radius * 4, radius * 2); - // PdfGState gState = new PdfGState(); - // gState.FillOpacity = .5f * _Opacity; - // _PatternPainter.SetGState(gState); - // _PatternPainter.SetColorFill(_Color); - // _PatternPainter.Rectangle(0, 0, radius, radius); - // _PatternPainter.Rectangle(radius * 2, radius, radius, radius); - // _PatternPainter.Fill(); - //} - //public void SetHashPattern(float thickness, float size) - //{ - // _PatternPainter = _ContentByte.CreatePattern(size, size, size, size); - // PdfGState gState = new PdfGState(); - // gState.FillOpacity = _Opacity; - // gState.StrokeOpacity = _Opacity; - // _PatternPainter.SetGState(gState); - // _PatternPainter.SetLineWidth(.01F); - // _PatternPainter.SetColorStroke(_Color); // Set color - // _PatternPainter.MoveTo(0, 0); - // _PatternPainter.LineTo(size, size); - // _PatternPainter.MoveTo(size, 0); - // _PatternPainter.LineTo(0, size); - // _PatternPainter.Stroke(); - //} - //public void SetTextPattern(float fontSize, float space) - //{ - // float hgtA = _Basefont.GetAscentPoint(_Text, fontSize) + _Basefont.GetDescentPoint(_Text, fontSize); - // float wid = _Basefont.GetWidthPointKerned(_Text, fontSize); - // _PatternPainter = _ContentByte.CreatePattern(wid, hgtA, wid + space, hgtA + space); - // _PatternPainter.SetFontAndSize(_Basefont, fontSize); - // _PatternPainter.BoundingBox = new Rectangle(-20, -20, 100, 100); - // _PatternPainter.BeginText(); - // PdfGState gs1 = new PdfGState(); - // gs1.FillOpacity = _Opacity; - // _PatternPainter.SetGState(gs1); - // _PatternPainter.SetColorFill(_Color); // Set color - // _PatternPainter.ShowText(_Text); - // _PatternPainter.EndText(); - //} - //public void SetTextPattern2(float fontSize) - //{ - // BaseFont _Basefont2 = BaseFont.CreateFont(BaseFont.HELVETICA, Encoding.ASCII.EncodingName, BaseFont.EMBEDDED); - // float hgtA = _Basefont2.GetAscentPoint(_Text, fontSize); - // float wid = _Basefont2.GetWidthPointKerned(_Text, fontSize); - // _PatternPainter = _ContentByte.CreatePattern(wid * 2, hgtA * 2, wid * 2, hgtA * 2); - // _PatternPainter.SetFontAndSize(_Basefont2, fontSize); - // _PatternPainter.BoundingBox = new Rectangle(-20, -20, 100, 100); - // _PatternPainter.BeginText(); - // PdfGState gs1 = new PdfGState(); - // gs1.FillOpacity = _Opacity; - // _PatternPainter.SetGState(gs1); - // _PatternPainter.SetColorFill(_Color); // Set color - // _PatternPainter.ShowText(_Text); - // _PatternPainter.ShowTextAligned(PdfContentByte.ALIGN_LEFT, _Text, wid, hgtA, 0); - // _PatternPainter.EndText(); - //} - #endregion - public void Draw() - { - _ContentByte.SaveState(); - //_ContentByte.BeginText(); - //_ContentByte.SetPatternFill(_PatternPainter); - //_ContentByte.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE); - //_ContentByte.SetLineWidth(.5F); - //_ContentByte.SetFontAndSize(_Basefont, _Fontsize);// Set font and size - //_ContentByte.SetColorStroke(_Color); - //PdfGState gs2 = new PdfGState(); - //gs2.StrokeOpacity = _Opacity; - //_ContentByte.SetGState(gs2); - //_ContentByte.ShowTextAlignedKerned(PdfContentByte.ALIGN_CENTER, _Text, _XOffset, _YOffset, _TextAngle);// Draw the text - //_ContentByte.EndText(); - _ContentByte.AddImage(WatermarkImage); - _ContentByte.RestoreState(); - } - //private float CalcAngle(float opposite, float adjacent) - //{ - // return (float)(Math.Atan2(opposite, adjacent) * (180 / Math.PI)); - //} - private Image _WatermarkImage; - public Image WatermarkImage - { - get - { - if (_WatermarkImage == null) - { - float fntSize = 200; - System.Drawing.Font fnt = new System.Drawing.Font("Arial", fntSize); - string msg = _Text; - System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath(); - gp.AddString(msg, fnt.FontFamily, 0, fntSize, new System.Drawing.Point(0, 0), - System.Drawing.StringFormat.GenericTypographic); - System.Drawing.RectangleF bnds = gp.GetBounds(); - gp.Reset(); - int height = (int)bnds.Height; - int width = (int)bnds.Width; - System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(width + 2, height + 2); - using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp)) - { - g.FillRectangle(System.Drawing.Brushes.Transparent, 0, 0, width, height); - g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High; - g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; - g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; - g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; - gp.AddString(msg, fnt.FontFamily, 0, fntSize, new System.Drawing.PointF(-bnds.X, -bnds.Y), - System.Drawing.StringFormat.GenericTypographic); - // C2021-019: allow setting of watermark color - System.Drawing.Drawing2D.HatchBrush aHatchBrush = new System.Drawing.Drawing2D.HatchBrush(System.Drawing.Drawing2D.HatchStyle.Percent25, - _Color, System.Drawing.Color.Transparent); - g.FillPath(aHatchBrush, gp); - g.DrawPath(new System.Drawing.Pen(_Color), gp); - //g.DrawRectangle(System.Drawing.Pens.Cyan, 0, 0, bnds.Width, bnds.Height); - } - _WatermarkImage = iTextSharp.text.Image.GetInstance(bmp, System.Drawing.Imaging.ImageFormat.Png); - _WatermarkImage.SetAbsolutePosition(72, 72); - float H = _ContentByte.PdfWriter.PageSize.Height - 144; - float W = _ContentByte.PdfWriter.PageSize.Width - 144; - float ratio = bnds.Width / bnds.Height; - float W2 = (H - W / ratio) / (ratio - 1 / ratio); - float W1 = W - W2; - float H1 = (float)(Math.Sqrt(-4 * (W1 * W2) + H * H) + H) / 2; - float H2 = H - H1; - float Theta = (float)Math.Atan(H1 / W1); - float h = H2 / (float)Math.Cos(Theta); - float w = H1 / (float)Math.Sin(Theta); - // C2022-004 if the watermark is only one character, don't rotate and scale - if (msg.Length > 2) - { - _WatermarkImage.Rotation = Theta; // 3.141592653F / 4; - _WatermarkImage.ScaleAbsolute(w, h); - } - else - _WatermarkImage.ScaleAbsolute(W, H);// C2022-004 if the watermark is only one character, scale with respect to page size - - } - return _WatermarkImage; - } - } - - } - public enum SvgWatermarkFill - { - Dots = 1, - Text1 = 2, - Text2 = 3, - Hash = 4 - } -} diff --git a/PROMS/Volian.Utils.Library/IniReader/IniReader.cs b/PROMS/Volian.Utils.Library/IniReader/IniReader.cs deleted file mode 100644 index 19a88f3f..00000000 --- a/PROMS/Volian.Utils.Library/IniReader/IniReader.cs +++ /dev/null @@ -1,383 +0,0 @@ -/* - IniReader class for C# - Version: 1.0 Date: 2002/04/24 -*/ -/* - Copyright © 2002, The KPD-Team - All rights reserved. - http://www.mentalis.org/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Neither the name of the KPD-Team, nor the names of its contributors - may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -using System; -using System.Text; -using System.Collections; -using System.Runtime.InteropServices; - -// The Org.Mentalis.Files contains a number of classes that read from or write to special files. -namespace Org.Mentalis.Files { - /// - /// The INIReader class can read keys from and write keys to an INI file. - /// - /// - /// This class uses several Win32 API functions to read from and write to INI files. It will not work on Linux or FreeBSD. - /// - public class IniReader { - // API declarations - /// - /// The GetPrivateProfileInt function retrieves an integer associated with a key in the specified section of an initialization file. - /// - /// Pointer to a null-terminated string specifying the name of the section in the initialization file. - /// Pointer to the null-terminated string specifying the name of the key whose value is to be retrieved. This value is in the form of a string; the GetPrivateProfileInt function converts the string into an integer and returns the integer. - /// Specifies the default value to return if the key name cannot be found in the initialization file. - /// Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory. - /// The return value is the integer equivalent of the string following the specified key name in the specified initialization file. If the key is not found, the return value is the specified default value. If the value of the key is less than zero, the return value is zero. - [DllImport("KERNEL32.DLL", EntryPoint="GetPrivateProfileIntA", CharSet=CharSet.Ansi)] - private static extern int GetPrivateProfileInt(string lpApplicationName, string lpKeyName, int nDefault, string lpFileName); - /// - /// The WritePrivateProfileString function copies a string into the specified section of an initialization file. - /// - /// Pointer to a null-terminated string containing the name of the section to which the string will be copied. If the section does not exist, it is created. The name of the section is case-independent; the string can be any combination of uppercase and lowercase letters. - /// Pointer to the null-terminated string containing the name of the key to be associated with a string. If the key does not exist in the specified section, it is created. If this parameter is NULL, the entire section, including all entries within the section, is deleted. - /// Pointer to a null-terminated string to be written to the file. If this parameter is NULL, the key pointed to by the lpKeyName parameter is deleted. - /// Pointer to a null-terminated string that specifies the name of the initialization file. - /// If the function successfully copies the string to the initialization file, the return value is nonzero; if the function fails, or if it flushes the cached version of the most recently accessed initialization file, the return value is zero. - [DllImport("KERNEL32.DLL", EntryPoint="WritePrivateProfileStringA", CharSet=CharSet.Ansi)] - private static extern int WritePrivateProfileString (string lpApplicationName, string lpKeyName, string lpString, string lpFileName); - /// - /// The GetPrivateProfileString function retrieves a string from the specified section in an initialization file. - /// - /// Pointer to a null-terminated string that specifies the name of the section containing the key name. If this parameter is NULL, the GetPrivateProfileString function copies all section names in the file to the supplied buffer. - /// Pointer to the null-terminated string specifying the name of the key whose associated string is to be retrieved. If this parameter is NULL, all key names in the section specified by the lpAppName parameter are copied to the buffer specified by the lpReturnedString parameter. - /// Pointer to a null-terminated default string. If the lpKeyName key cannot be found in the initialization file, GetPrivateProfileString copies the default string to the lpReturnedString buffer. This parameter cannot be NULL.
Avoid specifying a default string with trailing blank characters. The function inserts a null character in the lpReturnedString buffer to strip any trailing blanks.
- /// Pointer to the buffer that receives the retrieved string. - /// Specifies the size, in TCHARs, of the buffer pointed to by the lpReturnedString parameter. - /// Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory. - /// The return value is the number of characters copied to the buffer, not including the terminating null character. - [DllImport("KERNEL32.DLL", EntryPoint="GetPrivateProfileStringA", CharSet=CharSet.Ansi)] - private static extern int GetPrivateProfileString (string lpApplicationName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, int nSize, string lpFileName); - /// - /// The GetPrivateProfileSectionNames function retrieves the names of all sections in an initialization file. - /// - /// Pointer to a buffer that receives the section names associated with the named file. The buffer is filled with one or more null-terminated strings; the last string is followed by a second null character. - /// Specifies the size, in TCHARs, of the buffer pointed to by the lpszReturnBuffer parameter. - /// Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter is NULL, the function searches the Win.ini file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory. - /// The return value specifies the number of characters copied to the specified buffer, not including the terminating null character. If the buffer is not large enough to contain all the section names associated with the specified initialization file, the return value is equal to the length specified by nSize minus two. - [DllImport("KERNEL32.DLL", EntryPoint="GetPrivateProfileSectionNamesA", CharSet=CharSet.Ansi)] - private static extern int GetPrivateProfileSectionNames (byte[] lpszReturnBuffer, int nSize, string lpFileName); - /// - /// The WritePrivateProfileSection function replaces the keys and values for the specified section in an initialization file. - /// - /// Pointer to a null-terminated string specifying the name of the section in which data is written. This section name is typically the name of the calling application. - /// Pointer to a buffer containing the new key names and associated values that are to be written to the named section. - /// Pointer to a null-terminated string containing the name of the initialization file. If this parameter does not contain a full path for the file, the function searches the Windows directory for the file. If the file does not exist and lpFileName does not contain a full path, the function creates the file in the Windows directory. The function does not create a file if lpFileName contains the full path and file name of a file that does not exist. - /// If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
- [DllImport("KERNEL32.DLL", EntryPoint="WritePrivateProfileSectionA", CharSet=CharSet.Ansi)] - private static extern int WritePrivateProfileSection (string lpAppName, string lpString, string lpFileName); - /// Constructs a new IniReader instance. - /// Specifies the full path to the INI file (the file doesn't have to exist). - public IniReader(string file) { - Filename = file; - } - /// Gets or sets the full path to the INI file. - /// A String representing the full path to the INI file. - public string Filename { - get { - return m_Filename; - } - set { - m_Filename = value; - } - } - /// Gets or sets the section you're working in. (aka 'the active section') - /// A String representing the section you're working in. - public string Section { - get { - return m_Section; - } - set { - m_Section = value; - } - } - /// Reads an Integer from the specified key of the specified section. - /// The section to search in. - /// The key from which to return the value. - /// The value to return if the specified key isn't found. - /// Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file. - public int ReadInteger(string section, string key, int defVal) { - return GetPrivateProfileInt(section, key, defVal, Filename); - } - /// Reads an Integer from the specified key of the specified section. - /// The section to search in. - /// The key from which to return the value. - /// Returns the value of the specified section/key pair, or returns 0 if the specified section/key pair isn't found in the INI file. - public int ReadInteger(string section, string key) { - return ReadInteger(section, key, 0); - } - /// Reads an Integer from the specified key of the active section. - /// The key from which to return the value. - /// The section to search in. - /// Returns the value of the specified Key, or returns the default value if the specified Key isn't found in the active section of the INI file. - public int ReadInteger(string key, int defVal) { - return ReadInteger(Section, key, defVal); - } - /// Reads an Integer from the specified key of the active section. - /// The key from which to return the value. - /// Returns the value of the specified key, or returns 0 if the specified key isn't found in the active section of the INI file. - public int ReadInteger(string key) { - return ReadInteger(key, 0); - } - /// Reads a String from the specified key of the specified section. - /// The section to search in. - /// The key from which to return the value. - /// The value to return if the specified key isn't found. - /// Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file. - public string ReadString(string section, string key, string defVal) { - StringBuilder sb = new StringBuilder(MAX_ENTRY); - int Ret = GetPrivateProfileString(section, key, defVal, sb, MAX_ENTRY, Filename); - return sb.ToString(); - } - /// Reads a String from the specified key of the specified section. - /// The section to search in. - /// The key from which to return the value. - /// Returns the value of the specified section/key pair, or returns an empty String if the specified section/key pair isn't found in the INI file. - public string ReadString(string section, string key) { - return ReadString(section, key, ""); - } - /// Reads a String from the specified key of the active section. - /// The key from which to return the value. - /// Returns the value of the specified key, or returns an empty String if the specified key isn't found in the active section of the INI file. - public string ReadString(string key) { - return ReadString(Section, key); - } - /// Reads a Long from the specified key of the specified section. - /// The section to search in. - /// The key from which to return the value. - /// The value to return if the specified key isn't found. - /// Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file. - public long ReadLong(string section, string key, long defVal) { - return long.Parse(ReadString(section, key, defVal.ToString())); - } - /// Reads a Long from the specified key of the specified section. - /// The section to search in. - /// The key from which to return the value. - /// Returns the value of the specified section/key pair, or returns 0 if the specified section/key pair isn't found in the INI file. - public long ReadLong(string section, string key) { - return ReadLong(section, key, 0); - } - /// Reads a Long from the specified key of the active section. - /// The key from which to return the value. - /// The section to search in. - /// Returns the value of the specified key, or returns the default value if the specified key isn't found in the active section of the INI file. - public long ReadLong(string key, long defVal) { - return ReadLong(Section, key, defVal); - } - /// Reads a Long from the specified key of the active section. - /// The key from which to return the value. - /// Returns the value of the specified Key, or returns 0 if the specified Key isn't found in the active section of the INI file. - public long ReadLong(string key) { - return ReadLong(key, 0); - } - /// Reads a Byte array from the specified key of the specified section. - /// The section to search in. - /// The key from which to return the value. - /// Returns the value of the specified section/key pair, or returns null (Nothing in VB.NET) if the specified section/key pair isn't found in the INI file. - public byte[] ReadByteArray(string section, string key) { - try { - return Convert.FromBase64String(ReadString(section, key)); - } catch {} - return null; - } - /// Reads a Byte array from the specified key of the active section. - /// The key from which to return the value. - /// Returns the value of the specified key, or returns null (Nothing in VB.NET) if the specified key pair isn't found in the active section of the INI file. - public byte[] ReadByteArray(string key) { - return ReadByteArray(Section, key); - } - /// Reads a Boolean from the specified key of the specified section. - /// The section to search in. - /// The key from which to return the value. - /// The value to return if the specified key isn't found. - /// Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file. - public bool ReadBoolean(string section, string key, bool defVal) { - return Boolean.Parse(ReadString(section, key, defVal.ToString())); - } - /// Reads a Boolean from the specified key of the specified section. - /// The section to search in. - /// The key from which to return the value. - /// Returns the value of the specified section/key pair, or returns false if the specified section/key pair isn't found in the INI file. - public bool ReadBoolean(string section, string key) { - return ReadBoolean(section, key, false); - } - /// Reads a Boolean from the specified key of the specified section. - /// The key from which to return the value. - /// The value to return if the specified key isn't found. - /// Returns the value of the specified key pair, or returns the default value if the specified key isn't found in the active section of the INI file. - public bool ReadBoolean(string key, bool defVal) { - return ReadBoolean(Section, key, defVal); - } - /// Reads a Boolean from the specified key of the specified section. - /// The key from which to return the value. - /// Returns the value of the specified key, or returns false if the specified key isn't found in the active section of the INI file. - public bool ReadBoolean(string key) { - return ReadBoolean(Section, key); - } - /// Writes an Integer to the specified key in the specified section. - /// The section to write in. - /// The key to write to. - /// The value to write. - /// Returns true if the function succeeds, false otherwise. - public bool Write(string section, string key, int value) { - return Write(section, key, value.ToString()); - } - /// Writes an Integer to the specified key in the active section. - /// The key to write to. - /// The value to write. - /// Returns true if the function succeeds, false otherwise. - public bool Write(string key, int value) { - return Write(Section, key, value); - } - /// Writes a String to the specified key in the specified section. - /// Specifies the section to write in. - /// Specifies the key to write to. - /// Specifies the value to write. - /// Returns true if the function succeeds, false otherwise. - public bool Write(string section, string key, string value) { - return (WritePrivateProfileString(section, key, value, Filename) != 0); - } - /// Writes a String to the specified key in the active section. - /// The key to write to. - /// The value to write. - /// Returns true if the function succeeds, false otherwise. - public bool Write(string key, string value) { - return Write(Section, key, value); - } - /// Writes a Long to the specified key in the specified section. - /// The section to write in. - /// The key to write to. - /// The value to write. - /// Returns true if the function succeeds, false otherwise. - public bool Write(string section, string key, long value) { - return Write(section, key, value.ToString()); - } - /// Writes a Long to the specified key in the active section. - /// The key to write to. - /// The value to write. - /// Returns true if the function succeeds, false otherwise. - public bool Write(string key, long value) { - return Write(Section, key, value); - } - /// Writes a Byte array to the specified key in the specified section. - /// The section to write in. - /// The key to write to. - /// The value to write. - /// Returns true if the function succeeds, false otherwise. - public bool Write(string section, string key, byte [] value) { - if (value == null) - return Write(section, key, (string)null); - else - return Write(section, key, value, 0, value.Length); - } - /// Writes a Byte array to the specified key in the active section. - /// The key to write to. - /// The value to write. - /// Returns true if the function succeeds, false otherwise. - public bool Write(string key, byte [] value) { - return Write(Section, key, value); - } - /// Writes a Byte array to the specified key in the specified section. - /// The section to write in. - /// The key to write to. - /// The value to write. - /// An offset in value. - /// The number of elements of value to convert. - /// Returns true if the function succeeds, false otherwise. - public bool Write(string section, string key, byte [] value, int offset, int length) { - if (value == null) - return Write(section, key, (string)null); - else - return Write(section, key, Convert.ToBase64String(value, offset, length)); - } - /// Writes a Boolean to the specified key in the specified section. - /// The section to write in. - /// The key to write to. - /// The value to write. - /// Returns true if the function succeeds, false otherwise. - public bool Write(string section, string key, bool value) { - return Write(section, key, value.ToString()); - } - /// Writes a Boolean to the specified key in the active section. - /// The key to write to. - /// The value to write. - /// Returns true if the function succeeds, false otherwise. - public bool Write(string key, bool value) { - return Write(Section, key, value); - } - /// Deletes a key from the specified section. - /// The section to delete from. - /// The key to delete. - /// Returns true if the function succeeds, false otherwise. - public bool DeleteKey(string section, string key) { - return (WritePrivateProfileString(section, key, null, Filename) != 0); - } - /// Deletes a key from the active section. - /// The key to delete. - /// Returns true if the function succeeds, false otherwise. - public bool DeleteKey(string key) { - return (WritePrivateProfileString(Section, key, null, Filename) != 0); - } - /// Deletes a section from an INI file. - /// The section to delete. - /// Returns true if the function succeeds, false otherwise. - public bool DeleteSection(string section) { - return WritePrivateProfileSection(section, null, Filename) != 0; - } - /// Retrieves a list of all available sections in the INI file. - /// Returns an ArrayList with all available sections. - public ArrayList GetSectionNames() { - try { - byte[] buffer = new byte[MAX_ENTRY]; - GetPrivateProfileSectionNames(buffer, MAX_ENTRY, Filename); - string [] parts = Encoding.ASCII.GetString(buffer).Trim('\0').Split('\0'); - return new ArrayList(parts); - } catch {} - return null; - } - //Private variables and constants - /// - /// Holds the full path to the INI file. - /// - private string m_Filename; - /// - /// Holds the active section name - /// - private string m_Section; - /// - /// The maximum number of bytes in a section buffer. - /// - private const int MAX_ENTRY = 32768; - } -} \ No newline at end of file diff --git a/PROMS/Volian.Utils.Library/IniReader/IniReader.csproj b/PROMS/Volian.Utils.Library/IniReader/IniReader.csproj deleted file mode 100644 index d1f4966c..00000000 --- a/PROMS/Volian.Utils.Library/IniReader/IniReader.csproj +++ /dev/null @@ -1,55 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {889E30F7-CFBC-470D-9488-7009C354F9C9} - Library - Properties - IniReader - IniReader - - - - - - - - - - - true - full - false - ..\..\..\..\..\veproms\bin\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - \ No newline at end of file diff --git a/PROMS/Volian.Utils.Library/MSWord/MSWord.csproj b/PROMS/Volian.Utils.Library/MSWord/MSWord.csproj deleted file mode 100644 index 96609362..00000000 --- a/PROMS/Volian.Utils.Library/MSWord/MSWord.csproj +++ /dev/null @@ -1,81 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {2F79D7F9-885E-4441-99F3-045D7612B2E5} - Library - Properties - MSWord - MSWord - - - - - - - - - - - true - full - false - ..\..\..\..\..\veproms\bin\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {2DF8D04C-5BFA-101B-BDE5-00AA0044DE52} - 2 - 3 - 0 - primary - False - - - {0002E157-0000-0000-C000-000000000046} - 5 - 3 - 0 - primary - False - - - {00020905-0000-0000-C000-000000000046} - 8 - 3 - 0 - primary - False - - - - - \ No newline at end of file diff --git a/PROMS/Volian.Utils.Library/MSWord/WordDoc.cs b/PROMS/Volian.Utils.Library/MSWord/WordDoc.cs deleted file mode 100644 index 86b436a0..00000000 --- a/PROMS/Volian.Utils.Library/MSWord/WordDoc.cs +++ /dev/null @@ -1,138 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using LBWordLibrary; - -namespace Volian.MSWord -{ - public class WordDoc - { - private static LBApplicationClass _MyWordApp; - public static LBApplicationClass MyWordApp - { - get - { - if (_MyWordApp == null) - _MyWordApp = new LBApplicationClass(); - return WordDoc._MyWordApp; - } - } - private LBDocumentClass _MyWordDoc; - public LBDocumentClass MyWordDoc - { - get - { return _MyWordDoc; } - } - private string _DocName; - public string DocName - { - get { return _DocName; } - set { _DocName = value; } - } - public WordDoc(string docName) - { - DocName = docName; - _MyWordDoc = MyWordApp.Documents.Open(_DocName, false); - } - public string Save() - { - try - { - MyWordDoc.SaveAs(DocName, LBWdSaveFormat.wdFormatDocument); - return "Successful Save"; - } - catch (Exception ex) - { - return string.Format("Error during Doc save - {0}", ex.Message); - } - } - public string Save(string docName) - { - DocName = docName; - return Save(); - } - public void Close() - { - MyWordDoc.Close(false); - } - public float SetLineSpacing(float linesPerInch) // if need landscape set too: , bool landscape) - { - float retval = 0; - LBSelection selection = MyWordApp.Selection; - selection.WholeStory(); - retval = selection.ParagraphFormat.LineSpacing; - selection.ParagraphFormat.SpaceBefore = 0; - selection.ParagraphFormat.SpaceAfter = 0; - selection.ParagraphFormat.LineSpacingRule = LBWdLineSpacing.wdLineSpaceExactly; - selection.ParagraphFormat.LineSpacing = 72 / linesPerInch; - return retval; - } - public float Length - { - get - { - try - { - return MyWordDoc.Length; - } - catch (Exception ex) - { - Console.WriteLine("Error Getting Length, {0}", ex.Message); - } - return 0; - } - } - public static void CloseApp() - { - if(_MyWordApp != null) - { - TryToQuit(); - KillWordApps(); - } - } - - private static void TryToQuit() - { - try - { - _MyWordApp.Quit(false); - } - catch (Exception ex) - { - Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message); - } - _MyWordApp=null; - } - public static void KillWordApps() - { - try - { - TerminateProcesses(WordProcesses); - } - catch (Exception ex) - { - Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message); - } - } - public static void TerminateProcesses(System.Diagnostics.Process[] wordProcesses) - { - foreach (System.Diagnostics.Process proc in wordProcesses) - { - // Determine if Word is Visible - // If it is let it run - // otherwise Kill it. - if(proc.MainWindowTitle=="") - proc.Kill(); - } - _MyWordApp = null; - } - public static System.Diagnostics.Process[] WordProcesses - { - get - { - return System.Diagnostics.Process.GetProcessesByName("WINWORD"); - } - } - - } -} diff --git a/PROMS/Volian.Utils.Library/Properties/AssemblyInfo.cs b/PROMS/Volian.Utils.Library/Properties/AssemblyInfo.cs deleted file mode 100644 index a5d08ab8..00000000 --- a/PROMS/Volian.Utils.Library/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("IniReader")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Volian Enterprises, Inc.")] -[assembly: AssemblyProduct("IniReader")] -[assembly: AssemblyCopyright("Copyright © Volian Enterprises, Inc. 2006")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("0defcd71-3fa3-4b0c-8df0-64ca71984473")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PROMS/Volian.Utils.Library/Volian.Utils.Library.csproj b/PROMS/Volian.Utils.Library/Volian.Utils.Library.csproj deleted file mode 100644 index d098bfa8..00000000 --- a/PROMS/Volian.Utils.Library/Volian.Utils.Library.csproj +++ /dev/null @@ -1,98 +0,0 @@ - - - - Debug - AnyCPU - {62314B9C-DA84-4037-8B68-AA18C1F641F5} - Library - false - Volian.Utils.Library - Volian.Utils.Library - - - - - - - - - v4.8.1 - - - - - 2.0 - - - - true - full - false - .\bin\Debug\ - DEBUG;TRACE - false - x64 - - - pdbonly - true - .\bin\Release\ - TRACE - false - x64 - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - MinimumRecommendedRules.ruleset - false - - - bin\x86\Release\ - TRACE - true - pdbonly - x64 - MinimumRecommendedRules.ruleset - false - - - - False - ..\..\..\..\3rdPartyLibraries\Log4Net\log4net.dll - - - - - - - - - - - - - - - - - - - - - {70F23722-19A3-4AC1-A900-55831C945786} - LBWordLibrary - - - - - - - - - - - \ No newline at end of file diff --git a/PROMS/Volian.Utils.Library/vlnObject/vlnObject.cs b/PROMS/Volian.Utils.Library/vlnObject/vlnObject.cs deleted file mode 100644 index 3de17358..00000000 --- a/PROMS/Volian.Utils.Library/vlnObject/vlnObject.cs +++ /dev/null @@ -1,282 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; -using System.Xml; -using System.Xml.Schema; -using System.Collections; -using System.IO; -using System.Text.RegularExpressions; - -namespace vlnObjectLibrary -{ - [Serializable()] - public class vlnObject : IXmlSerializable , IDisposable - { - #region Log4Net - private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - #endregion - public void Dispose() - { - /* See if I need to do anything */ - } - #region XML Serialization - public void WriteXml(XmlWriter w) - { - WriteXml(w, true); - } - public void WriteXml(XmlWriter w,bool bSaveParent) - { - w.WriteAttributeString("title", Title); - w.WriteAttributeString("path", Path); - w.WriteAttributeString("type", Type); - if (m_PropArray.Count > 0) - { - w.WriteStartElement("properties"); - foreach (string sKey in m_PropArray.Keys) - { - w.WriteStartElement("property"); - w.WriteAttributeString("name", sKey); - w.WriteAttributeString("value", PropArray[sKey]); - w.WriteEndElement(); - } - w.WriteEndElement(); - } - if (bSaveParent && Parent != null) - { - w.WriteStartElement("parent"); - Parent.WriteXml(w); - w.WriteEndElement(); - } - } - private bool SkipToElement(XmlReader xr) - { - while (xr.Read()) - if (xr.NodeType == XmlNodeType.Element || xr.NodeType == XmlNodeType.EndElement) - return xr.NodeType == XmlNodeType.Element; - return false; - } - public void ReadXml(XmlReader xr) - { - SkipToElement(xr); - if (xr.MoveToAttribute("title")) m_Title = xr.Value; - if (xr.MoveToAttribute("type")) m_Type = xr.Value; - if (xr.MoveToAttribute("path")) m_Path = xr.Value; - while (SkipToElement(xr)) - { - if (xr.NodeType == XmlNodeType.Element && xr.Name == "properties") - while (SkipToElement(xr)) - if (xr.NodeType == XmlNodeType.Element && xr.Name == "property") - AddProp(xr.ReadSubtree()); - if (xr.NodeType == XmlNodeType.Element && xr.Name == "parent") - m_Parent = new vlnObject(xr.ReadSubtree()); - } - xr.Close(); - } - - public XmlSchema GetSchema() - { - return (null); - } - #endregion - #region Constructors - public vlnObject(vlnObject parent, string type, string title, string path) - { - m_Parent = parent; - m_Type = type; - m_Title = title; - m_Path = path; - m_PropArray = new Dictionary(); - } - public vlnObject() - { - m_Parent = null; - m_Title = null; - m_Path = null; - m_Type = null; - m_PropArray = new Dictionary(); - } - public vlnObject(XmlReader xr) - { - m_Parent = null; - m_PropArray = new Dictionary(); - this.ReadXml(xr); - } - public vlnObject(string sXML) - { - m_Parent = null; - m_PropArray = new Dictionary(); - this.ReadXml(new XmlTextReader(new StringReader(sXML))); - } - #endregion - #region Public Properties - private vlnObject m_Parent; - public vlnObject Parent - { - get { return m_Parent; } - set { m_Parent = value; } - } - private string m_Title; - public string Title - { - get { return m_Title; } - set { m_Title = value; } - } - private string m_Path; - public string Path - { - get { return m_Path; } - set { m_Path = value; } - } - private string m_Type; - - public string Type - { - get { return m_Type; } - set { m_Type = value; } - } - private Dictionary m_PropArray; - public Dictionary PropArray - { - get { return m_PropArray; } - set { m_PropArray = value; } - } - #endregion - #region Public Methods - public vlnObject Add(string type, string title, string path) - { - vlnObject b = new vlnObject(this, type, title, path); - return b; - } - public void AddProp(string name, string value) - { - PropArray[name.ToUpper()] = value; - } - public void AddProp(XmlReader xr) - { - SkipToElement(xr); - string sName = null; - string sValue = null; - if (xr.MoveToAttribute("name")) sName = xr.Value; - if (xr.MoveToAttribute("value")) sValue = xr.Value; - if (sName != null && sValue != null) AddProp(sName, sValue); - xr.Close(); - } - public override string ToString() - { - StringWriter swxml = new StringWriter(); - XmlSerializer mySer = new XmlSerializer(this.GetType()); - mySer.Serialize(swxml, this); - return swxml.ToString(); - } - #endregion - private List m_Children; - public List Children - { - get - { - return m_Children; - } - set - { - m_Children = value; - } - } - public void LoadChildren(string sXml) - { - LoadChildren(new XmlTextReader(new StringReader(sXml))); - } - public void LoadChildren(XmlReader xr) - { - m_Children = new List(); - SkipToElement(xr); - while(SkipToElement(xr)){ - vlnObject o = new vlnObject(xr.ReadSubtree()); - o.Parent = this; - m_Children.Add(o); - } - } - public string AllChildren() - { - StringWriter sw = new StringWriter(); - XmlTextWriter xw = new XmlTextWriter(sw); - xw.WriteStartElement("children"); - foreach (vlnObject vb in Children) - { - xw.WriteStartElement("vlnObject"); - vb.WriteXml(xw,false); - xw.WriteEndElement(); - } - xw.WriteEndElement(); - return sw.ToString(); - } - public string ProcessString(string s) - { - //string retval=s; - //string retval = Regex.Replace(s, "{[.]*}", new MatchEvaluator(ReplaceKey)); - string retval = Regex.Replace(s, "{{.*?}}", new MatchEvaluator(ReplaceRow)); - retval = Regex.Replace(retval, "{.*?}", new MatchEvaluator(ReplaceDrv)); - return retval; - } - private string ReplaceRow(Match m) - { - string sResult = FindField(m.Value.Substring(2, m.Value.Length - 4)); - if (sResult == null && Parent != null) - { - sResult = Parent.ReplaceRow(m); - } - if (sResult == null) - { - log.ErrorFormat("vlnObject - Couldn't find {0}", m.Value); - } - return sResult; - } - private string ReplaceDrv(Match m) - { - string sRetVal = FindField(m.Value.Substring(1, m.Value.Length - 2)); - if (sRetVal == null) sRetVal = ""; - return sRetVal; - } - private string FindField(string s) - { - string retval = ""; - string[] parts = s.ToUpper().Split(":".ToCharArray()); - switch (s.ToUpper()) - { - case "PATH": - retval = m_Path; - break; - //case "TITLE": - //retval = m_Title; - //break; - case "TYPE": - retval = m_Type; - break; - default: - if (PropArray.ContainsKey(parts[0])) - { - retval = PropArray[parts[0]].ToString(); - } - else - { - return null; - } - break; - } - if (parts.Length > 1) - { - int width = Convert.ToInt32(parts[1]); - if (parts[1][0] == ' ' || parts[1][0] == '0') - { - retval = retval.PadLeft(width, parts[1][0]); - } - else - { - retval = retval.PadRight(width).Substring(0, width).Trim(); - } - } - return retval; - } - } - -} diff --git a/PROMS/Volian.Utils.Library/vlnObject/vlnObjectLibrary.csproj b/PROMS/Volian.Utils.Library/vlnObject/vlnObjectLibrary.csproj deleted file mode 100644 index 443d2994..00000000 --- a/PROMS/Volian.Utils.Library/vlnObject/vlnObjectLibrary.csproj +++ /dev/null @@ -1,64 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {933269F5-C3AD-423E-88EB-133A7333FD6B} - Library - Properties - vlnObject - vlnObject - - - - - - - - - - - true - full - false - ..\..\..\..\..\veproms\bin\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\..\..\..\..\veproms\bin\log4net.dll - - - - - - - - - - - - Always - - - - - \ No newline at end of file diff --git a/PROMS/Volian.Utils.Library/vlnServerLibrary/vlnServer.cs b/PROMS/Volian.Utils.Library/vlnServerLibrary/vlnServer.cs deleted file mode 100644 index e3a0c027..00000000 --- a/PROMS/Volian.Utils.Library/vlnServerLibrary/vlnServer.cs +++ /dev/null @@ -1,248 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using vlnObjectLibrary; -using System.Xml; -using System.IO; -using System.Data; -using System.Data.OleDb; -using System.Reflection; - -namespace vlnServerLibrary -{ - public class vlnServer // This class loads children for a vlnObject - { - #region Log4Net - private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - #endregion - #region Static Properties - private static string m_XmlControlPath = "vlnControl.xml"; - private static XmlDocument m_XmlControl; - public static string XMLControlPath - { - get { return m_XmlControlPath; } - set - { - m_XmlControlPath = value; - } - } - public static XmlDocument XMLControl - { - get - { - if (m_XmlControl == null) - { - m_XmlControl = new XmlDocument(); - lock (m_XmlControl) - { - m_XmlControl.Load(m_XmlControlPath); - } - } - return m_XmlControl; - } - } - #endregion - private List LoadChildren(vlnObject o) - { - o.Children = new List(); - LoadChildrenFromFolders(o); - LoadChildrenFromDB(o,LookUp(o,"select")); - return o.Children; - } - public string GetChildren(string sVlnObject) - { - using (vlnObject o = new vlnObject(sVlnObject)) - { - LoadChildren(o); - return o.AllChildren(); - } - } - public string GetDataPath() - { - vlnObject o = new vlnObject(); - o.Type="datapath"; - o.Title="Data Path"; - o.Path=LookUpX(o,".//default/@datapath"); - return o.ToString(); - } - protected string LookUp(vlnObject o,string s) - { - string xPath = string.Format(".//dbObject[@type='{0}']/@{1}", o.Type, s); - return LookUpX(o,xPath); - } - protected string LookUpP(vlnObject o,string s) - { - string xPath = string.Format(".//dbObject[@type='{0}']/@{1}", o.Parent.Type, s); - return LookUpX(o,xPath); - } - protected string LookUpX(vlnObject o,string xPath) - { - return LookUpX(o,xPath, XMLControl); - } - private void LoadChildrenFromDB(vlnObject o,string sSelect) - { - if (sSelect != "") - { - try - { - string s = LookUpX(o,".//connection/@string"); - OleDbConnectionStringBuilder csb = new OleDbConnectionStringBuilder(s); - OleDbConnection dbConn = new OleDbConnection(csb.ConnectionString); - string sTable = LookUp(o,"table"); - //if (dbConn.State != ConnectionState.Open) dbConn.Open(); - OleDbDataAdapter da = new OleDbDataAdapter(sSelect, dbConn); - DataSet ds = new DataSet(); - da.Fill(ds, sTable); - string srt = LookUp(o,"sort"); - DataView dv = new DataView(ds.Tables[sTable], LookUp(o,"criteria"), LookUp(o,"sort"), DataViewRowState.CurrentRows); - foreach (DataRowView mydrv in dv) - { - vlnObject vb = o.Add(LookUp(o,"child"), "", o.Path); - foreach (DataColumn dc in dv.Table.Columns) - { - vb.AddProp(dc.ColumnName, mydrv[dc.ColumnName].ToString()); - } - vb.Title = LookUpP(vb,"title"); - o.Children.Add(vb); - } - } - catch (Exception ex) - { - log.ErrorFormat("{0}\r\n{1}", ex.Message, ex.InnerException); - } - } - } - public DataSet GetDataSet(vlnObject o, string sSelect) - { - if (sSelect != "") - { - try - { - OleDbConnection dbConn = new OleDbConnection(LookUpX(o, ".//connection/@string")); - OleDbDataAdapter da = new OleDbDataAdapter(sSelect, dbConn); - DataSet ds = new DataSet(); - da.Fill(ds, LookUp(o, "table")); - return ds; - } - catch (Exception ex) - { - log.ErrorFormat("{0}\r\n{1}", ex.Message, ex.InnerException); - } - } - return null; - } - public OleDbDataReader GetDataReader(vlnObject o, string sSelect) - { - if (sSelect != "") - { - OleDbConnection dbConn = new OleDbConnection(LookUpX(o, ".//connection/@string")); - OleDbCommand cmd = new OleDbCommand(sSelect, dbConn); - cmd.CommandType = CommandType.Text; - dbConn.Open(); - OleDbDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); - return dr; - } - return null; - } - private void LoadChildrenFromFolders(vlnObject o) - { - // First look in the XML to see if there are any folders for the specified item - XmlNodeList nl = XMLControl.SelectNodes(string.Format(".//dbObject[@type='{0}']/folders/folder", o.Type)); - if (nl.Count != 0) - { - foreach (XmlNode xn in nl) - { - LoadChildrenFromFolder(o,xn); - } - } - } - private void LoadChildrenFromFolder(vlnObject o, XmlNode xn) - { - // First look in the XML to see if there are any folders for the specified item - string sTmp = LookUpX(o,"@template", xn); - if (sTmp != "") - { - string sException = LookUpX(o,"@exception", xn); - string sRequired = LookUpX(o,"@requires", xn); - DirectoryInfo di = new DirectoryInfo(o.Path); - if (sRequired == "" || di.GetFileSystemInfos(sRequired).Length > 0) - { - if (sException == "" || di.GetFileSystemInfos(sException).Length == 0) - { - try - { - if (sTmp == ".") - { - LoadChildrenFromFolder(o, xn, di); - } - else - { - if(sTmp.Contains("\\")){ - string[] sTmps = sTmp.Split('\\'); - DirectoryInfo [] dis = di.GetDirectories(sTmps[0]); - foreach (DirectoryInfo di2 in dis) - { - foreach (FileSystemInfo di3 in di2.GetFileSystemInfos(sTmps[1])) - { - LoadChildrenFromFolder(o, xn, di3); - } - } - } - else - { - foreach (FileSystemInfo di1 in di.GetFileSystemInfos(sTmp)) - { - LoadChildrenFromFolder(o, xn, di1); - } - } - } - } - catch (DirectoryNotFoundException ex) - { - // Ignore this exception - log.InfoFormat("Directory {0} Template {1} Error {2}",di, sTmp,ex.Message); - } - catch (Exception ex) - { - log.ErrorFormat("Error: {0}\r\n{1}", ex.Message, ex.InnerException); - } - } - } - } - } - private void LoadChildrenFromFolder(vlnObject o,XmlNode xn, FileSystemInfo fi) - { - vlnObject vb = o.Add(LookUpX(o,"@child", xn), "", fi.FullName); - vb.AddProp("filename", fi.Name); - vb.Title = GetTitle(fi.FullName, LookUpX(vb,"@title", xn)); - o.Children.Add(vb); - } - protected string GetTitle(string sPath, string sDefault) - { - string sRetval = sDefault; - if (sRetval[0] == '~') - { - string sTitlePath = sPath + "\\title"; - if (File.Exists(sTitlePath)) - { - StreamReader sr = File.OpenText(sTitlePath); - return sr.ReadToEnd(); - } - sRetval = sRetval.Substring(1); - } - return sRetval; - } - protected string LookUpX(vlnObject o, string xPath, XmlNode xn) - { - XmlNode nd = xn; - XmlNode ndf = nd.SelectSingleNode(xPath); - while (ndf == null && nd.ParentNode != null) - { - nd = nd.ParentNode; - ndf = nd.SelectSingleNode(xPath); - } - if (ndf == null) return ""; - return o.ProcessString(ndf.InnerText); - } - } -} diff --git a/PROMS/Volian.Utils.Library/vlnServerLibrary/vlnServerLibrary.csproj b/PROMS/Volian.Utils.Library/vlnServerLibrary/vlnServerLibrary.csproj deleted file mode 100644 index 07c91b84..00000000 --- a/PROMS/Volian.Utils.Library/vlnServerLibrary/vlnServerLibrary.csproj +++ /dev/null @@ -1,63 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {F9B53DDC-2A2E-4A17-B777-4EC0EE585DE2} - Library - Properties - vlnServerLibrary - vlnServerLibrary - - - - - - - - - - - true - full - false - ..\..\..\..\..\veproms\bin\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\..\..\..\..\veproms\bin\log4net.dll - - - - - - False - ..\..\..\..\..\veproms\bin\vlnObject.dll - - - - - - - - - \ No newline at end of file diff --git a/PROMS/XYPlots/AssemblyInfo.cs b/PROMS/XYPlots/AssemblyInfo.cs deleted file mode 100644 index 9f89a328..00000000 --- a/PROMS/XYPlots/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -// -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: - -[assembly: AssemblyVersion("1.0.*")] - -// -// In order to sign your assembly you must specify a key to use. Refer to the -// Microsoft .NET Framework documentation for more information on assembly signing. -// -// Use the attributes below to control which key is used for signing. -// -// Notes: -// (*) If no key is specified, the assembly is not signed. -// (*) KeyName refers to a key that has been installed in the Crypto Service -// Provider (CSP) on your machine. KeyFile refers to a file which contains -// a key. -// (*) If the KeyFile and the KeyName values are both specified, the -// following processing occurs: -// (1) If the KeyName can be found in the CSP, that key is used. -// (2) If the KeyName does not exist and the KeyFile does exist, the key -// in the KeyFile is installed into the CSP and used. -// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. -// When specifying the KeyFile, the location of the KeyFile should be -// relative to the project output directory which is -// %Project Directory%\obj\. For example, if your KeyFile is -// located in the project directory, you would specify the AssemblyKeyFile -// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] -// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework -// documentation for more information on this. -// -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("")] -[assembly: AssemblyKeyName("")] diff --git a/PROMS/XYPlots/XYPlots.cs b/PROMS/XYPlots/XYPlots.cs deleted file mode 100644 index f9269c6c..00000000 --- a/PROMS/XYPlots/XYPlots.cs +++ /dev/null @@ -1,2069 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Windows.Forms; -using System.Text; -using System.Drawing; -using System.Text.RegularExpressions; -using Volian.Base.Library; -using VG; - -namespace XYPlots -{ - /// - /// Summary description for XYPlot. - /// - public class XYPlot - { - #region Log4Net - // C2018-035 Added error Handling to provide more useful information when a plot fails - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - #endregion - static string _MyFontFamily = "Letter Gothic Tall"; - public static string MyFontFamily - { - get { return _MyFontFamily; } - set { _MyFontFamily = value; } - } - private static Color _BlackColor = Color.Red; - public static Color BlackColor - { - get { return VG.VG.BlackColor; } - set { VG.VG.BlackColor = value; } - } - public float Width - { - get { return 72 * (LeftMargin + RightMargin) + printerunits[0] * .05F; } - } - public float Height - { - get { return 72 * (TopMargin + BottomMargin) + printerunits[1] * .05F; } - } - public float PlotWidth - { - get { return (float) userunits[X]; } - } - public float PlotHeight - { - get { return (float) userunits[Y]; } - } - private double ConvertToTwips = 4.8; - static int MAX_XY_STACK = 8; /* this is max of CIE cursor/font stack */ - static int DPI = 1440; //300; - static int CWIDEDOTS = 120; //25; - static int CHIGHDOTS = 240; //50; - static int STRAIGHT = 0; - static int CURVE = 1; - static int X = 0; - static int Y = 1; - static int Dimensions = 2; - static int USER = 0; - static int PLOT = 1; - static double PI = 3.141592653; - static double Zero = 0.0; - static double ANGLELIMIT = 1.0; - // !!!! NEED REAL SUPERSCRIPT ON/OFF TOKENS - static string[] SuperScript = { "##", "##" }; - static string[] SubScript = { "~~", "~~" }; - FileStream XYPlotFile; - private int[] SavedX; - private int[] SavedY; - private int stack; - /// - /// Set All Margins at once - /// - /// Left Margin in Inches. - /// Top Margin in Inches. - /// Right Margin in Inches. - /// Bottom Margin in Inches. - public void SetMargins(float leftMargin, float topMargin, float rightMargin, float bottomMargin) - { - _LeftMargin = leftMargin * 1440; - _TopMargin = yTopMarginAdjust + topMargin * 1440; - _RightMargin = rightMargin * 1440; - _BottomMargin = bottomMargin * 1440; - } - private float _LeftMargin = 1440; - /// - /// Left Margin in Inches. - /// - public float LeftMargin - { - get { return _LeftMargin / 1440; } - set { _LeftMargin = value * 1440; } - } - private float _RightMargin = 720; - /// - /// Right Margin in Inches. - /// - public float RightMargin - { - get { return _RightMargin / 1440; } - set { _RightMargin = value * 1440; } - } - private float _TopMargin = 1440; - /// - /// Top Margin in Inches. - /// - public float TopMargin - { - get { return _TopMargin / 1440; } - set { _TopMargin = value * 1440; } - } - private float _BottomMargin = 1440; - /// - /// Bottom Margin in Inches. - /// - public float BottomMargin - { - get { return _BottomMargin / 1440; } - set { _BottomMargin = value * 1440; } - } - public int LinesUsed; - private string valuestring; - private string powerstring; - private int GridOnFlag, Visible, ShadowFlag; - private char[] type = new char[Dimensions]; - private double FontPitch = 10.0; - private double[] minimum = new double[Dimensions]; - private double[] maximum = new double[Dimensions]; - private double[] userunits = new double[Dimensions]; - private int[] printerunits = new int[Dimensions]; - private int[] Position = new int[Dimensions]; - private double[,] Scale = new double[2, Dimensions]; - private double[,] Offset = new double[2, Dimensions]; - private double[] delta = new double[Dimensions]; - private int[] cycles = new int[Dimensions]; - private int[] onecycle = new int[Dimensions]; - private int[] minor = new int[Dimensions]; - private int[] spcminor = new int[Dimensions]; - private string[] AxisTitles = new string[Dimensions]; - private int[] AxisLabel = new int[Dimensions];// 1 for YES(default), 0 for NO - private int CurPenWidth, DrawDirection, LineFlag, LineDiv; - private int EndFlag = 0; - public string Buff; - private int BuffPtr = 0; - private bool[,] doLOG10 = { { false, false }, { false, false } }; - public struct point - { - public int[] xyValue; //new int[Dimensions]; - } - public struct XyBox - { - public int Shadow; - public string BoxText; - public point BoxMinimum; - public point BoxMaximum; - }; - public class XyBoxes : List - { - } - private XyBoxes AllBoxes = new XyBoxes(); - private XyBoxes ActiveBoxes = new XyBoxes(); - public class DataPoint - { - public override string ToString() // Make it easier to Debug - { - return string.Format("{0},{1}", APoint.xyValue[X],APoint.xyValue[Y]); - } - private point m_APoint; - public point APoint - { - get { return m_APoint; } - set { m_APoint = value; } - } - private double m_slope; // slope of tangent to circle at this point - public double slope - { - get { return m_slope; } - set { m_slope = value; } - } - } - public class DataPoints : List - { - } - public struct PlotLine - { - public int PlotType; - public int PlotDivisions; - public DataPoints PlotDataPoints; - }; - private List AllPlots = new List(); - private int YLandScape = 0; /* y axis title is horizontal */ - private point YTitleOrigin; /* y axis title origin if vertical */ - private double FixAngle(double a1) - { - double retval; - int sign; - if (a1 < 0) - { - a1 = -a1; - sign = -1; - } - else - sign = 1; - retval = sign * Math.Floor(0.5 + a1); - return retval; - } - private double dsquare(int val) - { - double result; - result = (double)(val * val); - return result; - } - private double FMin(double f1, double f2) - { - return ((f1 >= f2) ? f2 : f1); - } - private double FMax(double f1, double f2) - { - return ((f1 >= f2) ? f1 : f2); - } - private double atan_deg(double x) - { - return (Math.Atan(x) * 180.0 / PI); - } - private double cos_deg(double x) - { - return (Math.Cos(x * PI / 180.0)); - } - private double tan_deg(double x) - { - return (Math.Tan(x * PI / 180.0)); - } - private double sin_deg(double x) - { - return (Math.Sin(x * PI / 180.0)); - } - /// - /// the following function is pointed to by a function pointer - /// and is provided for compatibility with log10() function usage - /// - /// - /// - private double linear(double x) - { - return x; - } - private bool isWhiteSpace(char cptr) - { - bool rtnval = false; - if (!cptr.Equals(null)) - { - int idx = "\t\n\r\f ".IndexOf(cptr); - rtnval = (idx > -1); - } - return rtnval; - } - private string NextPiece() - { - string rtnval; - int ptr; - while (BuffPtr >= 0 && Buff[BuffPtr] != 0 && isWhiteSpace(Buff[BuffPtr])) BuffPtr++; - ptr = BuffPtr; - while (BuffPtr >= 0 && Buff[BuffPtr] != 0 && !isWhiteSpace(Buff[BuffPtr])) BuffPtr++; - if (EndOfCommand()) EndFlag = 1; - rtnval = Buff.Substring(ptr, BuffPtr - ptr); - BuffPtr++; - return rtnval; - } - private bool EndOfCommand() - { - int tmpPtr = BuffPtr; - while (!Buff[tmpPtr].Equals('\0') && Buff[tmpPtr].Equals(' ')) tmpPtr++; - if (!Buff[tmpPtr].Equals('\0') && !isWhiteSpace(Buff[tmpPtr])) - return false; - else if (Buff[tmpPtr] == '\r' || Buff[tmpPtr] == '\n' || Buff[tmpPtr] == '\0') - return true; - else - return false; - } - private bool LoadBuff(string FileName) - { - if (!File.Exists(FileName)) - { - if (!BaseLnSettings.blBaseLine) // B2026-056 suppress messages when running baseline. - { - // File does not exist, show error message - MessageBox.Show(String.Format("X/Y Plot File {0} Does Not Exist", FileName), "Error Opening X/Y Plot File"); - return false; - } - } - // Open the X/Y Plot file - try - { - XYPlotFile = File.OpenRead(FileName); - } - catch (Exception e) - { - if (!BaseLnSettings.blBaseLine) // B2026-056 suppress messages when running baseline. - { - // cannot open the x/y plot file - MessageBox.Show(e.Message, String.Format("Error Opening {0} for Reading", FileName)); - return false; - } - } - int blen = (int)XYPlotFile.Length; - int bread = 0; - // initialize a byte array to read into - byte[] bbuf = new byte[blen + 1]; - for (int i = 0; i < blen; i++) bbuf[i] = 0; - // Read the contents of the x/y plot file into the byte array - try - { - bread = XYPlotFile.Read(bbuf, 0, blen); - } - catch (Exception e) - { - if (!BaseLnSettings.blBaseLine) // B2026-056 suppress messages when running baseline. - { - MessageBox.Show(e.Message, String.Format("Error Reading {0}", FileName)); - return false; - } - } - try - { - XYPlotFile.Close(); - } - catch (Exception e) - { - if (!BaseLnSettings.blBaseLine) // B2026-056 suppress messages when running baseline. - { - MessageBox.Show(e.Message, String.Format("Error Closing {0}", FileName)); - return false; - } - } - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < bbuf.Length; i++) - { - if (bbuf[i] == '\r' && bbuf[i - 1] == ' ') - sb.Remove(i - 1, 1); - sb.Append(Convert.ToChar(bbuf[i])); - } - Buff = sb.ToString(); - BuffPtr = 0; - return true; - } - private void LoadBuffFromString(string str) - { - Buff = str; - } - private int getint() - { - int retval; - string np = NextPiece(); - np = Regex.Replace(np, "[^-0-9]", ""); - retval = Convert.ToInt32(np, 10); - return retval; - } - // A 'special' isWhiteSpaceDelta, NextPieceDelta, and getdoubleDelta was added because Wolf Creek - // has a ',' between the x/y delta of one of their plots (C-1). - // this was causing the x delta to be set to 50,250. - private bool isWhiteSpaceDelta(char cptr) - { - bool rtnval = false; - if (!cptr.Equals(null)) - { - int idx = "\t\n\r\f ,".IndexOf(cptr); - rtnval = (idx > -1); - } - return rtnval; - } - private string NextPieceDelta() - { - string rtnval; - int ptr; - while (BuffPtr >= 0 && Buff[BuffPtr] != 0 && isWhiteSpaceDelta(Buff[BuffPtr])) BuffPtr++; - ptr = BuffPtr; - while (BuffPtr >= 0 && Buff[BuffPtr] != 0 && !isWhiteSpaceDelta(Buff[BuffPtr])) BuffPtr++; - if (EndOfCommand()) EndFlag = 1; - rtnval = Buff.Substring(ptr, BuffPtr - ptr); - BuffPtr++; - return rtnval; - } - private double getdoubleDelta() - { - double retval; - retval = Convert.ToDouble(NextPieceDelta()); - return retval; - } - private double getdouble() - { - double retval; - retval = Convert.ToDouble(NextPiece()); - return retval; - } - private char NextChar() - { - return Buff[BuffPtr++]; - } - private char getchr() - { - string nxtstring = NextPiece(); - if (nxtstring.Equals("")) - return '\0'; - else - return nxtstring[0]; - } - // C2018-035 Added error Handling to provide more useful information when a plot fails - private string _XYPlotIssue; - public string XYPlotIssue - { - get { return _XYPlotIssue; } - set { _XYPlotIssue = value; } - } - private point GetPair(int flag) - { - point retval = new point(); - retval.xyValue = new int[Dimensions]; - double x, y; - char[] sepchar = { ',' }; - string nextPiece = NextPiece(); // Plot Definition - string[] xystr = nextPiece.Split(sepchar); - // C2018-035 Added error Handling to provide more useful information when a plot fails - if (xystr.Length != 2) - XYPlotIssue = String.Format("Invalid Pair {0}", nextPiece); - if (xystr.Length == 1) - throw new Exception(XYPlotIssue); - x = double.Parse(xystr[0]); - char[] trimEndDot = { '.' }; // Wolf Creek OFN SB-008, figure 3 had a string like 50.0. so trim the ending '.' - string ystr = xystr[1]; - if (ystr.EndsWith(".0")) // bug fix B2012-169, the Trim converted a ".75" value to a "75.0" value - ystr = ystr.Trim(trimEndDot); - // count the number of '.', if there are two and the last char is a '.', trim it (this was causing - // a crash in CAL-OTO-OTO-BG-00001. This was done this way so as to be very specific to the - // problem found in Callaway, i.e. didn't want to break something else. - int cnt = 0; - int indx = ystr.IndexOf("."); - while (indx >= 0) - { - cnt++; - indx = indx+1==ystr.Length?-1:ystr.IndexOf(".", indx + 1); - } - if (cnt > 1) ystr = ystr.TrimEnd(trimEndDot); - - y = double.Parse(ystr); - if (doLOG10[flag, X]) - retval.xyValue[X] = (int)(Offset[flag, X] + Scale[flag, X] * Math.Log10(x) + .5); - else - retval.xyValue[X] = (int)(Offset[flag, X] + Scale[flag, X] * x + .5); - if (doLOG10[flag, Y]) - retval.xyValue[Y] = (int)(printerunits[Y] - (Offset[flag, Y] + Scale[flag, Y] * Math.Log10(y) + .5)); - else - retval.xyValue[Y] = (int)(printerunits[Y] - (Offset[flag, Y] + Scale[flag, Y] * y + .5)); - return (retval); - } - private string GetString() - { - char retval; - StringBuilder Lbuff = new StringBuilder(); - retval = NextChar(); - if (retval != '"' && retval != '\x1C' && !BaseLnSettings.blBaseLine) // open double quote - MessageBox.Show("Double Quote not found", "Syntax problem in XY Plot"); - retval = NextChar(); - while (retval != 0 && retval != '\n') - { - switch (retval) - { - case '"': - case '\x1D': // close double quote - retval = NextChar(); - if (retval == ' ') - { - Lbuff.Append('\n'); - retval = NextChar(); - retval = NextChar(); - } - break; - case '\r': - retval = NextChar(); - break; - case '\\': - retval = NextChar(); /*always take next*/ - Lbuff.Append(retval); - retval = NextChar(); - break; - default: - Lbuff.Append(retval); - retval = NextChar(); - break; - } - } - return Lbuff.ToString(); - } - private void FixBuffIfNeeded() - { - int ptr = 0; - Buff = Buff.Trim(" \r\n".ToCharArray()); - while (Buff.Contains("> ")) Buff = Buff.Replace("> ", ">"); - if (Buff.StartsWith("<< - //Buff = Regex.Replace(Buff, @"[ ]+<", "<"); - Buff = Buff.Replace(">\r ", ">\r\n "); - Buff = Buff.Replace(">\n ", ">\r\n "); // C2022-003 if RO has symbols - Buff = Regex.Replace(Buff, @"[ ]+<", "<"); - // some data only had carriage return, replace these with cr/nl so that following code - // will work - Buff = Buff.Replace(">\r<", ">\r\n<"); - Buff = Buff.Replace(">\n<", ">\r\n<"); // C2022-003 if RO has symbols - Buff = Buff.Replace("><", ">\r\n<"); - // some data had cr/cr/nl, change to cr/nl - Buff = Buff.Replace("\r\r\n", "\r\n"); - while ((ptr = Buff.IndexOf(">\r\n<", ptr)) > 0) - { - // blank out ">" - Buff = Buff.Remove(ptr, 1); - Buff = Buff.Insert(ptr, " "); - // remove "<" - Buff = Buff.Remove(ptr + 3, 1); - // if command on next line is blank, - // combine with the previous line - if (Buff[ptr + 3] == ' ') - Buff = Buff.Remove(ptr, 3); - } - ptr = Buff.Length - 5; // back up past >>\r\n - if (Buff.IndexOf(">>\r\n", ptr) > 0) - { - Buff = Buff.Remove(ptr, 2); - Buff = Buff.Insert(ptr, " "); - } - else if (Buff.EndsWith(">>")) // doesn't end with return chars... - Buff = Buff.Substring(0, Buff.Length - 2) + " \r\n\0x00"; // needs to end with null - else if (Buff.EndsWith(">")) // doesn't end with return chars... - Buff = Buff.Substring(0, Buff.Length - 1) + " \r\n\0x00"; // needs to end with null - Buff = Regex.Replace(Buff, @"\\u([0-9]{1,4})\?", m => int.TryParse(m?.Groups[1]?.Value, out int result) ? Convert.ToChar(result).ToString() : ""); // C2022-003 RO Symbols. Convert unicode to character. - Buff = Regex.Replace(Buff, @"([0-9])\r\n([0-9])", "$1 $2"); - } - private void CloseGraph() - { - /* Send back number of lines used assuming 6 lines per inch */ - if (LinesUsed == 0) - LinesUsed = (int)(1.5 * CHIGHDOTS); /* adjust for x axis tics */ - LinesUsed += printerunits[Y]; - LinesUsed = LinesUsed / CHIGHDOTS; - } - private void GetScaleInfo() - { - GridOnFlag = getint(); - userunits[X] = getdouble(); - userunits[Y] = getdouble(); - printerunits[X] = (int)(DPI * userunits[X]); - printerunits[Y] = (int)(DPI * userunits[Y]); - minimum[X] = getdouble(); - maximum[X] = getdouble(); - minimum[Y] = getdouble(); - maximum[Y] = getdouble(); - type[X] = getchr(); - type[Y] = getchr(); - if (EndFlag == 0) delta[X] = getdoubleDelta(); - if (EndFlag == 0) delta[Y] = getdoubleDelta(); - if (EndFlag == 0) spcminor[X] = getint(); - if (EndFlag == 0) spcminor[Y] = getint(); - Offset[USER, X] = 0; - Offset[USER, Y] = 0; - Scale[USER, X] = DPI; - Scale[USER, Y] = DPI; - /* - in the following if blocks, the array variable f is a function - pointer which is set to either the function linear or log10. - */ - /* X-axis function generation and scaling */ - if (type[X] != 'L') - { - // Linear - doLOG10[PLOT, X] = false; - LinearScale(X); - Scale[PLOT, X] = printerunits[X] / (maximum[X] - minimum[X]); - Offset[PLOT, X] = -Scale[PLOT, X] * minimum[X]; - } - else - { - // Log10 - doLOG10[PLOT, X] = true; - LogScale(X); - Scale[PLOT, X] = printerunits[X] / - (Math.Log10(maximum[X]) - Math.Log10(minimum[X])); - Offset[PLOT, X] = -Scale[PLOT, X] * Math.Log10(minimum[X]); - } - /* Y-axis function generation and scaling */ - if (type[Y] != 'L') - { - // Linear - doLOG10[PLOT, Y] = false; - LinearScale(Y); - Scale[PLOT, Y] = printerunits[Y] / (maximum[Y] - minimum[Y]); - Offset[PLOT, Y] = -Scale[PLOT, Y] * minimum[Y]; - } - else - { - // Log10 - doLOG10[PLOT, Y] = true; - LogScale(Y); - Scale[PLOT, Y] = printerunits[Y] / - (Math.Log10(maximum[Y]) - Math.Log10(minimum[Y])); - Offset[PLOT, Y] = -Scale[PLOT, Y] * Math.Log10(minimum[Y]); - } - } - private void GetAxisTitle(int flag) - { - AxisTitles[flag] = GetString(); - } - private string stripSuperSub(string instr) - { - StringBuilder sb = new StringBuilder(instr); - sb.Replace(SuperScript[0], ""); - sb.Replace(SuperScript[1], ""); - sb.Replace(SubScript[0], ""); - sb.Replace(SubScript[1], ""); - return sb.ToString(); - } - private point DetermineBoxMax(XyBox boxptr) - { - point newval = new point(); - newval.xyValue = new int[Dimensions]; - string tmp; - int pos = 0, prevPos = 0; - int nl = 0, xmax = 0, ilen = 0; - tmp = stripSuperSub(boxptr.BoxText); - tmp = tmp.Replace("\r\n", "\n"); - while ((pos = tmp.IndexOf('\n', pos)) > -1) - { - ilen = pos - prevPos; - xmax = Math.Max(xmax, ilen); - // OLD: prevPos = pos; - prevPos = pos + 1; - pos++; - nl++; - } - // OLD: ilen = tmp.Substring(prevPos + 1).Length; - ilen = tmp.Length - prevPos; // tmp.Substring(prevPos).Length; - xmax = Math.Max(xmax, ilen) + 2; - newval.xyValue[X] = boxptr.BoxMinimum.xyValue[X] + (xmax * CWIDEDOTS); - // OLD: newval.xyValue[Y] = boxptr.BoxMinimum.xyValue[Y] - (nl * CHIGHDOTS) - (int)(30 * ConvertToTwips); - newval.xyValue[Y] = boxptr.BoxMinimum.xyValue[Y] - (nl * CHIGHDOTS) - (int)(19 * ConvertToTwips); - return newval; - } - private float yTopMarginAdjust = 0; - private void GetBoxParameters() - { - XyBox NewBox = new XyBox(); - point Origin; - Origin = GetPair(USER); - string str = GetString(); - NewBox.BoxText = str; - NewBox.BoxMinimum = Origin; - NewBox.Shadow = ShadowFlag; - ShadowFlag = 0; - NewBox.BoxMaximum = DetermineBoxMax(NewBox); - point minPoint = new point(); - minPoint.xyValue = new int[Dimensions]; - point maxPoint = new point(); - maxPoint.xyValue = new int[Dimensions]; - minPoint.xyValue[X] = Origin.xyValue[X]; - minPoint.xyValue[Y] = NewBox.BoxMaximum.xyValue[Y]; - maxPoint.xyValue[X] = NewBox.BoxMaximum.xyValue[X]; - maxPoint.xyValue[Y] = Origin.xyValue[Y]; - NewBox.BoxMinimum = minPoint; - if (minPoint.xyValue[Y] < 0) // If the box is above the range of the Plot then the top margin must be adjusted - // so that the text is visible - yTopMarginAdjust = -(minPoint.xyValue[Y]+720); // TopMargin defaults to .5 Inches (720 Twips) - NewBox.BoxMaximum = maxPoint; - AllBoxes.Add(NewBox); - } - private void GetLineParameters() - { - DataPoints dataPoints = new DataPoints(); - int pointcount; - pointcount = EndFlag = 0; - while (EndFlag == 0) - { - DataPoint pl = new DataPoint(); - pl.APoint = new point(); - pl.APoint = GetPair(PLOT); - pointcount++; - dataPoints.Add(pl); - } - if (LineFlag == CURVE && pointcount > 2) - CalculateSlopes(dataPoints); - else - LineFlag = STRAIGHT; -//#if DEBUG - //ShowPoints(dataPoints); -//#endif - AddAPlot(dataPoints); - } - private double FindSlope(point first, point last) - { - double dx, dy, result; - dx = last.xyValue[X] - first.xyValue[X]; - dy = (last.xyValue[Y] - first.xyValue[Y]); - if (dx == 0.0) - { - if (dy > 0) - result = Convert.ToDouble("1.E99"); - else - result = Convert.ToDouble("-1.E99"); - } - else - result = dy / dx; - return result; - } - private double FindEndSlope(point first, point last, double s1) - { - double result; - result = 2.0 * FindSlope(first, last) - s1; - if (result * s1 < 0.0) - result = 0.0; - return result; - } - private void CalculateSlopes(DataPoints dataPoints) - { - DataPoint thispt, prevpt, firstpt; - long yval, y1, y3; - int PlAryIdx = 0; - int PlAryNumItems = dataPoints.Count; - prevpt = dataPoints[PlAryIdx]; - PlAryIdx++; - thispt = dataPoints[PlAryIdx]; - while (PlAryIdx + 1 < dataPoints.Count) - { - thispt.slope = Zero; - yval = thispt.APoint.xyValue[Y]; - y1 = prevpt.APoint.xyValue[Y]; - y3 = dataPoints[PlAryIdx + 1].APoint.xyValue[Y]; - if ((yval - y1) * (y3 - yval) > 0) - thispt.slope = FindSlope(prevpt.APoint, dataPoints[PlAryIdx + 1].APoint); - prevpt = thispt; - PlAryIdx++; - thispt = dataPoints[PlAryIdx]; - } - firstpt = dataPoints[0]; - firstpt.slope = FindEndSlope(firstpt.APoint, dataPoints[1].APoint, dataPoints[1].slope); - thispt.slope = FindEndSlope(thispt.APoint, prevpt.APoint, prevpt.slope); - } - private void AddAPlot(DataPoints ptr) - { - PlotLine NewLine = new PlotLine(); - NewLine.PlotType = LineFlag; - NewLine.PlotDivisions = LineDiv; - NewLine.PlotDataPoints = ptr; - AllPlots.Insert(0, NewLine); - } - private void GenerateGrid(VG.Page pg, IVGOutput vgOutput) - { - ActiveBoxes.Clear(); - Position[X] = 0; - Position[Y] = 0; // printerunits[Y]; - SavePosition(); - SetPenDiameter(5); - BoxRelative(printerunits[X], printerunits[Y], CurPenWidth, pg, vgOutput); - if (GridOnFlag == 0) Visible = 0; - //if (vgOutput is VGOut_Graphics) - //{ - DoGrid(X, pg, vgOutput, 1); - DoGrid(Y, pg, vgOutput, 1); - DoGrid(X, pg, vgOutput, 2); - DoGrid(Y, pg, vgOutput, 2); - DoGrid(X, pg, vgOutput, 3); - DoGrid(Y, pg, vgOutput, 3); - //} - //else if (vgOutput is VGOut_C1PDF) - //{ - // DrawDirection = Y; - // DoGrid(X, pg, vgOutput); - // DrawDirection = X; - // DoGrid(Y, pg, vgOutput); - //} - Visible = 1; - RecallPosition(); - // Draw outline last to overlap any grid lines. - //SetPenDiameter(5); - //BoxRelative(printerunits[X], printerunits[Y], CurPenWidth, pg, vgOutput); - } - private void DoGrid(int flag, VG.Page pg, IVGOutput vgOutput) - { - if (type[flag] != 'L') - DoLinearGrid(flag, pg, vgOutput); - else - DoLogGrid(flag, pg, vgOutput); - } - private void DoLinearGrid(int flag, VG.Page pg, IVGOutput vgOutput) - { - int i, n, ns, subminor; - int ptval; - n = (int)(0.5 + (maximum[flag] - minimum[flag]) / delta[flag]); - ns = n * minor[flag]; - if ((minor[flag] % 2) != 0) - subminor = minor[flag]; - else - subminor = minor[flag] / 2; - for (i = 0; i <= ns; i++) - { - SetPenDiameter((((i % minor[flag]) != 0) ? (((i % subminor) != 0) ? 1 : 2) : 3)); - ptval = ((int)printerunits[flag]) * i / ns; - if (flag == Y) - ptval = printerunits[Y] - ptval; - MoveAbsolute(((flag == X) ? ptval : 0), ((flag == Y) ? ptval : 0)); - if (i % minor[flag] == 0) - WriteValue(flag, minimum[flag] + i * delta[flag] / minor[flag], false, pg, vgOutput); - DrawGridLine((flag == 0) ? 1 : 0, ptval, pg, vgOutput); - } - } - private void DoGrid(int flag, VG.Page pg, IVGOutput vgOutput, int gridPen) - { - DrawDirection = 1 - flag; - if (type[flag] != 'L') - DoLinearGrid(flag, pg, vgOutput, gridPen); - else - if (gridPen == 3) DoLogGrid(flag, pg, vgOutput); - } - private void DoLinearGrid(int flag, VG.Page pg, IVGOutput vgOutput, int gridPen) - { - int i, n, ns, subminor; - int ptval; - n = (int)(0.5 + (maximum[flag] - minimum[flag]) / delta[flag]); - ns = n * minor[flag]; - if ((minor[flag] % 2) != 0) - subminor = minor[flag]; - else - subminor = minor[flag] / 2; - for (i = 0; i <= ns; i++) - { - int pd = (((i % minor[flag]) != 0) ? (((i % subminor) != 0) ? 1 : 2) : 3); - if (pd == gridPen) - { - SetPenDiameter(pd); - ptval = ((int)printerunits[flag]) * i / ns; - if (flag == Y) - ptval = printerunits[Y] - ptval; - MoveAbsolute(((flag == X) ? ptval : 0), ((flag == Y) ? ptval : 0)); - if (i % minor[flag] == 0) - WriteValue(flag, minimum[flag] + i * delta[flag] / minor[flag], false, pg, vgOutput); - DrawGridLine((flag == 0) ? 1 : 0, ptval, pg, vgOutput); - } - } - } - private void DoLogGrid(int flag, VG.Page pg, IVGOutput vgOutput) - { - double showval; - int gs, ge, gd; - int i, ptval; - showval = minimum[flag]; - for (i = 0; i < cycles[flag]; i++) - { - gs = gd = 100; - ge = 1000; - ptval = ((int)printerunits[flag]) * i / cycles[flag]; - if (flag == Y) - ptval = printerunits[Y] - ptval; //jj - MoveAbsolute(((flag == X) ? ptval : 0), ((flag == Y) ? ptval : 0)); - SetPenDiameter(3); - WriteValue(flag, showval, false, pg, vgOutput); - GenGrid(flag, gs, ge, gd, onecycle[flag], 2, i * onecycle[flag], pg, vgOutput); - showval *= 10.0; - } - ptval = ((int)printerunits[flag]) * i / cycles[flag]; - if (flag == Y) - ptval = printerunits[Y] - ptval; //jj - MoveAbsolute(((flag == X) ? ptval : 0), ((flag == Y) ? ptval : 0)); - SetPenDiameter(3); - WriteValue(flag, showval, false, pg, vgOutput); - } - private void WriteValue(int flag, double val, bool SubLogValue, VG.Page pg, IVGOutput vgOutput) - { - int size; - size = GenNumberString(val); - SavePosition(); - if (flag == X) - { - MoveRelative(0, -printerunits[Y]); - if (!SubLogValue) - DrawGridRelative(0, (int)(-30 * ConvertToTwips), pg, vgOutput); - // OLD: MoveRelative((int)((-130 * size / (int)FontPitch) * ConvertToTwips), (int)(-60 * ConvertToTwips)); - MoveRelative((int)((2 - 130 * size / (int)FontPitch) * ConvertToTwips), (int)(-62 * ConvertToTwips)); - if ((AxisLabel[0]) != 0) - { - if (SubLogValue) - { - StringBuilder sb = new StringBuilder(); - sb.Append(SuperScript[0]); - sb.Append(valuestring); - sb.Append(SuperScript[1]); - valuestring = sb.ToString(); - MoveRelative(30, 30); - } - GraphText(valuestring, pg, vgOutput); - } - } - else - { - if (!SubLogValue) - DrawGridRelative((int)(-30 * ConvertToTwips), 0, pg, vgOutput); - // OLD: MoveRelative((int)(-(15 + 300 * size / (int)FontPitch) * ConvertToTwips), (int)(-15 * ConvertToTwips)); - MoveRelative((int)(-(14 + 250 * size / (int)FontPitch) * ConvertToTwips), (int)(-16 * ConvertToTwips)); - if ((AxisLabel[1]) != 0) - { - if (SubLogValue) - { - StringBuilder sb = new StringBuilder(); - sb.Append(SuperScript[0]); - sb.Append(valuestring); - sb.Append(SuperScript[1]); - valuestring = sb.ToString(); - MoveRelative(90, -90); //jj - } - GraphText(valuestring, pg, vgOutput); - } - } - RecallPosition(); - } - private int GenNumberString(double x) - { - int power, size, sign; - double mantissa; - if (x == 0.0) return (savenumber(x)); - if (x < 0.0) - { - x = -x; - sign = 1; - } - else - sign = 0; - mantissa = Math.Log10(x); - power = 0; - while (mantissa < 0.999) - { - power--; - mantissa++; - } - while (mantissa >= 0.999) - { - power++; - mantissa--; - } - if (mantissa < 0) - mantissa = 0; - if (power > -5 && power < 5) - size = savenumber(x); - else - { - size = savenumber(Math.Pow(10.0, mantissa)); - size += addpower(power); - if (valuestring.StartsWith("1x")) - { - size -= 2; - valuestring = valuestring.Remove(0, 2); - } - } - if (sign != 0) - { - valuestring = "-" + valuestring; - size++; - } - return (size); - } - private int savenumber(double x) - { - valuestring = x.ToString("G"); - return valuestring.Length; - } - private int addpower(int i) - { - int tlen; - powerstring = string.Format("x10{0}{1}{2}", SuperScript[0], i.ToString(), SuperScript[1]); - valuestring = valuestring + powerstring; - tlen = SuperScript[0].Length + SuperScript[1].Length; - return (powerstring.Length - tlen); - } - private void DoAxisTitles(VG.Page pg, IVGOutput vgOutput) - { - int len, frommargin; - string str; - SavePosition(); - if ((AxisTitles[X] != null) && (len = AxisTitles[X].Length) > 0) - { - frommargin = (int)((0.5 * (printerunits[X])) - (0.47 * (len * CWIDEDOTS))); - // OLD: frommargin = (int)((0.5 * (printerunits[X])) - (0.5 * (len * CWIDEDOTS))); - MoveAbsolute(frommargin, (3 * CHIGHDOTS) + printerunits[Y]); - PrintText(AxisTitles[X], pg, vgOutput); - LinesUsed += (3 * CHIGHDOTS); - AxisTitles[X] = null; - } - if ((AxisTitles[Y] != null) && (len = AxisTitles[Y].Length) > 0) - { - if (YLandScape > 0) - { - int strIdx = 0; - MoveTo(YTitleOrigin); - str = AxisTitles[Y]; - while (strIdx < str.Length) - { - PrintText(str[strIdx].ToString(), pg, vgOutput); - MoveRelative(0, -CHIGHDOTS); - strIdx++; - } - } - else - { - MoveAbsolute(-3 * CWIDEDOTS, -CHIGHDOTS); - PrintText(AxisTitles[Y], pg, vgOutput); - } - AxisTitles[Y] = null; - } - RecallPosition(); - } - private void DoBoxes(VG.Page pg, IVGOutput vgOutput) - { - int dx, dy; - XyBox current; - string str; - SavePosition(); - int BoxIdx = 0; - SetPenDiameter(5); - while (BoxIdx < AllBoxes.Count) - { - current = AllBoxes[BoxIdx]; - MoveTo(current.BoxMinimum); - dx = current.BoxMaximum.xyValue[X] - current.BoxMinimum.xyValue[X]; - dy = current.BoxMaximum.xyValue[Y] - current.BoxMinimum.xyValue[Y]; - if (current.Shadow != 2) BoxRelative(dx, dy, CurPenWidth, pg, vgOutput); - if (current.Shadow == 1) - { - int savePenWidth = CurPenWidth; - SavePosition(); - SetPenDiameter(10); - MoveRelative((int)(10 * ConvertToTwips), -(dy + (int)(5 * ConvertToTwips))); - DrawRelative(dx, 0, pg, vgOutput); - MoveRelative(-(int)(3 * ConvertToTwips), -(int)(5 * ConvertToTwips)); - DrawRelative(0, dy, pg, vgOutput); - CurPenWidth = savePenWidth; - RecallPosition(); - } - MoveRelative((CWIDEDOTS * (3 / 2)), -(CHIGHDOTS * (5 / 4))); - str = current.BoxText; - int stridx = 0; - while (stridx < str.Length) - { - string tstr = str; - int idx; - if ((idx = str.IndexOf("\n", stridx)) >= 0) - { - tstr = str.Substring(stridx, idx - stridx); - stridx = idx + 1; - } - else - stridx = str.Length + 1; - PrintText(tstr, pg, vgOutput); - MoveRelative(0, -CHIGHDOTS); - } - BoxIdx++; - } - RecallPosition(); - } - private void DrawLines(VG.Page pg, IVGOutput vgOutput) - { - int PlotsIdx = 0; - DataPoint curpoint; - PlotLine current; - SavePosition(); - SetPenDiameter(8); - /* begin plotting the graph lines, which may be straight or curved */ - while (PlotsIdx < AllPlots.Count) - { - current = AllPlots[PlotsIdx]; - int pntListIdx = 0; - LineDiv = current.PlotDivisions; - if (current.PlotType == STRAIGHT) - { /* straight plot */ - curpoint = current.PlotDataPoints[pntListIdx]; - MoveTo(curpoint.APoint); - while (++pntListIdx < current.PlotDataPoints.Count) - { - curpoint = current.PlotDataPoints[pntListIdx]; - DrawLineTo(curpoint.APoint, pg, vgOutput); - } - } - else - { - DrawCurve(current, pg, vgOutput); /* curved plot */ - } - PlotsIdx++; - } /* repeat for each plot (while) */ - RecallPosition(); - } - private point FindCenterOfArc(point StartPoint, double Slope1, point EndPoint, double Slope2) - { - point center = new point(); - double s1, s2; - int x1, y1, x2, y2; - center.xyValue = new int[Dimensions]; - s1 = tan_deg(FixAngle(atan_deg(Slope1))); - s2 = tan_deg(FixAngle(atan_deg(Slope2))); - x1 = StartPoint.xyValue[X]; - y1 = StartPoint.xyValue[Y]; - x2 = EndPoint.xyValue[X]; - y2 = EndPoint.xyValue[Y]; - center.xyValue[X] = (int)(((s2 * s1) * (y2 - y1) + (s1 * x2) - (s2 * x1)) / (s1 - s2)); - if (s1 == 0.0) - center.xyValue[Y] = (int)(y2 - ((center.xyValue[X] - x2) / s2)); - else - center.xyValue[Y] = (int)(y1 - ((center.xyValue[X] - x1) / s1)); - return (center); - } - private point FindModifiedCenter(double rprime, point PtOnArc, double ang) - { - point newcenter = new point(); - newcenter.xyValue = new int[Dimensions]; - newcenter.xyValue[X] = (int)(PtOnArc.xyValue[X] - rprime * cos_deg(ang)); - newcenter.xyValue[Y] = (int)(PtOnArc.xyValue[Y] - rprime * sin_deg(ang)); - return (newcenter); - } - private int AddMidPoint(DataPoints ptLstAry, int pt1Idx, int pt2Idx) - { - DataPoint midpt; - DataPoint pt1, pt2; - point pt; - double so; - int x1, y1, x2, y2; - pt1 = ptLstAry[pt1Idx]; - pt2 = ptLstAry[pt2Idx]; - x1 = pt1.APoint.xyValue[X]; - y1 = pt1.APoint.xyValue[Y]; - x2 = pt2.APoint.xyValue[X]; - y2 = pt2.APoint.xyValue[Y]; - midpt = new DataPoint(); - pt = new point(); - pt.xyValue = new int[Dimensions]; - so = FindSlope(pt1.APoint, pt2.APoint); - midpt.slope = (4.0 * so - pt1.slope - pt2.slope) / 2.0; - pt.xyValue[X] = x1 + (x2 - x1) / 2; - pt.xyValue[Y] = y1 + (y2 - y1) / 2; - midpt.APoint = pt; - ptLstAry.Insert(pt1Idx + 1, midpt); - return (pt1Idx + 1); - } - private double FindTheta(point Endpoint, point Centerpoint) - { - double dy, dx, result; - dx = Endpoint.xyValue[X] - Centerpoint.xyValue[X]; - dy = Endpoint.xyValue[Y] - Centerpoint.xyValue[Y]; - result = 90.0 - atan_deg((dy / dx)); - if (dx < 0) result += 180.0; - return (result); - } - private double FindRadius(point Endpoint, point Centerpoint) - { - double dy, dx, r; - dx = Centerpoint.xyValue[X] - Endpoint.xyValue[X]; - dy = Centerpoint.xyValue[Y] - Endpoint.xyValue[Y]; - r = Math.Sqrt(((dx * dx) + (dy * dy))); - return (r); - } - private void DrawCurve(PlotLine linestart, VG.Page pg, IVGOutput vgOutput) - { - CheckDataPoints(linestart); - int pltptListIdx = -1; - while (++pltptListIdx < linestart.PlotDataPoints.Count - 1) - { - DoSubArcs(linestart.PlotDataPoints, pltptListIdx, pg, vgOutput); - } - } - - private void CheckDataPoints(PlotLine linestart) - { - for(int i = 0;i x1) - { - XYPlotIssue = "X Values should be Increasing"; - throw new Exception("Curve has Invalid Values"); - } - } - } - private double GetAngle(double s1) - { - double t1; - t1 = atan_deg(s1); - return (t1); - } - private double GetAngleBetweenPoints(point pt1, point pt2) - { - double retval; - retval = GetAngle(FindSlope(pt1, pt2)); - if (pt2.xyValue[X] < pt1.xyValue[X]) - { - if (retval < 0) - retval += 180; - else - retval -= 180; - } - return (retval); - } - private double SpecialGetAngleBetweenPoints(point pt1, point pt2, double s1) - { - double retval; - if (s1 == 0.0) - { - if (pt1.xyValue[Y] < pt2.xyValue[Y]) - s1 = Convert.ToDouble("1.E99"); - else - s1 = Convert.ToDouble("-1.E99"); - } - else - s1 = -1 / s1; - retval = GetAngle(s1); - if (pt2.xyValue[X] < pt1.xyValue[X]) - { - if (retval < 0) - retval += 180; - else - retval -= 180; - } - return (retval); - } - private double GetArcAngle(double s1, double s2) - { - double result, t1, t2; - t1 = GetAngle(s1); - t2 = GetAngle(s2); - result = t1 - t2; - return (result); - } - private void DoSubArcs(DataPoints dataPoints, int aryIdx, VG.Page pg, IVGOutput vgOutput) - { - bool debug = false; //jsj - int x, y, x1, x2, y1, y2; - DataPoint pt1 = dataPoints[aryIdx]; - DataPoint pt2 = dataPoints[aryIdx + 1]; - DebugOutput("pt1={0},{1},{2}", pt1.APoint.xyValue[0], pt1.APoint.xyValue[1], pt1.slope); - DebugOutput("pt2={0},{1},{2}", pt2.APoint.xyValue[0], pt2.APoint.xyValue[1], pt2.slope); - double theta, delta1, delta2, r1, r2, t1, t2, theta1, theta2, thetaa, t3, t4; - double c1, c2, s1, s2; - double t3a, t4a; - point cp1, cp2; - t3 = FixAngle(t3a=GetAngle(pt1.slope)); - t4 = FixAngle(t4a=GetAngle(pt2.slope)); - thetaa = GetAngleBetweenPoints(pt1.APoint, pt2.APoint); - if ((t3 - thetaa) * (t4 - thetaa) >= 0.0) - { - double tprime; - tprime = FixAngle(thetaa); - if (Math.Abs(tprime - t3) <= ANGLELIMIT) - { - MoveTo(pt1.APoint); - DrawTo(pt2.APoint, pg, vgOutput); - return; - } - else - { - pt2 = dataPoints[AddMidPoint(dataPoints, aryIdx, aryIdx + 1)]; - t4 = FixAngle(GetAngle(pt2.slope)); - thetaa = GetAngleBetweenPoints(pt1.APoint, pt2.APoint); - } - } - if (thetaa < t3) - t1 = t3 + 90; - else - t1 = t3 - 90; - if (thetaa > t4) - t2 = t4 + 90; - else - t2 = t4 - 90; - theta = t2 - t1; - theta1 = FixAngle(thetaa - t3); - theta2 = theta - theta1; - if (Math.Abs(theta1) < Math.Abs(theta2)) - { - if (Math.Abs(theta1) < ANGLELIMIT) - { - theta1 = 0; - theta2 = theta; - } - } - else if (Math.Abs(theta2) < Math.Abs(theta1)) - { - if (Math.Abs(theta2) < ANGLELIMIT) - { - theta2 = 0; - theta1 = theta; - } - } - x1 = pt1.APoint.xyValue[X]; - y1 = pt1.APoint.xyValue[Y]; - x2 = pt2.APoint.xyValue[X]; - y2 = pt2.APoint.xyValue[Y]; - s1 = sin_deg(t1 + 180); - s2 = sin_deg(t2 + 180); - c1 = cos_deg(t1 + 180); - c2 = cos_deg(t2 + 180); - if (s1 == 0.0) - { - r2 = (x1 - x2) / s2; - r1 = (y2 + r2 * c2 - y1) / c1; - } - else if (s2 == 0.0) - { - r1 = (x2 - x1) / s1; - r2 = (y1 + r1 * c1 - y2) / c2; - } - else if (c1 == 0.0) - { - r2 = (y1 - y2) / c2; - r1 = (x2 + r2 * s2 - x1) / s1; - } - else if (c2 == 0.0) - { - r1 = (y2 - y1) / c1; - r2 = (x1 + r1 * s1 - x2) / s2; - } - else - { - r2 = (((x2 - x1) / c1) - ((y2 - y1) / s1)) / (s2 / s1 - c2 / c1); - r1 = (y2 - y1 + r2 * s2) / s1; - } - MoveTo(pt1.APoint); - if (debug) //jsj - { - DrawTo(pt2.APoint, pg, vgOutput); - return; - } - if (Math.Abs(theta1) > ANGLELIMIT && Math.Abs(theta2) > ANGLELIMIT) - { - delta1 = (r2 - r1) / ( - (1.0 - cos_deg(theta1)) + - (1.0 - cos_deg(theta2)) * sin_deg(theta1) / sin_deg(theta2)); - r1 = Math.Floor(0.5 + r1 + delta1); - cp1 = FindModifiedCenter(r1, pt1.APoint, t1); - x = (int)(cp1.xyValue[X] + r1 * cos_deg(t1 + theta1)); - y = (int)(cp1.xyValue[Y] + r1 * sin_deg(t1 + theta1)); - delta2 = delta1 * sin_deg(theta1) / sin_deg(theta2); - r2 = Math.Floor(0.5 + r2 - delta2); - cp2 = FindModifiedCenter(r2, pt2.APoint, t2); -//#if DEBUG - //DebugOutput("DrawArc1"); VG_Arc.iColor = 1; -//#endif - DrawArc(r1, t1, t1 + theta1, cp1, x, y, pg, vgOutput); - DebugShowLocation("DrawArc1"); - MoveTo(pt2.APoint); - DebugShowLocation("MoveTo1"); - if (r2 > 15000) - { - DebugOutput("DrawAbs1 {0},{1}", x, y); - DrawAbsolute(x, y, pg, vgOutput); - DebugShowLocation("DrawAbs1"); - } - else - { -//#if DEBUG - //DebugOutput("DrawArc2"); VG_Arc.iColor = 2; -//#endif - DrawArc(r2, t2, t2 - theta2, cp2, x, y, pg, vgOutput); - DebugShowLocation("DrawArc2"); - } - } - else if (Math.Abs(theta1) > ANGLELIMIT) - { - delta1 = (r2 - r1) / (1.0 - cos_deg(theta1)); - r1 = Math.Floor(0.5 + r1 + delta1); - if (r1 < 0) r1 = -r1; - cp1 = FindModifiedCenter(r1, pt1.APoint, t1); - x = (int)(cp1.xyValue[X] + r1 * cos_deg(t1 + theta1)); - y = (int)(cp1.xyValue[Y] + r1 * sin_deg(t1 + theta1)); - if (r1 > 15000) - { - DebugOutput("DrawAbs2"); - DrawAbsolute(x, y, pg, vgOutput); - DebugShowLocation("DrawAbs2"); - } - else - { - //Console.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", t3, t3a, t4, t4a, thetaa, t1, t2, r1, r2, aryIdx); -//#if DEBUG - //DebugOutput("DrawArc3"); VG_Arc.iColor = 3; - //VG_Arc.iColor = 4; -//#endif - DrawArc(r1, t1, t1 + theta1, cp1, x, y, pg, vgOutput); - //Console.WriteLine("'DrawArc3','{0}',{1},{2}", Key, r1, theta1); - DebugShowLocation("DrawArc3"); - } - MoveAbsolute(x, y); - DebugShowLocation("MoveAbs2"); - DebugOutput("DrawTo1"); - DrawTo(pt2.APoint, pg, vgOutput); - DebugShowLocation("DrawTo1"); - //DebugOutput("DrawArc4"); VG_Arc.iColor = 4; - //DrawArc(r1, t1, t1 + theta1, cp1, x, y, pg, vgOutput); - //DebugShowLocation("DrawArc4"); - } - else if (Math.Abs(theta2) > ANGLELIMIT) - { - delta2 = (r2 - r1) / (1.0 - cos_deg(theta2)); - r2 = Math.Floor(0.5 + r2 - delta2); - if (r2 < 0) r2 = -r2; - cp2 = FindModifiedCenter(r2, pt2.APoint, t2); - x = (int)(cp2.xyValue[X] + r2 * cos_deg(t2 - theta2)); - y = (int)(cp2.xyValue[Y] + r2 * sin_deg(t2 - theta2)); - DebugOutput("DrawAbs3"); - DrawAbsolute(x, y, pg, vgOutput); - DebugShowLocation("DrawAbs3"); - MoveTo(pt2.APoint); - DebugShowLocation("MoveTo1"); - if (r2 > 15000) - { - DebugOutput("DrawAbs4"); - DrawAbsolute(x, y, pg, vgOutput); - DebugShowLocation("DrawAbs4"); - } - else - { -//#if DEBUG - //DebugOutput("DrawArc5"); VG_Arc.iColor = 5; - //VG_Arc.iColor = 6; -//#endif - if (r2 != 0) DrawArc(r2, t2, t2 - theta2, cp2, x, y, pg, vgOutput); - DebugShowLocation("DrawArc5"); - } - //DebugOutput(""); VG_Arc.iColor = 6; - //DrawArc(r2, t2, t2 - theta2, cp2, x, y, pg, vgOutput); - //DebugShowLocation("DrawArc6"); - } - else - { - DebugOutput("DrawTo2"); - DrawTo(pt2.APoint, pg, vgOutput); - DebugShowLocation("DrawTo2"); - pt2.slope = FindSlope(pt1.APoint, pt2.APoint); - } - return; - } - private void SetPenDiameter(int pd) - { - if ((pd * ConvertToTwips) != CurPenWidth) - { - CurPenWidth = (int)(pd * ConvertToTwips); - } - } - private void PrintStackError(string relation, int limit) - { - if (!BaseLnSettings.blBaseLine) // B2026-056 suppress messages when running baseline. - { - MessageBox.Show(String.Format("Position Stack Pointer {0} {1}", relation, limit.ToString()), "Print Stack Error"); - } - } - private void SavePosition() - { - if (stack >= MAX_XY_STACK) PrintStackError(">=", MAX_XY_STACK); - SavedX[stack] = Position[X]; - SavedY[stack++] = Position[Y]; - } - private void RecallPosition() - { - if (stack <= 0) PrintStackError(" <", 0); - Position[X] = SavedX[--stack]; - Position[Y] = SavedY[stack]; - } - private void MoveTo(point pnt) - { - MoveAbsolute(pnt.xyValue[X], pnt.xyValue[Y]); - } - private void DrawTo(point pnt, VG.Page pg, IVGOutput vgOutput) - { - DrawAbsolute(pnt.xyValue[X], pnt.xyValue[Y], pg, vgOutput); - } - private void MoveAbsolute(int ptx, int pty) - { - int x, y; - x = ptx - Position[X]; - y = Position[Y] - pty; - MoveRelative(x, y); - } - private void DrawAbsolute(int ptx, int pty, VG.Page pg, IVGOutput vgOutput) - { - int x, y; - x = ptx - Position[X]; - y = Position[Y] - pty; - DrawRelative(x, y, pg, vgOutput); - } - private void DrawGridAbsolute(int ptx, int pty, VG.Page pg, IVGOutput vgOutput) - { - int x, y; - x = ptx - Position[X]; - y = Position[Y] - pty; - DrawGridRelative(x, y, pg, vgOutput); - } - private void relval(string ptr, int i) - { - ptr = string.Format("+{0}", i.ToString()); - } - private void MoveRelative(int x, int y) - { - Position[X] += x; - Position[Y] -= y; - } - private void DrawRelative(int x, int y, VG.Page pg, IVGOutput vgOutput) - { - if (Visible == 0) - MoveRelative(x, y); - else - { - int toX, toY; - toX = Position[X] + x; - toY = Position[Y] - y; - VG_Line RelLine = new VG_Line(Position[X], Position[Y], toX, toY, CurPenWidth, pg); - Position[X] += x; - Position[Y] -= y; - RelLine.Draw(vgOutput); - } - } - private void DrawGridRelative(int x, int y, VG.Page pg, IVGOutput vgOutput) - { - if (Visible == 0) - MoveRelative(x, y); - else - { - DrawRelative(x, y, pg, vgOutput); - } - } - private void DrawArc(double radius, double Sangle, double Eangle, point cp, int x, int y, VG.Page pg, IVGOutput vgOutput) - { - DebugOutput("r={0} sAngle={1} eAngle={2} cp={3},{4} x={5} y={6}", radius, Sangle, Eangle, cp.xyValue[0], cp.xyValue[1], x, y); - int dx, dy; - long radchk; - radchk = (long)radius; - if (radchk > 72000L) - { - DrawAbsolute(x, y, pg, vgOutput); - return; - } - dx = x - cp.xyValue[X]; //jj - dy = Math.Abs(cp.xyValue[Y] - Position[Y]); //jj - float x1 = cp.xyValue[X] - (float)radius; - float y1 = cp.xyValue[Y] - (float)radius; - float w1 = (float)radius * 2; - VG_Arc arc = new VG_Arc(x1, y1, w1, w1, (float)Sangle, (float)(Eangle - Sangle), CurPenWidth, pg); - DebugOutput("arc {0},{1},{2},{3},{4},{5}", x1, y1, w1, w1, (float)Sangle, (float)(Eangle - Sangle)); - arc.Draw(vgOutput); - } - private void DrawGridLine(int flag, int val, VG.Page pg, IVGOutput vgOutput) - { - XyBox curbox; - int v1, v2; - int BoxesIdx = 0; - FindBoxesinArea(val, (flag == 0) ? 1 : 0); - v1 = Position[flag]; - if (ActiveBoxes.Count > 0) - { - curbox = ActiveBoxes[BoxesIdx]; - while (BoxesIdx < ActiveBoxes.Count) - { - int my_x, my_y; - v2 = curbox.BoxMinimum.xyValue[flag]; - my_x = (flag == X) ? ((v2 < printerunits[flag]) ? v2 : printerunits[flag]) - : val; - my_y = (flag == Y) ? - ((v2 < printerunits[flag]) ? v2 : printerunits[flag]) - : val; - DrawGridAbsolute(my_x, my_y, pg, vgOutput); - v1 = curbox.BoxMaximum.xyValue[flag]; - while ((BoxesIdx < ActiveBoxes.Count) && (curbox.BoxMinimum.xyValue[flag] < v1)) - { - v1 = (curbox.BoxMaximum.xyValue[flag]); - BoxesIdx++; - if (BoxesIdx < ActiveBoxes.Count) - curbox = ActiveBoxes[BoxesIdx]; - } - MoveAbsolute((flag == X ? v1 : val), (flag == Y ? v1 : val)); - } - } - v2 = printerunits[flag]; - if (v1 < v2) DrawGridAbsolute((flag == X ? v2 : val), (flag == Y ? v2 : val), pg, vgOutput); - ActiveBoxes.Clear(); - } - private void LogScale(int flag) - { - double newminimum, newmaximum, maxlimit = maximum[flag] * .9; - newminimum = 1.0; - while (newminimum < minimum[flag]) newminimum *= 10.0; - while (newminimum > minimum[flag]) newminimum /= 10.0; - newmaximum = 10.0 * newminimum; - cycles[flag] = 1; - while (newmaximum < maxlimit) - { - newmaximum *= 10.0; - cycles[flag]++; - } - onecycle[flag] = printerunits[flag] / cycles[flag]; - minimum[flag] = newminimum; - maximum[flag] = newmaximum; - } - private void LinearScale(int flag) - { - double mantissa, nx; - double newminimum, newmaximum; - int power = 0; - if (spcminor[flag] == 0) - minor[flag] = 10; - else - minor[flag] = spcminor[flag]; - if (delta[flag] == 0) - { - delta[flag] = maximum[flag] - minimum[flag]; - mantissa = Math.Log10(delta[flag]); - while (mantissa < 1.2) - { - mantissa++; - power--; - } - while (mantissa > 1.2) - { - mantissa--; - power++; - } - if (mantissa < 0) mantissa = 0; - nx = Math.Pow(10.0, mantissa); - if (nx > 5.0) - { - delta[flag] = 1.0; - } - else if (nx > 3.001) - { // allow for roundoff - delta[flag] = 0.5; - } - else if (nx > 2.001) - { // allow for roundoff - delta[flag] = 0.25; - } - else - { - delta[flag] = 0.2; - if (spcminor[flag] == 0) minor[flag] = 8; - } - while (power > 0) - { - power--; - delta[flag] *= 10.0; - } - while (power < 0) - { - power++; - delta[flag] /= 10.0; - } - } - if (GridOnFlag == 0 || GridOnFlag == 1) - minor[flag] = 1; - else if (GridOnFlag == 2) - minor[flag] /= 2; - newminimum = ((int)(0.01 + minimum[flag] / delta[flag])) * delta[flag]; - if (newminimum > minimum[flag] + (delta[flag] * 0.001)) - newminimum -= delta[flag]; - newmaximum = ((int)(maximum[flag] / delta[flag])) * delta[flag]; - if (newmaximum < maximum[flag] - (delta[flag] * 0.001)) - newmaximum += delta[flag]; - // B2017-008 Support a reverse Axis which goes from a larger value to a smaller value. - if (newmaximum < newminimum) delta[flag] = -delta[flag]; - minimum[flag] = newminimum; - maximum[flag] = newmaximum; - } - private void err_exit(string msg, string msg2) - { - if (!BaseLnSettings.blBaseLine) // B2026-056 suppress messages when running baseline. - { - MessageBox.Show(msg + "\n" + msg2 + "\n\n This p=Process Will Terminate", "\n## ERROR ## - "); - Environment.Exit(255); - } - } - private void FindBoxesinArea(int ptval, int flag) - { - XyBox cptr; - int BoxesIdx = 0; - while (BoxesIdx < AllBoxes.Count) - { - cptr = AllBoxes[BoxesIdx]; - if (cptr.BoxMinimum.xyValue[flag] <= ptval && - cptr.BoxMaximum.xyValue[flag] >= ptval) - if(cptr.BoxMinimum.xyValue[1-flag] > 0 && - cptr.BoxMaximum.xyValue[1 - flag] < printerunits[1-flag])// Don't include box if it is outside of the range of the grid. - AddBoxToActiveList(cptr); - BoxesIdx++; - } - } - private void AddBoxToActiveList(XyBox box) - { - int i = 0; - while (i < ActiveBoxes.Count) - { - if (box.BoxMinimum.xyValue[DrawDirection] < ActiveBoxes[i].BoxMinimum.xyValue[DrawDirection]) - break; // Located the location to insert the box - i++; - } - ActiveBoxes.Insert(i, box); - } - private void GenGrid(int flag, int ss, int ee, int dd, int w, int lw, int goffset, VG.Page pg, IVGOutput vgOutput) - { - int val, wn, valn; - double p2; - int n, dn, MinorGrid = 0; - if ((GridOnFlag * lw) <= 1) return; - if (ee / ss == 10) MinorGrid = 2; - n = ss; - p2 = n; - w = (int)(w / Math.Log10(ee / p2)); //jj - val = (int)(Math.Log10(p2 / ss) * w + goffset); - MoveAbsolute((flag == X ? val : 0), (flag == Y ? val : 0)); - DrawGridLine((flag == 0) ? 1 : 0, val, pg, vgOutput); - if ((GridOnFlag * lw) == 2) return; - SetPenDiameter(lw); - while (n < ee) - { - n += dd; - p2 = n; - valn = (int)(Math.Log10(p2 / ss) * w + goffset); - wn = valn - val; - if (wn > DPI / 20 && lw > 1) - { - if (wn > DPI * 2 / 5) dn = dd / 10; - else if (wn > DPI / 5) dn = dd / 5; - else dn = dd / 2; - GenGrid(flag, n - dd, n, dn, wn, lw - 1, val, pg, vgOutput); - wn = 0; - } - val = valn; - if (flag == Y) - val = printerunits[Y] - val; //jj - MoveAbsolute((flag == X ? val : 0), (flag == Y ? val : 0)); - if ((MinorGrid != 0) && (MinorGrid < 10)) - { - WriteValue(flag, MinorGrid++, true, pg, vgOutput); //these numbers are in dots - } - DrawGridLine((flag == 0) ? 1 : 0, val, pg, vgOutput); - } - } - private void PrintText(string txt, VG.Page pg, IVGOutput vgOutput) - { - StringBuilder tstr = new StringBuilder(txt); - int ptr; - SavePosition(); /* 'cause TEXT...,E screws up position! */ - ptr = 0; - while (ptr < tstr.Length) - { - if ("`øòó".IndexOf(tstr[ptr]) >= 0) - { - string SpecialChar = ""; - switch ((byte)tstr[ptr]) - { - case 0x60: /* backquote */ - case 0xF8: SpecialChar = "\u00B0"; /* degree symbol */ - break; - case 0xF2: SpecialChar = "\u2265"; /* greaterthanequal */ - break; - case 0xF3: SpecialChar = "\u2264"; /* lessthanequal */ - break; - } - tstr.Remove(ptr, 1); - tstr.Insert(ptr, SpecialChar); - ptr++; - } - else - { - ptr++; - } - } - GraphText(tstr.ToString(), pg, vgOutput); - RecallPosition(); - } - private void FreeBoxList() - { - AllBoxes.Clear(); - } - private void FreeLineList() - { - AllPlots.Clear(); - } - private void Init_Graphic_Vars() - { - int i; - SavedX = new int[MAX_XY_STACK]; - SavedY = new int[MAX_XY_STACK]; - LinesUsed = 0; /* Number lines used by graph, in dots */ - Visible = 1; - ShadowFlag = 0; - CurPenWidth = 0; - DrawDirection = -1; - AxisTitles[X] = null; - AxisTitles[Y] = null; - AxisLabel[0] = 1; - AxisLabel[1] = 1; - EndFlag = 0; - for (i = 0; i < Dimensions; i++) - { - Scale[0, i] = 0; - Scale[1, i] = 0; - Offset[0, i] = 0; - Offset[1, i] = 0; - delta[i] = 0; - cycles[i] = 0; - onecycle[i] = 0; - minor[i] = 0; - } - } - private void DrawLineTo(point pnt, VG.Page pg, IVGOutput vgOutput) - { - int x1, y1, x2, y2; - int nd, x, y, i; - long ddx, ddy, dx, dy; - x1 = Position[X]; - y1 = Position[Y]; - x2 = pnt.xyValue[X]; - y2 = pnt.xyValue[Y]; - if (LineDiv != 0) - { - nd = LineDiv * 4; - dx = x2 - x1; - dy = y2 - y1; - for (i = 1; i <= nd; i++) - { - ddx = dx * i; - ddy = dy * i; - x = (int)(x1 + ddx / nd); - y = (int)(y1 + ddy / nd); - if ((i & 2) != 0) - MoveAbsolute(x, y); - else - DrawAbsolute(x, y, pg, vgOutput); - } - } - else - DrawTo(pnt, pg, vgOutput); - } - private void BoxRelative(int dx, int dy, int LineWidth, VG.Page pg, IVGOutput vgOutput) - { - VG_Rect vgrec = new VG_Rect((int)Position[X], (int)Position[Y], dx, dy, LineWidth, pg); - vgrec.Draw(vgOutput); - } - private void GraphText(string txt, VG.Page pg, IVGOutput vgOutput) - { - // Look for a Superscript or Subsript. - // - break up the string (if needed) and change the font pitch - // for the text that is to be super/subscripted - VG_Text drawText; - string tstr = ""; - int Xpos, Ypos; - int sidx = 0; // beginning of string - int idx = 0; // current position in string - Xpos = Position[X]; - Ypos = Position[Y]; - while (idx < txt.Length) - { - int tidx; - if ((tidx = txt.IndexOf(SuperScript[0], idx)) > -1) - { - // print text up to the superscript - tstr = txt.Substring(sidx, tidx - sidx); - drawText = new VG_Text(Xpos, Ypos, (int)FontPitch, tstr, MyFontFamily, "", "", "", pg); - drawText.Draw(vgOutput); - Xpos += (CWIDEDOTS * tstr.Length); - tidx += SuperScript[0].Length; - idx = tidx; - sidx = idx; - tidx = txt.IndexOf(SuperScript[1], idx); - if (tidx > 0) - { - // switch font pitch, move up some, and print the superscript text - tstr = txt.Substring(sidx, tidx - sidx); - Ypos -= (CHIGHDOTS / 2); // move up half a char heigth - drawText = new VG_Text(Xpos, Ypos, (int)(FontPitch / 2), tstr, MyFontFamily, "", "", "", pg); - drawText.Draw(vgOutput); - Ypos += (CHIGHDOTS / 2); // move back down - Xpos += ((CWIDEDOTS / 2) * tstr.Length); // positon half the width of the string - tidx += SuperScript[1].Length; - idx = tidx; - sidx = idx; - continue; // go back to beginning of while loop - } - } - else if ((tidx = txt.IndexOf(SubScript[0], idx)) > -1) - { - // print text up to the superscript - tstr = txt.Substring(sidx, tidx - sidx); - drawText = new VG_Text(Xpos, Ypos, (int)FontPitch, tstr, MyFontFamily, "", "", "", pg); - drawText.Draw(vgOutput); - Xpos += (CWIDEDOTS * tstr.Length); - tidx += SubScript[0].Length; - idx = tidx; - sidx = idx; - tidx = txt.IndexOf(SubScript[1], idx); - if (tidx > 0) - { - // switch font pitch, move up some, and print the superscript text - tstr = txt.Substring(sidx, tidx - sidx); - drawText = new VG_Text(Xpos, Ypos, (int)(FontPitch / 2), tstr, MyFontFamily, "", "", "", pg); - drawText.Draw(vgOutput); - Xpos += ((CWIDEDOTS / 2) * tstr.Length); // positon half the width of the string - tidx += SubScript[1].Length; - idx = tidx; - sidx = idx; - continue; // go back to beginning of while loop - } - } - else - { - idx++; - } - } // end while - - if (sidx < txt.Length) - { - tstr = txt.Substring(sidx); - drawText = new VG_Text(Xpos, Ypos, (int)FontPitch, tstr, MyFontFamily, "", "", "", pg); - drawText.Draw(vgOutput); - } - } - /// - /// Generates a vgOutput files containing an X/Y PLot generated from the passed in - /// commands. - /// - /// Plot Commands - public XYPlot(string PlotCommands) - { - // MSWord enters left and right double-quotes when you press the double-quote key - //B2017 - Replace left and right double-quotes with normal double-quotes - PlotCommands = PlotCommands.Replace('\u201C', '"').Replace('\u201D', '"'); - LoadBuffFromString(PlotCommands); - Setup(); -//#if DEBUG - //VG.VG_Arc.iColor = 0; -//#endif - } - private int _OffsetX = 0; - public int OffsetX - { - get { return _OffsetX; } - set { _OffsetX = value; } - } - private int _OffsetY = 0; - public int OffsetY - { - get { return _OffsetY; } - set { _OffsetY = value; } - } - public void Setup() - { - char Command, PrevCommand = ' '; - Init_Graphic_Vars(); - FixBuffIfNeeded(); - GetScaleInfo(); - while ((Command = char.ToUpper(getchr())) != '\0') - { - LineDiv = 0; - LineFlag = CURVE; - ShadowFlag = 0; - switch (Command) - { - case 'O': - OffsetX = getint(); - OffsetY = getint(); - break; - case 'T': - ShadowFlag += 2; // 2 for no box - GetBoxParameters(); - break; - case 'W': - ShadowFlag++; // 1 for shadow box - GetBoxParameters(); - break; - case 'B': - GetBoxParameters(); // 0 for box - break; - case 'D': - LineDiv = getint(); - LineFlag = STRAIGHT; - GetLineParameters(); - break; - case 'L': - LineFlag = STRAIGHT; - GetLineParameters(); - break; - case 'C': - GetLineParameters(); - break; - case 'X': - GetAxisTitle(X); - break; - case 'Y': - GetAxisTitle(Y); - break; - case 'Z': - YLandScape = 1; - YTitleOrigin = GetPair(USER); - GetAxisTitle(Y); - break; - case 'A': - AxisLabel[0] = getint(); - AxisLabel[1] = getint(); - break; - default: - if (BaseLnSettings.blBaseLine == false) // B2026-056 suppress messages when running baseline. - { - if (PrevCommand.Equals(null)) - MessageBox.Show("Check the first line of the X/Y Plot definition.", "Unrecognized Graph Command"); - else - MessageBox.Show(string.Format("Problem with the X/Y Plot Command after {0}", PrevCommand.ToString()), "Unrecognized Graph Command"); - break; - } - break; - } - PrevCommand = Command; - } - } - public void Process(IVGOutput vgOutput) - { - VG.Page pg = new Page(true, _LeftMargin, _TopMargin, _RightMargin, _BottomMargin); - string step = "Process"; - try // C2018-035 Added error Handling to Process to provide more useful information when a plot fails - { - step = "GenerateGrid";GenerateGrid(pg, vgOutput); - step = "DoAxisTitles";DoAxisTitles(pg, vgOutput); - step = "DrawLines";DrawLines(pg, vgOutput); - step = "DoBoxes";DoBoxes(pg, vgOutput); - step = "FreeBoxList";FreeBoxList(); - step = "FreeLineList";FreeLineList(); - step = "CloseGraph";CloseGraph(); - } - catch (Exception ex) - { - _MyLog.WarnFormat("X/Y Plot Error - {0} - {1} - {2}", step, XYPlotIssue ?? "Unknown Issue"); - throw new Exception(String.Format("X/Y Plot Error - {0} - {1}",step,XYPlotIssue ?? "Unknown Issue")); - } - } - private void ShowPoints(DataPoints dataPoints) - { -//#if DEBUG - //foreach (DataPoint pl in dataPoints) - //{ - // DebugOutput("x={0},y={1},slope={2}", pl.APoint.xyValue[0], pl.APoint.xyValue[1], pl.slope); - //} -//#endif - } - public static string Key = ""; - private void DebugOutput(string format, params object[] args) - { -//#if DEBUG - //if (args.Length == 0) - // Console.WriteLine("'{0}','{1}'",Key,format); - //Console.WriteLine(format, args); -//#endif - } - private void DebugShowLocation(string command) - { - //Console.WriteLine("'{0}',{1},{2}", command, Position[X], Position[Y]); - } - } -} \ No newline at end of file diff --git a/PROMS/XYPlots/XYPlots.csproj b/PROMS/XYPlots/XYPlots.csproj deleted file mode 100644 index b94ba2be..00000000 --- a/PROMS/XYPlots/XYPlots.csproj +++ /dev/null @@ -1,194 +0,0 @@ - - - - Local - 8.0.50727 - 2.0 - {04E168D0-9CC7-43D9-A9F1-93E481EA86A3} - - - - - - - - - Debug - AnyCPU - - - - - XYPlots - - - JScript - Grid - IE50 - false - Library - XYPlots - OnBuildSuccess - - - - - - - v4.8.1 - 2.0 - - - - bin\Debug\ - false - 285212672 - false - - - DEBUG;TRACE - - - true - 4096 - false - - - false - false - false - false - 4 - full - prompt - x64 - false - - - bin\Release\ - false - 285212672 - false - - - TRACE - - - false - 4096 - false - - - true - false - false - false - 4 - none - prompt - false - x64 - - - true - bin\Demo\ - DEBUG;TRACE - 285212672 - full - x64 - prompt - false - - - true - bin\Debug\ - DEBUG;TRACE - 285212672 - full - x64 - prompt - false - - - bin\Release\ - TRACE - 285212672 - true - - - x64 - prompt - false - - - true - bin\Demo\ - TRACE;DEMO - 285212672 - full - x64 - prompt - false - - - - False - ..\..\..\..\3rdPartyLibraries\Log4Net\log4net.dll - - - System - - - System.Data - - - System.Drawing - - - System.Windows.Forms - - - System.XML - - - - - Code - - - Form - - - frmXYPlot.cs - - - Code - - - - - frmXYPlot.cs - Designer - - - - - {52D74078-3822-410E-889B-464BD21AAB9E} - VG - - - {aeee9fd1-6892-45e2-a67e-418c06d46ff9} - Volian.Base.Library - - - - - - - - - - - - - \ No newline at end of file diff --git a/PROMS/XYPlots/frmXYPlot.cs b/PROMS/XYPlots/frmXYPlot.cs deleted file mode 100644 index 461fed05..00000000 --- a/PROMS/XYPlots/frmXYPlot.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Diagnostics; -using System.Drawing; -using System.Drawing.Imaging; -using System.Drawing.Printing; -using System.IO; -using System.Text; -using System.Text.RegularExpressions; -using System.Windows.Forms; -using VG; -//using XYPlots; - -namespace XYPlots -{ - public partial class frmXYPlot : Form - { - private string _XYPlot; - private string _Title; - public frmXYPlot(string title,string xyPlot) - { - InitializeComponent(); - - title = Regex.Replace(title, @"\\u([0-9]{1,4})\?", m => int.TryParse(m?.Groups[1]?.Value, out int result) ? Convert.ToChar(result).ToString() : ""); // C2022-003 RO Symbols. Convert unicode to character. - xyPlot = Regex.Replace(xyPlot, @"\\u([0-9]{1,4})\?", m => int.TryParse(m?.Groups[1]?.Value, out int result) ? Convert.ToChar(result).ToString() : ""); // C2022-003 RO Symbols. Convert unicode to character. - - int pstart = xyPlot.IndexOf("< scaleY ? scaleY : scaleX; - e.Graphics.ScaleTransform(scale, scale); - myPlot.Process(new VGOut_Graphics(e.Graphics)); - } - private void pnl_Resize(object sender, EventArgs e) - { - pnl.Invalidate(); - } - private void frmXYPlot_Load(object sender, EventArgs e) - { - Text = _Title; - XYPlots.XYPlot myPlot = new XYPlots.XYPlot(_XYPlot); - myPlot.SetMargins(.75F, .5F, .25F, .75F); - float scaleX = pnl.Width / myPlot.Width; - float scaleY = pnl.Height / myPlot.Height; - float scale = scaleX > scaleY ? scaleY : scaleX; - int height = (int)(Height - pnl.Height + pnl.Height * scale / scaleY); - int width = (int)(Width - pnl.Width + pnl.Width * scale / scaleX); - Size = new Size(width, height); - } - } -} \ No newline at end of file diff --git a/PROMS/XYPlots/frmXYPlot.designer.cs b/PROMS/XYPlots/frmXYPlot.designer.cs deleted file mode 100644 index 84958a10..00000000 --- a/PROMS/XYPlots/frmXYPlot.designer.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace XYPlots -{ - partial class frmXYPlot - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.pnl = new System.Windows.Forms.Panel(); - this.SuspendLayout(); - // - // pnl - // - this.pnl.Dock = System.Windows.Forms.DockStyle.Fill; - this.pnl.Location = new System.Drawing.Point(0, 0); - this.pnl.Name = "pnl"; - this.pnl.Size = new System.Drawing.Size(818, 702); - this.pnl.TabIndex = 1; - this.pnl.Paint += new System.Windows.Forms.PaintEventHandler(this.pnl_Paint); - this.pnl.Resize += new System.EventHandler(this.pnl_Resize); - // - // frmXYPlot - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(818, 702); - this.Controls.Add(this.pnl); - this.Name = "frmXYPlot"; - this.Text = "frmXYPlot"; - this.Load += new System.EventHandler(this.frmXYPlot_Load); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Panel pnl; - } -} \ No newline at end of file diff --git a/PROMS/XYPlots/frmXYPlot.resx b/PROMS/XYPlots/frmXYPlot.resx deleted file mode 100644 index 19dc0dd8..00000000 --- a/PROMS/XYPlots/frmXYPlot.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file