/// <summary> /// Initialize new instance of <see cref="ToolEllipseSelection"/> class. /// </summary> /// <param name="serviceProvider">The service provider.</param> /// <param name="layer">The selection shapes layer.</param> /// <param name="shape">The selected shape.</param> /// <param name="style">The selection shapes style.</param> public ToolEllipseSelection(IServiceProvider serviceProvider, ILayerContainer layer, IEllipseShape shape, IShapeStyle style) { _serviceProvider = serviceProvider; _layer = layer; _ellipse = shape; _style = style; }
public EllipseDrawNode(IEllipseShape ellipse, IShapeStyle style) : base() { Style = style; Ellipse = ellipse; Text = ellipse; UpdateGeometry(); }
public static AM.Geometry ToGeometry(IEllipseShape ellipse) { var rect2 = Rect2.FromPoints(ellipse.TopLeft.X, ellipse.TopLeft.Y, ellipse.BottomRight.X, ellipse.BottomRight.Y); var rect = new A.Rect(rect2.X, rect2.Y, rect2.Width, rect2.Height); var g = new AM.EllipseGeometry(rect); return(g); }
/// <summary> /// Transfer selection state to Point2. /// </summary> public void ToStatePoint2() { _ellipse = _serviceProvider.GetService <IFactory>().CreateEllipseShape(0, 0, _style); _p1HelperPoint = _serviceProvider.GetService <IFactory>().CreatePointShape(0, 0); _p2HelperPoint = _serviceProvider.GetService <IFactory>().CreatePointShape(0, 0); _centerHelperPoint = _serviceProvider.GetService <IFactory>().CreatePointShape(0, 0); _layer.Shapes = _layer.Shapes.Add(_ellipse); _layer.Shapes = _layer.Shapes.Add(_p1HelperPoint); _layer.Shapes = _layer.Shapes.Add(_p2HelperPoint); _layer.Shapes = _layer.Shapes.Add(_centerHelperPoint); }
/// <summary> /// Reset selection. /// </summary> public void Reset() { if (_ellipse != null) { _layer.Shapes = _layer.Shapes.Remove(_ellipse); _ellipse = null; } if (_startLine != null) { _layer.Shapes = _layer.Shapes.Remove(_startLine); _startLine = null; } if (_endLine != null) { _layer.Shapes = _layer.Shapes.Remove(_endLine); _endLine = null; } if (_p1HelperPoint != null) { _layer.Shapes = _layer.Shapes.Remove(_p1HelperPoint); _p1HelperPoint = null; } if (_p2HelperPoint != null) { _layer.Shapes = _layer.Shapes.Remove(_p2HelperPoint); _p2HelperPoint = null; } if (_centerHelperPoint != null) { _layer.Shapes = _layer.Shapes.Remove(_centerHelperPoint); _centerHelperPoint = null; } if (_startHelperPoint != null) { _layer.Shapes = _layer.Shapes.Remove(_startHelperPoint); _startHelperPoint = null; } if (_endHelperPoint != null) { _layer.Shapes = _layer.Shapes.Remove(_endHelperPoint); _endHelperPoint = null; } _layer.Invalidate(); }
/// <summary> /// Transfer selection state to Point4. /// </summary> public void ToStatePoint4() { if (_ellipse != null) { _layer.Shapes = _layer.Shapes.Remove(_ellipse); _ellipse = null; } _endLine = _serviceProvider.GetService <IFactory>().CreateLineShape(0, 0, _style); _endHelperPoint = _serviceProvider.GetService <IFactory>().CreatePointShape(0, 0); _layer.Shapes = _layer.Shapes.Add(_endLine); _layer.Shapes = _layer.Shapes.Add(_endHelperPoint); }
public static SKPath ToSKPath(this IBaseShape shape, double dx, double dy, Func <double, float> scale) { return(shape switch { ILineShape lineShape => ToSKPath(lineShape, dx, dy, scale), IRectangleShape rectangleShape => ToSKPath(rectangleShape, dx, dy, scale), IEllipseShape ellipseShape => ToSKPath(ellipseShape, dx, dy, scale), IImageShape imageShape => ToSKPath(imageShape, dx, dy, scale), IArcShape arcShape => ToSKPath(arcShape, dx, dy, scale), ICubicBezierShape cubicBezierShape => ToSKPath(cubicBezierShape, dx, dy, scale), IQuadraticBezierShape quadraticBezierShape => ToSKPath(quadraticBezierShape, dx, dy, scale), ITextShape textShape => ToSKPath(textShape, dx, dy, scale), IPathShape pathShape => ToSKPath(pathShape, dx, dy, scale), IGroupShape groupShape => ToSKPath(groupShape.Shapes, dx, dy, scale), _ => null, });
/// <inheritdoc/> public void Bind(IEllipseShape ellipse, object db, object r) { }
public IEllipseDrawNode CreateEllipseDrawNode(IEllipseShape ellipse, IShapeStyle style) { return(new EllipseDrawNode(ellipse, style)); }