/// <summary> /// Creates a new instance of the XArc class. /// </summary> /// <param name="point1"></param> /// <param name="point2"></param> /// <param name="point3"></param> /// <param name="point4"></param> /// <param name="isStroked"></param> /// <param name="isFilled"></param> /// <returns></returns> public XArc Arc( XPoint point1, XPoint point2, XPoint point3, XPoint point4, bool isStroked = true, bool isFilled = false) { var arc = XArc.Create( point1, point2, point3, point4, Context.Editor.Project.CurrentStyleLibrary.CurrentStyle, Context.Editor.Project.Options.PointShape, isStroked, isFilled); Context.Editor.AddWithHistory(arc); return(arc); }
/// <summary> /// Creates a new instance of the XArc class. /// </summary> /// <param name="x1"></param> /// <param name="y1"></param> /// <param name="x2"></param> /// <param name="y2"></param> /// <param name="x3"></param> /// <param name="y3"></param> /// <param name="x4"></param> /// <param name="y4"></param> /// <param name="isStroked"></param> /// <param name="isFilled"></param> /// <returns></returns> public XArc Arc( double x1 = 30, double y1 = 30, double x2 = 60, double y2 = 60, double x3 = 30, double y3 = 45, double x4 = 60, double y4 = 45, bool isStroked = true, bool isFilled = false) { var arc = XArc.Create( x1, y1, x2, y2, x3, y3, x4, y4, Context.Editor.Project.CurrentStyleLibrary.CurrentStyle, Context.Editor.Project.Options.PointShape, isStroked, isFilled); Context.Editor.AddWithHistory(arc); return(arc); }
/// <summary> /// /// </summary> /// <param name="x"></param> /// <param name="y"></param> public override void LeftDown(double x, double y) { double sx = _editor.Project.Options.SnapToGrid ? Editor.Snap(x, _editor.Project.Options.SnapX) : x; double sy = _editor.Project.Options.SnapToGrid ? Editor.Snap(y, _editor.Project.Options.SnapY) : y; switch (_currentState) { case State.None: { _connectedP3 = false; _connectedP4 = false; _shape = XArc.Create( sx, sy, _editor.Project.CurrentStyleLibrary.CurrentStyle, _editor.Project.Options.PointShape, _editor.Project.Options.DefaultIsStroked, _editor.Project.Options.DefaultIsFilled); if (_editor.Project.Options.TryToConnect) { TryToConnectPoint1(_shape, sx, sy); } _editor.Project.CurrentContainer.WorkingLayer.Invalidate(); ToStateOne(); Move(_shape); _editor.Project.CurrentContainer.HelperLayer.Invalidate(); _currentState = State.One; _editor.CancelAvailable = true; } break; case State.One: { if (_shape != null) { _shape.Point2.X = sx; _shape.Point2.Y = sy; _shape.Point3.X = sx; _shape.Point3.Y = sy; if (_editor.Project.Options.TryToConnect) { TryToConnectPoint2(_shape, sx, sy); } _editor.Project.CurrentContainer.WorkingLayer.Invalidate(); ToStateTwo(); Move(_shape); _editor.Project.CurrentContainer.HelperLayer.Invalidate(); _currentState = State.Two; } } break; case State.Two: { if (_shape != null) { _shape.Point3.X = sx; _shape.Point3.Y = sy; _shape.Point4.X = sx; _shape.Point4.Y = sy; if (_editor.Project.Options.TryToConnect) { _connectedP3 = TryToConnectPoint3(_shape, sx, sy); } _editor.Project.CurrentContainer.WorkingLayer.Shapes = _editor.Project.CurrentContainer.WorkingLayer.Shapes.Add(_shape); _editor.Project.CurrentContainer.WorkingLayer.Invalidate(); ToStateThree(); Move(_shape); _editor.Project.CurrentContainer.HelperLayer.Invalidate(); _currentState = State.Three; } } break; case State.Three: { if (_shape != null) { _shape.Point4.X = sx; _shape.Point4.Y = sy; if (_editor.Project.Options.TryToConnect) { _connectedP4 = TryToConnectPoint4(_shape, sx, sy); } _editor.Project.CurrentContainer.WorkingLayer.Shapes = _editor.Project.CurrentContainer.WorkingLayer.Shapes.Remove(_shape); Remove(); Finalize(_shape); _editor.AddWithHistory(_shape); _currentState = State.None; _editor.CancelAvailable = false; } } break; } }