예제 #1
0
        public void BeginDown(InputArgs args)
        {
            var factory = _serviceProvider.GetService <IFactory>();
            var editor  = _serviceProvider.GetService <ProjectEditorViewModel>();

            (double x, double y)     = args;
            (decimal sx, decimal sy) = editor.TryToSnap(args);
            switch (_currentState)
            {
            case State.Start:
            {
                editor.IsToolIdle = false;
                var style = editor.Project.CurrentStyleLibrary?.Selected is { } ?
                editor.Project.CurrentStyleLibrary.Selected :
                editor.Factory.CreateShapeStyle(ProjectEditorConfiguration.DefaulStyleName);
                _line = factory.CreateLineShape(
                    (double)sx, (double)sy,
                    (ShapeStyleViewModel)style.Copy(null),
                    editor.Project.Options.DefaultIsStroked);

                editor.SetShapeName(_line);

                if (editor.Project.Options.TryToConnect)
                {
                    var result = editor.TryToGetConnectionPoint((double)sx, (double)sy);
                    if (result is { })
예제 #2
0
 public LineSelection(IServiceProvider serviceProvider, LayerContainerViewModel layer, LineShapeViewModel shape, ShapeStyleViewModel style)
 {
     _serviceProvider = serviceProvider;
     _layer           = layer;
     _line            = shape;
     _styleViewModel  = style;
 }
예제 #3
0
        public void ToStatePoint2()
        {
            _line12        = _serviceProvider.GetService <IFactory>().CreateLineShape(0, 0, _styleViewModel);
            _line12.State |= ShapeStateFlags.Thickness;

            _helperPoint2 = _serviceProvider.GetService <IFactory>().CreatePointShape(0, 0);

            _layer.Shapes = _layer.Shapes.Add(_line12);
            _layer.Shapes = _layer.Shapes.Add(_helperPoint2);
        }
예제 #4
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;
 }
예제 #5
0
    public override object Copy(IDictionary <object, object>?shared)
    {
        var copy = new LineShapeViewModel(ServiceProvider)
        {
            Name       = Name,
            State      = State,
            Style      = _style?.CopyShared(shared),
            IsStroked  = IsStroked,
            IsFilled   = IsFilled,
            Properties = _properties.CopyShared(shared).ToImmutable(),
            Record     = _record,
            Start      = _start?.CopyShared(shared),
            End        = _end?.CopyShared(shared)
        };

        return(copy);
    }
예제 #6
0
 public void Bind(LineShapeViewModel line, object db, object r)
 {
 }
예제 #7
0
 public LineDrawNode(LineShapeViewModel line, ShapeStyleViewModel style)
 {
     Style = style;
     Line  = line;
     UpdateGeometry();
 }
예제 #8
0
 public ILineDrawNode CreateLineDrawNode(LineShapeViewModel line, ShapeStyleViewModel style)
 {
     return(new LineDrawNode(line, style));
 }
예제 #9
0
 public LinePathToolViewModel(IServiceProvider?serviceProvider) : base(serviceProvider)
 {
     _currentState = State.Start;
     _line         = new LineShapeViewModel(serviceProvider);
 }
예제 #10
0
 public ArcPathToolViewModel(IServiceProvider serviceProvider) : base(serviceProvider)
 {
     _currentState = State.Start;
     _arc          = new LineShapeViewModel(serviceProvider);
 }