示例#1
0
        public object printTextAngle(XmlWriter doc, CGM.Scanner.Point Position)
        {
            object obj2 = default(object);

            string[] strArray2;
            double   num6;

            if ((this.TextAngle != 1.0) & (this.TextRotateAngle == 0.0))
            {
                double num2 = Math.Floor(Math.Tan(this.TextAngle) * 100.0) * 0.001;
                double num  = num2 * Convert.ToDouble(Position.Y);
                strArray2    = new string[5];
                strArray2[0] = "matrix(1 0 ";
                num6         = -num2;
                strArray2[1] = num6.ToString();
                strArray2[2] = " 1 ";
                strArray2[3] = num.ToString();
                strArray2[4] = " 0)";
                doc.WriteAttributeString("transform", string.Concat(strArray2));
                return(obj2);
            }
            if ((this.TextAngle == 1.0) & (this.TextRotateAngle != 0.0))
            {
                strArray2    = new string[7];
                strArray2[0] = "rotate(";
                num6         = -this.TextRotateAngle;
                strArray2[1] = num6.ToString();
                strArray2[2] = " ";
                strArray2[3] = Position.X.ToString();
                strArray2[4] = ", ";
                strArray2[5] = Position.Y.ToString();
                strArray2[6] = ")";
                doc.WriteAttributeString("transform", string.Concat(strArray2));
                return(obj2);
            }
            if ((this.TextAngle != 1.0) & (this.TextRotateAngle != 0.0))
            {
                double   num4     = Math.Floor(Math.Tan(this.TextAngle) * 100.0) * 0.001;
                double   num3     = num4 * Convert.ToDouble(Position.Y);
                string[] strArray = new string[6];
                strArray2   = new string[] { "rotate(", this.TextRotateAngle.ToString(), " ", Position.X.ToString(), ", ", Position.Y.ToString() };
                strArray[0] = string.Concat(strArray2);
                strArray[1] = ") matrix(1 0 ";
                strArray[2] = num4.ToString();
                strArray[3] = " 1 ";
                strArray[4] = num3.ToString();
                strArray[5] = " 0)";
                doc.WriteAttributeString("transform", string.Concat(strArray));
            }
            return(obj2);
        }
示例#2
0
        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();
        }
示例#3
0
        public void PrintTextRotation(XmlWriter xw, CGM.Scanner.Point loc)
        {
            switch (this.TextPath)
            {
            case 1:
                xw.WriteAttributeString("writing-mode", "rl-tb");
                xw.WriteAttributeString("unicode-bidi", "bidi-override");
                xw.WriteAttributeString("direction", "rtl");
                break;

            case 2:
                xw.WriteAttributeString("transform", string.Format("rotate(-90 {0} {1})", loc.X, loc.Y));
                xw.WriteAttributeString("glyph-orientation-horizontal", "90");
                break;

            case 3:
                xw.WriteAttributeString("writing-mode", "tb");
                xw.WriteAttributeString("glyph-orientation-vertical", "0");
                break;
            }
        }
示例#4
0
 public CGM.Scanner.Point fxy(CGM.Scanner.Point xyc)
 {
     xyc.X = new decimal(this.fx(Convert.ToDouble(xyc.X)));
     xyc.Y = new decimal(this.fy(Convert.ToDouble(xyc.Y)));
     return(xyc);
 }
示例#5
0
        // 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);
        }
示例#6
0
        // Methods
        public static bool class2(CGMElement element, SVGContext mycontext, XmlTextWriter myxml)
        {
            switch (element.ElementId)
            {
            case 3:
                mycontext.linewidthmode = mycontext.Reader.ReadE();
                break;

            case 5:
                mycontext.edgewidthmode = mycontext.Reader.ReadE();
                break;

            case 6:
            {
                mycontext.vdclb = mycontext.Reader.ReadP();
                mycontext.vdcrt = mycontext.Reader.ReadP();
                mycontext.ow    = Convert.ToDouble(Math.Abs(decimal.Subtract(mycontext.vdclb.X, mycontext.vdcrt.X)));
                mycontext.oh    = Convert.ToDouble(Math.Abs(decimal.Subtract(mycontext.vdclb.Y, mycontext.vdcrt.Y)));
                CGM.Scanner.Point point = new CGM.Scanner.Point(new decimal(mycontext.options.ViewBox.Location.X), new decimal(mycontext.options.ViewBox.Location.Y));
                mycontext.rtl   = point;
                mycontext.rw    = Convert.ToInt32(Math.Round(mycontext.ow));
                mycontext.rh    = Convert.ToInt32(Math.Round(mycontext.oh));
                mycontext.scale = 1.0;
                if (mycontext.options.FitInBox || mycontext.options.EnlargeInBox)
                {
                    double num2 = mycontext.ow / ((double)mycontext.options.ViewBox.Width);
                    double num  = mycontext.oh / ((double)mycontext.options.ViewBox.Height);
                    if (num2 < num)
                    {
                        if (((num > 1.0) && mycontext.options.FitInBox) || ((num < 1.0) && mycontext.options.EnlargeInBox))
                        {
                            mycontext.scale = num;
                            mycontext.rw    = Convert.ToInt32(Math.Round(mycontext.ow / num));
                            mycontext.rh    = Convert.ToInt32(Math.Round((double)mycontext.options.ViewBox.Width));
                        }
                    }
                    else if (((num2 > 1.0) && mycontext.options.FitInBox) || ((num2 < 1.0) && mycontext.options.EnlargeInBox))
                    {
                        mycontext.scale = num2;
                        mycontext.rw    = Convert.ToInt32(Math.Round((double)mycontext.options.ViewBox.Width));
                        mycontext.rh    = Convert.ToInt32(Math.Round(mycontext.oh / num2));
                    }
                }
                break;
            }

            case 7:
                mycontext.BackColor = mycontext.convertColor(mycontext.Reader.ReadCD());
                break;

            case 11:
            {
                SVGContext.linebundlestruct linebundlestruct;
                int index = mycontext.Reader.ReadIX();
                linebundlestruct.type  = mycontext.Reader.ReadIX();
                linebundlestruct.width = Convert.ToDouble(mycontext.Reader.ReadSS(true));
                linebundlestruct.color = (Color)mycontext.Reader.ReadCO();
                if ((mycontext.linebundle.Length - 1) < index)
                {
                    mycontext.linebundle = mycontext.linebundle.Concat(new SVGContext.linebundlestruct[(index - 1) + 1]).ToArray();//mycontext.linebundle = Utils.CopyArray((Array)mycontext.linebundle, new SVGContext.linebundlestruct[(index - 1) + 1]);
                }
                mycontext.linebundle[index] = linebundlestruct;
                break;
            }

            case 13:
            {
                SVGContext.textbundlestruct textbundlestruct;
                int num4 = mycontext.Reader.ReadIX();
                textbundlestruct.fontindex = mycontext.Reader.ReadIX().ToString();
                textbundlestruct.precision = mycontext.Reader.ReadE();
                textbundlestruct.spacing   = mycontext.Reader.ReadR();
                textbundlestruct.expansion = mycontext.Reader.ReadR();
                textbundlestruct.color     = (Color)mycontext.Reader.ReadCO();
                if ((mycontext.textbundle.Length - 1) < num4)
                {
                    //mycontext.textbundle = Utils.CopyArray((Array)mycontext.textbundle, new SVGContext.textbundlestruct[(num4 - 1) + 1]);
                    mycontext.textbundle = mycontext.textbundle.Concat(new SVGContext.textbundlestruct[(num4 - 1) + 1]).ToArray();
                }
                mycontext.textbundle[num4] = textbundlestruct;
                break;
            }

            case 14:
            {
                SVGContext.fillbundlestruct fillbundlestruct;
                int num5 = mycontext.Reader.ReadIX();
                fillbundlestruct.style   = mycontext.Reader.ReadE();
                fillbundlestruct.color   = (Color)mycontext.Reader.ReadCO();
                fillbundlestruct.hatch   = mycontext.Reader.ReadIX();
                fillbundlestruct.pattern = mycontext.Reader.ReadIX();
                if ((mycontext.fillbundle.Length - 1) < num5)
                {
                    //mycontext.fillbundle = Utils.CopyArray((Array)mycontext.fillbundle, new SVGContext.fillbundlestruct[(num5 - 1) + 1]);
                    mycontext.fillbundle = mycontext.fillbundle.Concat(new SVGContext.fillbundlestruct[(num5 - 1) + 1]).ToArray();
                }
                mycontext.fillbundle[num5] = fillbundlestruct;
                break;
            }

            case 15:
            {
                SVGContext.edgebundlestruct edgebundlestruct;
                int num6 = mycontext.Reader.ReadIX();
                edgebundlestruct.type  = mycontext.Reader.ReadIX();
                edgebundlestruct.width = Convert.ToDouble(mycontext.Reader.ReadSS(true));
                edgebundlestruct.color = (Color)mycontext.Reader.ReadCO();
                if ((mycontext.edgebundle.Length - 1) < num6)
                {
                    //mycontext.edgebundle = Utils.CopyArray((Array)mycontext.edgebundle, new SVGContext.edgebundlestruct[(num6 - 1) + 1]);
                    mycontext.edgebundle = mycontext.edgebundle.Concat(new SVGContext.edgebundlestruct[(num6 - 1) + 1]).ToArray();
                }
                mycontext.edgebundle[num6] = edgebundlestruct;
                break;
            }

            default:
                return(false);
            }
            return(true);
        }
示例#7
0
        // Methods
        public static bool class0(CGMElement element, SVGContext mycontext, XmlTextWriter myxml)
        {
            switch (element.ElementId)
            {
            case 1:
            //myxml.WriteComment("Begin MetaFile: " + mycontext.Reader.ReadS().Trim());
            //foreach (Assembly assembly in AppDomain.get_CurrentDomain().GetAssemblies())
            //{
            //  if (string.Compare(Path.GetExtension(assembly.get_Location()), ".exe", true) == 0)
            //  {
            //    object[] customAttributes = assembly.GetCustomAttributes(typeof(AssemblyCompanyAttribute), true);
            //    for (int i = 0; i < customAttributes.Length; i++)
            //    {
            //      AssemblyCompanyAttribute attribute = customAttributes[i];
            //      if (attribute.get_Company().StartsWith("DocSoft"))
            //      {
            //        break;
            //      }
            //    }
            //  }
            //}
            //throw new Exception("Invalid Use.");

            case 3:
            {
                string str2 = mycontext.Reader.ReadS();
                myxml.WriteStartElement("g");
                myxml.WriteAttributeString("qsvg:picture", str2.Trim());
                break;
            }

            case 4:
                if (!mycontext.BackColor.IsEmpty)
                {
                    new CGMBackGround().WriteBackground(myxml, mycontext);
                }
                break;

            case 5:
                myxml.WriteFullEndElement();
                break;

            case 8:
                mycontext.CurrFigure = new CGMFigure();
                mycontext.fingureOn  = true;
                break;

            case 9:
                if (mycontext.CurrFigure != null)
                {
                    if (Dynamic.Instance.Linked)
                    {
                        Dynamic.Instance.CreateBeginSVGLink(ref myxml, mycontext);
                    }
                    mycontext.CurrFigure.UpdateSVG(myxml, mycontext);
                    if (Dynamic.Instance.Linked)
                    {
                        Dynamic.Instance.CreateEndSVGLink(ref myxml, mycontext);
                    }
                    mycontext.CurrFigure = null;
                }
                mycontext.fingureOn      = false;
                mycontext.connectingedge = false;
                break;

            case 0x13:
            {
                mycontext.prevtiles          = new CGMTiles();
                mycontext.prevtiles.Position = mycontext.Reader.ReadP();
                mycontext.Reader.ReadE();
                mycontext.Reader.ReadE();
                Size size = new Size(mycontext.Reader.ReadI(), mycontext.Reader.ReadI());
                mycontext.prevtiles.NumberTiles = size;
                size = new Size(mycontext.Reader.ReadI(), mycontext.Reader.ReadI());
                mycontext.prevtiles.TileSize = size;
                SizeF ef = new SizeF((float)mycontext.Reader.ReadR(), (float)mycontext.Reader.ReadR());
                mycontext.prevtiles.PointSize = ef;
                CGM.Scanner.Point point = new CGM.Scanner.Point(mycontext.Reader.ReadI(), mycontext.Reader.ReadI());
                mycontext.prevtiles.Offset = point;
                size = new Size(mycontext.Reader.ReadI(), mycontext.Reader.ReadI());
                mycontext.prevtiles.ImageSize = size;
                break;
            }

            case 20:
                mycontext.prevtiles.UpdateSVG(myxml, mycontext);
                break;

            case 0x15:
            {
                string s    = mycontext.Reader.ReadS();
                string str4 = mycontext.Reader.ReadS();
                mycontext.Reader.ReadE();
                myxml.WriteStartElement("g");
                myxml.WriteAttributeString("id", MakeId(s));
                myxml.WriteAttributeString("qsvg:aps", s);
                myxml.WriteAttributeString("qsvg:type", str4);
                break;
            }

            case 0x16:
                myxml.WriteComment("aps body");
                break;

            case 0x17:
                myxml.WriteFullEndElement();
                break;

            default:
                return(false);
            }
            return(true);
        }
示例#8
0
        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", (LateBinding.LateGet(this.appendcontext.get_Item(0), null, "Text", new object[0], null, null)).ToString());
            mycontext.PrintTextRotation(doc, this.Position);
            mycontext.PrintTextHeight(doc, this.TextSize);
            mycontext.PrintTextAlign(doc);
            //doc.WriteAttributeString("font-family", (LateBinding.LateGet(this.appendcontext.get_Item(0), null, "Font", new object[0], null, null)).ToString());
            //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)), ")")));
            //}
            if (mycontext.TextSpacing != 0.0)
            {
                doc.WriteAttributeString("letter-spacing", (mycontext.TextSpacing * 4.8).ToString());
            }
            mycontext.printTextAngle(doc, this.Position);
            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());
            //  object[] args = new object[] { doc, this.Position };
            //  bool[] 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[] objArray2 = new object[] { doc };
            //  copyBack = new bool[] { true };
            //  LateBinding.LateCall(this.appendcontext.get_Item(i), null, "PrintTextAlign", objArray2, null, copyBack);
            //  if (copyBack[0])
            //  {
            //    doc = objArray2[0];
            //  }
            //  doc.WriteAttributeString("font-family", mycontext.Font);
            //  mycontext.PrintTextHeight(doc, this.TextSize);
            //  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", StringType.FromDouble(mycontext.TextSpacing * 4.8));
            //  }
            //  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") //if (StringType.StrCmp(strArray3[index], "o", false) == 0)
            //    {
            //      index = 0;
            //    }
            //    else
            //    {
            //      index++;
            //    }
            //  }
            //  doc.WriteString(str2);
            //  doc.WriteEndElement();
            //}
            doc.WriteStartElement("tspan");
            doc.WriteAttributeString("fill", mycontext.Text);
            mycontext.PrintTextRotation(doc, this.Position);
            mycontext.PrintTextAlign(doc);
            mycontext.PrintTextHeight(doc, this.TextSize);
            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 + ")");
            }
            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 (strArray2[index] == "o") //if (StringType.StrCmp(strArray2[index], "o", false) == 0)
            //  {
            //    index = 0;
            //  }
            //  else
            //  {
            //    index++;
            //  }
            //}
            //doc.WriteString(text);
            doc.WriteEndElement();
            doc.WriteEndElement();
        }
示例#9
0
 public PointDbl(CGM.Scanner.Point p)
 {
     this   = new PointDbl();
     this.X = Convert.ToDouble(p.X);
     this.Y = Convert.ToDouble(p.Y);
 }