public RectangleDrawNode(RectangleShapeViewModel rectangle, ShapeStyleViewModel style)
     : base()
 {
     Style     = style;
     Rectangle = rectangle;
     UpdateGeometry();
 }
 public RectangleSelection(IServiceProvider serviceProvider, LayerContainerViewModel layer, RectangleShapeViewModel shape, ShapeStyleViewModel style)
 {
     _serviceProvider = serviceProvider;
     _layer           = layer;
     _rectangle       = shape;
     _styleViewModel  = style;
 }
        public void BeginDown(InputArgs args)
        {
            var factory = _serviceProvider.GetService <IFactory>();
            var editor  = _serviceProvider.GetService <ProjectEditorViewModel>();

            (decimal sx, decimal sy) = editor.TryToSnap(args);
            switch (_currentState)
            {
            case State.TopLeft:
            {
                editor.IsToolIdle = false;
                var style = editor.Project.CurrentStyleLibrary?.Selected is { } ?
                editor.Project.CurrentStyleLibrary.Selected :
                editor.Factory.CreateShapeStyle(ProjectEditorConfiguration.DefaulStyleName);

                _rectangle = factory.CreateRectangleShape(
                    (double)sx, (double)sy,
                    (ShapeStyleViewModel)style.Copy(null),
                    editor.Project.Options.DefaultIsStroked,
                    editor.Project.Options.DefaultIsFilled);

                editor.SetShapeName(_rectangle);

                var result = editor.TryToGetConnectionPoint((double)sx, (double)sy);
                if (result is { })
Exemple #4
0
        public void ToStateBottomRight()
        {
            _helperRectangle        = _serviceProvider.GetService <IFactory>().CreateRectangleShape(0, 0, _styleViewModel);
            _helperRectangle.State |= 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);
        }
Exemple #5
0
 public BoxDecoratorViewModel(IServiceProvider serviceProvider) : base(serviceProvider)
 {
     _factory             = serviceProvider.GetService <IFactory>();
     _sizeLarge           = 4m;
     _sizeSmall           = 4m;
     _rotateDistance      = -16.875m;
     _handleStyle         = _factory.CreateShapeStyle("Handle", 255, 0, 191, 255, 255, 255, 255, 255, 2.0);
     _boundsStyle         = _factory.CreateShapeStyle("Bounds", 255, 0, 191, 255, 255, 255, 255, 255, 1.0);
     _selectedHandleStyle = _factory.CreateShapeStyle("SelectedHandle", 255, 0, 191, 255, 255, 0, 191, 255, 2.0);
     _selectedBoundsStyle = _factory.CreateShapeStyle("SelectedBounds", 255, 0, 191, 255, 255, 255, 255, 255, 1.0);
     _rotateHandle        = _factory.CreateEllipseShape(0, 0, 0, 0, _handleStyle, true, true, name: "_rotateHandle");
     _topLeftHandle       = _factory.CreateEllipseShape(0, 0, 0, 0, _handleStyle, true, true, name: "_topLeftHandle");
     _topRightHandle      = _factory.CreateEllipseShape(0, 0, 0, 0, _handleStyle, true, true, name: "_topRightHandle");
     _bottomLeftHandle    = _factory.CreateEllipseShape(0, 0, 0, 0, _handleStyle, true, true, name: "_bottomLeftHandle");
     _bottomRightHandle   = _factory.CreateEllipseShape(0, 0, 0, 0, _handleStyle, true, true, name: "_bottomRightHandle");
     _topHandle           = _factory.CreateRectangleShape(0, 0, 0, 0, _handleStyle, true, true, name: "_topHandle");
     _bottomHandle        = _factory.CreateRectangleShape(0, 0, 0, 0, _handleStyle, true, true, name: "_bottomHandle");
     _leftHandle          = _factory.CreateRectangleShape(0, 0, 0, 0, _handleStyle, true, true, name: "_leftHandle");
     _rightHandle         = _factory.CreateRectangleShape(0, 0, 0, 0, _handleStyle, true, true, name: "_rightHandle");
     _boundsHandle        = _factory.CreateRectangleShape(0, 0, 0, 0, _boundsStyle, true, false, name: "_boundsHandle");
     _rotateLine          = _factory.CreateLineShape(0, 0, 0, 0, _boundsStyle, true, name: "_rotateLine");
     _handles             = new List <BaseShapeViewModel>
     {
         //_rotateHandle,
         _topLeftHandle,
         _topRightHandle,
         _bottomLeftHandle,
         _bottomRightHandle,
         _topHandle,
         _bottomHandle,
         _leftHandle,
         _rightHandle,
         _boundsHandle,
         //_rotateLine
     };
     _currentHandle            = null;
     _rotateHandle.State      |= ShapeStateFlags.Size | ShapeStateFlags.Thickness;
     _topLeftHandle.State     |= ShapeStateFlags.Size | ShapeStateFlags.Thickness;
     _topRightHandle.State    |= ShapeStateFlags.Size | ShapeStateFlags.Thickness;
     _bottomLeftHandle.State  |= ShapeStateFlags.Size | ShapeStateFlags.Thickness;
     _bottomRightHandle.State |= ShapeStateFlags.Size | ShapeStateFlags.Thickness;
     _topHandle.State         |= ShapeStateFlags.Size | ShapeStateFlags.Thickness;
     _bottomHandle.State      |= ShapeStateFlags.Size | ShapeStateFlags.Thickness;
     _leftHandle.State        |= ShapeStateFlags.Size | ShapeStateFlags.Thickness;
     _rightHandle.State       |= ShapeStateFlags.Size | ShapeStateFlags.Thickness;
     _boundsHandle.State      |= ShapeStateFlags.Thickness;
     _rotateLine.State        |= ShapeStateFlags.Thickness;
 }
Exemple #6
0
    public override object Copy(IDictionary <object, object>?shared)
    {
        var copy = new RectangleShapeViewModel(ServiceProvider)
        {
            Name        = Name,
            State       = State,
            Style       = _style?.CopyShared(shared),
            IsStroked   = IsStroked,
            IsFilled    = IsFilled,
            Properties  = _properties.CopyShared(shared).ToImmutable(),
            Record      = _record,
            TopLeft     = _topLeft?.CopyShared(shared),
            BottomRight = _bottomRight?.CopyShared(shared)
        };

        return(copy);
    }
Exemple #7
0
 public void Bind(RectangleShapeViewModel rectangle, object db, object r)
 {
 }
Exemple #8
0
 public IRectangleDrawNode CreateRectangleDrawNode(RectangleShapeViewModel rectangle, ShapeStyleViewModel style)
 {
     return(new RectangleDrawNode(rectangle, style));
 }