/// <summary> /// Initialize new instance of <see cref="ToolRectangleSelection"/> 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 ToolRectangleSelection(IServiceProvider serviceProvider, ILayerContainer layer, IRectangleShape shape, IShapeStyle style) { _serviceProvider = serviceProvider; _layer = layer; _rectangle = shape; _style = style; }
public RectangleDrawNode(IRectangleShape rectangle, IShapeStyle style) : base() { Style = style; Rectangle = rectangle; Text = rectangle; UpdateGeometry(); }
/// <summary> /// Transfer selection state to BottomRight. /// </summary> public void ToStateBottomRight() { _helperRectangle = _serviceProvider.GetService <IFactory>().CreateRectangleShape(0, 0, _style, null); _topLeftHelperPoint = _serviceProvider.GetService <IFactory>().CreatePointShape(0, 0, _point); _bottomRightHelperPoint = _serviceProvider.GetService <IFactory>().CreatePointShape(0, 0, _point); _layer.Shapes = _layer.Shapes.Add(_helperRectangle); _layer.Shapes = _layer.Shapes.Add(_topLeftHelperPoint); _layer.Shapes = _layer.Shapes.Add(_bottomRightHelperPoint); }
void ILeafVisitorOf <IRectangleShape> .Visit(IRectangleShape rectangleShape) { IModel model; if (!_allocatedModels.TryGetValue(rectangleShape, out model)) { model = _allocatedModels[rectangleShape] = Models.Cube.Translated(-0.5f, -0.5f, -0.5f).Scaled(rectangleShape.Descriptor.WidthX, rectangleShape.Descriptor.WidthY, 0.1f); } DrawShape(rectangleShape, model); }
/// <summary> /// Transfer selection state to BottomRight. /// </summary> public void ToStateBottomRight() { _helperRectangle = _serviceProvider.GetService <IFactory>().CreateRectangleShape(0, 0, _style); _helperRectangle.State.Flags |= ShapeStateFlags.Thickness; _topLeftHelperPoint = _serviceProvider.GetService <IFactory>().CreatePointShape(0, 0); _bottomRightHelperPoint = _serviceProvider.GetService <IFactory>().CreatePointShape(0, 0); _layer.Shapes = _layer.Shapes.Add(_helperRectangle); _layer.Shapes = _layer.Shapes.Add(_topLeftHelperPoint); _layer.Shapes = _layer.Shapes.Add(_bottomRightHelperPoint); }
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, });
/// <summary> /// Remove selection. /// </summary> public void Remove() { if (_helperRectangle != null) { _layer.Shapes = _layer.Shapes.Remove(_helperRectangle); _helperRectangle = null; } if (_topLeftHelperPoint != null) { _layer.Shapes = _layer.Shapes.Remove(_topLeftHelperPoint); _topLeftHelperPoint = null; } if (_bottomRightHelperPoint != null) { _layer.Shapes = _layer.Shapes.Remove(_bottomRightHelperPoint); _bottomRightHelperPoint = null; } _layer.Invalidate(); }
public BezierTool(IOverlayInterface overlay) : base(overlay) { Preview_CP1 = overlay.ShapeFactory.GetCPCircle(); Preview_CP2 = overlay.ShapeFactory.GetCPCircle(); }
public void CopyStateTo(IRectangleShape element) { element.Descriptor = Descriptor; }
public SelectionTool(OverlayInterface overlay) : base(overlay) { SelectionRect = overlay.ShapeFactory.GetSelectionRect(); }
public EllipseTool(IOverlayInterface overlay) : base(overlay) { PreviewEllipse = overlay.ShapeFactory.GetPreviewEllipse(); }
/// <inheritdoc/> public void Bind(IRectangleShape rectangle, object db, object r) { }
public SelectionTool(IOverlayInterface overlay) : base(overlay) { SelectionRect = overlay.ShapeFactory.GetSelectionRect(); }
public IRectangleDrawNode CreateRectangleDrawNode(IRectangleShape rectangle, IShapeStyle style) { return(new RectangleDrawNode(rectangle, style)); }
public EllipseTool(OverlayInterface overlay) : base(overlay) { PreviewEllipse = overlay.ShapeFactory.GetPreviewEllipse(); }
public RectangleTool(OverlayInterface overlay) : base(overlay) { PreviewRect = CreatePreviewShape(); }
public RectangleTool(IOverlayInterface overlay) : base(overlay) { PreviewRect = CreatePreviewShape(); }