public void UpdateSVG(XmlTextWriter doc, SVGContext context) { try { this.topleft = context.fxy(this.topleft); this.bottomright = context.fxy(this.bottomright); if (decimal.Compare(this.bottomright.Y, this.topleft.Y) < 0) { int num = Convert.ToInt32(this.topleft.Y); this.topleft.Y = this.bottomright.Y; this.bottomright.Y = new decimal(num); } doc.WriteStartElement("rect"); doc.WriteAttributeString("x", this.topleft.X.ToString()); doc.WriteAttributeString("y", this.topleft.Y.ToString()); doc.WriteAttributeString("width", Math.Abs(decimal.Subtract(this.bottomright.X, this.topleft.X)).ToString()); doc.WriteAttributeString("height", Math.Abs(decimal.Subtract(this.bottomright.Y, this.topleft.Y)).ToString()); context.PrintEdge(doc); } finally { doc.WriteAttributeString("fill", context.fill); //if (context.isClip & (StringType.StrCmp(context.CurrClipID, "", false) != 0)) if (context.isClip & context.CurrClipID != "") { doc.WriteAttributeString("clip-path", "url(#" + context.CurrClipID + ")"); } doc.WriteFullEndElement(); } }
public void UpdateSVG(XmlTextWriter doc, SVGContext context) { this.center = context.fxy(this.center); this.cd1 = context.fxy(this.cd1); this.cd2 = context.fxy(this.cd2); double introduced4 = Convert.ToDouble(decimal.Subtract(this.cd1.X, this.center.X)); double num2 = Math2.Distance(introduced4, Convert.ToDouble(decimal.Subtract(this.cd1.Y, this.center.Y))); double introduced5 = Convert.ToDouble(decimal.Subtract(this.cd2.X, this.center.X)); double num3 = Math2.Distance(introduced5, Convert.ToDouble(decimal.Subtract(this.cd2.Y, this.center.Y))); decimal introduced6 = decimal.Subtract(this.cd1.Y, this.center.Y); double num = Math.Atan(Convert.ToDouble(decimal.Divide(introduced6, decimal.Subtract(this.cd1.X, this.center.X)))) * 57.295779513082323; doc.WriteStartElement("ellipse"); doc.WriteAttributeString("cx", this.center.X.ToString()); doc.WriteAttributeString("cy", this.center.Y.ToString()); doc.WriteAttributeString("rx", num2.ToString()); doc.WriteAttributeString("ry", num3.ToString()); doc.WriteAttributeString("transform", "rotate(" + num.ToString() + " " + this.center.X.ToString() + " " + this.center.Y.ToString() + ")"); context.PrintEdge(doc); doc.WriteAttributeString("fill", context.fill); if (context.isClip & !String.IsNullOrEmpty(context.CurrClipID))//if (context.isClip & (StringType.StrCmp(context.CurrClipID, "", false) != 0)) { doc.WriteAttributeString("clip-path", "url(#" + context.CurrClipID + ")"); } doc.WriteFullEndElement(); }
// Methods public static bool class7(CGMElement element, SVGContext mycontext, XmlTextWriter myxml) { switch (element.ElementId) { case 1: { int num = mycontext.Reader.ReadE(); string str = mycontext.Reader.ReadS(); myxml.WriteStartElement("qsvg:string"); myxml.WriteAttributeString("identifier", num.ToString()); myxml.WriteAttributeString("value", str); myxml.WriteEndElement(); break; } case 2: { int num2 = mycontext.Reader.ReadI(); byte[] buffer = mycontext.Reader.ReadD(); myxml.WriteStartElement("qsvg:data"); myxml.WriteAttributeString("identifier", num2.ToString()); myxml.WriteAttributeString("value", Convert.ToBase64String(buffer)); myxml.WriteEndElement(); break; } default: return(false); } return(true); }
public void UpdateSVG(XmlTextWriter doc, SVGContext context) { try { string[] strArray = new string[(this.points.Length - 1) + 1]; int num2 = strArray.Length - 1; for (int i = 0; i <= num2; i++) { strArray[i] = context.fx(Convert.ToDouble(this.points[i].X)).ToString() + "," + context.fy(Convert.ToDouble(this.points[i].Y)).ToString(); } if (context.interiorstyle == 3) { context.getHatch(doc); } doc.WriteStartElement("polygon"); doc.WriteAttributeString("points", string.Join(" ", strArray)); doc.WriteAttributeString("fill", context.fill); doc.WriteAttributeString("fill-rule", "evenodd"); context.PrintEdge(doc); } finally { if (context.isClip & !String.IsNullOrEmpty(context.CurrClipID)) //if (context.isClip & (StringType.StrCmp(context.CurrClipID, "", false) != 0)) { doc.WriteAttributeString("clip-path", "url(#" + context.CurrClipID + ")"); } doc.WriteFullEndElement(); } }
public string GetPath(SVGContext context) { PointDbl p = new PointDbl(context.fxy(this.center)); PointDbl dbl4 = new PointDbl(context.fxy(this.cd1)); PointDbl dbl3 = new PointDbl(context.fxy(this.cd2)); PointDbl dbl2 = new PointDbl(this.context_fxy2(this.v1, context)); PointDbl dbl = new PointDbl(this.context_fxy2(this.v2, context)); SVGEllipseArc arc = CGM2SVGMath.FindSVGArc(p, dbl4, dbl3, dbl2, dbl); string dAttribute = arc.dAttribute; string transformAttribute = arc.transformAttribute; if ((arc.StartP.X == arc.EndP.X) & (arc.StartP.Y == arc.EndP.Y)) { SVGEllipseArc arc2 = arc; arc2.EndP.Y++; dAttribute = arc.dAttribute; } switch (this.closingType) { case 0: return(dAttribute + string.Format(" L{0},{1} L{2},{3} Z", new object[] { arc.CenterP.X, arc.CenterP.Y, arc.StartP.X, arc.StartP.Y })); case 1: return(dAttribute + string.Format(" L{0},{1} Z", arc.StartP.X, arc.StartP.Y)); } return(dAttribute); }
public string GetPath2(SVGContext context) { string str2 = String.Empty; string[] strArray = new string[Points.Length]; //Array.CreateInstance(typeof(string), this.Points.Length); int num6 = strArray.Length - 1; for (int i = 0; i <= num6; i++) { strArray[i] = string.Format("{0:f2},{1:f2}", context.fx(Convert.ToDouble(this.Points[i].X)), context.fy(Convert.ToDouble(this.Points[i].Y))); } if (!this.Continue) { int num5 = strArray.Length - 1; for (int k = 0; k <= num5; k += 4) { str2 = str2 + string.Format("M{0} C{1} {2} {3} ", new object[] { strArray[k], strArray[k + 1], strArray[k + 2], strArray[k + 3] }); } return(str2); } int num4 = strArray.Length - 3; for (int j = 1; j <= num4; j += 3) { str2 = str2 + string.Format("M{0} C{1} {2} {3} ", new object[] { strArray[j - 1], strArray[j], strArray[j + 1], strArray[j + 2] }); } return(str2); }
public void CreateBeginSVGHighlight(ref XmlTextWriter doc, SVGContext context) { if (this.isHighlight) { doc.WriteStartElement("script"); doc.WriteAttributeString("type", "text/ecmascript"); } }
public void UpdateSVG(XmlTextWriter doc, SVGContext context) { try { PointDbl dbl6 = new PointDbl(context.fxy(this.center)); PointDbl p = dbl6; dbl6 = new PointDbl(context.fxy(this.cd1)); PointDbl dbl2 = dbl6; dbl6 = new PointDbl(context.fxy(this.cd2)); PointDbl dbl3 = dbl6; dbl6 = new PointDbl(this.context_fxy2(this.v1, context)); PointDbl dbl4 = dbl6; dbl6 = new PointDbl(this.context_fxy2(this.v2, context)); PointDbl dbl5 = dbl6; SVGEllipseArc arc = CGM2SVGMath.FindSVGArc(p, dbl2, dbl3, dbl4, dbl5); string dAttribute = arc.dAttribute; string transformAttribute = arc.transformAttribute; switch (this.closingType) { case 0: dAttribute = dAttribute + string.Format(" L{0},{1} L{2},{3} Z", new object[] { arc.CenterP.X, arc.CenterP.Y, arc.StartP.X, arc.StartP.Y }); break; case 1: dAttribute = dAttribute + string.Format(" L{0},{1} Z", arc.StartP.X, arc.StartP.Y); break; } doc.WriteStartElement("path"); doc.WriteAttributeString("d", dAttribute); if (!String.IsNullOrEmpty(transformAttribute)) //if (StringType.StrCmp(transformAttribute, "", false) != 0) { doc.WriteAttributeString("transform", transformAttribute); } if (this.closingType >= 0) { context.PrintEdgeArc(doc); doc.WriteAttributeString("fill", context.fill); } else { context.PrintLine(doc); doc.WriteAttributeString("fill", "none"); } } finally { if (context.isClip & !String.IsNullOrEmpty(context.CurrClipID)) //if (context.isClip & (StringType.StrCmp(context.CurrClipID, "", false) != 0)) { doc.WriteAttributeString("clip-path", "url(#" + context.CurrClipID + ")"); } doc.WriteFullEndElement(); } }
public void UpdateSVG(XmlTextWriter doc, SVGContext context) { doc.WriteStartElement("path"); doc.WriteAttributeString("d", this.GetPath2(context)); doc.WriteAttributeString("fill", "none"); context.PrintLine(doc); if (context.isClip & !String.IsNullOrEmpty(context.CurrClipID)) //if (context.isClip & (StringType.StrCmp(context.CurrClipID, "", false) != 0)) { doc.WriteAttributeString("clip-path", "url(#" + context.CurrClipID + ")"); } doc.WriteFullEndElement(); }
// Methods public string GetPath(SVGContext context) { this.center = context.fxy(this.center); double num = context.fscale((double)this.radius); string str = " M" + (Convert.ToDouble(this.center.X) - num).ToString() + "," + this.center.Y.ToString(); str = ((str + " A" + this.radius.ToString() + "," + this.radius.ToString()) + " 0 1 0 ") + (Convert.ToDouble(this.center.X) + num).ToString() + "," + this.center.Y.ToString(); str = str + " M" + (Convert.ToDouble(this.center.X) + num).ToString() + "," + this.center.Y.ToString(); str = (((str + " A" + this.radius.ToString() + "," + this.radius.ToString()) + " 0 0 0 ") + (Convert.ToDouble(this.center.X) - num).ToString() + "," + this.center.Y.ToString()) + "Z"; context.newregion = true; return(str); }
// Methods public string GetPath(SVGContext context) { string[] strArray = new string[points.Length]; //Array.CreateInstance(typeof(string), this.points.Length); int num2 = strArray.Length - 1; for (int i = 0; i <= num2; i++) { strArray[i] = context.fx(Convert.ToDouble(this.points[i].X)).ToString() + "," + context.fy(Convert.ToDouble(this.points[i].Y)).ToString(); } string str2 = string.Join(" L", strArray); return("M" + str2 + " Z"); }
// Methods public void WriteBackground(XmlTextWriter doc, SVGContext mycontext) { if (!mycontext.options.SingleBackground || !mycontext.backgroundProduced) { doc.WriteStartElement("rect"); doc.WriteAttributeString("width", mycontext.rw.ToString()); doc.WriteAttributeString("height", mycontext.rh.ToString()); doc.WriteAttributeString("fill", mycontext.Back.ToString()); doc.WriteAttributeString("qsvg:element", "background"); doc.WriteEndElement(); mycontext.backgroundProduced = true; } }
public static bool class9(CGMElement element, SVGContext mycontext, XmlTextWriter myxml) { if (element.ElementId == 1) { string str = mycontext.Reader.ReadS(); SDR sdr = mycontext.Reader.ReadSDR(); myxml.WriteStartElement("qsvg:sdrData"); myxml.WriteAttributeString("type", str); WriteSDR(myxml, sdr); myxml.WriteEndElement(); return(true); } return(false); }
// Methods private Point context_fxy2(Point p, SVGContext context) { int inversion = context.GetInversion(); if ((inversion == 3) | (inversion == 4)) { p.X = decimal.Negate(p.X); } if ((inversion == 1) | (inversion == 3)) { p.Y = decimal.Negate(p.Y); } return(p); }
public void UpdateSVG(XmlTextWriter doc, SVGContext context) { this.center = context.fxy(this.center); doc.WriteStartElement("circle"); doc.WriteAttributeString("cx", this.center.X.ToString()); doc.WriteAttributeString("cy", this.center.Y.ToString()); doc.WriteAttributeString("r", context.fscale((double)this.radius).ToString()); context.PrintEdge(doc); doc.WriteAttributeString("fill", context.fill); if (context.isClip & !String.IsNullOrEmpty(context.CurrClipID))//if (context.isClip & (StringType.StrCmp(context.CurrClipID, "", false) != 0)) { doc.WriteAttributeString("clip-path", "url(#" + context.CurrClipID + ")"); } doc.WriteEndElement(); }
// Methods public static bool class1(CGMElement element, SVGContext mycontext, XmlTextWriter myxml) { switch (element.ElementId) { case 1: mycontext.version = mycontext.Reader.ReadI(); myxml.WriteComment("Version: " + mycontext.version.ToString().Trim()); break; case 2: myxml.WriteComment("MetaFile Description: " + mycontext.Reader.ReadS().Trim()); break; case 9: mycontext.MaxColourIndex = Convert.ToInt32(mycontext.Reader.ReadCI()); break; case 10: mycontext.mincolor = mycontext.Reader.ReadCD(); mycontext.maxcolor = mycontext.Reader.ReadCD(); break; case 12: break; case 13: { ArrayList list = new ArrayList(); while (!mycontext.Reader.EOF) { list.Add(mycontext.Reader.ReadS()); } mycontext.Fonts = (string[])list.ToArray(typeof(string)); mycontext.Font = mycontext.Fonts[0]; break; } case 0x12: mycontext.SegPriExtMin = mycontext.Reader.ReadI(); mycontext.segPriExtMax = mycontext.Reader.ReadI(); break; default: return(false); } return(true); }
// Methods public string GetPath(SVGContext context) { this.topleft = context.fxy(this.topleft); this.bottomright = context.fxy(this.bottomright); if (decimal.Compare(this.bottomright.Y, this.topleft.Y) < 0) { int num = Convert.ToInt32(this.topleft.Y); this.topleft.Y = this.bottomright.Y; this.bottomright.Y = new decimal(num); } string str = " M" + this.topleft.X.ToString() + "," + this.topleft.Y.ToString(); str = str + " L" + this.bottomright.X.ToString() + "," + this.topleft.Y.ToString(); str = str + " L" + this.bottomright.X.ToString() + "," + this.bottomright.Y.ToString(); str = (str + " L" + this.topleft.X.ToString() + "," + this.bottomright.Y.ToString()) + " Z "; context.newregion = true; return(str); }
public void UpdateSVG(XmlTextWriter doc, SVGContext mycontext) { this.Position = mycontext.fxy(this.Position); doc.WriteStartElement("text"); doc.WriteAttributeString("x", this.Position.X.ToString()); doc.WriteAttributeString("y", (Convert.ToDouble(this.Position.Y) + mycontext.compAliVert()).ToString()); doc.WriteAttributeString("fill", mycontext.Text); mycontext.PrintTextRotation(doc, this.Position); mycontext.PrintTextHeight(doc, this.TextSize); mycontext.PrintTextAlign(doc); if (!String.IsNullOrEmpty(mycontext.Font)) //if (StringType.StrCmp(mycontext.Font, "", false) != 0) { doc.WriteAttributeString("font-family", mycontext.Font); } if (mycontext.isClip & !String.IsNullOrEmpty(mycontext.CurrClipID)) //if (mycontext.isClip & (StringType.StrCmp(mycontext.CurrClipID, "", false) != 0)) { doc.WriteAttributeString("clip-path", "url(#" + mycontext.CurrClipID + ")"); } mycontext.printTextAngle(doc, this.Position); if (mycontext.TextSpacing != 0.0) { doc.WriteAttributeString("letter-spacing", (mycontext.TextSpacing * 4.8).ToString()); } int num = this.Text.Length; this.Text = ""; string[] strArray = new string[] { "d", "e", "m", "o" }; int index = 0; while (this.Text.Length <= num) { this.Text = this.Text + strArray[index]; if (strArray[index] == "o") //if (StringType.StrCmp(strArray[index], "o", false) == 0) { index = 0; } else { index++; } } doc.WriteString(this.Text); doc.WriteEndElement(); }
public static bool class3(CGMElement element, SVGContext mycontext, XmlTextWriter myxml) { switch (element.ElementId) { case 3: mycontext.AuxColorC = RuntimeHelpers.GetObjectValue(mycontext.Reader.ReadCO()); break; case 4: mycontext.transparent = mycontext.Reader.ReadE() > 0; break; case 5: { CGMClip clip = new CGMClip { ClipPoint1 = mycontext.Reader.ReadP(), ClipPoint2 = mycontext.Reader.ReadP() }; clip.UpdateSVG(myxml, mycontext); mycontext.CurrClipID = clip.ClipID; break; } case 6: { int num = mycontext.Reader.ReadE(); mycontext.isClip = num == 0 ? false : true; break; } case 10: mycontext.newregion = true; break; case 0x13: mycontext.MetreLimit = mycontext.Reader.ReadR(); break; default: return(false); } return(true); }
// Methods public string GetPath(SVGContext context) { this.center = context.fxy(this.center); this.cd1 = context.fxy(this.cd1); this.cd2 = context.fxy(this.cd2); double introduced6 = Convert.ToDouble(decimal.Subtract(this.cd1.X, this.center.X)); double num2 = Math2.Distance(introduced6, Convert.ToDouble(decimal.Subtract(this.cd1.Y, this.center.Y))); double introduced7 = Convert.ToDouble(decimal.Subtract(this.cd2.X, this.center.X)); double num3 = Math2.Distance(introduced7, Convert.ToDouble(decimal.Subtract(this.cd2.Y, this.center.Y))); decimal introduced8 = decimal.Subtract(this.cd1.Y, this.center.Y); double num = Math.Atan(Convert.ToDouble(decimal.Divide(introduced8, decimal.Subtract(this.cd1.X, this.center.X)))) * 57.295779513082323; string str = " M" + (Convert.ToDouble(this.center.X) - num2).ToString() + "," + this.center.Y.ToString(); str = ((str + " A" + num2.ToString() + "," + num3.ToString()) + " 0 0 1 ") + (Convert.ToDouble(this.center.X) + num2).ToString() + "," + this.center.Y.ToString(); str = str + " M" + (Convert.ToDouble(this.center.X) + num2).ToString() + "," + this.center.Y.ToString(); str = (((str + " A" + num2.ToString() + "," + num3.ToString()) + " 0 0 1 ") + (Convert.ToDouble(this.center.X) - num2).ToString() + "," + this.center.Y.ToString()) + "Z"; context.newregion = true; return(str); }
public void UpdateSVG(XmlTextWriter doc, SVGContext context) { string str = "none"; if ((context.interiorstyle == 3) & context.fingureOn) { context.getHatch(doc); str = "url(#" + context.HatchIndex.ToString() + ")"; } doc.WriteStartElement("path"); doc.WriteAttributeString("d", this.GetPath(context)); doc.WriteAttributeString("fill", str); context.PrintLine(doc); if (context.isClip & !String.IsNullOrEmpty(context.CurrClipID))//if (context.isClip & (StringType.StrCmp(context.CurrClipID, "", false) != 0)) { doc.WriteAttributeString("clip-path", "url(#" + context.CurrClipID + ")"); } doc.WriteEndElement(); }
// Methods public string GetPath(SVGContext context) { string str2 = String.Empty; string[] strArray = new string[points.Length]; //Array.CreateInstance(typeof(string), this.points.Length); int num4 = strArray.Length - 1; for (int i = 0; i <= num4; i++) { strArray[i] = context.fx(Convert.ToDouble(this.points[i].X)).ToString() + "," + context.fy(Convert.ToDouble(this.points[i].Y)).ToString(); } int num3 = strArray.Length; for (int j = 1; j <= num3; j += 2) { str2 = str2 + "M" + strArray[j - 1] + " L" + strArray[j] + " "; } return(str2); }
public void UpdateSVG(XmlTextWriter doc, SVGContext context) { this.ClipID = GenerateID(); doc.WriteStartElement("clipPath"); doc.WriteAttributeString("id", this.ClipID); this.ClipPoint1 = context.fxy(this.ClipPoint1); this.ClipPoint2 = context.fxy(this.ClipPoint2); if (decimal.Compare(this.ClipPoint2.Y, this.ClipPoint1.Y) < 0) { int num = Convert.ToInt32(this.ClipPoint1.Y); this.ClipPoint1.Y = this.ClipPoint2.Y; this.ClipPoint2.Y = new decimal(num); } doc.WriteStartElement("rect"); doc.WriteAttributeString("x", this.ClipPoint1.X.ToString()); doc.WriteAttributeString("y", this.ClipPoint1.Y.ToString()); doc.WriteAttributeString("width", Math.Abs(decimal.Subtract(this.ClipPoint2.X, this.ClipPoint1.X)).ToString()); doc.WriteAttributeString("height", Math.Abs(decimal.Subtract(this.ClipPoint2.Y, this.ClipPoint1.Y)).ToString()); doc.WriteEndElement(); doc.WriteEndElement(); }
public void UpdateSVGfFigure(XmlTextWriter doc, SVGContext context) { string[] strArray = new string[points.Length]; //Array.CreateInstance(typeof(string), this.points.Length); int num2 = strArray.Length - 1; for (int i = 0; i <= num2; i++) { strArray[i] = context.fx(Convert.ToDouble(this.points[i].X)).ToString() + "," + context.fy(Convert.ToDouble(this.points[i].Y)).ToString(); } if (context.interiorstyle == 3) { context.getHatch(doc); } doc.WriteStartElement("polygon"); doc.WriteAttributeString("points", string.Join(" ", strArray)); doc.WriteAttributeString("fill", context.fill); if (context.isClip & !String.IsNullOrEmpty(context.CurrClipID)) //if (context.isClip & (StringType.StrCmp(context.CurrClipID, "", false) != 0)) { doc.WriteAttributeString("clip-path", "url(#" + context.CurrClipID + ")"); } doc.WriteEndElement(); }
// Methods public void AddPath(string path, SVGContext mycontext) { if (mycontext.newregion | !String.IsNullOrEmpty(this.MyFillPath)) //if (mycontext.newregion | (StringType.StrCmp(this.MyFillPath, "", false) == 0)) { if (mycontext.edgevis == 1) { this.MyStrokePath = this.MyStrokePath + path; } if (!String.IsNullOrEmpty(this.MyFillPath) && !this.MyFillPath.Trim().EndsWith("Z"))// if ((StringType.StrCmp(this.MyFillPath, "", false) != 0) && !this.MyFillPath.Trim().EndsWith("Z")) { this.MyFillPath = this.MyFillPath + "Z" + path; } else { this.MyFillPath = this.MyFillPath + path; } } else if (mycontext.connectingedge) { if (mycontext.edgevis == 1) { this.MyStrokePath = this.MyStrokePath + "L" + path.TrimStart(new char[0]).Substring(1); } this.MyFillPath = this.MyFillPath + "L" + path.TrimStart(new char[0]).Substring(1); } else if (!this.MyFillPath.TrimEnd(new char[0]).EndsWith("Z")) { this.MyFillPath = this.MyFillPath + "L" + path.TrimStart(new char[0]).Substring(1); this.MyStrokePath = this.MyStrokePath + "Z" + path; } else { this.MyFillPath = this.MyFillPath + path; this.MyStrokePath = this.MyStrokePath + path; } mycontext.newregion = false; mycontext.connectingedge = false; }
public void UpdateSVG(XmlTextWriter doc, SVGContext context) { string str = String.Empty; string[] strArray = new string[points.Length];//Array.CreateInstance(typeof(string), this.points.Length); int num4 = strArray.Length - 1; for (int i = 0; i <= num4; i++) { strArray[i] = context.fx(Convert.ToDouble(this.points[i].X)).ToString() + "," + context.fy(Convert.ToDouble(this.points[i].Y)).ToString(); } int num3 = strArray.Length; for (int j = 1; j <= num3; j += 2) { str = str + "M" + strArray[j - 1] + " L" + strArray[j] + " "; } doc.WriteStartElement("path"); doc.WriteAttributeString("d", str); doc.WriteAttributeString("fill", "none"); context.PrintLine(doc); doc.WriteEndElement(); }
public void UpdateSVG(XmlTextWriter doc, SVGContext context) { if (context.connectingedge) { this.MyStrokePath = this.MyStrokePath + " Z"; context.connectingedge = false; } if (!this.MyFillPath.TrimEnd(new char[0]).EndsWith("Z")) { this.MyFillPath = this.MyFillPath + "Z"; } if (!this.MyFillPath.TrimStart(new char[0]).StartsWith("M")) { this.MyFillPath = "M" + this.MyFillPath.TrimStart(new char[0]).Substring(1); } if (!String.IsNullOrEmpty(this.MyStrokePath) && !this.MyStrokePath.TrimStart(new char[0]).StartsWith("M"))//if ((StringType.StrCmp(this.MyStrokePath, "", false) != 0) && !this.MyStrokePath.TrimStart(new char[0]).StartsWith("M")) { this.MyStrokePath = "M" + this.MyStrokePath.TrimStart(new char[0]).Substring(1); } if (context.interiorstyle == 3) { context.getHatch(doc); } doc.WriteStartElement("g"); doc.WriteStartElement("path"); doc.WriteAttributeString("d", this.MyFillPath); doc.WriteAttributeString("fill", context.fill); doc.WriteAttributeString("fill-rule", "evenodd"); doc.WriteAttributeString("stroke", "none"); doc.WriteEndElement(); doc.WriteStartElement("path"); doc.WriteAttributeString("d", this.MyStrokePath); doc.WriteAttributeString("fill", "none"); context.PrintEdgeArc(doc); doc.WriteEndElement(); doc.WriteEndElement(); }
// Methods public static bool class4(CGMElement element, SVGContext mycontext, XmlTextWriter myxml) { CGM.Scanner.Point[] pointArray; switch (element.ElementId) { case 1: { ArrayList list = new ArrayList(); while (!mycontext.Reader.EOF) { list.Add(mycontext.Reader.ReadP()); } CGMPolyLine line = new CGMPolyLine { points = (CGM.Scanner.Point[])list.ToArray(typeof(CGM.Scanner.Point)) }; if (mycontext.CurrFigure == null) { line.UpdateSVG(myxml, mycontext); } else { mycontext.figline = true; mycontext.CurrFigure.AddPath(line.GetPath(mycontext), mycontext); } break; } case 2: { ArrayList list2 = new ArrayList(); while (!mycontext.Reader.EOF) { list2.Add(mycontext.Reader.ReadP()); } CGMDisjoint disjoint = new CGMDisjoint { points = (CGM.Scanner.Point[])list2.ToArray(typeof(CGM.Scanner.Point)) }; if (mycontext.CurrFigure == null) { disjoint.UpdateSVG(myxml, mycontext); } else { mycontext.figline = true; mycontext.CurrFigure.AddPath(disjoint.GetPath(mycontext), mycontext); } break; } case 4: { CGM4Text text = new CGM4Text { Position = mycontext.Reader.ReadP() }; int num = mycontext.Reader.ReadE(); text.Text = mycontext.Reader.ReadS(); if (num != 0) { mycontext.Final = true; text.UpdateSVG(myxml, mycontext); } else { mycontext.Final = false; SVGContext context = (SVGContext)mycontext.Clone(); text.appendcontext.Add(context); mycontext.AppendTxt4 = text; mycontext.Appfour = true; } break; } case 5: { CGMText text2 = new CGMText(); SizeF ef = new SizeF((float)mycontext.Reader.ReadVDC(), (float)mycontext.Reader.ReadVDC()); text2.TextSize = ef; text2.Position = mycontext.Reader.ReadP(); int num2 = mycontext.Reader.ReadE(); text2.Text = mycontext.Reader.ReadS(); if (num2 != 1) { mycontext.Final = false; SVGContext context2 = (SVGContext)mycontext.Clone(); text2.appendcontext.Add(context2); mycontext.AppendTxt = text2; mycontext.Appfour = false; } else { text2.UpdateSVG(myxml, mycontext); } break; } case 6: if (mycontext.Final) { mycontext.Final = false; } else { int num3 = mycontext.Reader.ReadE(); string str = mycontext.Reader.ReadS(); if (num3 != 1) { if (mycontext.Appfour) { CGM4Text text5 = mycontext.AppendTxt4; text5.appendtext.Add(str); SVGContext context3 = (SVGContext)mycontext.Clone(); text5.appendcontext.Add(context3); mycontext.Appfour = true; } else { CGMText appendTxt = mycontext.AppendTxt; appendTxt.appendtext.Add(str); SVGContext context4 = (SVGContext)mycontext.Clone(); appendTxt.appendcontext.Add(context4); mycontext.Appfour = false; } } else if (!mycontext.Appfour) { CGMText text4 = mycontext.AppendTxt; text4.appendtext.Add(str); text4.UpdateSVGwContext(myxml, mycontext); mycontext.Final = true; mycontext.AppendTxt = null; } else { CGM4Text text3 = mycontext.AppendTxt4; text3.appendtext.Add(str); text3.UpdateSVGwContext(myxml, mycontext); mycontext.Final = true; mycontext.AppendTxt4 = null; } } break; case 7: { ArrayList list3 = new ArrayList(); while (!mycontext.Reader.EOF) { list3.Add(mycontext.Reader.ReadP()); } list3.Add(RuntimeHelpers.GetObjectValue(list3[0])); CGMPoly poly = new CGMPoly { points = (CGM.Scanner.Point[])list3.ToArray(typeof(CGM.Scanner.Point)) }; if (mycontext.CurrFigure == null) { if (Dynamic.Instance.Linked) { Dynamic.Instance.CreateBeginSVGLink(ref myxml, mycontext); } poly.UpdateSVG(myxml, mycontext); if (Dynamic.Instance.Linked) { Dynamic.Instance.CreateEndSVGLink(ref myxml, mycontext); } } else { mycontext.newregion = true; mycontext.CurrFigure.AddPath(poly.GetPath(mycontext), mycontext); } break; } case 8: { ArrayList list4 = new ArrayList(); ArrayList list5 = new ArrayList(); while (!mycontext.Reader.EOF) { list4.Add(mycontext.Reader.ReadP()); list5.Add(mycontext.Reader.ReadE()); } CGMPolySet set = new CGMPolySet { points = (CGM.Scanner.Point[])list4.ToArray(typeof(CGM.Scanner.Point)), flags = (int[])list5.ToArray(typeof(int)) }; if (Dynamic.Instance.Linked) { Dynamic.Instance.CreateBeginSVGLink(ref myxml, mycontext); } set.UpdateSVG(myxml, mycontext); if (Dynamic.Instance.Linked) { Dynamic.Instance.CreateEndSVGLink(ref myxml, mycontext); } break; } case 9: { MakeCellArray array = new MakeCellArray(mycontext) { p = mycontext.Reader.ReadP(), q = mycontext.Reader.ReadP(), r = mycontext.Reader.ReadP(), nx = mycontext.Reader.ReadI(), ny = mycontext.Reader.ReadI(), LCP = mycontext.Reader.ReadI(), cellmode = mycontext.Reader.ReadE(), data = mycontext.Reader.ReadBS(-1) }; array.MakeArray(); array.updatesvg(myxml); break; } case 11: { CGMRect rect = new CGMRect { topleft = mycontext.Reader.ReadP(), bottomright = mycontext.Reader.ReadP() }; if (mycontext.CurrFigure != null) { mycontext.newregion = true; mycontext.CurrFigure.AddPath(rect.GetPath(mycontext), mycontext); } else { if (Dynamic.Instance.Linked) { Dynamic.Instance.CreateBeginSVGLink(ref myxml, mycontext); } rect.UpdateSVG(myxml, mycontext); if (Dynamic.Instance.Linked) { Dynamic.Instance.CreateEndSVGLink(ref myxml, mycontext); } } break; } case 12: { CGMCircle circle = new CGMCircle { center = mycontext.Reader.ReadP(), radius = Convert.ToInt32(mycontext.Reader.ReadVDC()) }; if (Dynamic.Instance.Linked) { Dynamic.Instance.CreateBeginSVGLink(ref myxml, mycontext); } if (mycontext.CurrFigure != null) { mycontext.newregion = true; mycontext.CurrFigure.AddPath(circle.GetPath(mycontext), mycontext); } else { if (Dynamic.Instance.Linked) { Dynamic.Instance.CreateBeginSVGLink(ref myxml, mycontext); } circle.UpdateSVG(myxml, mycontext); if (Dynamic.Instance.Linked) { Dynamic.Instance.CreateEndSVGLink(ref myxml, mycontext); } } break; } case 13: { CGMArc arc = new CGMArc(); pointArray = new CGM.Scanner.Point[] { mycontext.Reader.ReadP(), mycontext.Reader.ReadP(), mycontext.Reader.ReadP() }; arc.SetCircle3Points(pointArray); if (mycontext.CurrFigure != null) { mycontext.CurrFigure.AddPath(arc.GetPath(mycontext), mycontext); } else { arc.UpdateSVG(myxml, mycontext); } break; } case 14: { CGMArc arc2 = new CGMArc(); pointArray = new CGM.Scanner.Point[] { mycontext.Reader.ReadP(), mycontext.Reader.ReadP(), mycontext.Reader.ReadP() }; arc2.SetCircle3Points(pointArray); arc2.closingType = mycontext.Reader.ReadE(); if (mycontext.CurrFigure != null) { mycontext.newregion = true; mycontext.CurrFigure.AddPath(arc2.GetPath(mycontext), mycontext); } else { if (Dynamic.Instance.Linked) { Dynamic.Instance.CreateBeginSVGLink(ref myxml, mycontext); } arc2.UpdateSVG(myxml, mycontext); if (Dynamic.Instance.Linked) { Dynamic.Instance.CreateEndSVGLink(ref myxml, mycontext); } } break; } case 15: { CGMArc arc3 = new CGMArc { center = mycontext.Reader.ReadP(), v1 = { X = Convert.ToDecimal(mycontext.Reader.ReadVDC()), Y = Convert.ToDecimal(mycontext.Reader.ReadVDC()) }, v2 = { X = Convert.ToDecimal(mycontext.Reader.ReadVDC()), Y = Convert.ToDecimal(mycontext.Reader.ReadVDC()) } }; double r = Convert.ToDouble(mycontext.Reader.ReadVDC()); arc3.SetCircleDiameters(r, false); if (mycontext.CurrFigure != null) { mycontext.CurrFigure.AddPath(arc3.GetPath(mycontext), mycontext); } else { arc3.UpdateSVG(myxml, mycontext); } break; } case 0x10: { CGMArc arc4 = new CGMArc { center = mycontext.Reader.ReadP(), v1 = { X = Convert.ToDecimal(mycontext.Reader.ReadVDC()), Y = Convert.ToDecimal(mycontext.Reader.ReadVDC()) }, v2 = { X = Convert.ToDecimal(mycontext.Reader.ReadVDC()), Y = Convert.ToDecimal(mycontext.Reader.ReadVDC()) } }; double num5 = Convert.ToDouble(mycontext.Reader.ReadVDC()); arc4.SetCircleDiameters(num5, false); arc4.closingType = mycontext.Reader.ReadE(); if (mycontext.CurrFigure != null) { mycontext.newregion = true; mycontext.CurrFigure.AddPath(arc4.GetPath(mycontext), mycontext); } else { if (Dynamic.Instance.Linked) { Dynamic.Instance.CreateBeginSVGLink(ref myxml, mycontext); } arc4.UpdateSVG(myxml, mycontext); if (Dynamic.Instance.Linked) { Dynamic.Instance.CreateEndSVGLink(ref myxml, mycontext); } } break; } case 0x11: { CGMEllipse ellipse = new CGMEllipse { center = mycontext.Reader.ReadP(), cd1 = mycontext.Reader.ReadP(), cd2 = mycontext.Reader.ReadP() }; if (mycontext.CurrFigure != null) { mycontext.newregion = true; mycontext.CurrFigure.AddPath(ellipse.GetPath(mycontext), mycontext); } else { if (Dynamic.Instance.Linked) { Dynamic.Instance.CreateBeginSVGLink(ref myxml, mycontext); } ellipse.UpdateSVG(myxml, mycontext); if (Dynamic.Instance.Linked) { Dynamic.Instance.CreateEndSVGLink(ref myxml, mycontext); } } break; } case 0x12: new CGMArc { center = mycontext.Reader.ReadP(), cd1 = mycontext.Reader.ReadP(), cd2 = mycontext.Reader.ReadP(), v1 = { X = Convert.ToDecimal(mycontext.Reader.ReadVDC()), Y = Convert.ToDecimal(mycontext.Reader.ReadVDC()) }, v2 = { X = Convert.ToDecimal(mycontext.Reader.ReadVDC()), Y = Convert.ToDecimal(mycontext.Reader.ReadVDC()) } }.UpdateSVG(myxml, mycontext); break; case 0x13: new CGMArc { center = mycontext.Reader.ReadP(), cd1 = mycontext.Reader.ReadP(), cd2 = mycontext.Reader.ReadP(), v1 = { X = Convert.ToDecimal(mycontext.Reader.ReadVDC()), Y = Convert.ToDecimal(mycontext.Reader.ReadVDC()) }, v2 = { X = Convert.ToDecimal(mycontext.Reader.ReadVDC()), Y = Convert.ToDecimal(mycontext.Reader.ReadVDC()) }, closingType = mycontext.Reader.ReadE() }.UpdateSVG(myxml, mycontext); break; case 0x15: mycontext.connectingedge = true; break; case 0x1a: { CGMPolyBez bez = new CGMPolyBez { Continue = mycontext.Reader.ReadIX() == 1 ? false : true }; ArrayList list6 = new ArrayList(); while (!mycontext.Reader.EOF) { list6.Add(mycontext.Reader.ReadP()); } bez.Points = (CGM.Scanner.Point[])list6.ToArray(typeof(CGM.Scanner.Point)); if (mycontext.CurrFigure == null) { bez.UpdateSVG(myxml, mycontext); } else { mycontext.CurrFigure.AddPath(bez.GetPath(mycontext), mycontext); } break; } case 0x1c: { mycontext.Reader.ReadIX(); mycontext.Reader.ReadI(); mycontext.Reader.ReadCO(); mycontext.Reader.ReadCO(); mycontext.Reader.ReadSDR(); byte[] buffer = mycontext.Reader.ReadBS(-1); mycontext.prevtiles.Tiles.Add(buffer); mycontext.prevtiles.isBitonal = true; break; } case 0x1d: { mycontext.Reader.ReadIX(); mycontext.Reader.ReadI(); mycontext.Reader.ReadI(); mycontext.Reader.ReadSDR(); byte[] buffer2 = mycontext.Reader.ReadBS(-1); mycontext.prevtiles.Tiles.Add(buffer2); mycontext.prevtiles.Tiles.Add(buffer2); mycontext.prevtiles.isBitonal = false; break; } default: return(false); } return(true); }
public void UpdateSVGwContext(XmlTextWriter doc, SVGContext mycontext) { this.Position = mycontext.fxy(this.Position); doc.WriteStartElement("text"); doc.WriteAttributeString("x", this.Position.X.ToString()); doc.WriteAttributeString("y", (Convert.ToDouble(this.Position.Y) + mycontext.compAliVert()).ToString()); // doc.WriteAttributeString("fill", StringType.FromObject(LateBinding.LateGet(this.appendcontext.get_Item(0), null, "Text", new object[0], null, null))); object[] args = new object[] { doc, this.Position }; bool[] copyBack = new bool[] { true, true }; //LateBinding.LateCall(this.appendcontext.get_Item(0), null, "PrintTextRotation", args, null, copyBack); //if (copyBack[1]) //{ // this.Position = args[1]; //} //if (copyBack[0]) //{ // doc = args[0]; //} args = new object[1]; //object o = this.appendcontext.get_Item(0); //args[0] = RuntimeHelpers.GetObjectValue(LateBinding.LateGet(o, null, "FontSize", new object[0], null, null)); object[] objArray3 = args; copyBack = new bool[] { true }; if (copyBack[0]) { // LateBinding.LateSetComplex(o, null, "FontSize", new object[] { RuntimeHelpers.GetObjectValue(objArray3[0]) }, null, true, true); } //doc.WriteAttributeString("font-size", (LateBinding.LateGet(this.appendcontext.get_Item(0), null, "fscale", objArray3, null, copyBack)).ToString()); args = new object[] { doc }; copyBack = new bool[] { true }; //LateBinding.LateCall(this.appendcontext.get_Item(0), null, "PrintTextAlign", args, null, copyBack); if (copyBack[0]) { // doc = args[0]; } //doc.WriteAttributeString("font-family", StringType.FromObject(LateBinding.LateGet(this.appendcontext.get_Item(0), null, "Font", new object[0], null, null))); // if (BooleanType.FromObject(ObjectType.BitAndObj(LateBinding.LateGet(this.appendcontext.get_Item(0), null, "isClip", new object[0], null, null), ObjectType.ObjTst(LateBinding.LateGet(this.appendcontext.get_Item(0), null, "CurrClipID", new object[0], null, null), "", false) != 0))) // { // doc.WriteAttributeString("clip-path", StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("url(#", LateBinding.LateGet(this.appendcontext.get_Item(0), null, "CurrClipID", new object[0], null, null)), ")"))); // } mycontext.printTextAngle(doc, this.Position); if (mycontext.TextSpacing != 0.0) { doc.WriteAttributeString("letter-spacing", (mycontext.TextSpacing * 4.8).ToString()); } int num2 = this.Text.Length; this.Text = ""; //string[] strArray = new string[] { "d", "e", "m", "o" }; //int index = 0; //while (this.Text.Length <= num2) //{ // this.Text = this.Text + strArray[index]; // if (strArray[index] == "o") // //if (StringType.StrCmp(strArray[index], "o", false) == 0) // { // index = 0; // } // else // { // index++; // } //} doc.WriteString(this.Text); //for (int i = 1; i < this.appendtext.Count; i++) //{ // doc.WriteStartElement("tspan"); // doc.WriteAttributeString("fill", (LateBinding.LateGet(this.appendcontext.get_Item(i), null, "Text", new object[0], null, null)).ToString()); // args = new object[] { doc, this.Position }; // copyBack = new bool[] { true, true }; // LateBinding.LateCall(this.appendcontext.get_Item(i), null, "PrintTextRotation", args, null, copyBack); // if (copyBack[1]) // { // this.Position = args[1]; // } // if (copyBack[0]) // { // doc = args[0]; // } // object[] objArray = new object[1]; // o = this.appendcontext.get_Item(i); // objArray[0] = RuntimeHelpers.GetObjectValue(LateBinding.LateGet(o, null, "FontSize", new object[0], null, null)); // args = objArray; // copyBack = new bool[] { true }; // if (copyBack[0]) // { // LateBinding.LateSetComplex(o, null, "FontSize", new object[] { RuntimeHelpers.GetObjectValue(args[0]) }, null, true, true); // } // doc.WriteAttributeString("font-size",(LateBinding.LateGet(this.appendcontext.get_Item(i), null, "fscale", args, null, copyBack)).ToString()); // args = new object[] { doc }; // copyBack = new bool[] { true }; // LateBinding.LateCall(this.appendcontext.get_Item(i), null, "PrintTextAlign", args, null, copyBack); // if (copyBack[0]) // { // doc = args[0]; // } // doc.WriteAttributeString("font-family", mycontext.Font); // if (BooleanType.FromObject(ObjectType.BitAndObj(LateBinding.LateGet(this.appendcontext.get_Item(i), null, "isClip", new object[0], null, null), ObjectType.ObjTst(LateBinding.LateGet(this.appendcontext.get_Item(i), null, "CurrClipID", new object[0], null, null), "", false) != 0))) // { // doc.WriteAttributeString("clip-path", (ObjectType.StrCatObj(ObjectType.StrCatObj("url(#", LateBinding.LateGet(this.appendcontext.get_Item(i), null, "CurrClipID", new object[0], null, null)), ")")).ToString()); // } // if (mycontext.TextSpacing != 0.0) // { // doc.WriteAttributeString("letter-spacing", (mycontext.TextSpacing * 4.8).ToString()); // } // num2 = StringType.FromObject(this.appendtext.get_Item(i - 1)).Length; // string str2 = ""; // string[] strArray3 = new string[] { "d", "e", "m", "o" }; // index = 0; // while (str2.Length <= num2) // { // str2 = str2 + strArray3[index]; // if (strArray3[index] == "o") // { // index = 0; // } // else // { // index++; // } //} // doc.WriteString(str2); // doc.WriteEndElement(); //} doc.WriteStartElement("tspan"); doc.WriteAttributeString("fill", mycontext.Text); mycontext.PrintTextRotation(doc, this.Position); doc.WriteAttributeString("font-size", (mycontext.fscale(mycontext.FontSize)).ToString()); mycontext.PrintTextAlign(doc); doc.WriteAttributeString("font-family", mycontext.Font); //if (BooleanType.FromObject(ObjectType.BitAndObj(LateBinding.LateGet(this.appendcontext.get_Item(0), null, "isClip", new object[0], null, null), ObjectType.ObjTst(LateBinding.LateGet(this.appendcontext.get_Item(0), null, "CurrClipID", new object[0], null, null), "", false) != 0))) //{ // doc.WriteAttributeString("clip-path", "url(#" + mycontext.CurrClipID + ")"); //} //if (mycontext.TextSpacing != 0.0) //{ // doc.WriteAttributeString("letter-spacing", (mycontext.TextSpacing * 4.8).ToString()); //} //num2 = StringType.FromObject(this.appendtext.get_Item(this.appendtext.Count - 1)).Length; string text = ""; //string[] strArray2 = new string[] { "d", "e", "m", "o" }; //index = 0; //while (text.Length <= num2) //{ // text = text + strArray2[index]; // if (StringType.StrCmp(strArray2[index], "o", false) == 0) // { // index = 0; // } // else // { // index++; // } //} doc.WriteString(text); doc.WriteFullEndElement(); doc.WriteFullEndElement(); }
public void CreateEndSVGLink(ref XmlTextWriter doc, SVGContext context) { doc.WriteFullEndElement(); this.isLinked = false; }