Beispiel #1
0
    //--------------------------------------------------------------------------------------------------

    public override bool Start()
    {
        _SourceBody = WorkspaceController.Selection.SelectedEntities.First() as Body;

        if (WorkspaceController.Selection.SelectedEntities.Count > 1)
        {
            var shapeOperands = WorkspaceController.Selection.SelectedEntities
                                .Skip(1)
                                .OfType <Body>()
                                .Select(body => (IShapeOperand) new BodyShapeOperand(body))
                                .ToArray();
            Execute(_SourceBody, shapeOperands);
            Stop();
            WorkspaceController.Invalidate();
            return(false);
        }
        else
        {
            var toolAction = new SelectEntityAction <Body>(this);
            toolAction.SetFilter(body => body.Shape?.ShapeType == ShapeType.Solid);
            if (!WorkspaceController.StartToolAction(toolAction))
            {
                return(false);
            }
            toolAction.Previewed += _OnActionPreview;
            toolAction.Finished  += _OnActionFinished;
            toolAction.Exclude(_SourceBody);

            UpdateStatusText(null);
            WorkspaceController.HudManager?.SetCursor(Cursors.SelectShape);
            return(true);
        }
    }
        //--------------------------------------------------------------------------------------------------

        bool _StartToolAction()
        {
            var toolAction = new SelectEntityAction <Body>(this);

            toolAction.SetFilter((body) => body.Shape.ShapeType == ShapeType.Sketch);
            if (!WorkspaceController.StartToolAction(toolAction))
            {
                return(false);
            }
            toolAction.Finished += _OnActionFinished;

            toolAction.Exclude(_TargetBody);

            return(true);
        }
Beispiel #3
0
        //--------------------------------------------------------------------------------------------------

        public override bool Start()
        {
            if (_TargetBody2 != null)
            {
                var boxJoint = BoxJoint.Create(_TargetBody1, _TargetBody2);
                InteractiveContext.Current.UndoHandler.Commit();
                Stop();
                WorkspaceController.Invalidate();
                return(false);
            }

            var toolAction = new SelectEntityAction <Body>(this);

            if (!WorkspaceController.StartToolAction(toolAction))
            {
                return(false);
            }
            toolAction.Previewed += _OnActionPreview;
            toolAction.Finished  += _OnActionFinished;
            toolAction.Exclude(_TargetBody1);
            UpdateStatusText(null);
            WorkspaceController.HudManager?.SetCursor(Cursors.SelectShape);
            return(true);
        }