Ejemplo n.º 1
0
 // Methods
 public BezierOperation(MouseArea mc)
 {
     this.mouseAreaControl = null;
     this.currentGraph = null;
     this.revertMatrix = new Matrix();
     this.startPoint = PointF.Empty;
     this.currentOperate = BezierOperate.Draw;
     this.activePoints = new PointInfoCollection();
     this.editPath = new GraphicsPath();
     this.preInfo = null;
     this.reversePath = new GraphicsPath();
     this.editpath = new GraphicsPath();
     this.preDrawInfo = null;
     this.starttrend = PointF.Empty;
     this.endtrend = PointF.Empty;
     this.addInfo = null;
     this.moveinfo = null;
     this.movePoint = PointF.Empty;
     this.currentinfo = null;
     this.SubpathList = new Hashtable(0x10);
     this.oldstr = string.Empty;
     this.attributename = string.Empty;
     this.showcontrol = true;
     this.activeindex = new int[0];
     this.oldindex = -1;
     this.centerPoint = PointF.Empty;
     this.incenter = false;
     this.tooltips = new Hashtable(0x10);
     this.mouseAreaControl = mc;
     this.win32 = mc.win32;
     this.mouseAreaControl.DefaultCursor = SpecialCursors.bezierCursor;
 }
Ejemplo n.º 2
0
 public static PointF[] PointsParse(string listString, PointInfoCollection pointsInfo)
 {
     listString = listString.Trim();
     while (listString.EndsWith(";"))
     {
         listString = listString.Substring(0, listString.Length - 1);
     }
     PointInfo info1 = null;
     ArrayList list1 = new ArrayList(0x10);
     try
     {
         Regex regex1 = new Regex(@"\s+,?\s*|,\s*");
         string[] textArray1 = regex1.Split(listString);
         for (int num1 = 0; num1 < textArray1.Length; num1 += 2)
         {
             if (num1 >= textArray1.Length)
             {
                 goto Label_0117;
             }
             string text1 = textArray1[num1];
             string text2 = textArray1[num1 + 1];
             if ((text1.Length == 0) || (text2.Length == 0))
             {
                 throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("invalidpointsformat") + listString);
             }
             PointF tf1 = new PointF(ItopVector.Core.Func.Number.ParseFloatStr(text1.Trim()), ItopVector.Core.Func.Number.ParseFloatStr(text2.Trim()));
             list1.Add(tf1);
             info1 = new PointInfo(tf1, PointF.Empty, PointF.Empty, text1.ToString() + " " + text2.ToString() + ";");
         }
     }
     catch (Exception exception1)
     {
         throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("invalidpointsformat") + listString, exception1);
     }
     Label_0117:
     if (info1 != null)
     {
         info1.Command = "L";
         pointsInfo.Add(info1);
     }
     if (list1.Count > 0)
     {
         PointF[] tfArray1 = new PointF[list1.Count];
         list1.CopyTo(0, tfArray1, 0, list1.Count);
         return tfArray1;
     }
     return null;
 }
Ejemplo n.º 3
0
 public void Insert(int index, PointInfo value)
 {
     base.List.Insert(index, value);
     if ((((index - 1) >= 0) && ((index - 1) < base.List.Count)) && !value.IsStart)
     {
         PointInfo info1 = (PointInfo)base.List[index - 1];
         value.PreInfo     = info1;
         info1.NextInfo    = value;
         info1.NextControl = value.FirstControl;
     }
     if (value.IsStart)
     {
         this.startinfo = value;
     }
     if (value.IsEnd)
     {
         value.NextInfo = this.startinfo;
     }
 }
Ejemplo n.º 4
0
 public PointInfo(PointF middle, PointF first, PointF sec, string str)
 {
     //            this.MiddlePoint = PointF.Empty;
     //            this.FirstControl = PointF.Empty;
     //            this.SecondControl = PointF.Empty;
     //            this.PointString = string.Empty;
     this.IsStart = false;
     this.IsEnd = false;
     this.PreInfo = null;
     this.NextInfo = null;
     this.SubPath = -1;
     this.NextControl = PointF.Empty;
     this.Command = string.Empty;
     this.MiddlePoint = middle;
     this.pointString = str;
     this.FirstControl = first;
     this.SecondControl = sec;
     this.owerCollection=null;
     this.Index=0;
     this.Rx=this.Ry=0f;
     this.Angle=0f;
     this.SweepFlage=this.LargeArcFlage=0;
 }
Ejemplo n.º 5
0
        public void OnMouseMove(MouseEventArgs e)
        {
            if (this.currentGraph != null)
            {
                if (e.Button == MouseButtons.None)
                {
                    this.preInfo = null;
                    this.addInfo = null;
                    this.moveinfo = null;
                    Pen pen1 = new Pen(Color.Black, 4f);
                    pen1.Alignment = PenAlignment.Center;
                    if (Control.ModifierKeys == (Keys.Control | Keys.Shift))
                    {
                        this.CurrentOperate = BezierOperate.CenterPoint;
                        this.incenter = false;
                        RectangleF ef1 = new RectangleF(this.mouseAreaControl.CenterPoint.X - 4f, this.mouseAreaControl.CenterPoint.Y - 4f, 8f, 8f);
                        PointF tf1 = new PointF((float) e.X, (float) e.Y);
                        if (ef1.Contains(tf1))
                        {
                            this.incenter = true;
                        }
                        return;
                    }
                    PointF tf2 = new PointF((float) e.X, (float) e.Y);
                    GraphicsPath path1 = new GraphicsPath();
                    PointInfoCollection.PointInfoEnumerator enumerator1 = this.currentGraph.PointsInfo.GetEnumerator();
                    while (enumerator1.MoveNext())
                    {
                        PointInfo info1 = enumerator1.Current;
                        GraphicsPath path2 = new GraphicsPath();
                        path2.AddRectangle(new RectangleF(info1.MiddlePoint.X - 3f, info1.MiddlePoint.Y - 3f, 6f, 6f));
                        path2.Transform(this.revertMatrix);
                        if (path2.IsVisible(tf2) || path2.IsOutlineVisible(tf2, pen1))
                        {
                            this.preInfo = info1;
                            PointInfoCollection collection1 = new PointInfoCollection();
                            if (this.SubpathList.ContainsKey(info1.SubPath))
                            {
                                collection1 = (PointInfoCollection) this.SubpathList[info1.SubPath];
                            }
                            if ((((Control.ModifierKeys & Keys.Control) == Keys.Control) && ((Control.ModifierKeys & Keys.Alt) != Keys.Alt)) || (this.mouseAreaControl.CurrentOperation == ToolOperation.ShapeTransform)
                                   || (this.mouseAreaControl.CurrentOperation == ToolOperation.Custom14) || (this.mouseAreaControl.CurrentOperation == ToolOperation.Custom15))
                            {
                                this.CurrentOperate = BezierOperate.MoveAnchor;
                                return;
                            }
                            if ((info1.IsStart && (info1.PreInfo == null)) && (info1.NextInfo != null))
                            {
                                this.CurrentOperate = BezierOperate.CloseFigure;
                                return;
                            }
                            if ((collection1.IndexOf(info1) == (collection1.Count - 1)) && !info1.IsEnd)
                            {
                                this.CurrentOperate = BezierOperate.ChangeEndAnchor;
                                this.preInfo = info1;
                                return;
                            }
                            if (((Control.ModifierKeys & Keys.Alt) == Keys.Alt) || (this.mouseAreaControl.CurrentOperation == ToolOperation.ConvertAnchor))
                            {
                                this.CurrentOperate = BezierOperate.ConvertAnchor;
                                return;
                            }
                            this.CurrentOperate = BezierOperate.DelAnchor;
                            return;
                        }
                        if (info1.NextInfo != null)
                        {
                            path1.Reset();
                            if (info1.NextInfo.FirstControl.IsEmpty)
                            {
                                path1.AddLine(info1.MiddlePoint, info1.NextInfo.MiddlePoint);
                            }
                            else
                            {
                                path1.AddBezier(info1.MiddlePoint, info1.NextInfo.FirstControl, info1.NextInfo.SecondControl, info1.NextInfo.MiddlePoint);
                            }
                            path1.Transform(this.revertMatrix);
                            if (path1.IsOutlineVisible(tf2, pen1))
                            {
                                if (((Control.ModifierKeys & Keys.Control) == Keys.Control) || (this.mouseAreaControl.CurrentOperation == ToolOperation.ShapeTransform) || (this.mouseAreaControl.CurrentOperation == ToolOperation.Custom11)
                                    || (this.mouseAreaControl.CurrentOperation == ToolOperation.Custom12) || (this.mouseAreaControl.CurrentOperation == ToolOperation.Custom13) || (this.mouseAreaControl.CurrentOperation == ToolOperation.Custom14) || (this.mouseAreaControl.CurrentOperation == ToolOperation.Custom15))
                                {
                                    this.CurrentOperate = BezierOperate.MovePath;
                                    return;
                                }
                                if (((Control.ModifierKeys & Keys.Alt) != Keys.Alt) && (this.mouseAreaControl.CurrentOperation != ToolOperation.ConvertAnchor))
                                {
                                    this.addInfo = info1;
                                    this.CurrentOperate = BezierOperate.AddAnchor;
                                }
                                return;
                            }
                        }
                    }
                    if ((this.currentInfo != null) && (((this.mouseAreaControl.CurrentOperation == ToolOperation.ShapeTransform) || (this.mouseAreaControl.CurrentOperation == ToolOperation.Custom11) || ((Control.ModifierKeys & Keys.Control) == Keys.Control)) || ((Control.ModifierKeys & Keys.Alt) == Keys.Alt))
                        || (this.mouseAreaControl.CurrentOperation == ToolOperation.Custom12) || (this.mouseAreaControl.CurrentOperation == ToolOperation.Custom13) || (this.mouseAreaControl.CurrentOperation == ToolOperation.Custom14) || (this.mouseAreaControl.CurrentOperation == ToolOperation.Custom15))
                    {
                        int num1 = this.currentGraph.PointsInfo.IndexOf(this.currentInfo);
                        if (!this.currentInfo.FirstControl.IsEmpty)
                        {
                            GraphicsPath path3 = new GraphicsPath();
                            path3.AddRectangle(new RectangleF(this.currentInfo.FirstControl.X - 3f, this.currentInfo.FirstControl.Y - 2f, 4f, 4f));
                            path3.Transform(this.revertMatrix);
                            if (path3.IsVisible(tf2) || path3.IsOutlineVisible(tf2, pen1))
                            {
                                this.moveinfo = this.currentInfo.PreInfo;
                                this.movePoint = this.currentInfo.FirstControl;
                                this.CurrentOperate = BezierOperate.MoveControl;
                                return;
                            }
                        }
                        GraphicsPath path4 = new GraphicsPath();
                        GraphicsPath path5 = new GraphicsPath();
                        path4.AddRectangle(new RectangleF(this.currentInfo.SecondControl.X - 2f, this.currentInfo.SecondControl.Y - 2f, 4f, 4f));
                        path5.AddRectangle(new RectangleF(this.currentInfo.NextControl.X - 2f, this.currentInfo.NextControl.Y - 2f, 4f, 4f));
                        path4.Transform(this.revertMatrix);
                        path5.Transform(this.revertMatrix);
                        if ((!this.currentInfo.SecondControl.IsEmpty && (path4.IsVisible(tf2) || path4.IsOutlineVisible(tf2, pen1))) || (!this.currentInfo.NextControl.IsEmpty && (path5.IsVisible(tf2) || path5.IsOutlineVisible(tf2, pen1))))
                        {
                            this.moveinfo = this.currentInfo;
                            this.movePoint = (!this.currentInfo.SecondControl.IsEmpty && (path4.IsVisible(tf2) || path4.IsOutlineVisible(tf2, pen1))) ? this.currentInfo.SecondControl : this.currentInfo.NextControl;
                            this.CurrentOperate = BezierOperate.MoveControl;
                            return;
                        }
                        if (this.currentInfo.NextInfo != null)
                        {
                            path4.Reset();
                            path4.AddRectangle(new RectangleF(this.currentInfo.NextInfo.SecondControl.X - 2f, this.currentInfo.NextInfo.SecondControl.Y - 2f, 4f, 4f));
                            path4.Transform(this.revertMatrix);
                            if (!this.currentInfo.NextInfo.SecondControl.IsEmpty && (path4.IsVisible(tf2) || path4.IsOutlineVisible(tf2, pen1)))
                            {
                                this.moveinfo = this.currentInfo.NextInfo;
                                this.movePoint = this.currentInfo.NextInfo.SecondControl;
                                this.CurrentOperate = BezierOperate.MoveControl;
                                return;
                            }
                        }
                    }
                    if (((Control.ModifierKeys & Keys.Alt) == Keys.Alt) || (this.mouseAreaControl.CurrentOperation == ToolOperation.ConvertAnchor))
                    {
                        this.CurrentOperate = BezierOperate.ConvertAnchor;
                    }
                    else
                    {
                        if (((Control.ModifierKeys & Keys.Control) == Keys.Control) || (this.mouseAreaControl.CurrentOperation == ToolOperation.ShapeTransform) || (this.mouseAreaControl.CurrentOperation == ToolOperation.Custom11)
                            || (this.mouseAreaControl.CurrentOperation == ToolOperation.Custom12) || (this.mouseAreaControl.CurrentOperation == ToolOperation.Custom13) || (this.mouseAreaControl.CurrentOperation == ToolOperation.Custom14) || (this.mouseAreaControl.CurrentOperation == ToolOperation.Custom15))
                        {
                            this.CurrentOperate = BezierOperate.MoveAnchor;
                            return;
                        }
                        this.CurrentOperate = BezierOperate.Draw;
                    }
                    return;
                }
                if (e.Button == MouseButtons.Left)
                {
                    this.mouseAreaControl.Cursor = SpecialCursors.DragCursor;
                    SizeF ef2 = this.mouseAreaControl.PicturePanel.GridSize;
                    PointF tf3 = this.mouseAreaControl.PicturePanel.PointToView(new PointF((float) e.X, (float) e.Y));
                    float single1 = ef2.Height;
                    float single2 = ef2.Width;
                    if (this.mouseAreaControl.PicturePanel.SnapToGrid)
                    {
                        int num2 = (int) ((tf3.X + (single2 / 2f)) / single2);
                        int num3 = (int) ((tf3.Y + (single1 / 2f)) / single1);
                        tf3 = new PointF((float) ((int) (num2 * single2)), (float) ((int) (num3 * single1)));
                    }
                    tf3 = this.mouseAreaControl.PicturePanel.PointToSystem(tf3);
                    tf3 = this.PointToView(tf3);
                    Matrix matrix1 = new Matrix();
                    matrix1.Translate(tf3.X - this.startPoint.X, tf3.Y - this.startPoint.Y);
                    this.win32.hdc = this.win32.W32GetDC(this.mouseAreaControl.Handle);
                    this.win32.W32SetROP2(6);
                    this.win32.W32PolyDraw(this.reversePath);
                    this.reversePath.Reset();
                    switch (this.currentOperate)
                    {
                        case BezierOperate.Draw:
                        {
                            PointF tf4 = this.PointToView(new PointF((float) e.X, (float) e.Y));
                            PointF tf5 = new PointF((2f * this.startPoint.X) - tf4.X, (2f * this.startPoint.Y) - tf4.Y);
                            if (this.currentInfo != null)
                            {
                                this.reversePath.AddBezier(this.currentInfo.MiddlePoint, this.currentinfo.NextControl, tf5, this.startPoint);
                                this.reversePath.Transform(this.revertMatrix);
                            }
                            PointF[] tfArray10 = new PointF[3] { this.startPoint, tf4, tf5 } ;
                            PointF[] tfArray1 = tfArray10;
                            this.revertMatrix.TransformPoints(tfArray1);
                            RectangleF[] efArray1 = new RectangleF[3] { new RectangleF(tfArray1[1].X - 2f, tfArray1[1].Y - 2f, 4f, 4f), new RectangleF(tfArray1[2].X - 2f, tfArray1[2].Y - 2f, 4f, 4f), new RectangleF(tfArray1[0].X - 2f, tfArray1[0].Y - 2f, 4f, 4f) } ;
                            this.reversePath.AddRectangles(efArray1);
                            this.reversePath.AddLine(tfArray1[1], tfArray1[2]);
                            this.win32.W32PolyDraw(this.reversePath);
                            this.win32.ReleaseDC();
                            return;
                        }
                        case BezierOperate.AddAnchor:
                        case BezierOperate.DelAnchor:
                        case BezierOperate.ChangeAnchor:
                        case BezierOperate.CloseFigure:
                        {
                            return;
                        }
                        case BezierOperate.MoveAnchor:
                        {
                            PointInfoCollection.PointInfoEnumerator enumerator2 = this.activePoints.GetEnumerator();
                            while (enumerator2.MoveNext())
                            {
                                PointInfo info2 = enumerator2.Current;
                                PointInfo info3 = info2.PreInfo;
                                PointInfo info4 = info2.NextInfo;
                                PointF tf6 = info2.MiddlePoint;
                                PointF tf7 = info2.NextControl;
                                tf7 = tf7.IsEmpty ? info2.MiddlePoint : tf7;
                                PointF[] tfArray11 = new PointF[3] { (info2.SecondControl.IsEmpty && (info3 != null)) ? info3.MiddlePoint : info2.SecondControl, info2.MiddlePoint, tf7 } ;
                                PointF[] tfArray2 = tfArray11;
                                matrix1.TransformPoints(tfArray2);
                                this.reversePath.StartFigure();
                                if (info3 != null)
                                {
                                    PointF tf8 = info3.MiddlePoint;
                                    PointF tf9 = info2.FirstControl;
                                    if ((info2.IsStart && info3.IsEnd) && ((info3.MiddlePoint == info2.MiddlePoint) && (info3.PreInfo != null)))
                                    {
                                        tf8 = info3.PreInfo.MiddlePoint;
                                        tf9 = info3.FirstControl;
                                    }
                                    tf9 = tf9.IsEmpty ? tf8 : tf9;
                                    if (this.activePoints.Contains(info3))
                                    {
                                        PointF[] tfArray12 = new PointF[2] { tf8, tf9 } ;
                                        PointF[] tfArray3 = tfArray12;
                                        matrix1.TransformPoints(tfArray3);
                                        tf8 = tfArray3[0];
                                        tf9 = tfArray3[1];
                                    }
                                    if (tf8 != tfArray2[1])
                                    {
                                        if (info3.FirstControl.IsEmpty && info2.FirstControl.IsEmpty)
                                        {
                                            this.reversePath.AddLine(tf8, tfArray2[1]);
                                        }
                                        else
                                        {
                                            this.reversePath.AddBezier(tf8, tf9, tfArray2[0], tfArray2[1]);
                                        }
                                    }
                                }
                                this.reversePath.StartFigure();
                                if ((info4 != null) && !this.activePoints.Contains(info4))
                                {
                                    PointF tf10 = info4.SecondControl;
                                    tf10 = tf10.IsEmpty ? info4.MiddlePoint : tf10;
                                    if (info2.FirstControl.IsEmpty && info4.FirstControl.IsEmpty)
                                    {
                                        this.reversePath.AddLine(tfArray2[2], info4.MiddlePoint);
                                    }
                                    else
                                    {
                                        this.reversePath.AddBezier(tfArray2[1], tfArray2[2], tf10, info4.MiddlePoint);
                                    }
                                }
                            }
                            this.reversePath.Transform(this.revertMatrix);
                            if (this.currentInfo != null)
                            {
                                if (this.activePoints.Count == 1)
                                {
                                    PointF[] tfArray13 = new PointF[3] { this.currentInfo.SecondControl, this.currentInfo.MiddlePoint, this.currentInfo.NextControl } ;
                                    PointF[] tfArray4 = tfArray13;
                                    matrix1.TransformPoints(tfArray4);
                                    this.revertMatrix.TransformPoints(tfArray4);
                                    RectangleF[] efArray2 = new RectangleF[1] { new RectangleF(tfArray4[1].X - 2f, tfArray4[1].Y - 2f, 4f, 4f) } ;
                                    this.reversePath.AddRectangles(efArray2);
                                    if (!this.currentInfo.SecondControl.IsEmpty)
                                    {
                                        this.reversePath.AddRectangle(new RectangleF(tfArray4[0].X - 2f, tfArray4[0].Y - 2f, 4f, 4f));
                                        this.reversePath.AddLine(tfArray4[0], tfArray4[1]);
                                    }
                                    if (!this.currentInfo.NextControl.IsEmpty)
                                    {
                                        this.reversePath.AddRectangle(new RectangleF(tfArray4[2].X - 2f, tfArray4[2].Y - 2f, 4f, 4f));
                                        this.reversePath.AddLine(tfArray4[1], tfArray4[2]);
                                    }
                                }
                            }
                            else
                            {
                                int num4 = (int) Math.Min(this.startPoint.X, tf3.X);
                                int num5 = (int) Math.Min(this.startPoint.Y, tf3.Y);
                                int num6 = (int) Math.Max(this.startPoint.X, tf3.X);
                                int num7 = (int) Math.Max(this.startPoint.Y, tf3.Y);
                                this.reversePath.AddRectangle(new RectangleF((float) num4, (float) num5, (float) (num6 - num4), (float) (num7 - num5)));
                                this.reversePath.Transform(this.revertMatrix);
                            }
                            this.win32.W32PolyDraw(this.reversePath);
                            this.win32.ReleaseDC();
                            return;
                        }
                        case BezierOperate.ConvertAnchor:
                        {
                            if (this.currentInfo != null)
                            {
                                PointF[] tfArray18 = new PointF[2] { tf3, this.currentInfo.MiddlePoint } ;
                                PointF[] tfArray6 = tfArray18;
                                this.revertMatrix.TransformPoints(tfArray6);
                                PointF tf13 = tfArray6[0];
                                PointF tf14 = tfArray6[1];
                                if (this.currentInfo.NextInfo != null)
                                {
                                    this.reversePath.AddBezier(this.currentInfo.MiddlePoint, tf3, this.currentInfo.NextInfo.SecondControl.IsEmpty ? this.currentInfo.NextInfo.MiddlePoint : this.currentInfo.NextInfo.SecondControl, this.currentInfo.NextInfo.MiddlePoint);
                                }
                                if (this.currentInfo.PreInfo != null)
                                {
                                    this.reversePath.StartFigure();
                                    tf3 = new PointF((2f * this.currentInfo.MiddlePoint.X) - tf3.X, (2f * this.currentInfo.MiddlePoint.Y) - tf3.Y);
                                    PointInfo info5 = this.currentinfo.PreInfo;
                                    PointInfo info6 = this.currentinfo;
                                    if ((this.currentinfo.IsStart && info5.IsEnd) && (info5.MiddlePoint == this.currentinfo.MiddlePoint))
                                    {
                                        info6 = info5;
                                        info5 = info5.PreInfo;
                                    }
                                    if (info5 != null)
                                    {
                                        PointF tf15 = info6.FirstControl.IsEmpty ? info5.MiddlePoint : info6.FirstControl;
                                        this.reversePath.AddBezier(info5.MiddlePoint, tf15, tf3, info6.MiddlePoint);
                                    }
                                }
                                this.reversePath.Transform(this.revertMatrix);
                                this.reversePath.StartFigure();
                                RectangleF[] efArray5 = new RectangleF[1] { new RectangleF(tf14.X - 2f, tf14.Y - 2f, 4f, 4f) } ;
                                this.reversePath.AddRectangles(efArray5);
                                if (((Math.Abs((float) (tf13.X - tf3.X)) >= 1f) || (Math.Abs((float) (tf13.Y - tf3.Y)) >= 1f)) && (this.currentInfo.NextInfo != null))
                                {
                                    PointF tf16 = new PointF((2f * tf14.X) - tf13.X, (2f * tf14.Y) - tf13.Y);
                                    RectangleF[] efArray6 = new RectangleF[2] { new RectangleF(tf13.X - 2f, tf13.Y - 2f, 4f, 4f), new RectangleF(tf16.X - 2f, tf16.Y - 2f, 4f, 4f) } ;
                                    this.reversePath.AddRectangles(efArray6);
                                    this.reversePath.AddLine(tf16, tf14);
                                }
                                this.reversePath.AddLine(tf14, tf13);
                            }
                            this.win32.W32PolyDraw(this.reversePath);
                            this.win32.ReleaseDC();
                            return;
                        }
                        case BezierOperate.ChangeEndAnchor:
                        {
                            if (this.preInfo == null)
                            {
                                return;
                            }
                            PointF tf17 = new PointF((2f * this.preInfo.MiddlePoint.X) - tf3.X, (2f * this.preInfo.MiddlePoint.Y) - tf3.Y);
                            if ((((Control.ModifierKeys & Keys.Alt) != Keys.Alt) && !this.preInfo.FirstControl.IsEmpty) && (this.preInfo.MiddlePoint != this.preInfo.SecondControl))
                            {
                                this.reversePath.AddBezier(this.preInfo.PreInfo.MiddlePoint, this.preInfo.FirstControl, tf3, this.preInfo.MiddlePoint);
                                this.reversePath.Transform(this.revertMatrix);
                                PointF[] tfArray21 = new PointF[3] { tf3, this.preInfo.MiddlePoint, tf17 } ;
                                PointF[] tfArray9 = tfArray21;
                                this.revertMatrix.TransformPoints(tfArray9);
                                RectangleF[] efArray7 = new RectangleF[3] { new RectangleF(tfArray9[0].X - 2f, tfArray9[0].Y - 2f, 4f, 4f), new RectangleF(tfArray9[1].X - 2f, tfArray9[1].Y - 2f, 4f, 4f), new RectangleF(tfArray9[2].X - 2f, tfArray9[2].Y - 2f, 4f, 4f) } ;
                                this.reversePath.AddRectangles(efArray7);
                                this.reversePath.AddLine(tfArray9[0], tfArray9[2]);
                                goto Label_2164;
                            }
                            PointF[] tfArray20 = new PointF[2] { this.preInfo.MiddlePoint, tf3 } ;
                            PointF[] tfArray8 = tfArray20;
                            this.revertMatrix.TransformPoints(tfArray8);
                            this.reversePath.AddLine(tfArray8[0], tfArray8[1]);
                            goto Label_2164;
                        }
                        case BezierOperate.MoveControl:
                        {
                            if (this.moveinfo != null)
                            {
                                PointF[] tfArray14 = new PointF[2] { this.moveinfo.MiddlePoint, tf3 } ;
                                PointF[] tfArray5 = tfArray14;
                                this.revertMatrix.TransformPoints(tfArray5);
                                PointF tf11 = tfArray5[0];
                                PointF tf12 = tfArray5[1];
                                if (this.movePoint == this.moveinfo.SecondControl)
                                {
                                    if (this.moveinfo.PreInfo != null)
                                    {
                                        if (this.moveinfo.IsStart && this.moveinfo.PreInfo.IsEnd)
                                        {
                                            if (this.moveinfo.PreInfo.PreInfo != null)
                                            {
                                                this.reversePath.AddBezier(this.moveinfo.PreInfo.PreInfo.MiddlePoint, this.moveinfo.PreInfo.FirstControl, tf3, this.moveinfo.PreInfo.MiddlePoint);

                                            }
                                        }
                                        else
                                        {
                                            if (this.moveinfo.Command=="A")
                                            {
                                                float ry=matrix1.OffsetY+this.moveinfo.Ry;
                                                ry=ry>5?ry:this.moveinfo.Ry;

                                                ExtendedGraphicsPath expath1 = new ExtendedGraphicsPath(this.reversePath);

                                                expath1.AddArc(this.moveinfo.PreInfo.MiddlePoint,this.moveinfo.MiddlePoint,this.moveinfo.Rx,ry,this.moveinfo.LargeArcFlage==1,this.moveinfo.SweepFlage==1,this.moveinfo.Angle);
                                            }
                                            else
                                            {
                                                this.reversePath.AddBezier(this.moveinfo.PreInfo.MiddlePoint, this.moveinfo.FirstControl, tf3, this.moveinfo.MiddlePoint);
                                            }
                                        }
                                    }
                                    float single3 = tf12.X;
                                    float single4 = tf12.Y;
                                    bool flag1 = false;
                                    if (((this.moveinfo.NextInfo != null) && ((Control.ModifierKeys & Keys.Alt) != Keys.Alt)) && !this.moveinfo.Steep)
                                    {
                                        if (!this.moveinfo.NextInfo.FirstControl.IsEmpty)
                                        {
                                            float single5 = (float) Math.Sqrt(Math.Pow((double) (this.moveinfo.SecondControl.X - this.moveinfo.MiddlePoint.X), 2) + Math.Pow((double) (this.moveinfo.SecondControl.Y - this.moveinfo.MiddlePoint.Y), 2));
                                            float single6 = (float) Math.Sqrt(Math.Pow((double) (tf3.X - this.moveinfo.MiddlePoint.X), 2) + Math.Pow((double) (tf3.Y - this.moveinfo.MiddlePoint.Y), 2));
                                            if (single5 == 0f)
                                            {
                                                single5 += 0.0001f;
                                            }
                                            float single7 = single6 / single5;
                                            single3 = this.moveinfo.MiddlePoint.X + (single7 * (this.moveinfo.MiddlePoint.X - tf3.X));
                                            single4 = this.moveinfo.MiddlePoint.Y + (single7 * (this.moveinfo.MiddlePoint.Y - tf3.Y));
                                            this.reversePath.AddBezier(this.moveinfo.MiddlePoint, new PointF(single3, single4), this.moveinfo.NextInfo.SecondControl, this.moveinfo.NextInfo.MiddlePoint);
                                            PointF[] tfArray15 = new PointF[1] { new PointF(single3, single4) } ;
                                            tfArray5 = tfArray15;
                                            this.revertMatrix.TransformPoints(tfArray5);
                                            single3 = tfArray5[0].X;
                                            single4 = tfArray5[0].Y;
                                        }
                                        flag1 = this.activePoints.Contains(this.moveinfo.NextInfo);
                                    }
                                    this.reversePath.Transform(this.revertMatrix);
                                    this.reversePath.StartFigure();
                                    RectangleF[] efArray3 = new RectangleF[2] { new RectangleF(tf11.X - 2f, tf11.Y - 2f, 4f, 4f), new RectangleF(tf12.X - 2f, tf12.Y - 2f, 4f, 4f) } ;
                                    this.reversePath.AddRectangles(efArray3);
                                    if ((Math.Abs((float) (single3 - tf12.X)) >= 1f) || (Math.Abs((float) (single4 - tf12.Y)) >= 1f))
                                    {
                                        this.reversePath.AddRectangle(new RectangleF(single3 - 2f, single4 - 2f, 4f, 4f));
                                        this.reversePath.AddLine(new PointF(single3, single4), tf11);
                                    }
                                    this.reversePath.AddLine(tf11, tf12);
                                }
                                else if (this.movePoint == this.moveinfo.NextControl)
                                {
                                    if (this.moveinfo.Command=="A")
                                    {
                                        float rx=matrix1.OffsetX+this.moveinfo.Rx;
                                        rx=rx>5?rx:this.moveinfo.Rx;

                                        ExtendedGraphicsPath expath1 = new ExtendedGraphicsPath(this.reversePath);

                                        expath1.AddArc(this.moveinfo.PreInfo.MiddlePoint,this.moveinfo.MiddlePoint,rx,this.moveinfo.Ry,this.moveinfo.LargeArcFlage==1,this.moveinfo.SweepFlage==1,this.moveinfo.Angle);
                                    }
                                    else
                                    {
                                        if (this.moveinfo.NextInfo != null)
                                        {
                                            this.reversePath.AddBezier(this.moveinfo.MiddlePoint, tf3, this.moveinfo.NextInfo.SecondControl, this.moveinfo.NextInfo.MiddlePoint);
                                        }
                                    }
                                    float single8 = tf12.X;
                                    float single9 = tf12.Y;
                                    bool flag2 = true;
                                    if (((this.moveinfo.PreInfo != null) && ((Control.ModifierKeys & Keys.Alt) != Keys.Alt)) && !this.moveinfo.Steep)
                                    {
                                        if ((this.moveinfo.IsStart && this.moveinfo.PreInfo.IsEnd) && (this.moveinfo.PreInfo.PreInfo != null))
                                        {
                                            float single10 = (float) Math.Sqrt(Math.Pow((double) (this.moveinfo.NextControl.X - this.moveinfo.MiddlePoint.X), 2) + Math.Pow((double) (this.moveinfo.NextControl.Y - this.moveinfo.MiddlePoint.Y), 2));
                                            float single11 = (float) Math.Sqrt(Math.Pow((double) (tf3.X - this.moveinfo.MiddlePoint.X), 2) + Math.Pow((double) (tf3.Y - this.moveinfo.MiddlePoint.Y), 2));
                                            if (single10 == 0f)
                                            {
                                                single10 += 0.0001f;
                                            }
                                            float single12 = single11 / single10;
                                            single8 = this.moveinfo.MiddlePoint.X + (single12 * (this.moveinfo.MiddlePoint.X - tf3.X));
                                            single9 = this.moveinfo.MiddlePoint.Y + (single12 * (this.moveinfo.MiddlePoint.Y - tf3.Y));
                                            this.reversePath.StartFigure();
                                            this.reversePath.AddBezier(this.moveinfo.PreInfo.PreInfo.MiddlePoint, this.moveinfo.PreInfo.FirstControl, new PointF(single8, single9), this.moveinfo.MiddlePoint);
                                            PointF[] tfArray16 = new PointF[1] { new PointF(single8, single9) } ;
                                            tfArray5 = tfArray16;
                                            this.revertMatrix.TransformPoints(tfArray5);
                                            single8 = tfArray5[0].X;
                                            single9 = tfArray5[0].Y;
                                        }
                                        else if (!this.moveinfo.SecondControl.IsEmpty)
                                        {
                                            float single13 = (float) Math.Sqrt(Math.Pow((double) (this.moveinfo.NextControl.X - this.moveinfo.MiddlePoint.X), 2) + Math.Pow((double) (this.moveinfo.NextControl.Y - this.moveinfo.MiddlePoint.Y), 2));
                                            float single14 = (float) Math.Sqrt(Math.Pow((double) (tf3.X - this.moveinfo.MiddlePoint.X), 2) + Math.Pow((double) (tf3.Y - this.moveinfo.MiddlePoint.Y), 2));
                                            if (single13 == 0f)
                                            {
                                                single13 += 0.0001f;
                                            }
                                            float single15 = single14 / single13;
                                            single8 = this.moveinfo.MiddlePoint.X + (single15 * (this.moveinfo.MiddlePoint.X - tf3.X));
                                            single9 = this.moveinfo.MiddlePoint.Y + (single15 * (this.moveinfo.MiddlePoint.Y - tf3.Y));
                                            this.reversePath.StartFigure();
                                            this.reversePath.AddBezier(this.moveinfo.PreInfo.MiddlePoint, this.moveinfo.FirstControl, new PointF(single8, single9), this.moveinfo.MiddlePoint);
                                            PointF[] tfArray17 = new PointF[1] { new PointF(single8, single9) } ;
                                            tfArray5 = tfArray17;
                                            this.revertMatrix.TransformPoints(tfArray5);
                                            single8 = tfArray5[0].X;
                                            single9 = tfArray5[0].Y;
                                        }
                                        flag2 = this.activePoints.Contains(this.moveinfo.PreInfo);
                                    }
                                    this.reversePath.Transform(this.revertMatrix);
                                    this.reversePath.StartFigure();
                                    RectangleF[] efArray4 = new RectangleF[2] { new RectangleF(tf11.X - 2f, tf11.Y - 2f, 4f, 4f), new RectangleF(tf12.X - 2f, tf12.Y - 2f, 4f, 4f) } ;
                                    this.reversePath.AddRectangles(efArray4);
                                    if ((Math.Abs((float) (single8 - tf12.X)) >= 1f) || (Math.Abs((float) (single9 - tf12.Y)) >= 1f))
                                    {
                                        this.reversePath.AddRectangle(new RectangleF(single8 - 2f, single9 - 2f, 4f, 4f));
                                        this.reversePath.AddLine(new PointF(single8, single9), tf11);
                                    }
                                    this.reversePath.AddLine(tf11, tf12);
                                }
                                this.win32.W32PolyDraw(this.reversePath);
                                this.win32.ReleaseDC();
                            }
                            return;
                        }
                        case BezierOperate.MovePath:
                        {
                            this.reversePath = (GraphicsPath) this.currentGraph.GPath.Clone();
                            this.reversePath.Transform(matrix1);
                            this.reversePath.Transform(this.revertMatrix);
                            this.win32.W32PolyDraw(this.reversePath);
                            this.win32.ReleaseDC();
                            return;
                        }
                        case BezierOperate.CenterPoint:
                        {
                            PointF[] tfArray19 = new PointF[1] { tf3 } ;
                            PointF[] tfArray7 = tfArray19;
                            this.revertMatrix.TransformPoints(tfArray7);
                            this.reversePath.AddEllipse((float) (tfArray7[0].X - 4f), (float) (tfArray7[0].Y - 4f), (float) 8f, (float) 8f);
                            this.win32.W32PolyDraw(this.reversePath);
                            this.win32.ReleaseDC();
                            return;
                        }
                    }
                }
            }
            return;
            Label_2164:
            this.win32.W32PolyDraw(this.reversePath);
            this.win32.ReleaseDC();
        }
Ejemplo n.º 6
0
 public BezierOperation(MouseArea mc, IPath path)
 {
     this.mouseAreaControl = null;
     this.currentGraph = null;
     this.revertMatrix = new Matrix();
     this.startPoint = PointF.Empty;
     this.currentOperate = BezierOperate.Draw;
     this.activePoints = new PointInfoCollection();
     this.editPath = new GraphicsPath();
     this.preInfo = null;
     this.reversePath = new GraphicsPath();
     this.editpath = new GraphicsPath();
     this.preDrawInfo = null;
     this.starttrend = PointF.Empty;
     this.endtrend = PointF.Empty;
     this.addInfo = null;
     this.moveinfo = null;
     this.movePoint = PointF.Empty;
     this.currentinfo = null;
     this.SubpathList = new Hashtable(0x10);
     this.oldstr = string.Empty;
     this.attributename = string.Empty;
     this.showcontrol = true;
     this.activeindex = new int[0];
     this.oldindex = -1;
     this.centerPoint = PointF.Empty;
     this.incenter = false;
     this.tooltips = new Hashtable(0x10);
     this.centerPoint = PointF.Empty;
     this.mouseAreaControl = mc;
     this.win32 = mc.win32;
     this.currentGraph = path;
     this.mouseAreaControl.Invalidate();
     if (path is IGraph)
     {
         this.revertMatrix = ((IGraph) path).GraphTransform.Matrix.Clone();
     }
     else if (path is MotionAnimate)
     {
         SvgElement element1 = ((MotionAnimate) path).RefElement;
         if (element1 is IGraph)
         {
             Matrix matrix1 = ((IGraph) element1).Transform.Matrix.Clone();
             this.revertMatrix = ((IGraph) element1).GraphTransform.Matrix.Clone();
             matrix1.Invert();
             this.revertMatrix.Multiply(matrix1);
             Matrix matrix2 = new Matrix();
             matrix2 = AnimFunc.GetMatrixForTime((IGraph) element1, this.mouseAreaControl.SVGDocument.ControlTime, ((MotionAnimate) this.currentGraph).Begin);
             this.revertMatrix.Multiply(matrix2);
             this.centerPoint = this.PointToView(this.mouseAreaControl.CenterPoint);
             object obj1 = ((MotionAnimate) path).GetAnimateResult((float) this.mouseAreaControl.SVGDocument.ControlTime, DomType.SvgMatrix);
             if (obj1 is Matrix)
             {
                 Matrix matrix3 = (Matrix) obj1;
                 this.centerPoint.X -= matrix3.OffsetX;
                 this.centerPoint.Y -= matrix3.OffsetY;
             }
             this.revertMatrix.Translate(this.centerPoint.X, this.centerPoint.Y);
         }
     }
     if (path is GraphPath)
     {
         this.attributename = "d";
     }
     else if (path is MotionAnimate)
     {
         this.attributename = "path";
     }
     this.mouseAreaControl.DefaultCursor = SpecialCursors.bezierCursor;
 }
Ejemplo n.º 7
0
 public void OnMouseDown(MouseEventArgs e)
 {
     bool flag1;
     string text2;
     PointInfo info6;
     bool flag2;
     string text3;
     int num10;
     if (this.currentGraph != null)
     {
         if (!this.currentGraph.PointsInfo.Contains(this.currentInfo))
         {
             this.currentInfo = null;
         }
         for (int num1 = 0; num1 < this.activePoints.Count; num1++)
         {
             PointInfo info1 = this.activePoints[num1];
             if (!this.currentGraph.PointsInfo.Contains(info1))
             {
                 this.activePoints.Remove(info1);
                 num1--;
             }
         }
         if (this.currentGraph == null)
         {
             return;
         }
         if (e.Button != MouseButtons.Left)
         {
             return;
         }
         SizeF ef1 = this.mouseAreaControl.PicturePanel.GridSize;
         this.startPoint = this.mouseAreaControl.PicturePanel.PointToView(new PointF((float) e.X, (float) e.Y));
         float single1 = ef1.Height;
         float single2 = ef1.Width;
         this.startPoint = this.PointToView(new PointF((float) e.X, (float) e.Y));
         PointInfoCollection.PointInfoEnumerator enumerator1 = this.currentGraph.PointsInfo.GetEnumerator();
         while (enumerator1.MoveNext())
         {
             PointInfo info2 = enumerator1.Current;
             RectangleF ef2 = new RectangleF(info2.MiddlePoint.X - 3f, info2.MiddlePoint.Y - 3f, 6f, 6f);
             if (ef2.Contains(this.startPoint))
             {
                 this.preInfo = info2;
                 break;
             }
         }
         switch (this.currentOperate)
         {
             case BezierOperate.Draw:
             {
                 flag1 = false;
                 if (this.currentGraph != null)
                 {
                     string text1 = ((SvgElement) this.currentGraph).Name;
                     if ((text1 != "path") && (text1 != "animateMotion"))
                     {
                         flag1 = true;
                     }
                     goto Label_01E2;
                 }
                 flag1 = true;
                 goto Label_01E2;
             }
             case BezierOperate.AddAnchor:
             {
                 if (this.addInfo == null)
                 {
                     return;
                 }
                 if (this.addInfo.NextInfo == null)
                 {
                     goto Label_100E;
                 }
                 PointInfo info8 = this.addInfo.NextInfo;
                 text3 = string.Empty;
                 num10 = this.currentGraph.PointsInfo.IndexOf(this.addInfo);
                 if (!info8.FirstControl.IsEmpty)
                 {
                     float single3 = 0f;
                     PointF[] tfArray1 = BezierOperation.SplitBezierAtPoint(this.addInfo.MiddlePoint, info8.FirstControl, info8.SecondControl, info8.MiddlePoint, this.startPoint, out single3);
                     if (tfArray1 == null)
                     {
                         return;
                     }
                     if ((tfArray1.Length == 5) && (single3 >= 0f))
                     {
                         text3 = this.addInfo.PreString + this.addInfo.PointString;
                         string text9 = text3;
                         string[] textArray5 = new string[13] { text9, "C ", tfArray1[0].X.ToString(), " ", tfArray1[0].Y.ToString(), " ", tfArray1[1].X.ToString(), " ", tfArray1[1].Y.ToString(), " ", tfArray1[2].X.ToString(), " ", tfArray1[2].Y.ToString() } ;
                         text3 = string.Concat(textArray5);
                         string text10 = text3;
                         string[] textArray6 = new string[13] { text10, "C ", tfArray1[3].X.ToString(), " ", tfArray1[3].Y.ToString(), " ", tfArray1[4].X.ToString(), " ", tfArray1[4].Y.ToString(), " ", info8.MiddlePoint.X.ToString(), " ", info8.MiddlePoint.Y.ToString() } ;
                         text3 = string.Concat(textArray6);
                         text3 = text3 + info8.NextString;
                     }
                     goto Label_0F3A;
                 }
                 text3 = this.addInfo.PreString + this.addInfo.PointString;
                 string text8 = text3;
                 string[] textArray4 = new string[5] { text8, "L ", this.startPoint.X.ToString(), " ", this.startPoint.Y.ToString() } ;
                 text3 = string.Concat(textArray4);
                 text3 = text3 + this.addInfo.NextString;
                 goto Label_0F3A;
             }
             case BezierOperate.DelAnchor:
             {
                 if (this.preInfo == null)
                 {
                     return;
                 }
                 text2 = this.preInfo.PreString;
                 int num6 = this.currentGraph.PointsInfo.IndexOf(this.preInfo);
                 if (((num6 + 1) < 0) || ((num6 + 1) >= this.currentGraph.PointsInfo.Count))
                 {
                     goto Label_0A75;
                 }
                 info6 = this.currentGraph.PointsInfo[num6 + 1];
                 flag2 = false;
                 if (info6.FirstControl.IsEmpty || this.preInfo.FirstControl.IsEmpty)
                 {
                     if (this.preInfo.IsStart && (this.preInfo.PreInfo != null))
                     {
                         string text6 = text2;
                         string[] textArray2 = new string[5] { text6, "M ", info6.MiddlePoint.X.ToString(), " ", info6.MiddlePoint.Y.ToString() } ;
                         text2 = string.Concat(textArray2);
                         int num7 = this.currentGraph.PointsInfo.IndexOf(this.preInfo.PreInfo);
                         PointInfo info7 = null;
                         for (int num8 = num6 + 2; num8 < num7; num8++)
                         {
                             info7 = this.currentGraph.PointsInfo[num8];
                             text2 = text2 + this.currentGraph.PointsInfo[num8].PointString;
                         }
                         if (info7 != null)
                         {
                             PointF tf1 = PointF.Empty;
                             PointF tf2 = PointF.Empty;
                             if (!info7.FirstControl.IsEmpty)
                             {
                                 tf1 = new PointF((2f * info7.MiddlePoint.X) - info7.SecondControl.X, (2f * info7.MiddlePoint.Y) - info7.SecondControl.Y);
                             }
                             if (!info6.NextControl.IsEmpty)
                             {
                                 tf2 = new PointF((2f * info6.MiddlePoint.X) - info6.NextControl.X, (2f * info6.MiddlePoint.Y) - info6.NextControl.Y);
                             }
                             if (!tf1.IsEmpty || !tf2.IsEmpty)
                             {
                                 tf1 = tf1.IsEmpty ? info7.MiddlePoint : tf1;
                                 tf2 = tf2.IsEmpty ? info6.MiddlePoint : tf2;
                                 string text7 = text2;
                                 string[] textArray3 = new string[13] { text7, "C ", tf1.X.ToString(), " ", tf1.Y.ToString(), " ", tf2.X.ToString(), " ", tf2.Y.ToString(), " ", info6.MiddlePoint.X.ToString(), " ", info6.MiddlePoint.Y.ToString() } ;
                                 text2 = string.Concat(textArray3);
                             }
                         }
                         if (info7 != null)
                         {
                             text2 = text2 + "Z";
                         }
                         flag2 = true;
                         if (((num7 + 1) >= 0) && ((num7 + 1) < this.currentGraph.PointsInfo.Count))
                         {
                             info7 = this.currentGraph.PointsInfo[num7 + 1];
                             text2 = text2 + info7.PointString + info7.NextString;
                         }
                     }
                     else
                     {
                         text2 = text2 + info6.PointString;
                     }
                     goto Label_0A61;
                 }
                 string text5 = text2;
                 string[] textArray1 = new string[13] { text5, "C ", this.preInfo.FirstControl.X.ToString(), " ", this.preInfo.FirstControl.Y.ToString(), " ", info6.SecondControl.X.ToString(), " ", info6.SecondControl.Y.ToString(), " ", info6.MiddlePoint.X.ToString(), " ", info6.MiddlePoint.Y.ToString() } ;
                 text2 = string.Concat(textArray1);
                 goto Label_0A61;
             }
             case BezierOperate.ChangeAnchor:
             {
                 return;
             }
             case BezierOperate.MoveAnchor:
             {
                 if (!this.activePoints.Contains(this.preInfo))
                 {
                     this.activePoints.Clear();
                     this.activePoints.Add(this.preInfo);
                 }
                 this.currentInfo = this.preInfo;
                 this.oldindex = this.currentGraph.PointsInfo.IndexOf(this.currentInfo);
                 this.activeindex = new int[this.activePoints.Count];
                 int num5 = 0;
                 PointInfoCollection.PointInfoEnumerator enumerator3 = this.activePoints.GetEnumerator();
                 while (enumerator3.MoveNext())
                 {
                     PointInfo info5 = enumerator3.Current;
                     this.activeindex[num5] = this.currentGraph.PointsInfo.IndexOf(info5);
                     num5++;
                 }
                 this.mouseAreaControl.Invalidate();
                 return;
             }
             case BezierOperate.ConvertAnchor:
             {
                 this.currentInfo = this.preInfo;
                 this.oldindex = this.currentGraph.PointsInfo.IndexOf(this.currentinfo);
                 if (!this.activePoints.Contains(this.currentInfo))
                 {
                     int[] numArray1 = new int[1] { this.oldindex } ;
                     this.activeindex = numArray1;
                     this.activePoints.Clear();
                     this.activePoints.Add(this.currentinfo);
                 }
                 this.mouseAreaControl.Invalidate();
                 return;
             }
             case BezierOperate.ChangeEndAnchor:
             {
                 this.currentinfo = this.preInfo;
                 return;
             }
             case BezierOperate.CloseFigure:
             {
                 if (this.currentGraph.PointsInfo.Contains(this.preInfo))
                 {
                     PointInfo info10 = null;
                     if (this.SubpathList.ContainsKey(this.preInfo.SubPath))
                     {
                         PointInfoCollection collection1 = (PointInfoCollection) this.SubpathList[this.preInfo.SubPath];
                         info10 = collection1[collection1.Count - 1];
                     }
                     if (info10 == null)
                     {
                         return;
                     }
                     bool flag5 = this.mouseAreaControl.SVGDocument.AcceptChanges;
                     this.mouseAreaControl.SVGDocument.AcceptChanges = true;
                     this.mouseAreaControl.SVGDocument.NumberOfUndoOperations = 200;
                     string text4 = info10.PreString + info10.PointString;
                     PointF tf3 = info10.NextControl;
                     PointF tf4 = this.preInfo.SecondControl;
                     if (info10.NextControl.IsEmpty && !info10.SecondControl.IsEmpty)
                     {
                         tf3 = new PointF((2f * info10.MiddlePoint.X) - info10.SecondControl.X, (2f * info10.MiddlePoint.Y) - info10.SecondControl.Y);
                     }
                     if (!tf3.IsEmpty || !tf4.IsEmpty)
                     {
                         tf3 = tf3.IsEmpty ? info10.MiddlePoint : tf3;
                         tf4 = tf4.IsEmpty ? this.preInfo.MiddlePoint : tf4;
                         if ((Control.ModifierKeys & Keys.Alt) != Keys.Alt)
                         {
                             string text11 = text4;
                             string[] textArray7 = new string[13] { text11, "C ", tf3.X.ToString(), " ", tf3.Y.ToString(), " ", tf4.X.ToString(), " ", tf4.Y.ToString(), " ", this.preInfo.MiddlePoint.X.ToString(), " ", this.preInfo.MiddlePoint.Y.ToString() } ;
                             text4 = string.Concat(textArray7);
                         }
                         else
                         {
                             string text12 = text4;
                             string[] textArray8 = new string[13] { text12, "C ", tf3.X.ToString(), " ", tf3.Y.ToString(), " ", this.preInfo.MiddlePoint.X.ToString(), " ", this.preInfo.MiddlePoint.Y.ToString(), " ", this.preInfo.MiddlePoint.X.ToString(), " ", this.preInfo.MiddlePoint.Y.ToString() } ;
                             text4 = string.Concat(textArray8);
                         }
                     }
                     text4 = text4 + "Z";
                     if (text4.Length > 0)
                     {
                         this.Update(text4, this.oldstr);
                     }
                     this.mouseAreaControl.SVGDocument.NotifyUndo();
                     this.mouseAreaControl.SVGDocument.AcceptChanges = flag5;
                     this.activeindex = new int[0];
                     this.oldindex = -1;
                     this.activePoints.Clear();
                     this.currentInfo = null;
                 }
                 return;
             }
         }
     }
     return;
     Label_01E2:
     if (flag1)
     {
         IGraph graph1 = this.mouseAreaControl.PicturePanel.PreGraph;
         if (graph1 == null)
         {
             return;
         }
         this.currentGraph = (IGraph) ((SvgElement) graph1).Clone();
         this.mouseAreaControl.SVGDocument.AcceptChanges = false;
         if (this.currentGraph != null)
         {
             ((SvgElement) this.currentGraph).RemoveAttribute("d");
         }
         if (((SvgElement) this.currentGraph) is IGraphPath)
         {
             if ((((SvgElement) graph1).GetAttribute("style") != string.Empty) && (((SvgElement) graph1).GetAttribute("style") != null))
             {
                 this.mouseAreaControl.SVGDocument.AcceptChanges = false;
                 AttributeFunc.SetAttributeValue((SvgElement) this.currentGraph, "style", ((SvgElement) this.currentGraph).GetAttribute("style"));
             }
             ISvgBrush brush1 = ((IGraphPath) graph1).GraphBrush;
             if (brush1 is SvgElement)
             {
                 ISvgBrush brush2 = (ISvgBrush) ((SvgElement) brush1).Clone();
                 ((IGraphPath) this.currentGraph).GraphBrush = brush2;
                 ((SvgElement) brush2).pretime = -1;
             }
             else
             {
                 ((IGraphPath) this.currentGraph).GraphBrush = brush1;
             }
             brush1 = ((IGraphPath) graph1).GraphStroke.Brush;
             if (brush1 is SvgElement)
             {
                 ISvgBrush brush3 = (ISvgBrush) ((SvgElement) brush1).Clone();
                 ((IGraphPath) this.currentGraph).GraphStroke = new Stroke(brush3);
                 ((SvgElement) brush3).pretime = -1;
             }
             else
             {
                 ((IGraphPath) this.currentGraph).GraphStroke.Brush = brush1;
             }
         }
     }
     int num2 = 0;
     this.preDrawInfo = null;
     PointInfoCollection.PointInfoEnumerator enumerator2 = this.activePoints.GetEnumerator();
     while (enumerator2.MoveNext())
     {
         PointInfo info3 = enumerator2.Current;
         if (num2 == 0)
         {
             this.preDrawInfo = info3;
         }
         else if (this.preDrawInfo.SubPath != info3.SubPath)
         {
             this.preDrawInfo = null;
             break;
         }
         this.preDrawInfo = info3;
         num2++;
     }
     if (this.preDrawInfo != null)
     {
         int num3 = this.currentGraph.PointsInfo.IndexOf(this.preDrawInfo);
         if ((num3 >= 0) && (num3 < this.currentGraph.PointsInfo.Count))
         {
             for (int num4 = num3 + 1; num4 < this.currentGraph.PointsInfo.Count; num4++)
             {
                 PointInfo info4 = this.currentGraph.PointsInfo[num4];
                 if (info4.SubPath != this.preDrawInfo.SubPath)
                 {
                     break;
                 }
                 this.preDrawInfo = info4;
             }
         }
         else
         {
             this.preDrawInfo = null;
         }
     }
     this.currentInfo = this.preDrawInfo;
     if ((this.currentinfo != null) && this.currentinfo.IsEnd)
     {
         this.currentinfo = null;
     }
     this.preDrawInfo = this.currentinfo;
     this.oldindex = this.currentGraph.PointsInfo.IndexOf(this.currentinfo);
     return;
     Label_0A61:
     if (!flag2)
     {
         text2 = text2 + info6.NextString;
     }
     Label_0A75:
     if (((this.preInfo.PreInfo != null) && (this.preInfo.NextInfo != null)) && (this.preInfo.PreInfo.IsStart && this.preInfo.NextInfo.IsEnd))
     {
         text2 = this.preInfo.PreInfo.PreString + this.preInfo.PreInfo.PointString;
         int num9 = this.currentGraph.PointsInfo.IndexOf(this.preInfo.NextInfo);
         if ((num9 >= 0) && ((num9 + 1) < this.currentGraph.PointsInfo.Count))
         {
             text2 = text2 + this.currentGraph.PointsInfo[num9 + 1].PointString + this.currentGraph.PointsInfo[num9 + 1].NextString;
         }
     }
     bool flag3 = this.mouseAreaControl.SVGDocument.AcceptChanges;
     this.mouseAreaControl.SVGDocument.AcceptChanges = true;
     this.mouseAreaControl.SVGDocument.NumberOfUndoOperations = 200;
     this.Update(text2, this.oldstr);
     this.mouseAreaControl.SVGDocument.NotifyUndo();
     this.mouseAreaControl.SVGDocument.AcceptChanges = flag3;
     this.oldindex = -1;
     this.activeindex = new int[0];
     this.activePoints.Clear();
     this.currentInfo = null;
     return;
     Label_0F3A:
     if (text3.Length > 0)
     {
         bool flag4 = this.mouseAreaControl.SVGDocument.AcceptChanges;
         this.mouseAreaControl.SVGDocument.AcceptChanges = true;
         this.mouseAreaControl.SVGDocument.NumberOfUndoOperations = 200;
         this.Update(text3, this.oldstr);
         this.mouseAreaControl.SVGDocument.NotifyUndo();
         this.mouseAreaControl.SVGDocument.AcceptChanges = flag4;
     }
     if (((num10 + 1) >= 0) && ((num10 + 1) < this.currentGraph.PointsInfo.Count))
     {
         this.activePoints.Clear();
         this.activePoints.Add(this.currentGraph.PointsInfo[num10 + 1]);
         this.currentInfo = this.currentGraph.PointsInfo[num10 + 1];
     }
     Label_100E:
     this.activeindex = new int[this.activePoints.Count];
     int num11 = 0;
     PointInfoCollection.PointInfoEnumerator enumerator4 = this.activePoints.GetEnumerator();
     while (enumerator4.MoveNext())
     {
         PointInfo info9 = enumerator4.Current;
         this.activeindex[num11] = this.currentGraph.PointsInfo.IndexOf(info9);
         num11++;
     }
 }
Ejemplo n.º 8
0
 private PointInfo GetLastPointInfoForCurrentInfo(PointInfo info)
 {
     if (info == null)
     {
         return null;
     }
     PointInfoCollection collection1 = this.currentGraph.PointsInfo;
     int num1 = collection1.IndexOf(info);
     if (num1 < 0)
     {
         return null;
     }
     PointInfo info1 = info;
     for (int num2 = num1; num2 < collection1.Count; num2++)
     {
         PointInfo info2 = collection1[num2];
         if (info2.SubPath != info1.SubPath)
         {
             return info1;
         }
         info1 = info2;
     }
     return info;
 }
Ejemplo n.º 9
0
 public bool Undo()
 {
     PointF tf1;
     PointInfo info1;
     if (this.currentGraph != null)
     {
         bool flag1 = this.mouseAreaControl.SVGDocument.AcceptChanges;
         this.mouseAreaControl.SVGDocument.AcceptChanges = false;
         if (this.currentGraph is IGraph)
         {
             string text1 = ((SvgElement) this.currentGraph).GetAttribute("d").Trim();
             if (text1.Length > 0)
             {
                 AttributeFunc.SetAttributeValue((SvgElement) this.currentGraph, "d", text1);
             }
         }
         this.mouseAreaControl.SVGDocument.AcceptChanges = flag1;
         ((SvgElement) this.currentGraph).pretime = -1;
     }
     this.activePoints.Clear();
     this.currentInfo = null;
     this.endtrend = tf1 = PointF.Empty;
     this.starttrend = tf1;
     this.preInfo = (PointInfo) (info1 = null);
     this.preDrawInfo = info1;
     return false;
 }
Ejemplo n.º 10
0
        public static GraphicsPath PathDataParse(string text, PointInfoCollection pointsInfo)
        {
            PathFunc.startinfo = null;
            int num1 = -1;
            pointsInfo.Clear();
            GraphicsPath path1 = new GraphicsPath();
            GraphicsPathIterator iterator1 = new GraphicsPathIterator(path1);
            PointF tf1 = PointF.Empty;
            string text1 = "";
            int nLength=text.Length;
            Regex regex1 = new Regex("[A-DF-Za-df-z][^A-DF-Za-df-z]*");
            PointF tf2 = PointF.Empty;
            Match match1 = regex1.Match(text);
            int num2 = 0;
            //StringBuilder text2 = new StringBuilder();
            //string text3 = text;
            PointF tf3 = PointF.Empty;
            PointF tf4 = PointF.Empty;
            PointInfo info1 = null;
            StringBuilder text4=new StringBuilder(text);
            while (match1.Success)
            {
                float single1;
                float single2;
                float single3;
                float single4;
                float single5;
                float single6;
                ExtendedGraphicsPath path2;
                int num3 = match1.Index;
                text4.Remove(0,text1.Length);
            //                text4 =new StringBuilder(text3.Substring(num3, text3.Length - match1.Index));
                if (info1 != null)
                {
                    //info1.NextString =match1.Value.Trim();// text4.ToString();//match1.Value.Trim();
                }
                text1 = match1.Value.Trim();
                char ch1 = (char) text1.ToCharArray(0, 1).GetValue(0);
                float[] singleArray1 = PathFunc.GetCoords(text1);
                PointInfo info2 = null;
                char ch2 = ch1;
                if (ch2 <= 'Z')
                {
                    if (ch2 <= 'H')
                    {
                        switch (ch2)
                        {
                            case 'A':
                            {
                                path2 = new ExtendedGraphicsPath(path1);
                                if (singleArray1.Length != 7)
                                {
                                    throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("invalidpathformat") + text1);
                                }
                                isArc=true;
                                path2.AddArc(tf2, new PointF(singleArray1[5], singleArray1[6]), singleArray1[0], singleArray1[1], (singleArray1[3] != 0f) && true, (singleArray1[4] != 0f) && true, singleArray1[2]);
                                goto Label_092D;
                            }
                            case 'B':
                            {
                                goto Label_0FEB;
                            }
                            case 'C':
                            {
                                PointF pf1=tf2;
                                int num10=0;

                                if (singleArray1.Length < 6)
                                {
                                    throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("invalidpathformat") + text1);
                                }

                                drawArc:
                                path1.AddBezier(pf1.X, pf1.Y, singleArray1[num10], singleArray1[num10+1], singleArray1[num10+2], singleArray1[num10+3], singleArray1[num10+4], singleArray1[num10+5]);

                                pf1=new PointF(singleArray1[num10+4],singleArray1[num10+5]);

                                if((num10+6)<singleArray1.Length)
                                {

            //									info2 = new PointInfo(new PointF(singleArray1[num10+4], singleArray1[num10+5]), new PointF(singleArray1[num10+0], singleArray1[num10+1]), new PointF(singleArray1[num10+2], singleArray1[num10+3]), text1);
            //									info2.Command="C";
            //									pointsInfo.Add(info2);
                                    num10+=6;
                                    goto drawArc;

                                }
                                if (num10>0)
                                {
                                    tf1 = new PointF(singleArray1[num10+2], singleArray1[num10+3]);
                                    tf2 = new PointF(singleArray1[num10+4], singleArray1[num10+5]);

                                    info2 = new PointInfo(new PointF(singleArray1[num10+4], singleArray1[num10+5]), new PointF(singleArray1[num10+0], singleArray1[num10+1]), new PointF(singleArray1[num10+2], singleArray1[num10+3]), text1);
                                    info2.Command="C";
                                    goto Label_1001;
                                }

                                goto Label_0872;
                            }
                            case 'H':
                            {
                                goto Label_033D;
                            }
                        }
                        goto Label_0FEB;
                    }
                    switch (ch2)
                    {
                        case 'L':
                        {
            //                            if (singleArray1.Length != 2)
            //                            {
            //                                throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("invalidpathformat") + text1);
            //                            }
                            //path1.AddLine(tf2, new PointF(singleArray1[0], singleArray1[1]));
                            PointF[] ptfs=new PointF[singleArray1.Length/2+1];
                            ptfs[0]=tf2;
                            int index1=0;
                            for (int i = 1; i < singleArray1.Length; i++)
                            {
                                index1++;
                                ptfs[index1]=new PointF(singleArray1[i-1],singleArray1[i]);
                                i++;
                            }
                            path1.AddLines(ptfs);
                            info2 = new PointInfo(new PointF(singleArray1[0], singleArray1[1]), text1);
                            goto Label_02B5;
                        }
                        case 'M':
                        {
                            path1.StartFigure();
                            if (singleArray1.Length != 2)
                            {
                                throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("invalidpathformat") + text1);
                            }
                            tf2 = new PointF(singleArray1[0], singleArray1[1]);
                            info2 = new PointInfo(tf2, text1);
                            info2.IsStart = true;
                            isArc=false;
                            PathFunc.startinfo = info2;
                            //info2.PreString = text1;//text2.ToString();
                            goto Label_0205;
                        }
                        case 'N':
                        case 'O':
                        case 'P':
                        case 'R':
                        case 'U':
                        {
                            goto Label_0FEB;
                        }
                        case 'Q':
                        {
                            single1 = tf2.X + (((singleArray1[0] - tf2.X) * 2f) / 3f);
                            single2 = tf2.Y + (((singleArray1[1] - tf2.Y) * 2f) / 3f);
                            single3 = singleArray1[0] + ((singleArray1[2] - singleArray1[0]) / 3f);
                            single4 = singleArray1[1] + ((singleArray1[3] - singleArray1[1]) / 3f);
                            if (singleArray1.Length != 4)
                            {
                                throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("invalidpathformat") + text1);
                            }
                            path1.AddBezier(tf2.X, tf2.Y, single1, single2, single3, single4, singleArray1[2], singleArray1[3]);
                            goto Label_0579;
                        }
                        case 'S':
                        {
                            if (singleArray1.Length != 4)
                            {
                                throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("invalidpathformat") + text1);
                            }
                            if (!tf1.IsEmpty)
                            {
                                goto Label_0755;
                            }
                            path1.AddBezier(tf2.X, tf2.Y, tf2.X, tf2.Y, singleArray1[0], singleArray1[1], singleArray1[2], singleArray1[3]);
                            pointsInfo.Add(new PointInfo(new PointF(singleArray1[2], singleArray1[3]), tf2, new PointF(singleArray1[0], singleArray1[1]), text1));
                            goto Label_07C4;
                        }
                        case 'T':
                        {
                            if (!tf1.IsEmpty)
                            {
                                goto Label_05D2;
                            }
                            single5 = tf2.X;
                            single6 = tf2.Y;
                            goto Label_0600;
                        }
                        case 'V':
                        {
                            if (singleArray1.Length != 1)
                            {
                                throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("invalidpathformat") + text1);
                            }
                            path1.AddLine(tf2, new PointF(tf2.X, singleArray1[0]));
                            goto Label_0439;
                        }
                        case 'Z':
                        {
                            goto Label_0F72;
                        }
                    }
                    goto Label_0FEB;
                }
                if (ch2 <= 'h')
                {
                    switch (ch2)
                    {
                        case 'a':
                        {
                            path2 = new ExtendedGraphicsPath(path1);
                            if (singleArray1.Length != 7)
                            {
                                throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("invalidpathformat") + text1);
                            }
                            path2.AddArc(tf2, new PointF(singleArray1[5] + tf2.X, singleArray1[6] + tf2.Y), singleArray1[0], singleArray1[1], (singleArray1[3] != 0f) && true, (singleArray1[4] != 0f) && true, singleArray1[2]);
                            goto Label_09F7;
                        }
                        case 'b':
                        {
                            goto Label_0FEB;
                        }
                        case 'c':
                        {
                            if (singleArray1.Length != 6)
                            {
                                throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("unnabeparsepath") + text1);
                            }
                            path1.AddBezier(tf2.X, tf2.Y, (float) (singleArray1[0] + tf2.X), (float) (singleArray1[1] + tf2.Y), (float) (singleArray1[2] + tf2.X), (float) (singleArray1[3] + tf2.Y), (float) (singleArray1[4] + tf2.X), (float) (singleArray1[5] + tf2.Y));
                            goto Label_0EF0;
                        }
                        case 'h':
                        {
                            goto Label_0397;
                        }
                    }
                    goto Label_0FEB;
                }
                switch (ch2)
                {
                    case 'l':
                    {
                        if (singleArray1.Length != 2)
                        {
                            throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("invalidpathformat") + text1);
                        }
                        path1.AddLine(tf2, new PointF(singleArray1[0] + tf2.X, singleArray1[1] + tf2.Y));
                        goto Label_030E;
                    }
                    case 'm':
                    {
                        path1.StartFigure();
                        if (singleArray1.Length != 2)
                        {
                            throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("invalidpathformat") + text1);
                        }
                        tf2 = new PointF(singleArray1[0], singleArray1[1]);
                        info2 = new PointInfo(tf2, text1);
                        info2.IsStart = true;
                        isArc=false;
                        PathFunc.startinfo = info2;
                        goto Label_025F;
                    }
                    case 'n':
                    case 'o':
                    case 'p':
                    case 'r':
                    case 'u':
                    {
                        goto Label_0FEB;
                    }
                    case 'q':
                    {
                        single1 = tf2.X + ((singleArray1[0] * 2f) / 3f);
                        single2 = tf2.Y + ((singleArray1[1] * 2f) / 3f);
                        single3 = (singleArray1[0] + tf2.X) + ((singleArray1[2] - singleArray1[0]) / 3f);
                        single4 = (singleArray1[1] + tf2.Y) + ((singleArray1[3] - singleArray1[1]) / 3f);
                        if (singleArray1.Length != 4)
                        {
                            throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("invalidpathformat") + text1);
                        }
                        path1.AddBezier(tf2.X, tf2.Y, single1, single2, single3, single4, (float) (singleArray1[2] + tf2.X), (float) (singleArray1[3] + tf2.Y));
                        goto Label_0B0D;
                    }
                    case 's':
                    {
                        if (singleArray1.Length != 4)
                        {
                            throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("invalidpathformat") + text1);
                        }
                        if (!tf1.IsEmpty)
                        {
                            goto Label_0D63;
                        }
                        path1.AddBezier(tf2.X, tf2.Y, tf2.X, tf2.Y, (float) (singleArray1[0] + tf2.X), (float) (singleArray1[1] + tf2.Y), (float) (singleArray1[2] + tf2.X), (float) (singleArray1[3] + tf2.Y));
                        goto Label_0DF2;
                    }
                    case 't':
                    {
                        if (!tf1.IsEmpty)
                        {
                            goto Label_0B98;
                        }
                        single5 = tf2.X;
                        single6 = tf2.Y;
                        goto Label_0BC6;
                    }
                    case 'v':
                    {
                        if (singleArray1.Length != 1)
                        {
                            throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("invalidpathformat") + text1);
                        }
                        path1.AddLine(tf2, new PointF(tf2.X, singleArray1[0] + tf2.Y));
                        goto Label_049B;
                    }
                    case 'z':
                    {
                        goto Label_0F72;
                    }
                    default:
                    {
                        goto Label_0FEB;
                    }
                }
            Label_0205://M
                num2++;
                goto Label_1001;
            Label_025F:
                num2++;
                goto Label_1001;
            Label_02B5:
                tf2 = new PointF(singleArray1[0], singleArray1[1]);
                goto Label_1001;
            Label_030E:
                tf2 = new PointF(singleArray1[0] + tf2.X, singleArray1[1] + tf2.Y);
                info2 = new PointInfo(tf2, text1);
                goto Label_1001;
            Label_033D:
                if (singleArray1.Length == 1)
                {
                    path1.AddLine(tf2, new PointF(singleArray1[0], tf2.Y));
                }
                else
                {
                    throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("invalidpathformat") + text1);
                }
                tf2 = new PointF(singleArray1[0], tf2.Y);
                info2 = new PointInfo(tf2, text1);
                goto Label_1001;
            Label_0397:
                if (singleArray1.Length == 1)
                {
                    path1.AddLine(tf2, new PointF(singleArray1[0] + tf2.X, tf2.Y));
                }
                else
                {
                    throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("invalidpathformat") + text1);
                }
                tf2 = new PointF(singleArray1[0] + tf2.X, tf2.Y);
                info2 = new PointInfo(tf2, text1);
                goto Label_1001;
            Label_0439:
                tf2 = new PointF(tf2.X, singleArray1[0]);
                info2 = new PointInfo(tf2, text1);
                goto Label_1001;
            Label_049B:
                tf2 = new PointF(tf2.X, singleArray1[0] + tf2.Y);
                info2 = new PointInfo(tf2, text1);
                goto Label_1001;
            Label_0579:
                tf1 = new PointF(single3, single4);
                tf2 = new PointF(singleArray1[2], singleArray1[3]);
                info2 = new PointInfo(tf2, new PointF(single1, single2), new PointF(single3, single4), text1);
                goto Label_1001;
            Label_05D2:
                single5 = (2f * tf2.X) - tf1.X;
                single6 = (2f * tf2.Y) - tf1.Y;
            Label_0600:
                single1 = tf2.X + (((single5 - tf2.X) * 2f) / 3f);
                single2 = tf2.Y + (((single6 - tf2.Y) * 2f) / 3f);
                single3 = single5 + ((singleArray1[0] - single5) / 3f);
                single4 = single6 + ((singleArray1[1] - single6) / 3f);
                if (singleArray1.Length != 2)
                {
                    throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("invalidpathformat") + text1);
                }
                path1.AddBezier(tf2.X, tf2.Y, single1, single2, single3, single4, singleArray1[0], singleArray1[1]);
                tf1 = new PointF(single3, single4);
                tf2 = new PointF(singleArray1[0], singleArray1[1]);
                info2 = new PointInfo(tf2, new PointF(single1, single2), new PointF(single3, single4), text1);
                goto Label_1001;
            Label_0755:
                single1 = (2f * tf2.X) - tf1.X;
                single2 = (2f * tf2.Y) - tf1.Y;
                path1.AddBezier(tf2.X, tf2.Y, single1, single2, singleArray1[0], singleArray1[1], singleArray1[2], singleArray1[3]);
            Label_07C4:
                tf1 = new PointF(singleArray1[0], singleArray1[1]);
                tf2 = new PointF(singleArray1[2], singleArray1[3]);
                info2 = new PointInfo(path1.GetLastPoint(), path1.PathPoints[path1.PointCount - 3], path1.PathPoints[path1.PointCount - 2], text1);
                goto Label_1001;
            Label_0872:
                tf1 = new PointF(singleArray1[2], singleArray1[3]);
                tf2 = new PointF(singleArray1[4], singleArray1[5]);
                info2 = new PointInfo(new PointF(singleArray1[4], singleArray1[5]), new PointF(singleArray1[0], singleArray1[1]), new PointF(singleArray1[2], singleArray1[3]), text1);
                goto Label_1001;
            Label_092D://A
                tf1 = PointF.Empty;
                tf2 = path1.GetLastPoint();//, path1.PathPoints[path1.PointCount - 3], path1.PathPoints[path1.PointCount - 2]
                info2 = new PointInfo(tf2,PointF.Empty,new PointF(tf2.X+singleArray1[0],tf2.Y), text1);
                info2.NextControl=new PointF(tf2.X,tf2.Y+singleArray1[1]);
                info2.Rx=singleArray1[0];
                info2.Ry=singleArray1[1];
                info2.Angle=singleArray1[2];
                info2.LargeArcFlage=(int)singleArray1[3];
                info2.SweepFlage=(int)singleArray1[4];
                goto Label_1001;
            Label_09F7:
                tf1 = PointF.Empty;
                tf2 = path1.GetLastPoint();
                info2 = new PointInfo(path1.GetLastPoint(), path1.PathPoints[path1.PointCount - 3], path1.PathPoints[path1.PointCount - 2], text1);
                goto Label_1001;
            Label_0B0D:
                tf1 = new PointF(single3, single4);
                tf2 = new PointF(singleArray1[2] + tf2.X, tf2.Y + singleArray1[3]);
                info2 = new PointInfo(path1.GetLastPoint(), path1.PathPoints[path1.PointCount - 3], path1.PathPoints[path1.PointCount - 2], text1);
                goto Label_1001;
            Label_0B98:
                single5 = (2f * tf2.X) - tf1.X;
                single6 = (2f * tf2.Y) - tf1.Y;
            Label_0BC6:
                single1 = tf2.X + (((single5 - tf2.X) * 2f) / 3f);
                single2 = tf2.Y + (((single6 - tf2.Y) * 2f) / 3f);
                single3 = single5 + (((singleArray1[0] + tf2.X) - single5) / 3f);
                single4 = single6 + (((singleArray1[1] + tf2.Y) - single6) / 3f);
                if (singleArray1.Length != 2)
                {
                    throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("invalidpathformat") + text1);
                }
                path1.AddBezier(tf2.X, tf2.Y, single1, single2, single3, single4, (float) (singleArray1[0] + tf2.X), (float) (singleArray1[1] + tf2.Y));
                tf1 = new PointF(single3, single4);
                tf2 = new PointF(singleArray1[0] + tf2.X, tf2.Y + singleArray1[1]);
                info2 = new PointInfo(path1.GetLastPoint(), path1.PathPoints[path1.PointCount - 3], path1.PathPoints[path1.PointCount - 2], text1);
                goto Label_1001;
            Label_0D63:
                single1 = (2f * tf2.X) - tf1.X;
                single2 = (2f * tf2.Y) - tf1.Y;
                path1.AddBezier(tf2.X, tf2.Y, single1, single2, (float) (singleArray1[0] + tf2.X), (float) (singleArray1[1] + tf2.Y), (float) (singleArray1[2] + tf2.X), (float) (singleArray1[3] + tf2.Y));
            Label_0DF2:
                tf1 = new PointF(singleArray1[0] + tf2.X, tf2.Y + singleArray1[1]);
                tf2 = new PointF(singleArray1[2] + tf2.X, tf2.Y + singleArray1[3]);
                info2 = new PointInfo(path1.GetLastPoint(), path1.PathPoints[path1.PointCount - 3], path1.PathPoints[path1.PointCount - 2], text1);
                goto Label_1001;
            Label_0EF0:
                tf1 = new PointF(singleArray1[2] + tf2.X, tf2.Y + singleArray1[3]);
                tf2 = new PointF(singleArray1[4] + tf2.X, tf2.Y + singleArray1[5]);
                info2 = new PointInfo(path1.GetLastPoint(), path1.PathPoints[path1.PointCount - 3], path1.PathPoints[path1.PointCount - 2], text1);
                goto Label_1001;
            Label_0F72://Z
                path1.CloseFigure();
                if (pointsInfo.Count > 0)
                {
                    PointInfo info3 = pointsInfo[pointsInfo.Count - 1];
                    if ((PathFunc.startinfo != null) && (info3 != PathFunc.startinfo))
                    {   PathFunc.startinfo.PreInfo = info3;
                        info3.NextInfo = PathFunc.startinfo;
                        if(!isArc)
                        {
                            PathFunc.startinfo.SecondControl = info3.SecondControl;
                        }
            //                        info3.NextControl = PathFunc.startinfo.NextControl;
                        info3.IsEnd = true;
                    }
                }
                num2++;
                goto Label_1001;
            Label_0FEB://error
                throw new Exception(ItopVector.Core.Config.Config.GetLabelForName("unnabeparsepath") + text);
            Label_1001:
                if (info2 != null)
                {
                    info2.Command = ch1.ToString();
                    pointsInfo.Add(info2);
                    //info2.PreString = text1;//text2.ToString();
                    info2.SubPath = num2;
                    info2.Index=num3;
                }

                info1 = info2;
                //text2.Append(match1.Value);
                match1 = match1.NextMatch();
                num1++;
            }
            return path1;
        }
Ejemplo n.º 11
0
 // Methods
 static PathFunc()
 {
     PathFunc.startinfo = null;
 }
Ejemplo n.º 12
0
 public int IndexOf(PointInfo value)
 {
     return(base.List.IndexOf(value));
 }
Ejemplo n.º 13
0
 public bool Contains(PointInfo value)
 {
     return(base.List.Contains(value));
 }
Ejemplo n.º 14
0
 public void Remove(PointInfo value)
 {
     base.List.Remove(value);
 }