/// <summary> /// /// </summary> public override void ToStateOne() { _style = _editor.Project.Options.HelperStyle; _ellipse = XEllipse.Create(0, 0, _style, null); _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_ellipse); _p1HelperPoint = XPoint.Create(0, 0, _editor.Project.Options.PointShape); _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_p1HelperPoint); _p2HelperPoint = XPoint.Create(0, 0, _editor.Project.Options.PointShape); _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_p2HelperPoint); _centerHelperPoint = XPoint.Create(0, 0, _editor.Project.Options.PointShape); _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_centerHelperPoint); }
/// <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: { _shape = XEllipse.Create( sx, sy, _editor.Project.CurrentStyleLibrary.CurrentStyle, _editor.Project.Options.PointShape, _editor.Project.Options.DefaultIsStroked, _editor.Project.Options.DefaultIsFilled); if (_editor.Project.Options.TryToConnect) { TryToConnectTopLeft(_shape as XEllipse, sx, sy); } _editor.Project.CurrentContainer.WorkingLayer.Shapes = _editor.Project.CurrentContainer.WorkingLayer.Shapes.Add(_shape); _editor.Project.CurrentContainer.WorkingLayer.Invalidate(); ToStateOne(); Move(_shape); _editor.Project.CurrentContainer.HelperLayer.Invalidate(); _currentState = State.One; _editor.CancelAvailable = true; } break; case State.One: { var ellipse = _shape as XEllipse; if (ellipse != null) { ellipse.BottomRight.X = sx; ellipse.BottomRight.Y = sy; if (_editor.Project.Options.TryToConnect) { TryToConnectBottomRight(_shape as XEllipse, 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; } }
/// <summary> /// Creates a new instance of the XEllipse class. /// </summary> /// <param name="topLeft"></param> /// <param name="bottomRight"></param> /// <param name="isStroked"></param> /// <param name="isFilled"></param> /// <param name="text"></param> /// <returns></returns> public XEllipse Ellipse( XPoint topLeft, XPoint bottomRight, bool isStroked = true, bool isFilled = false, string text = null) { var ellipse = XEllipse.Create( topLeft, bottomRight, Context.Editor.Project.CurrentStyleLibrary.CurrentStyle, Context.Editor.Project.Options.PointShape, isStroked, isFilled, text); Context.Editor.AddWithHistory(ellipse); return(ellipse); }
/// <summary> /// Creates a new instance of the XEllipse class. /// </summary> /// <param name="x1"></param> /// <param name="y1"></param> /// <param name="x2"></param> /// <param name="y2"></param> /// <param name="isStroked"></param> /// <param name="isFilled"></param> /// <param name="text"></param> /// <returns></returns> public XEllipse Ellipse( double x1 = 30, double y1 = 30, double x2 = 60, double y2 = 60, bool isStroked = true, bool isFilled = false, string text = null) { var ellipse = XEllipse.Create( x1, y1, x2, y2, Context.Editor.Project.CurrentStyleLibrary.CurrentStyle, Context.Editor.Project.Options.PointShape, isStroked, isFilled, text); Context.Editor.AddWithHistory(ellipse); return(ellipse); }
/// <summary> /// /// </summary> /// <param name="pss"></param> /// <returns></returns> public static BaseShape FilledEllipsePointShape(ShapeStyle pss) { return(XEllipse.Create(-3, -3, 3, 3, pss, null, true, true)); }
/// <summary> /// /// </summary> /// <param name="pss"></param> /// <returns></returns> public static BaseShape EllipsePointShape(ShapeStyle pss) { return(XEllipse.Create(-4, -4, 4, 4, pss, null, true, false)); }