Beispiel #1
0
 public override void ToolActionCompleted()
 {
     if (_newPath != null)
     {
         _newPath.CloseFigure();
     }
     _startPathDraw = true;
     IsComplete     = true;
     _newPath       = null;
 }
Beispiel #2
0
        public static DrawObject CreateDrawObject(SVGUnit svge)
        {
            DrawObject o = null;

            switch (svge.getElementType())
            {
            case SVGUnit.SVGUnitType.typeLine:
                o = DrawLineObject.Create((SVGLine)svge);
                break;

            case SVGUnit.SVGUnitType.typeRect:
                o = DrawRectangleObject.Create((SVGRect)svge);
                break;

            case SVGUnit.SVGUnitType.typeEllipse:
                o = DrawEllipseObject.Create((SVGEllipse)svge);
                break;

            case SVGUnit.SVGUnitType.typePolyline:
                o = DrawPolygonObject.Create((SVGPolyline)svge);
                break;

            case SVGUnit.SVGUnitType.typeImage:
                o = DrawImageObject.Create((SVGImage)svge);
                break;

            case SVGUnit.SVGUnitType.typeText:
                o = DrawTextObject.Create((SVGText)svge);
                break;

            case SVGUnit.SVGUnitType.typePath:
                o = DrawPathObject.Create((SVGPath)svge);
                break;

            case SVGUnit.SVGUnitType.typeCircle:
                o = DrawCircleObject.Create((SVGCircle)svge);
                break;

            default:
                break;
            }
            return(o);
        }
Beispiel #3
0
        /// <summary>
        /// Left nouse button is pressed
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public override void OnMouseDown(DrawArea drawArea, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                ToolActionCompleted();
                return;
            }

            // Create new polygon, add it to the list
            // and keep reference to it
            if (_startPathDraw)
            {
                _newPath = new DrawPathObject(e.X, e.Y);
                AddNewObject(drawArea, _newPath);
                _startPathDraw = false;
                IsComplete     = false;
            }
            else
            {
                _newPath.AddPoint(e.Location);
            }
        }