Ejemplo n.º 1
0
        public CreateRoundController(CreateRound createRound)
        {
            if (createRound == null)
            {
                throw new ArgumentNullException(nameof(createRound));
            }

            this.createRound = createRound;
        }
Ejemplo n.º 2
0
        private void OnMouseDown(object sender, MouseEventArgs e)
        {
            CreateRound newRound = new CreateRound(modelSpace.Project.CreateNewOperationId());

            //The width,height,depth of cuboid is setted with default value now
            //We'll improve it next version by using mouse draging
            Length.LengthUnit unit  = modelSpace.Project.Environment.DefaultLengthUnit;
            float             value = modelSpace.Project.Environment.GridSize.Value * 2;

            Vector3 center = modelSpace.SceneRender.DisplayedGridPoint;

            newRound.Center = new Vector3WithUnit(center, modelSpace.Project.Environment.DefaultLengthUnit);
            newRound.Radius = new Length(value, unit);

            //Set the aline axis
            switch (modelSpace.Project.Environment.GridPlane)
            {
            case GridPlane.XY:
                newRound.AlineAxis = Axis.Z;
                break;

            case GridPlane.XZ:
                newRound.AlineAxis = Axis.Y;
                break;

            case GridPlane.YZ:
                newRound.AlineAxis = Axis.X;
                break;

            default:
                newRound.AlineAxis = Axis.Z;
                break;
            }


            //Create the new single
            modelSpace.Project.CreateNewSingle(newRound);

            workspace.SelectTool();
        }