Пример #1
0
 /// <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;
 }
Пример #2
0
 public RectangleDrawNode(IRectangleShape rectangle, IShapeStyle style)
     : base()
 {
     Style     = style;
     Rectangle = rectangle;
     Text      = rectangle;
     UpdateGeometry();
 }
Пример #3
0
        /// <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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        /// <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);
        }
Пример #6
0
 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,
     });
Пример #7
0
        /// <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();
        }
Пример #8
0
 public BezierTool(IOverlayInterface overlay) : base(overlay)
 {
     Preview_CP1 = overlay.ShapeFactory.GetCPCircle();
     Preview_CP2 = overlay.ShapeFactory.GetCPCircle();
 }
Пример #9
0
 public void CopyStateTo(IRectangleShape element)
 {
     element.Descriptor = Descriptor;
 }
Пример #10
0
 public SelectionTool(OverlayInterface overlay) : base(overlay)
 {
     SelectionRect = overlay.ShapeFactory.GetSelectionRect();
 }
Пример #11
0
 public EllipseTool(IOverlayInterface overlay)
     : base(overlay)
 {
     PreviewEllipse = overlay.ShapeFactory.GetPreviewEllipse();
 }
Пример #12
0
 /// <inheritdoc/>
 public void Bind(IRectangleShape rectangle, object db, object r)
 {
 }
Пример #13
0
 public SelectionTool(IOverlayInterface overlay) : base(overlay)
 {
     SelectionRect = overlay.ShapeFactory.GetSelectionRect();
 }
Пример #14
0
 public void CopyStateTo(IRectangleShape element)
 {
     element.Descriptor = Descriptor;
 }
Пример #15
0
 public IRectangleDrawNode CreateRectangleDrawNode(IRectangleShape rectangle, IShapeStyle style)
 {
     return(new RectangleDrawNode(rectangle, style));
 }
Пример #16
0
 public EllipseTool(OverlayInterface overlay)
     : base(overlay)
 {
     PreviewEllipse = overlay.ShapeFactory.GetPreviewEllipse();
 }
Пример #17
0
 public RectangleTool(OverlayInterface overlay) : base(overlay)
 {
     PreviewRect = CreatePreviewShape();
 }
Пример #18
0
 public RectangleTool(IOverlayInterface overlay) : base(overlay)
 {
     PreviewRect = CreatePreviewShape();
 }
Пример #19
0
 public BezierTool(IOverlayInterface overlay) : base(overlay)
 {
     Preview_CP1 = overlay.ShapeFactory.GetCPCircle();
     Preview_CP2 = overlay.ShapeFactory.GetCPCircle();
 }