示例#1
0
        private void ActiveTool_ToolElementEvent(ToolOperation toolOperation)
        {
            switch (toolOperation)
            {
            case ToolOperation.Start:
                this.Shapes.Add(this.ActiveTool.Data);
                break;

            case ToolOperation.Move:
                break;

            case ToolOperation.End:
                break;

            case ToolOperation.Delete:
                this.Shapes.Remove(this.ActiveTool.Data);
                break;

            case ToolOperation.Selected:
                foreach (AreaShape item in this.ActiveTool.Datas)
                {
                    if (!this.SelectedShapes.Contains(item))
                    {
                        this.SelectedShapes.Add(item);
                    }
                }
                break;

            case ToolOperation.Clear:
                this.SelectedShapes.Clear();
                break;
            }
            this.InvalidateVisual();
        }
示例#2
0
 public static bool IsPieOperator(ToolOperation op)
 {
     if (op != ToolOperation.Pie)
     {
         return(op == ToolOperation.Arc);
     }
     return(true);
 }
示例#3
0
 public static bool IsTransformOperation(ToolOperation operation)
 {
     switch (operation)
     {
     case ToolOperation.FreeTransform:
     case ToolOperation.Rotate:
     case ToolOperation.Scale:
     {
         return(true);
     }
     }
     return(false);
 }
示例#4
0
 public static bool IsViewOperation(ToolOperation operation)
 {
     switch (operation)
     {
     case ToolOperation.Roam:
     case ToolOperation.IncreaseView:
     case ToolOperation.DecreaseView:
     {
         return(true);
     }
     }
     return(false);
 }
示例#5
0
 public static bool IsColorOperation(ToolOperation operation)
 {
     switch (operation)
     {
     case ToolOperation.GradientTransform:
     case ToolOperation.ColorPicker:
     case ToolOperation.InkBottle:
     case ToolOperation.PaintBottle:
     {
         return(true);
     }
     }
     return(false);
 }
示例#6
0
 public static bool IsColorOperation(ToolOperation operation)
 {
     switch (operation)
     {
         case ToolOperation.GradientTransform:
         case ToolOperation.ColorPicker:
         case ToolOperation.InkBottle:
         case ToolOperation.PaintBottle:
         {
             return true;
         }
     }
     return false;
 }
示例#7
0
 public static bool IsConnectLineOperation(ToolOperation operation)
 {
     switch(operation)
     {
         case ToolOperation.ConnectLine_Line:
         case ToolOperation.ConnectLine_Polyline:
         case ToolOperation.ConnectLine_Rightangle:
         case ToolOperation.ConnectLine_Spline:
         {
             return true;
         }
     }
     return false;
 }
示例#8
0
 public static bool IsConnectLineOperation(ToolOperation operation)
 {
     switch (operation)
     {
     case ToolOperation.ConnectLine_Line:
     case ToolOperation.ConnectLine_Polyline:
     case ToolOperation.ConnectLine_Rightangle:
     case ToolOperation.ConnectLine_Spline:
     {
         return(true);
     }
     }
     return(false);
 }
示例#9
0
        public static bool IsDrawOperation(ToolOperation operation)
        {
            ToolOperation operation1 = operation;

            switch (operation1)
            {
            case ToolOperation.Rectangle:
            case ToolOperation.AngleRectangle:
            case ToolOperation.Circle:
            case ToolOperation.Ellipse:
            case ToolOperation.Line:
            case ToolOperation.PolyLine:
            case ToolOperation.XPolyLine:
            case ToolOperation.YPolyLine:
            case ToolOperation.Confines_GuoJie:
            case ToolOperation.Confines_ShengJie:
            case ToolOperation.Confines_ShiJie:
            case ToolOperation.Confines_XianJie:
            case ToolOperation.Confines_XiangJie:
            case ToolOperation.LeadLine:
            case ToolOperation.Railroad:
            case ToolOperation.Polygon:
            case ToolOperation.Enclosure:
            case ToolOperation.InterEnclosure:
            case ToolOperation.InterEnclosurePrint:
            case ToolOperation.AreaPolygon:
            case ToolOperation.EqualPolygon:
            case ToolOperation.Bezier:
            case ToolOperation.FreeLines:
            case ToolOperation.Text:
            case ToolOperation.Image:
            case ToolOperation.Pie:
            case ToolOperation.Arc:
            case ToolOperation.ConnectLine:
            {
                break;
            }

            default:
            {
                if (operation1 != ToolOperation.PreShape)
                {
                    return(false);
                }
                break;
            }
            }
            return(true);
        }
示例#10
0
 public static bool IsDrawOperation(ToolOperation operation)
 {
     ToolOperation operation1 = operation;
     switch (operation1)
     {
         case ToolOperation.Rectangle:
         case ToolOperation.AngleRectangle:
         case ToolOperation.Circle:
         case ToolOperation.Ellipse:
         case ToolOperation.Line:
         case ToolOperation.PolyLine:
         case ToolOperation.XPolyLine:
         case ToolOperation.YPolyLine:
         case ToolOperation.Confines_GuoJie:
         case ToolOperation.Confines_ShengJie:
         case ToolOperation.Confines_ShiJie:
         case ToolOperation.Confines_XianJie:
         case ToolOperation.Confines_XiangJie:
         case ToolOperation.LeadLine:
         case ToolOperation.Railroad:
         case ToolOperation.Polygon:
         case ToolOperation.Enclosure:
         case ToolOperation.InterEnclosure:
         case ToolOperation.InterEnclosurePrint:
         case ToolOperation.AreaPolygon:
         case ToolOperation.EqualPolygon:
         case ToolOperation.Bezier:
         case ToolOperation.FreeLines:
         case ToolOperation.Text:
         case ToolOperation.Image:
         case ToolOperation.Pie:
         case ToolOperation.Arc:
         case ToolOperation.ConnectLine:
         {
             break;
         }
         default:
         {
             if (operation1 != ToolOperation.PreShape)
             {
                 return false;
             }
             break;
         }
     }
     return true;
 }
示例#11
0
        private IGraph CreateGraph(Point startpoint, Point endpoint, ToolOperation operation)
        {
            SvgDocument document1 = this.mouseAreaControl.SVGDocument;

            if (document1 == null)
            {
                return(null);
            }
            bool flag1 = document1.AcceptChanges;

            document1.AcceptChanges = false;
            IGraph graph1 = this.mouseAreaControl.PicturePanel.PreGraph;

            if (graph1 == null)
            {
                return(null);
            }
            IGraph graph2 = (IGraph)((SvgElement)graph1).Clone();

//			Point point1 = this.mouseAreaControl.PicturePanel.PointToView(startpoint);
//			Point point2 = this.mouseAreaControl.PicturePanel.PointToView(endpoint);
//			float single1 = this.mouseAreaControl.PicturePanel.ScaleUnit;
//			SizeF ef1 = this.mouseAreaControl.PicturePanel.GridSize;
//			float single2 = ef1.Height;
//			float single3 = ef1.Width;
//			if (this.mouseAreaControl.PicturePanel.SnapToGrid)
//			{
//				int num1 = (int) ((point1.X + (single3 / 2f)) / single3);
//				int num2 = (int) ((point1.Y + (single2 / 2f)) / single2);
//				point1 = new Point((int) (num1 * single3), (int) (num2 * single2));
//				num1 = (int) ((point2.X + (single3 / 2f)) / single3);
//				num2 = (int) ((point2.Y + (single2 / 2f)) / single2);
//				point2 = new Point((int) (num1 * single3), (int) (single2 * num2));
//			}
//			float single4 = Math.Min(point1.X, point2.X);
//			float single5 = Math.Min(point1.Y, point2.Y);
//			float single6 = Math.Max(point1.X, point2.X);
//			float single7 = Math.Max(point1.Y, point2.Y);
//			float single8 = single6 - single4;
//			float single9 = single7 - single5;

            this.mouseAreaControl.SVGDocument.AcceptChanges = flag1;
            return(graph2);
        }
示例#12
0
 public static bool IsSelectOperation(ToolOperation operation)
 {
     switch (operation)
     {
     case ToolOperation.Select:
     case ToolOperation.ShapeTransform:
     case ToolOperation.Custom11:
     case ToolOperation.Custom12:
     case ToolOperation.Custom13:
     case ToolOperation.Custom14:
     case ToolOperation.Custom15:
     case ToolOperation.ColorSelect:
     case ToolOperation.AreaSelect:
     case ToolOperation.WindowZoom:
     case ToolOperation.Exceptant:
     {
         return(true);
     }
     }
     return(false);
 }
示例#13
0
        public void OnMouseMove(MouseEventArgs e)
        {
            SizeF         ef1        = this.mouseAreaControl.PicturePanel.GridSize;
            float         single1    = ef1.Width;
            float         single2    = ef1.Height;
            ToolOperation operation1 = this.mouseAreaControl.CurrentOperation;

            if (operation1 == ToolOperation.GradientTransform)
            {
                this.mouseAreaControl.PicturePanel.ToolTip(this.gradientstr, 1);
            }
            else if (operation1 == ToolOperation.ColorPicker)
            {
                this.mouseAreaControl.PicturePanel.ToolTip(this.colorpickerstr, 1);
            }
            if ((operation1 == ToolOperation.GradientTransform) && (this.activeGraph != null))
            {
                ISvgBrush brush1 = this.activeGraph.GraphBrush;
                if (!(brush1 is SolidColor))
                {
                    ITransformBrush brush2 = (ITransformBrush)brush1;
                    bool            flag1  = brush2.Units == Units.UserSpaceOnUse;
                    if (e.Button == MouseButtons.None)
                    {
                        Pen pen1 = new Pen(Color.Blue, 4f);
                        pen1.Alignment = PenAlignment.Center;
                        PointF tf1 = new PointF((float)e.X, (float)e.Y);
                        if (this.translatePath.IsVisible(tf1) || this.translatePath.IsOutlineVisible(tf1, pen1))
                        {
                            this.mouseAreaControl.Cursor = SpecialCursors.GradientTranslateCursor;
                        }
                        else if (this.scalePath.IsVisible(tf1) || this.scalePath.IsOutlineVisible(tf1, pen1))
                        {
                            this.mouseAreaControl.Cursor = SpecialCursors.VScaleCursor;
                        }
                        else if (this.rotatePath.IsOutlineVisible(tf1, pen1) || this.rotatePath.IsVisible(tf1))
                        {
                            this.mouseAreaControl.Cursor = SpecialCursors.RotateCursor;
                        }
                        else if (this.equalPath.IsOutlineVisible(tf1, pen1) || this.equalPath.IsVisible(tf1))
                        {
                            this.mouseAreaControl.Cursor = SpecialCursors.EqualScaleCursor;
                        }
                        else if (this.vscalPath.IsOutlineVisible(tf1, pen1) || this.vscalPath.IsVisible(tf1))
                        {
                            this.mouseAreaControl.Cursor = SpecialCursors.HScaleCursor;
                        }
                        else if (this.skewxPath.IsOutlineVisible(tf1, pen1) || this.skewxPath.IsVisible(tf1))
                        {
                            this.mouseAreaControl.Cursor = SpecialCursors.SkewXCursor;
                        }
                        else if (this.skewyPath.IsOutlineVisible(tf1, pen1) || this.skewyPath.IsVisible(tf1))
                        {
                            this.mouseAreaControl.Cursor = SpecialCursors.SkewYCursor;
                        }
                        else if (this.anglescalePath.IsOutlineVisible(tf1, pen1) || this.anglescalePath.IsVisible(tf1))
                        {
                            this.mouseAreaControl.Cursor = SpecialCursors.TopRightScaleCursor;
                        }
                        else
                        {
                            this.mouseAreaControl.Cursor = this.mouseAreaControl.DefaultCursor;
                        }
                    }
                    else if ((e.Button == MouseButtons.Left) && (this.mouseAreaControl.Cursor != this.mouseAreaControl.DefaultCursor))
                    {
                        PointF tf2 = this.mouseAreaControl.PicturePanel.PointToView(this.startPoint);
                        PointF tf3 = this.mouseAreaControl.PicturePanel.PointToView(new PointF((float)e.X, (float)e.Y));
                        if (this.mouseAreaControl.PicturePanel.SnapToGrid)
                        {
                            int num1 = (int)((tf2.X + (single1 / 2f)) / single1);
                            int num2 = (int)((tf2.Y + (single2 / 2f)) / single2);
                            tf2  = (PointF) new Point((int)(num1 * single1), (int)(num2 * single2));
                            num1 = (int)((tf3.X + (single1 / 2f)) / single1);
                            num2 = (int)((tf3.Y + (single2 / 2f)) / single2);
                            tf3  = (PointF) new Point((int)(num1 * single1), (int)(single2 * num2));
                        }
                        tf2            = this.mouseAreaControl.PicturePanel.PointToSystem(tf2);
                        tf3            = this.mouseAreaControl.PicturePanel.PointToSystem(tf3);
                        this.win32.hdc = this.win32.W32GetDC(this.mouseAreaControl.Handle);
                        this.win32.W32SetROP2(6);
                        this.win32.W32PolyDraw(this.reversePath);
                        Matrix matrix1 = this.gradientMatrix.Clone();
                        if (((this.mouseAreaControl.Cursor == SpecialCursors.VScaleCursor) || (this.mouseAreaControl.Cursor == SpecialCursors.HScaleCursor)) || (this.mouseAreaControl.Cursor == SpecialCursors.TopRightScaleCursor))
                        {
                            PointF[] tfArray6 = new PointF[5] {
                                tf2, tf3, this.controlPoints[0], this.controlPoints[1], this.controlPoints[5]
                            };
                            PointF[] tfArray1 = tfArray6;
                            Matrix   matrix2  = this.graphMatrix.Clone();
                            matrix2.Multiply(this.gradientMatrix);
                            matrix2.Invert();
                            matrix2.TransformPoints(tfArray1);
                            float single3 = 1f;
                            if (tfArray1[3].X != tfArray1[2].X)
                            {
                                single3 = 1f + ((tfArray1[1].X - tfArray1[0].X) / (tfArray1[3].X - tfArray1[2].X));
                            }
                            float single4 = 1f;
                            if (tfArray1[4].Y != tfArray1[2].Y)
                            {
                                single4 = 1f + ((tfArray1[1].Y - tfArray1[0].Y) / (tfArray1[4].Y - tfArray1[2].Y));
                            }
                            if (flag1)
                            {
                                matrix1.Translate(this.centerPoint.X, this.centerPoint.Y);
                            }
                            else
                            {
                                matrix1.Translate(0.5f, 0.5f);
                            }
                            if (this.mouseAreaControl.Cursor == SpecialCursors.VScaleCursor)
                            {
                                single4 = 1f;
                            }
                            else if (this.mouseAreaControl.Cursor == SpecialCursors.HScaleCursor)
                            {
                                single3 = 1f;
                            }
                            matrix1.Scale(single3, single4);
                            if (flag1)
                            {
                                matrix1.Translate(-this.centerPoint.X, -this.centerPoint.Y);
                            }
                            else
                            {
                                matrix1.Translate(-0.5f, -0.5f);
                            }
                        }
                        else if ((this.mouseAreaControl.Cursor == SpecialCursors.SkewXCursor) || (this.mouseAreaControl.Cursor == SpecialCursors.SkewYCursor))
                        {
                            PointF[] tfArray7 = new PointF[5] {
                                tf2, tf3, this.controlPoints[0], this.controlPoints[3], this.controlPoints[4]
                            };
                            PointF[] tfArray2 = tfArray7;
                            Matrix   matrix3  = this.graphMatrix.Clone();
                            matrix3.Multiply(this.gradientMatrix);
                            matrix3.Invert();
                            matrix3.TransformPoints(tfArray2);
                            float single5 = 0f;
                            if (tfArray2[3].Y != tfArray2[2].Y)
                            {
                                single5 = ((tfArray2[1].X - tfArray2[0].X) / (tfArray2[3].Y - tfArray2[2].Y)) * 0.5f;
                            }
                            float single6 = 0f;
                            if (tfArray2[4].X != tfArray2[2].X)
                            {
                                single6 = ((tfArray2[1].Y - tfArray2[0].Y) / (tfArray2[4].X - tfArray2[2].X)) * 0.5f;
                            }
                            if (this.mouseAreaControl.Cursor == SpecialCursors.SkewXCursor)
                            {
                                single6 = 0f;
                            }
                            else if (this.mouseAreaControl.Cursor == SpecialCursors.SkewYCursor)
                            {
                                single5 = 0f;
                            }
                            if (flag1)
                            {
                                matrix1.Translate(this.centerPoint.X, this.centerPoint.Y);
                            }
                            else
                            {
                                matrix1.Translate(0.5f, 0.5f);
                            }
                            matrix1.Shear(single5, single6);
                            if (flag1)
                            {
                                matrix1.Translate(-this.centerPoint.X, -this.centerPoint.Y);
                            }
                            else
                            {
                                matrix1.Translate(-0.5f, -0.5f);
                            }
                        }
                        else if (this.mouseAreaControl.Cursor == SpecialCursors.RotateCursor)
                        {
                            PointF tf4     = this.controlPoints[0];
                            float  single7 = (float)Math.Atan((double)((tf2.Y - tf4.Y) / (tf2.X - tf4.X)));
                            float  single8 = (float)Math.Atan((double)((tf3.Y - tf4.Y) / (tf3.X - tf4.X)));
                            float  single9 = ((float)(((double)(single8 - single7)) / 3.1415926535897931)) * 180f;
                            if (((tf3.X - tf4.X) * (tf2.X - tf4.X)) < 0f)
                            {
                                single9 += 180f;
                            }
                            matrix1 = this.gradientMatrix.Clone();
                            PointF[] tfArray8 = new PointF[1] {
                                new PointF(0.5f, 0.5f)
                            };
                            PointF[] tfArray3 = tfArray8;
                            if (flag1)
                            {
                                PointF[] tfArray9 = new PointF[1] {
                                    this.centerPoint
                                };
                                tfArray3 = tfArray9;
                            }
                            this.gradientMatrix.TransformPoints(tfArray3);
                            matrix1.RotateAt(single9, tfArray3[0], MatrixOrder.Append);
                        }
                        else if (this.mouseAreaControl.Cursor == SpecialCursors.GradientTranslateCursor)
                        {
                            PointF[] tfArray10 = new PointF[5] {
                                tf2, tf3, this.controlPoints[0], this.controlPoints[1], this.controlPoints[4]
                            };
                            PointF[] tfArray4 = tfArray10;
                            bool     flag2    = tfArray4[4].IsEmpty;
                            Matrix   matrix4  = this.graphMatrix.Clone();
                            matrix4.Multiply(this.gradientMatrix);
                            matrix4.Invert();
                            matrix4.TransformPoints(tfArray4);
                            float single10 = tfArray4[1].X - tfArray4[0].X;
                            if (!flag1)
                            {
                                single10 /= (tfArray4[3].X - tfArray4[2].X);
                            }
                            else
                            {
                                single10 *= 2f;
                            }
                            float single11 = tfArray4[1].Y - tfArray4[0].Y;
                            if (!flag1)
                            {
                                single11 /= (tfArray4[4].Y - tfArray4[2].Y);
                            }
                            else
                            {
                                single11 *= 2f;
                            }
                            single10 /= 2f;
                            single11 /= 2f;
                            matrix1.Translate(single10, single11);
                        }
                        else if (this.mouseAreaControl.Cursor == SpecialCursors.EqualScaleCursor)
                        {
                            PointF[] tfArray11 = new PointF[5] {
                                tf2, tf3, this.controlPoints[0], this.controlPoints[1], this.controlPoints[4]
                            };
                            PointF[] tfArray5 = tfArray11;
                            Matrix   matrix5  = this.graphMatrix.Clone();
                            matrix5.Multiply(this.gradientMatrix);
                            matrix5.Invert();
                            matrix5.TransformPoints(tfArray5);
                            float single12 = 1f + ((tfArray5[1].X - tfArray5[0].X) / (tfArray5[3].X - tfArray5[2].X));
                            if (flag1)
                            {
                                matrix1.Translate(this.centerPoint.X, this.centerPoint.Y);
                            }
                            else
                            {
                                matrix1.Translate(0.5f, 0.5f);
                            }
                            matrix1.Scale(single12, single12);
                            if (flag1)
                            {
                                matrix1.Translate(-this.centerPoint.X, -this.centerPoint.Y);
                            }
                            else
                            {
                                matrix1.Translate(-0.5f, -0.5f);
                            }
                        }
                        if (this.mouseAreaControl.Cursor == SpecialCursors.RotateCursor)
                        {
                            this.reversePath = (GraphicsPath)this.gradientPath.Clone();
                            Matrix matrix6 = this.graphMatrix.Clone();
                            matrix6.Multiply(matrix1);
                            this.reversePath.Transform(matrix6);
                        }
                        else
                        {
                            this.reversePath = (GraphicsPath)this.gradientPath.Clone();
                            this.reversePath.Transform(matrix1);
                            this.reversePath.Transform(this.graphMatrix);
                        }
                        this.win32.W32PolyDraw(this.reversePath);
                        this.win32.ReleaseDC();
                    }
                }
            }
        }
示例#14
0
 public static bool IsPieOperator(ToolOperation op)
 {
     if (op != ToolOperation.Pie)
     {
         return (op == ToolOperation.Arc);
     }
     return true;
 }
示例#15
0
        private IGraph CreateGraph(PointF startpoint, PointF endpoint, ToolOperation operation)
        {
            SvgDocument document1 = this.mouseAreaControl.SVGDocument;
            if (document1 == null)
            {
                return null;
            }
            bool flag1 = document1.AcceptChanges;
            document1.AcceptChanges = false;
            IGraph graph1 = this.mouseAreaControl.PicturePanel.PreGraph;
            if (graph1 == null)
            {
                return null;
            }
            IGraph graph2 = (IGraph) ((SvgElement) graph1).Clone();
            if ((operation == ToolOperation.Ellipse) && ((Control.ModifierKeys == Keys.Shift) || (Control.ModifierKeys == (Keys.Control | Keys.Shift))))
            {
                graph2 = (Circle) document1.CreateElement(document1.Prefix, "circle", document1.NamespaceURI);
                foreach (XmlAttribute attribute1 in ((SvgElement) graph1).Attributes)
                {
                    ((SvgElement) graph2).SetAttributeNode((XmlAttribute) attribute1.Clone());
                }
            }
            if (((SvgElement) graph1) is IGraphPath)
            {
                if ((((SvgElement) graph1).GetAttribute("style") != string.Empty) && (((SvgElement) graph1).GetAttribute("style") != null))
                {
                    this.mouseAreaControl.SVGDocument.AcceptChanges = false;
                    AttributeFunc.SetAttributeValue((SvgElement) graph2, "style", ((SvgElement) graph1).GetAttribute("style"));
                }
                ISvgBrush brush1 = ((IGraphPath) graph1).GraphBrush;
                if (brush1 is SvgElement)
                {
                    ISvgBrush brush2 = (ISvgBrush) ((SvgElement) brush1).Clone();
                    ((IGraphPath) graph2).GraphBrush = brush2;
                    ((SvgElement) brush2).pretime = -1;
                }
                else
                {
                    ((IGraphPath) graph2).GraphBrush = brush1;
                }
                brush1 = ((IGraphPath) graph1).GraphStroke.Brush;
                if (brush1 is SvgElement)
                {
                    ISvgBrush brush3 = (ISvgBrush) ((SvgElement) brush1).Clone();
                    ((IGraphPath) graph2).GraphStroke = new Stroke(brush3);
                    ((SvgElement) brush3).pretime = -1;
                }
                else
                {
                    ((IGraphPath) graph2).GraphStroke.Brush = brush1;
                }
            }
            if (document1 == null)
            {
                return null;
            }
            PointF point1 = this.mouseAreaControl.PicturePanel.PointToView(startpoint);
            PointF point2 = this.mouseAreaControl.PicturePanel.PointToView(endpoint);
            float single1 = this.mouseAreaControl.PicturePanel.ScaleUnit;
            SizeF ef1 = this.mouseAreaControl.PicturePanel.GridSize;
            float single2 = ef1.Height;
            float single3 = ef1.Width;
            if (this.mouseAreaControl.PicturePanel.SnapToGrid)
            {
                int num1 = (int) ((point1.X + (single3 / 2f)) / single3);
                int num2 = (int) ((point1.Y + (single2 / 2f)) / single2);
                point1 = new Point((int) (num1 * single3), (int) (num2 * single2));
                num1 = (int) ((point2.X + (single3 / 2f)) / single3);
                num2 = (int) ((point2.Y + (single2 / 2f)) / single2);
                point2 = new Point((int) (num1 * single3), (int) (single2 * num2));
            }
            float single4 = Math.Min(point1.X, point2.X);
            float single5 = Math.Min(point1.Y, point2.Y);
            float single6 = Math.Max(point1.X, point2.X);
            float single7 = Math.Max(point1.Y, point2.Y);
            float single8 = single6 - single4;
            float single9 = single7 - single5;
            switch (operation)
            {
                case ToolOperation.AngleRectangle:
                {
                    float single10 = 0f;
                    single10 = Math.Max(0, ((ItopVector.Core.Figure.RectangleElement)this.mouseAreaControl.PicturePanel.PreGraph).Angle);
                    float single11 = single10;
                    float single12 = single10;
                    if ((single8 < 5f) || (single9 < 5f))
                    {
                        return null;
                    }
                    if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
                    {
                        single8 = single9 = Math.Max(single8, single9);
                        single4 = ((point1.X - point2.X) < 0) ? ((float)point1.X) : (point1.X - single8);
                        single5 = ((point1.Y - point2.Y) < 0) ? ((float)point1.Y) : (point1.Y - single9);
                    }
                    if (single11 > (single8 / 2f))
                    {
                        single11 = single8;
                    }
                    if (single12 > (single9 / 2f))
                    {
                        single12 = single9;
                    }
                    ItopVector.Core.Figure.RectangleElement rectangle1 = (ItopVector.Core.Figure.RectangleElement)graph2;
                    rectangle1.X = single4;
                    rectangle1.Y = single5;
                    rectangle1.Width = single8;
                    rectangle1.Height = single9;
                    rectangle1.RX = single11;
                    rectangle1.RY = single12;
                   // AttributeFunc.SetAttributeValue((XmlElement)rectangle1, "style", "fill:#C0C0FF;fill-opacity:0.3;stroke:#000000;stroke-opacity:1;");
                    goto Label_0F08;
                }
                case ToolOperation.InterEnclosurePrint:
                {
                    float single10 = 0f;
                    single10 = Math.Max(0, ((ItopVector.Core.Figure.RectangleElement) this.mouseAreaControl.PicturePanel.PreGraph).Angle);
                    float single11 = single10;
                    float single12 = single10;
                    if ((single8 < 5f) || (single9 < 5f))
                    {
                        return null;
                    }
                    if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
                    {
                        single8 = single9 = Math.Max(single8, single9);
                        single4 = ((point1.X - point2.X) < 0) ? ((float) point1.X) : (point1.X - single8);
                        single5 = ((point1.Y - point2.Y) < 0) ? ((float) point1.Y) : (point1.Y - single9);
                    }
                    if (single11 > (single8 / 2f))
                    {
                        single11 = single8;
                    }
                    if (single12 > (single9 / 2f))
                    {
                        single12 = single9;
                    }
                    ItopVector.Core.Figure.RectangleElement rectangle1 = (ItopVector.Core.Figure.RectangleElement) graph2;
                    rectangle1.X = single4;
                    rectangle1.Y = single5;
                    rectangle1.Width = single8;
                    rectangle1.Height = single9;
                    rectangle1.RX = single11;
                    rectangle1.RY = single12;
                    AttributeFunc.SetAttributeValue((XmlElement)rectangle1, "style", "fill:#C0C0FF;fill-opacity:0.0;stroke:#000000;stroke-opacity:1;");
                    goto Label_0F08;
                }
                case ToolOperation.Circle:
                case ToolOperation.Bezier:
                case ToolOperation.Text:
                {
                    goto Label_0F08;
                }
                case ToolOperation.Ellipse:
                {
                    if ((single8 < 3f) || (single9 < 3f))
                    {
                        return null;
                    }
                    if (Control.ModifierKeys == Keys.Shift)
                    {
                        float single13 = Math.Max((float) (single6 - single4), (float) (single7 - single5)) / 2f;
                        if (single13 < 3f)
                        {
                            return null;
                        }
                        single4 = ((point1.X - point2.X) < 0) ? ((float) point1.X) : (point1.X - (2f * single13));
                        single5 = ((point1.Y - point2.Y) < 0) ? ((float) point1.Y) : (point1.Y - (2f * single13));
                        float single14 = single4 + single13;
                        float single15 = single5 + single13;
                        Circle circle1 = (Circle) graph2;
                        circle1.CX = single14;
                        circle1.CY = single15;
                        circle1.R = single13;
                        goto Label_0F08;
                    }
                    if (Control.ModifierKeys == (Keys.Control | Keys.Shift))
                    {
                        Circle circle2 = (Circle) graph2;
                        circle2.CX = point1.X;
                        circle2.CY = point1.Y;
                        float single16 = Math.Max(Math.Abs((int) (point1.Y - point2.Y)), Math.Abs((int) (point1.X - point2.X)));
                        if (single16 < 3f)
                        {
                            return null;
                        }
                        circle2.R = single16;
                        goto Label_0F08;
                    }
                    Ellips ellips1 = (Ellips) graph2;
                    if (Control.ModifierKeys == Keys.Control)
                    {
                        ellips1.CX = point1.X;
                        ellips1.CY = point1.Y;
                        ellips1.RX = Math.Abs((int) (point2.X - point1.X));
                        ellips1.RY = Math.Abs((int) (point2.Y - point1.Y));
                        goto Label_0F08;
                    }
                    ellips1.CX = single4 + (single8 / 2f);
                    ellips1.CY = single5 + (single9 / 2f);
                    ellips1.RX = single8 / 2f;
                    ellips1.RY = single9 / 2f;
                    goto Label_0F08;
                }
                case ToolOperation.Line:
                {
                    if ((single8 < 1f) && (single9 < 1f))
                    {
                        return null;
                    }
                    if ((Math.Abs((int) (point1.X - point2.X)) <= (2f * single1)) && (Math.Abs((int) (point1.Y - point2.Y)) <= (2f * single1)))
                    {
                        goto Label_0F07;
                    }
                    if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
                    {
                        float single17 = (((float) Math.Atan2((double) (point2.Y - point1.Y), (double) (point2.X - point1.X))) * 180f) / 3.141593f;
                        single17 = ((int) Math.Round((double) (single17 / 45f), 0)) * 0x2d;
                        if ((single17 != 90f) && (single17 != -90f))
                        {
                            single17 = (float) Math.Tan((single17 / 180f) * 3.1415926535897931);
                            point2 = new PointF(point2.X, point1.Y + ((int) ((point2.X - point1.X) * single17)));
                            break;
                        }
                        point2 = new PointF(point1.X, point2.Y);
                    }
                    break;
                }
                case ToolOperation.ConnectLine://������
                 {
                     if (((single8 < 1f) && (single9 < 1f)) ||connectBegin==null || connectEnd==null || connectBegin==connectEnd)
                     {
                         return null;
                     }
                    ConnectLine cline =graph2 as ConnectLine;
                    cline.SetAttribute("start","#"+connectBegin.ID+"."+connectBeginIndex);

                    cline.SetAttribute("end","#"+connectEnd.ID+"."+connectEndIndex);

                    connectBegin=null;
                    connectEnd =null;

                     break;
                 }
                case ToolOperation.PolyLine:
                case ToolOperation.XPolyLine:
                case ToolOperation.YPolyLine:
                case ToolOperation.FreeLines:
                case ToolOperation.Confines_GuoJie:
                case ToolOperation.Confines_ShengJie:
                case ToolOperation.Confines_ShiJie:
                case ToolOperation.Confines_XianJie:
                case ToolOperation.Confines_XiangJie:
                case ToolOperation.Railroad:
                case ToolOperation.LeadLine:
                {
                    if (this.drawPath != null)
                    {
                        PointF[] tfArray1 = this.drawPath.PathPoints;
                        PointF[] tfArray2 = new PointF[tfArray1.Length];
                        for (int num3 = 0; num3 < tfArray1.Length; num3++)
                        {
                            PointF tf1 = this.mouseAreaControl.PicturePanel.PointToView(tfArray1[num3]);
                            tf1 = new PointF(tf1.X, tf1.Y);
                            tfArray2[num3] = tf1;
                        }
                        ((Polyline) graph2).Points = tfArray2;
                    }
                    goto Label_0F08;
                }
                case ToolOperation.Polygon:
                case ToolOperation.Enclosure:
                case ToolOperation.InterEnclosure:
                case ToolOperation.AreaPolygon:
                {
                    if (this.drawPath != null)
                    {
                        PointF[] tfArray3 = this.drawPath.PathPoints;
                        PointF[] tfArray4 = new PointF[tfArray3.Length];
                        for (int num4 = 0; num4 < tfArray3.Length; num4++)
                        {
                            PointF tf2 = this.mouseAreaControl.PicturePanel.PointToView(tfArray3[num4]);
                            tf2 = new PointF(tf2.X, tf2.Y);
                            tfArray4[num4] = tf2;
                        }
                        ((Polygon) graph2).Points = tfArray4;
                    }
                    goto Label_0F08;
                }
                case ToolOperation.EqualPolygon:
                {
                    int num5 = 3;
                    num5 = Math.Max(3, ((Polygon) this.mouseAreaControl.PicturePanel.PreGraph).LineCount);
                    double num6 = 6.2831853071795862 / ((double) num5);
                    GraphicsPath path1 = new GraphicsPath();
                    double num7 = 0;
                    double num8 = 0;
                    double num9 = Math.Sqrt(Math.Pow((double) (point1.X - point2.X), 2) + Math.Pow((double) (point1.Y - point2.Y), 2));
                    float single18 = (float) Math.Round((double) ((Polygon) this.mouseAreaControl.PicturePanel.PreGraph).Indent, 1);
                    int num10 = num5;
                    if (single18 < 1f)
                    {
                        num10 = num5 * 2;
                    }
                    PointF[] tfArray5 = new PointF[num10];
                    if (num9 < 2)
                    {
                        return null;
                    }
                    if (num9 >= 2)
                    {
                        double num11 = Math.Asin(((double) (point2.Y - point1.Y)) / num9);
                        if (point2.X < point1.X)
                        {
                            num11 = 3.1415926535897931 - num11;
                        }
                        PointF tf3 = PointF.Empty;
                        for (int num13 = 0; num13 < num10; num13 += (num10 / num5))
                        {
                            double num12 = num11 + (num6 * (num13 / (num10 / num5)));
                            num7 = num9 * Math.Cos(num12);
                            num8 = num9 * Math.Sin(num12);
                            tfArray5[num13] = new PointF((float) (point1.X + ((int) num7)), (float) (point1.Y + ((int) num8)));
                            if (num10 == (2 * num5))
                            {
                                if (!tf3.IsEmpty)
                                {
                                    PointF tf4 = new PointF((tf3.X + tfArray5[num13].X) / 2f, (tf3.Y + tfArray5[num13].Y) / 2f);
                                    tf4 = new PointF((float) (point1.X + ((int) (single18 * (tf4.X - point1.X)))), (float) (point1.Y + ((int) (single18 * (tf4.Y - point1.Y)))));
                                    tfArray5[num13 - 1] = tf4;
                                }
                                tf3 = tfArray5[num13];
                                if (num13 == ((2 * num5) - 2))
                                {
                                    PointF tf5 = new PointF((tfArray5[0].X + tfArray5[num13].X) / 2f, (tfArray5[0].Y + tfArray5[num13].Y) / 2f);
                                    tf5 = new PointF((float) (point1.X + ((int) (single18 * (tf5.X - point1.X)))), (float) (point1.Y + ((int) (single18 * (tf5.Y - point1.Y)))));
                                    tfArray5[num13 + 1] = tf5;
                                }
                            }
                        }
                        string text1 = string.Empty;
                        for (int num14 = 0; num14 < tfArray5.Length; num14++)
                        {
                            PointF tf6 = tfArray5[num14];
                            text1 = text1 + tf6.X.ToString() + " " + tf6.Y.ToString();
                            if (num14 < (tfArray5.Length - 1))
                            {
                                text1 = text1 + ",";
                            }
                        }
                        AttributeFunc.SetAttributeValue((SvgElement) graph2, "points", text1);
                    }
                    goto Label_0F08;
                }
                case ToolOperation.Image:
                {
                    graph2=null;
                    if (this.showdialog && (this.filename != string.Empty))
                    {
                        graph2 = (ItopVector.Core.Figure.Image) document1.CreateElement(document1.Prefix, "image", document1.NamespaceURI);
                        ItopVector.Core.Figure.Image image1 = (ItopVector.Core.Figure.Image) graph2;
                        image1.X = single4;
                        image1.Y = single5;
                        image1.Width = single8;
                        image1.Height = single9;
                        image1.ImageUrl = this.filename;
                    }
                    goto Label_0F08;
                }
                case ToolOperation.PreShape:
                {
                    GraphicsPath path2 = PathFunc.GetPathFromGraph(this.mouseAreaControl.PicturePanel.PreGraph);
                    single4 = point1.X;
                    single5 = point1.Y;
                    single8 = point2.X - point1.X;
                    single9 = point2.Y - point1.Y;
                    if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
                    {
                        single8 = single9 = Math.Max(single8, single9);
                        single4 = ((point1.X - point2.X) < 0) ? ((float) point1.X) : (point1.X - single9);
                        single5 = ((point1.Y - point2.Y) < 0) ? ((float) point1.Y) : (point1.Y - single8);
                    }
                    if ((Math.Abs(single8) < 2f) || (Math.Abs(single9) < 2f))
                    {
                        return null;
                    }
                    path2.Flatten(new Matrix());
                    float single19 = single4;
                    float single20 = single5;
                    RectangleF ef2 = path2.GetBounds();
                    Matrix matrix1 = new Matrix();
                    matrix1.Translate(single19 - ef2.X, single20 - ef2.Y);
                    matrix1.Translate(ef2.X, ef2.Y);
                    matrix1.Scale(single8 / ef2.Width, single9 / ef2.Height);
                    matrix1.Translate(-ef2.X, -ef2.Y);
                    Transf transf1 = new Transf();
                    transf1.setMatrix(matrix1);
                    AttributeFunc.SetAttributeValue((SvgElement) graph2, "transform", transf1.ToString());
                    goto Label_0F08;
                }
                case ToolOperation.Pie:
                case ToolOperation.Arc:
                {

                    if (!this.pieRect.IsEmpty)
                    {
                        SvgElement element9 = graph2 as SvgElement;
                        startpoint = new PointF(this.pieRect.X + (this.pieRect.Width / 2f), this.pieRect.Y + (this.pieRect.Height / 2f));
                        PointF tf7 = this.mouseAreaControl.PicturePanel.PointToView(endpoint);
                        if (tf7 == lastPoint)
                        {
                            graph2 =null;
                            goto Label_0F08;
                        }
                        endpoint = this.lastPoint;
                        float single17 = this.startArcAngle;
                        float single18 = this.endArcAngle;
                        while (single18 > 360f)
                        {
                            single18 -= 360f;
                        }
                        float single19 = this.pieRect.Width / 2f;
                        float single20 = this.pieRect.Height / 2f;
                        float single21 = startpoint.X;
                        float single22 = startpoint.Y;
                        string text4 = (((single18 - single17) > 180f) || (single18 < single17)) ? "1" : "0";
                        single17 = (float) ((single17 / 180f) * 3.1415926535897931);
                        single18 = (float) ((single18 / 180f) * 3.1415926535897931);
                        PointF tf8 = this.GetCrossPoint(this.pieRect, startpoint, endpoint);
                        float single23 = tf8.X;
                        float single24 = tf8.Y;
                        tf8 = this.GetCrossPoint(this.pieRect, startpoint, tf7);
                        float single25 = tf8.X;
                        float single26 = tf8.Y;
                        string text5 = string.Concat(new string[] {
                                                                      "M", single21.ToString(), " ", single22.ToString(), "L", single23.ToString(), " ", single24.ToString(), "A", single19.ToString(), " ", single20.ToString(), " 0 ", text4, " 1 ", single25.ToString(),
                                                                      " ", single26.ToString(), "Z"
                                                                  });
                        if (operation ==ToolOperation.Arc)
                        {
                            text5 = string.Concat(new string[] { "M", single23.ToString(), " ", single24.ToString(), "A", single19.ToString(), " ", single20.ToString(), " 0 ", text4, " 1 ", single25.ToString(), " ", single26.ToString() });
                        }
                        element9.SetAttribute("d", text5);
                        graph2 = element9 as IGraph;
                        this.pieRect = RectangleF.Empty;
                    }
                    else
                    {
                        graph2 =null;
                    }
                    goto Label_0F08;
                }
                default:
                {
                    goto Label_0F08;
                }
            }
            Label_0F07:
                Line line1 = (Line) graph2;
            line1.X1 = point1.X;
            line1.Y1 = point1.Y;
            line1.X2 = point2.X;
            line1.Y2 = point2.Y;
            Label_0F08:
                this.mouseAreaControl.SVGDocument.AcceptChanges = flag1;
            return graph2;
        }
示例#16
0
 private MousePoint GetMousePoint(GraphicsPath path, PointF point, Matrix matrix, ToolOperation operation)
 {
     if (operation == ToolOperation.Flip)
     {
         this.currentMousePoint = MousePoint.Flip;
     }
     RectangleF ef1 = PathFunc.GetBounds(path);
     PointF[] tfArray1 = new PointF[9] { new PointF(ef1.X, ef1.Y), new PointF(ef1.X + (ef1.Width / 2f), ef1.Y), new PointF(ef1.Right, ef1.Y), new PointF(ef1.Right, ef1.Y + (ef1.Height / 2f)), new PointF(ef1.Right, ef1.Bottom), new PointF(ef1.X + (ef1.Width / 2f), ef1.Bottom), new PointF(ef1.X, ef1.Bottom), new PointF(ef1.X, ef1.Y + (ef1.Height / 2f)), new PointF(ef1.X + (ef1.Width / 2f), ef1.Y + (ef1.Height / 2f)) } ;
     this.ps = tfArray1;
     matrix.TransformPoints(this.ps);
     //			this.ps = this.ps;
     RectangleF ef2 = new RectangleF(this.ps[0].X - 2f, this.ps[0].Y - 2f, 5f, 5f);
     GraphicsPath path1 = new GraphicsPath();
     path1.AddRectangle(ef2);
     ef2 = new RectangleF(this.ps[2].X - 2f, this.ps[2].Y - 2f, 5f, 5f);
     GraphicsPath path2 = new GraphicsPath();
     path2.AddRectangle(ef2);
     ef2 = new RectangleF(this.ps[1].X - 2f, this.ps[1].Y - 2f, 5f, 5f);
     GraphicsPath path3 = new GraphicsPath();
     path3.AddRectangle(ef2);
     ef2 = new RectangleF(this.ps[7].X - 2f, this.ps[7].Y - 2f, 5f, 5f);
     GraphicsPath path4 = new GraphicsPath();
     path4.AddRectangle(ef2);
     ef2 = new RectangleF(this.ps[6].X - 2f, this.ps[6].Y - 2f, 5f, 5f);
     GraphicsPath path5 = new GraphicsPath();
     path5.AddRectangle(ef2);
     ef2 = new RectangleF(this.ps[3].X - 2f, this.ps[3].Y - 2f, 5f, 5f);
     GraphicsPath path6 = new GraphicsPath();
     path6.AddRectangle(ef2);
     ef2 = new RectangleF(this.ps[5].X - 3f, this.ps[5].Y - 2f, 5f, 5f);
     GraphicsPath path7 = new GraphicsPath();
     path7.AddRectangle(ef2);
     ef2 = new RectangleF(this.ps[4].X - 2f, this.ps[4].Y - 2f, 5f, 5f);
     GraphicsPath path8 = new GraphicsPath();
     path8.AddRectangle(ef2);
     GraphicsPath path9 = new GraphicsPath();
     path9.AddLine(this.ps[0], this.ps[6]);
     GraphicsPath path10 = new GraphicsPath();
     path10.AddLine(this.ps[2], this.ps[4]);
     GraphicsPath path11 = new GraphicsPath();
     path11.AddLine(this.ps[0], this.ps[2]);
     GraphicsPath path12 = new GraphicsPath();
     path12.AddLine(this.ps[6], this.ps[4]);
     GraphicsPath path13 = new GraphicsPath();
     path13.AddRectangle(new RectangleF(this.ps[0].X - 5f, this.ps[0].Y - 5f, 8f, 8f));
     GraphicsPath path14 = new GraphicsPath();
     path14.AddRectangle(new RectangleF(this.ps[2].X - 2f, this.ps[2].Y - 5f, 8f, 8f));
     GraphicsPath path15 = new GraphicsPath();
     path15.AddRectangle(new RectangleF(this.ps[4].X - 3f, this.ps[4].Y - 3f, 8f, 8f));
     GraphicsPath path16 = new GraphicsPath();
     path16.AddRectangle(new RectangleF(this.ps[6].X - 2f, this.ps[6].Y - 5f, 8f, 8f));
     PointF tf1 = this.mouseAreaControl.CenterPoint;
     GraphicsPath path17 = new GraphicsPath();
     if (!tf1.IsEmpty)
     {
         path17.AddEllipse((float) (tf1.X - 3f), (float) (tf1.Y - 3f), (float) 6f, (float) 6f);
     }
     RectangleF ef3 = new RectangleF(point.X - 1f, point.Y - 1f, 2f, 2f);
     GraphicsPath path18 = (GraphicsPath) path.Clone();
     path.Transform(matrix);
     Pen pen1 = new Pen(Color.Blue, 3f);
     pen1.Alignment = PenAlignment.Center;
     MousePoint point1 = MousePoint.None;
     if (OperationFunc.IsSelectOperation(operation))
     {
         ToolOperation operation1 = operation;
         if ((operation1==ToolOperation.Exceptant)||(operation1 == ToolOperation.Select) && (path.IsVisible(point) || path.IsOutlineVisible(point, pen1)))
         {
             return MousePoint.Translate;
         }
     }
     else if (OperationFunc.IsTransformOperation(operation))
     {
         //				if (path17.IsVisible(point) || path17.IsOutlineVisible(point, pen1))
         //				{
         //					point1 = MousePoint.CenterPoint;
         //				}
         //				else
         if (path1.IsVisible(point) || path1.IsOutlineVisible(point, pen1))
         {
             point1 = MousePoint.ScaleTopLeft;
         }
         else if (path3.IsVisible(point) || path3.IsOutlineVisible(point, pen1))
         {
             point1 = MousePoint.ScaleTopMiddle;
         }
         else if (path2.IsVisible(point) || path2.IsOutlineVisible(point, pen1))
         {
             point1 = MousePoint.ScaleTopRight;
         }
         else if (path4.IsVisible(point) || path4.IsOutlineVisible(point, pen1))
         {
             point1 = MousePoint.ScaleMiddleLeft;
         }
         else if (path6.IsVisible(point) || path6.IsOutlineVisible(point, pen1))
         {
             point1 = MousePoint.ScaleMiddleRight;
         }
         else if (path5.IsVisible(point) || path5.IsOutlineVisible(point, pen1))
         {
             point1 = MousePoint.ScaleBottomLeft;
         }
         else if (path7.IsVisible(point) || path7.IsOutlineVisible(point, pen1))
         {
             point1 = MousePoint.ScaleBottomMiddle;
         }
         else if (path8.IsVisible(point) || path8.IsOutlineVisible(point, pen1))
         {
             point1 = MousePoint.ScaleBottomRight;
         }
         else
         {
             if (path9.IsVisible(point) || path9.IsOutlineVisible(point, pen1))
             {
                 return MousePoint.SkewYLeft;
             }
             if (path10.IsVisible(point) || path10.IsOutlineVisible(point, pen1))
             {
                 point1 = MousePoint.SkewYRight;
             }
             else if (path11.IsVisible(point) || path11.IsOutlineVisible(point, pen1))
             {
                 point1 = MousePoint.SkewXTop;
             }
             else if (path12.IsVisible(point) || path12.IsOutlineVisible(point, pen1))
             {
                 point1 = MousePoint.SkewXBottom;
             }
             else if (path13.IsVisible(point) || path13.IsOutlineVisible(point, pen1))
             {
                 this.rotateindex = 6;
                 point1 = MousePoint.Rotate;
             }
             else if (path14.IsVisible(point) || path14.IsOutlineVisible(point, pen1))
             {
                 this.rotateindex = 2;
                 point1 = MousePoint.Rotate;
             }
             else if (path15.IsVisible(point) || path15.IsOutlineVisible(point, pen1))
             {
                 this.rotateindex = 0;
                 point1 = MousePoint.Rotate;
             }
             else if (path16.IsVisible(point) || path16.IsOutlineVisible(point, pen1))
             {
                 this.rotateindex = 4;
                 point1 = MousePoint.Rotate;
             }
             else if (path.IsVisible(point))// || path.IsOutlineVisible(point,pen1))
             {
                 point1 = MousePoint.Translate;
             }
         }
         if (point1 != MousePoint.CenterPoint)
         {
             if (operation == ToolOperation.Rotate)
             {
                 if ((point1 == MousePoint.Rotate) || (point1 == MousePoint.Translate))
                 {
                     point1 = point1;
                 }
                 else
                 {
                     point1 = MousePoint.None;
                 }
             }
             else if (operation == ToolOperation.Scale)
             {
                 if ((((point1 == MousePoint.ScaleBottomLeft) || (point1 == MousePoint.ScaleBottomMiddle)) || ((point1 == MousePoint.ScaleBottomMiddle) || (point1 == MousePoint.ScaleBottomRight))) || ((((point1 == MousePoint.ScaleMiddleLeft) || (point1 == MousePoint.ScaleMiddleRight)) || ((point1 == MousePoint.ScaleTopLeft) || (point1 == MousePoint.ScaleTopMiddle))) || ((point1 == MousePoint.ScaleTopRight) || (point1 == MousePoint.Translate))))
                 {
                     point1 = point1;
                 }
                 else
                 {
                     point1 = MousePoint.None;
                 }
             }
             else if (operation == ToolOperation.Skew)
             {
                 if (((point1 == MousePoint.SkewXBottom) || (point1 == MousePoint.SkewXTop)) || (((point1 == MousePoint.SkewYLeft) || (point1 == MousePoint.SkewYRight)) || (point1 == MousePoint.Translate)))
                 {
                     point1 = point1;
                 }
                 else
                 {
                     point1 = MousePoint.None;
                 }
             }
         }
     }
     //            this.mouseAreaControl.Invalidate();
     return point1;
 }
示例#17
0
 public static bool IsViewOperation(ToolOperation operation)
 {
     switch (operation)
     {
         case ToolOperation.Roam:
         case ToolOperation.IncreaseView:
         case ToolOperation.DecreaseView:
         {
             return true;
         }
     }
     return false;
 }
示例#18
0
 public static bool IsTransformOperation(ToolOperation operation)
 {
     switch (operation)
     {
         case ToolOperation.FreeTransform:
         case ToolOperation.Rotate:
         case ToolOperation.Scale:
         {
             return true;
         }
     }
     return false;
 }
示例#19
0
 public static bool IsSelectOperation(ToolOperation operation)
 {
     switch (operation)
     {
         case ToolOperation.Select:
         case ToolOperation.ShapeTransform:
         case ToolOperation.Custom11:
         case ToolOperation.Custom12:
         case ToolOperation.Custom13:
         case ToolOperation.Custom14:
         case ToolOperation.Custom15:
         case ToolOperation.ColorSelect:
         case ToolOperation.AreaSelect:
         case ToolOperation.WindowZoom:
         case ToolOperation.Exceptant:
         {
             return true;
         }
     }
     return false;
 }
示例#20
0
        private IGraph CreateGraph(Point startpoint, Point endpoint, ToolOperation operation)
        {
            SvgDocument document1 = this.mouseAreaControl.SVGDocument;
            if (document1 == null)
            {
                return null;
            }
            bool flag1 = document1.AcceptChanges;
            document1.AcceptChanges = false;
            IGraph graph1 = this.mouseAreaControl.PicturePanel.PreGraph;
            if (graph1 == null)
            {
                return null;
            }
            IGraph graph2 = (IGraph) ((SvgElement) graph1).Clone();
            //			Point point1 = this.mouseAreaControl.PicturePanel.PointToView(startpoint);
            //			Point point2 = this.mouseAreaControl.PicturePanel.PointToView(endpoint);
            //			float single1 = this.mouseAreaControl.PicturePanel.ScaleUnit;
            //			SizeF ef1 = this.mouseAreaControl.PicturePanel.GridSize;
            //			float single2 = ef1.Height;
            //			float single3 = ef1.Width;
            //			if (this.mouseAreaControl.PicturePanel.SnapToGrid)
            //			{
            //				int num1 = (int) ((point1.X + (single3 / 2f)) / single3);
            //				int num2 = (int) ((point1.Y + (single2 / 2f)) / single2);
            //				point1 = new Point((int) (num1 * single3), (int) (num2 * single2));
            //				num1 = (int) ((point2.X + (single3 / 2f)) / single3);
            //				num2 = (int) ((point2.Y + (single2 / 2f)) / single2);
            //				point2 = new Point((int) (num1 * single3), (int) (single2 * num2));
            //			}
            //			float single4 = Math.Min(point1.X, point2.X);
            //			float single5 = Math.Min(point1.Y, point2.Y);
            //			float single6 = Math.Max(point1.X, point2.X);
            //			float single7 = Math.Max(point1.Y, point2.Y);
            //			float single8 = single6 - single4;
            //			float single9 = single7 - single5;

            this.mouseAreaControl.SVGDocument.AcceptChanges = flag1;
            return graph2;
        }
示例#21
0
        private void CreateDrawPath(PointF startpoint, PointF endpoint, ToolOperation operation)
        {
            SizeF ef1 = this.mouseAreaControl.PicturePanel.GridSize;
            startpoint = this.mouseAreaControl.PicturePanel.PointToView(startpoint);
            endpoint = this.mouseAreaControl.PicturePanel.PointToView(endpoint);
            float single1 = ef1.Height;
            float single2 = ef1.Width;
            if (this.mouseAreaControl.PicturePanel.SnapToGrid)
            {
                int num1 = (int) ((startpoint.X + (single2 / 2f)) / single2);
                int num2 = (int) ((startpoint.Y + (single1 / 2f)) / single1);
                startpoint = new Point((int) (num1 * single2), (int) (num2 * single1));
                num1 = (int) ((endpoint.X + (single2 / 2f)) / single2);
                num2 = (int) ((endpoint.Y + (single1 / 2f)) / single1);
                endpoint = new Point((int) (num1 * single2), (int) (single1 * num2));
            }
            GraphicsPath path1 = new GraphicsPath();
            float single3 = Math.Min(startpoint.X, endpoint.X);
            float single4 = Math.Min(startpoint.Y, endpoint.Y);
            float single5 = Math.Max(startpoint.X, endpoint.X);
            float single6 = Math.Max(startpoint.Y, endpoint.Y);
            float single7 = single5 - single3;
            float single8 = single6 - single4;
            float single9 = 0f;
            float single10 = 0f;
            float single11 = 0f;
            float single12 = 0f;
            switch (operation)
            {
                case ToolOperation.AngleRectangle:
                case ToolOperation.InterEnclosurePrint:
                {
                    single12 = 0f;
                    single12 = Math.Max(0, ((ItopVector.Core.Figure.RectangleElement) this.mouseAreaControl.PicturePanel.PreGraph).Angle);
                    single10 = single12;
                    single11 = single12;
                    if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
                    {
                        single7 = single8 = Math.Max(single7, single8);
                        single3 = ((startpoint.X - endpoint.X) < 0) ? ((float) startpoint.X) : (startpoint.X - single8);
                        single4 = ((startpoint.Y - endpoint.Y) < 0) ? ((float) startpoint.Y) : (startpoint.Y - single7);
                    }
                    if (single7 < 5f)
                    {
                        return;
                    }
                    if (single8 < 5f)
                    {
                        return;
                    }
                    if (single10 > (single7 / 2f))
                    {
                        single10 = single7;
                    }
                    if (single11 > (single8 / 2f))
                    {
                        single11 = single8;
                    }
                    if ((single10 == 0f) && (single11 == 0f))
                    {
                        path1.AddRectangle(new RectangleF(single3, single4, single7, single8));
                        goto Label_0B89;
                    }
                    path1.AddArc((float) ((single3 + single7) - single10), single4, single10, single11, (float) 270f, (float) 90f);
                    path1.AddArc((float) ((single3 + single7) - single10), (float) ((single4 + single8) - single11), single10, single11, (float) 0f, (float) 90f);
                    path1.AddArc(single3, (float) ((single4 + single8) - single11), single10, single11, (float) 90f, (float) 90f);
                    path1.AddArc(single3, single4, single10, single11, (float) 180f, (float) 90f);
                    path1.CloseFigure();
                    goto Label_0B89;
                }
                case ToolOperation.Circle:
                case ToolOperation.Bezier:
                case ToolOperation.FreeLines:
                case ToolOperation.Text:
                {
                    goto Label_0B89;
                }
                case ToolOperation.Ellipse:
                case ToolOperation.Pie:
                case ToolOperation.Arc:
                {
                    if (this.secondMouse)
                    {
                        if (!this.pieRect.IsEmpty)
                        {
                            startpoint = new PointF(this.pieRect.X + (this.pieRect.Width / 2f), this.pieRect.Y + (this.pieRect.Height / 2f));
                            PointF tf1 = endpoint;
                            endpoint = this.lastPoint;
                            float single13 = GetAngle(startpoint, endpoint);
                            float single14 = GetAngle(startpoint, tf1);
                            single14 -= single13;
                            if (single14 <= 0f)
                            {
                                single14 += 360f;
                            }
                            if (single14 == 360f)
                            {
                                path1.AddEllipse(this.pieRect.X, this.pieRect.Y, this.pieRect.Width, this.pieRect.Height);
                            }
                            else
                            {
                                path1.AddPie(this.pieRect.X, this.pieRect.Y, this.pieRect.Width, this.pieRect.Height, single13, single14);
                            }
                            this.startArcAngle = single13;
                            this.endArcAngle = single14 + single13;
                        }
                        goto Label_0B89;
                    }
                    this.lastPoint = endpoint;
                    if (Control.ModifierKeys == Keys.Shift)
                    {
                        single9 = Math.Max((float) (single5 - single3), (float) (single6 - single4));
                        path1.AddEllipse(((startpoint.X - endpoint.X) < 0) ? ((float) startpoint.X) : (startpoint.X - single9), ((startpoint.Y - endpoint.Y) < 0) ? ((float) startpoint.Y) : (startpoint.Y - single9), single9, single9);

                    }
                    else if (Control.ModifierKeys == (Keys.Control | Keys.Shift))
                    {
                        single9 = Math.Max((float) (single5 - single3), (float) (single6 - single4));
                        single3 = startpoint.X - single9;
                        single4 = startpoint.Y - single9;
                        path1.AddEllipse(single3, single4, (float) (2f * single9), (float) (2f * single9));
                    }
                    else
                    {
                        if (Control.ModifierKeys == Keys.Control)
                        {
                            single3 = startpoint.X - Math.Abs((int) (endpoint.X - startpoint.X));
                            single4 = startpoint.Y - Math.Abs((int) (endpoint.Y - startpoint.Y));
                            single7 = Math.Abs((int) (endpoint.X - startpoint.X)) * 2f;
                            single8 = Math.Abs((int) (endpoint.Y - startpoint.Y)) * 2f;
                        }
                        path1.AddEllipse(single3, single4, single7, single8);
                    }
                    this.pieRect = path1.GetBounds();
                    goto Label_0B89;
                }
                    //				case SVGDeveloper.Base.Enum.Operator.Pie:
                    //				case SVGDeveloper.Base.Enum.Operator.Arc:
                    //				 {
                    //					 if (this.secondMouse)
                    //					 {
                    //						 goto Label_061B;
                    //					 }
                    //					 this.lastPoint = endpoint;
                    //					 if (Control.ModifierKeys == Keys.Shift)
                    //					 {
                    //						 single7 = Math.Max((float) (single3 - single1), (float) (single4 - single2));
                    //						 path1.AddEllipse(((startpoint.X - endpoint.X) < 0f) ? startpoint.X : (startpoint.X - single7), ((startpoint.Y - endpoint.Y) < 0f) ? startpoint.Y : (startpoint.Y - single7), single7, single7);
                    //					 }
                    //					 else if (Control.ModifierKeys == (Keys.Control | Keys.Shift))
                    //					 {
                    //						 single7 = Math.Max((float) (single3 - single1), (float) (single4 - single2));
                    //						 single1 = startpoint.X - single7;
                    //						 single2 = startpoint.Y - single7;
                    //						 path1.AddEllipse(single1, single2, 2f * single7, 2f * single7);
                    //					 }
                    //					 else
                    //					 {
                    //						 if (Control.ModifierKeys == Keys.Control)
                    //						 {
                    //							 single1 = startpoint.X - Math.Abs((float) (endpoint.X - startpoint.X));
                    //							 single2 = startpoint.Y - Math.Abs((float) (endpoint.Y - startpoint.Y));
                    //							 single5 = Math.Abs((float) (endpoint.X - startpoint.X)) * 2f;
                    //							 single6 = Math.Abs((float) (endpoint.Y - startpoint.Y)) * 2f;
                    //						 }
                    //						 path1.AddEllipse(single1, single2, single5, single6);
                    //					 }
                    //					 this.pieRect = path1.GetBounds();
                    //					 goto Label_0ECF;
                    //				 }
                case ToolOperation.Line:
                {
                    if ((Math.Abs((int) (startpoint.X - endpoint.X)) <= 2) && (Math.Abs((int) (startpoint.Y - endpoint.Y)) <= 2))
                    {
                        goto Label_0B89;
                    }
                    if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
                    {
                        float single13 = (((float) Math.Atan2((double) (endpoint.Y - startpoint.Y), (double) (endpoint.X - startpoint.X))) * 180f) / 3.141593f;
                        single13 = ((int) Math.Round((double) (single13 / 45f), 0)) * 0x2d;
                        if ((single13 != 90f) && (single13 != -90f))
                        {
                            single13 = (float) Math.Tan((single13 / 180f) * 3.1415926535897931);
                            endpoint = new PointF(endpoint.X, startpoint.Y + ((int) ((endpoint.X - startpoint.X) * single13)));
                            break;
                        }
                        endpoint = new PointF(startpoint.X, endpoint.Y);
                    }
                    break;
                }
                case ToolOperation.ConnectLine:
                {
            //					if ((Math.Abs((int) (startpoint.X - endpoint.X)) <= 2) && (Math.Abs((int) (startpoint.Y - endpoint.Y)) <= 2))
            //					{
            //						goto Label_0B89;
            //					}
            //					if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
            //					{
            //						float single13 = (((float) Math.Atan2((double) (endpoint.Y - startpoint.Y), (double) (endpoint.X - startpoint.X))) * 180f) / 3.141593f;
            //						single13 = ((int) Math.Round((double) (single13 / 45f), 0)) * 0x2d;
            //						if ((single13 != 90f) && (single13 != -90f))
            //						{
            //							single13 = (float) Math.Tan((single13 / 180f) * 3.1415926535897931);
            //							endpoint = new PointF(endpoint.X, startpoint.Y + ((int) ((endpoint.X - startpoint.X) * single13)));
            //							break;
            //						}
            //						endpoint = new PointF(startpoint.X, endpoint.Y);
            //					}
                    break;
                }
                case ToolOperation.PolyLine:
                case ToolOperation.XPolyLine:
                case ToolOperation.YPolyLine:
                case ToolOperation.Confines_GuoJie:
                case ToolOperation.Confines_ShengJie:
                case ToolOperation.Confines_ShiJie:
                case ToolOperation.Confines_XianJie:
                case ToolOperation.Confines_XiangJie:
                case ToolOperation.Railroad:
                case ToolOperation.Polygon:
                case ToolOperation.Enclosure:
                case ToolOperation.InterEnclosure:
                case ToolOperation.AreaPolygon:
                case ToolOperation.LeadLine:
                {
                    if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
                    {
                        float single14 = (((float) Math.Atan2((double) (endpoint.Y - startpoint.Y), (double) (endpoint.X - startpoint.X))) * 180f) / 3.141593f;
                        single14 = ((int) Math.Round((double) (single14 / 45f), 0)) * 0x2d;
                        if ((single14 != 90f) && (single14 != -90f))
                        {
                            single14 = (float) Math.Tan((single14 / 180f) * 3.1415926535897931);
                            endpoint = new PointF(endpoint.X, startpoint.Y + ((int) ((endpoint.X - startpoint.X) * single14)));
                        }
                        else
                        {
                            endpoint = new PointF(startpoint.X, endpoint.Y);
                        }
                    }
                    path1.AddLine(startpoint, endpoint);
                    goto Label_0B89;
                }
                case ToolOperation.EqualPolygon:
                {
                    int num3 = 3;
                    num3 = Math.Max(3, ((Polygon) this.mouseAreaControl.PicturePanel.PreGraph).LineCount);
                    double num4 = 6.2831853071795862 / ((double) num3);
                    GraphicsPath path2 = new GraphicsPath();
                    double num5 = 0;
                    double num6 = 0;
                    double num7 = Math.Sqrt(Math.Pow((double) (startpoint.X - endpoint.X), 2) + Math.Pow((double) (startpoint.Y - endpoint.Y), 2));
                    float single15 = (float) Math.Round((double) ((Polygon) this.mouseAreaControl.PicturePanel.PreGraph).Indent, 1);
                    int num8 = num3;
                    if (single15 < 1f)
                    {
                        num8 = num3 * 2;
                    }
                    Point[] pointArray1 = new Point[num8];
                    if (num7 >= 2)
                    {
                        double num9 = Math.Asin(((double) (endpoint.Y - startpoint.Y)) / num7);
                        if (endpoint.X < startpoint.X)
                        {
                            num9 = 3.1415926535897931 - num9;
                        }
                        Point point1 = Point.Empty;
                        for (int num11 = 0; num11 < num8; num11 += (num8 / num3))
                        {
                            double num10 = num9 + (num4 * (num11 / (num8 / num3)));
                            num5 = num7 * Math.Cos(num10);
                            num6 = num7 * Math.Sin(num10);
                            pointArray1[num11] = new Point((int)startpoint.X + ((int) num5),(int) startpoint.Y + ((int) num6));
                            if (num8 == (2 * num3))
                            {
                                if (!point1.IsEmpty)
                                {
                                    Point point2 = new Point((point1.X + pointArray1[num11].X) / 2, (point1.Y + pointArray1[num11].Y) / 2);
                                    point2 = new Point((int)startpoint.X + ((int) (single15 * (point2.X - startpoint.X))), (int)startpoint.Y + ((int) (single15 * (point2.Y - startpoint.Y))));
                                    pointArray1[num11 - 1] = point2;
                                }
                                point1 = pointArray1[num11];
                                if (num11 == ((2 * num3) - 2))
                                {
                                    Point point3 = new Point((pointArray1[0].X + pointArray1[num11].X) / 2, (pointArray1[0].Y + pointArray1[num11].Y) / 2);
                                    point3 = new Point((int)startpoint.X + ((int) (single15 * (point3.X - startpoint.X))), (int)startpoint.Y + ((int) (single15 * (point3.Y - startpoint.Y))));
                                    pointArray1[num11 + 1] = point3;
                                }
                            }
                        }
                        path1.AddPolygon(pointArray1);
                        path1.StartFigure();
                        path1.AddLine(startpoint, endpoint);
                    }
                    goto Label_0B89;
                }
                case ToolOperation.Image:
                {
                    if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
                    {
                        single7 = single8 = Math.Min(single7, single8);
                    }
                    path1.AddRectangle(new RectangleF(single3, single4, single7, single8));
                    goto Label_0B89;
                }
                case ToolOperation.PreShape:
                {
                    if (this.first)
                    {
                        this.reversePath = PathFunc.GetPathFromGraph(this.mouseAreaControl.PicturePanel.PreGraph);
                        this.reversePath.Transform(this.mouseAreaControl.PicturePanel.CoordTransform);
                        this.first = false;
                    }
                    GraphicsPath path3 = (GraphicsPath) this.reversePath.Clone();
                    single3 = startpoint.X;
                    single4 = startpoint.Y;
                    single7 = endpoint.X - startpoint.X;
                    single8 = endpoint.Y - startpoint.Y;
                    if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
                    {
                        single7 = single8 = Math.Max(single7, single8);
                        single3 = ((startpoint.X - endpoint.X) < 0) ? ((float) startpoint.X) : (startpoint.X - single8);
                        single4 = ((startpoint.Y - endpoint.Y) < 0) ? ((float) startpoint.Y) : (startpoint.Y - single7);
                    }
                    if (Math.Abs(single7) < 2f)
                    {
                        return;
                    }
                    if (Math.Abs(single8) < 2f)
                    {
                        return;
                    }
                    path3.Flatten(new Matrix());
                    float single16 = single3;
                    float single17 = single4;
                    RectangleF ef2 = path3.GetBounds();
                    Matrix matrix1 = new Matrix();
                    matrix1.Translate(single16 - ef2.X, single17 - ef2.Y);
                    matrix1.Translate(ef2.X, ef2.Y);
                    matrix1.Scale(single7 / ef2.Width, single8 / ef2.Height);
                    matrix1.Translate(-ef2.X, -ef2.Y);
                    path1 = (GraphicsPath) this.reversePath.Clone();
                    path1.Transform(matrix1);
                    goto Label_0B89;
                }

                default:
                {
                    goto Label_0B89;
                }
            }
            path1.AddLine(startpoint, endpoint);
            Label_0B89:
                path1.Transform(this.mouseAreaControl.PicturePanel.CoordTransform);
            this.tempPath = path1;
        }
示例#22
0
        public void OnPaint(PaintEventArgs e)
        {
            e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
            ToolOperation operation1 = this.mouseAreaControl.CurrentOperation;
            SvgElement    element1   = this.mouseAreaControl.SVGDocument.CurrentElement;

            if (((operation1 == ToolOperation.GradientTransform) && (element1 is ISvgBrush)) && ((this.activeGraph != null) && !this.mouseAreaControl.SVGDocument.PlayAnim))
            {
                ISvgBrush  brush1 = (ISvgBrush)this.mouseAreaControl.SVGDocument.CurrentElement;
                RectangleF ef1    = RectangleF.Empty;
                if (!(brush1 is SolidColor))
                {
                    GraphicsPath path1    = new GraphicsPath();
                    PointF       tf1      = PointF.Empty;
                    PointF       tf2      = PointF.Empty;
                    PointF       tf3      = PointF.Empty;
                    PointF       tf4      = PointF.Empty;
                    PointF       tf5      = PointF.Empty;
                    PointF       tf6      = PointF.Empty;
                    PointF       tf7      = PointF.Empty;
                    PointF       tf8      = PointF.Empty;
                    PointF[]     tfArray1 = new PointF[1];
                    this.ratiomatrix.Reset();
                    this.gradientPath.Reset();
                    if (brush1 is LinearGradient)
                    {
                        LinearGradient gradient1 = (LinearGradient)brush1;
                        this.gradientPath  = (GraphicsPath)gradient1.GradientPath.Clone();
                        this.controlPoints = (PointF[])gradient1.BoundsPoints.Clone();
                        if (this.controlPoints.Length <= 0)
                        {
                            return;
                        }
                        this.graphMatrix = this.activeGraph.GraphTransform.Matrix.Clone();
                        this.graphMatrix.Multiply(gradient1.Coord);
                        this.gradientMatrix = gradient1.Transform.Matrix.Clone();
                        this.gradientPath.Transform(this.gradientMatrix);
                        this.gradientPath.Transform(this.graphMatrix);
                        e.Graphics.DrawPath(Pens.Black, this.gradientPath);
                        this.centerPoint = this.controlPoints[0];
                        this.gradientMatrix.TransformPoints(this.controlPoints);
                        this.graphMatrix.TransformPoints(this.controlPoints);
                        tf3 = this.controlPoints[0];
                        tf2 = this.controlPoints[1];
                        tf1 = this.controlPoints[2];
                        this.gradientPath = (GraphicsPath)gradient1.GradientPath.Clone();
                    }
                    else if (brush1 is RadialGradients)
                    {
                        RadialGradients gradients1 = (RadialGradients)brush1;
                        this.gradientPath  = (GraphicsPath)gradients1.GradientPath.Clone();
                        this.controlPoints = (PointF[])gradients1.BoundsPoints.Clone();
                        this.graphMatrix   = this.activeGraph.GraphTransform.Matrix.Clone();
                        this.graphMatrix.Multiply(gradients1.Coord);
                        this.gradientMatrix = gradients1.Transform.Matrix.Clone();
                        this.gradientPath.Transform(this.gradientMatrix);
                        this.gradientPath.Transform(this.graphMatrix);
                        e.Graphics.DrawPath(Pens.Black, this.gradientPath);
                        RectangleF ef3 = PathFunc.GetBounds(this.gradientPath);
                        this.gradientheight = ef3.Height;
                        this.centerPoint    = this.controlPoints[0];
                        this.gradientMatrix.TransformPoints(this.controlPoints);
                        this.graphMatrix.TransformPoints(this.controlPoints);
                        tf3 = this.controlPoints[0];
                        tf2 = this.controlPoints[2];
                        tf1 = this.controlPoints[3];
                        tf4 = this.controlPoints[1];
                        this.gradientPath = (GraphicsPath)gradients1.GradientPath.Clone();
                    }
                    else if (brush1 is Pattern)
                    {
                        Pattern pattern1 = (Pattern)brush1;
                        this.gradientPath = (GraphicsPath)pattern1.GradientPath.Clone();
                        RectangleF ef2 = this.gradientPath.GetBounds();
                        this.controlPoints  = (PointF[])pattern1.BoundsPoints.Clone();
                        this.graphMatrix    = this.activeGraph.GraphTransform.Matrix.Clone();
                        this.gradientMatrix = pattern1.Transform.Matrix.Clone();
                        this.gradientPath.Transform(this.gradientMatrix);
                        this.gradientPath.Transform(this.graphMatrix);
                        e.Graphics.DrawPath(Pens.Black, this.gradientPath);
                        RectangleF ef4 = PathFunc.GetBounds(this.gradientPath);
                        this.gradientheight = ef4.Height;
                        this.centerPoint    = this.controlPoints[0];
                        this.gradientMatrix.TransformPoints(this.controlPoints);
                        this.graphMatrix.TransformPoints(this.controlPoints);
                        tf3 = this.controlPoints[0];
                        tf1 = this.controlPoints[2];
                        tf7 = this.controlPoints[6];
                        tf5 = this.controlPoints[3];
                        tf6 = this.controlPoints[4];
                        tf2 = this.controlPoints[1];
                        tf8 = this.controlPoints[5];
                        this.gradientPath = (GraphicsPath)pattern1.GradientPath.Clone();
                    }
                    this.translatePath.Reset();
                    PointF[] tfArray2 = new PointF[4] {
                        new PointF(tf3.X, tf3.Y - 4f), new PointF(tf3.X - 4f, tf3.Y), new PointF(tf3.X, tf3.Y + 4f), new PointF(tf3.X + 4f, tf3.Y)
                    };
                    this.translatePath.AddPolygon(tfArray2);
                    e.Graphics.FillPath(Brushes.White, this.translatePath);
                    e.Graphics.DrawPath(Pens.Black, this.translatePath);
                    this.rotatePath.Reset();
                    this.rotatePath.AddEllipse((float)(tf1.X - 3f), (float)(tf1.Y - 3f), (float)6f, (float)6f);
                    this.scalePath.Reset();
                    this.scalePath.AddRectangle(new RectangleF(tf2.X - 3f, tf2.Y - 3f, 6f, 6f));
                    this.equalPath.Reset();
                    this.equalPath.AddEllipse((float)(tf4.X - 3f), (float)(tf4.Y - 3f), (float)6f, (float)6f);
                    this.skewxPath.Reset();
                    this.skewxPath.AddEllipse((float)(tf5.X - 3f), (float)(tf5.Y - 3f), (float)6f, (float)6f);
                    this.skewyPath.Reset();
                    this.skewyPath.AddEllipse((float)(tf6.X - 3f), (float)(tf6.Y - 3f), (float)6f, (float)6f);
                    this.anglescalePath.Reset();
                    this.anglescalePath.AddRectangle(new RectangleF(tf7.X - 3f, tf7.Y - 3f, 6f, 6f));
                    this.vscalPath.Reset();
                    this.vscalPath.AddRectangle(new RectangleF(tf8.X - 3f, tf8.Y - 3f, 6f, 6f));
                    e.Graphics.FillPath(Brushes.White, this.rotatePath);
                    e.Graphics.DrawPath(Pens.Black, this.rotatePath);
                    e.Graphics.FillPath(Brushes.White, this.scalePath);
                    e.Graphics.DrawPath(Pens.Black, this.scalePath);
                    e.Graphics.FillPath(Brushes.White, this.equalPath);
                    e.Graphics.DrawPath(Pens.Black, this.equalPath);
                    e.Graphics.FillPath(Brushes.White, this.skewxPath);
                    e.Graphics.DrawPath(Pens.Black, this.skewxPath);
                    e.Graphics.FillPath(Brushes.White, this.skewyPath);
                    e.Graphics.DrawPath(Pens.Black, this.skewyPath);
                    e.Graphics.FillPath(Brushes.White, this.anglescalePath);
                    e.Graphics.DrawPath(Pens.Black, this.anglescalePath);
                    e.Graphics.FillPath(Brushes.White, this.vscalPath);
                    e.Graphics.DrawPath(Pens.Black, this.vscalPath);
                }
            }
        }
示例#23
0
        // Methods
        public DrawArea()
        {
            this.components = null;
            this.mouseAreaControl = null;
            this.pageSetting = new PageSettings();
            this.drawMode = DrawModeType.ScreenImage;
            this.virtualLeft = 0f;
            this.virtualTop = 0f;
            this.scale = 1f;
            this.coordTransform = new Matrix();
            this.viewSize = new SizeF(500f, 500f);
            this.showGrid = true;
            this.showRule = true;
            this.showGuides = false;
            this.lockGuides = false;
            this.gridSize = new SizeF(10f, 10f);
            this.firstload = true;
            this.operation = ToolOperation.None;

            this.centerPoint = PointF.Empty;
            this.oldpoint = Point.Empty;
            this.prepathchanged = false;
            this.preGraph = null;
            this.UpdateRule = true;
            this.RefLines = new ArrayList(0x10);
            this.SnapToGrid = false;
            this.SnapToGuides = false;
            this.PreTextSelect = new SvgElementCollection();
            this.InitializeComponent();
            this.viewer.drawArea = this;
            this.margin = Size.Round(this.viewer.margin);
            this.mouseAreaControl.Focus();
            this.mouseAreaControl.PicturePanel = this;
            this.mouseAreaControl.DragAndDrop+=new DragEventHandler(mouseAreaControl_DragDrop);
            this.FillBrush = new SolidColor(Color.White);
            this.stroke = new Stroke(new SolidColor(Color.Black));
            this.backColor = new SolidBrush(Color.White);
            this.RatTextStyle = new ItopVector.Struct.TextStyle("����", 12, false, false, false);
            base.MouseWheel += new MouseEventHandler(this.DealMouseWheel);
            addedElements=new SvgElementCollection();
            this.viewer.ViewChanged +=new ViewChangedEventHandler(viewer_ViewChanged);
            this.mouseAreaControl.BeforeDragDrop+=new DragEventHandler(DrawArea_BeforeDragDrop);
            this.mouseAreaControl.OnPolyLineBreak += new PolyLineBreakEventHandler(mouseAreaControl_OnPolyLineBreak);
            this.mouseAreaControl.OnAddElement += new AddSvgElementEventHandler(mouseAreaControl_OnAddElement);
            this.mouseAreaControl.MouseMove += new MouseEventHandler(mouseAreaControl_MouseMove);
            this.mouseAreaControl.MouseDown += new MouseEventHandler(mouseAreaControl_MouseDown);
            this.mouseAreaControl.MouseUp += new MouseEventHandler(mouseAreaControl_MouseUp);
            this.mouseAreaControl.OnElementMove += new ElementMoveEventHandler(mouseAreaControl_OnElementMove);

            //            base.SetStyle(ControlStyles.DoubleBuffer | (ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint), true);
        }
示例#24
0
 public void OnToolElement(ToolOperation toolOperation)
 {
     this.ToolElementEvent?.Invoke(toolOperation);
 }
示例#25
0
 // Methods
 public MouseArea()
 {
     this.components = null;
     this.picturePanel = null;
     this.startPoint = PointF.Empty;
     this.defaultCursor = Cursors.Default;
     this.shiftDown = false;
     //			this.filename = string.Empty;
     //			this.selectPath = new GraphicsPath();
     this.graphCenterPoint = PointF.Empty;
     this.currentOperation = ToolOperation.None;
     //			this.undostack = new UndoStack();
     this.oldPoint = Point.Empty;
     this.hori = false;
     this.oldindex = 0;
     this.mousedown = false;
     this.win32 = new Win32();
     this.lineOperation = null;
     this.SelectOperation = null;
     this.DrawOperation = null;
     this.ViewOperation = null;
     this.ColorOperation = null;
     this.BezierOperation = null;
     this.IsDrawing = false;
     this.TextOperation = null;
     this.editingOperation = null;
     this.polyOperation = null;
     this.FlipOperation = null;
     this.SubOperation = null;
     this.InitializeComponent();
     base.SetStyle(ControlStyles.DoubleBuffer | (ControlStyles.AllPaintingInWmPaint | (ControlStyles.SupportsTransparentBackColor | (ControlStyles.Selectable | ControlStyles.UserPaint))), true);
     this.CreateMenus();
 }
示例#26
0
 public void UpdateToolBottom(ToolOperation operation)
 {
     string str1="m"+operation.ToString();
     ButtonItem button =this.dotNetBarManager1.GetItem(str1) as ButtonItem;
     if(button!=null)
     {
         this.UpdateToolBottom(button);
     }
 }