Exemple #1
0
        public virtual void ExecuteFigureCreationCommand(string[] splitFigString)
        {
            switch (splitFigString[0])
            {
                case "vertex":
                    {
                        Vector3D location = Vector3D.Parse(splitFigString[1]);
                        currentFigure = new Vertex(location);
                        break;
                    }
                case "segment":
                    {
                        Vector3D a = Vector3D.Parse(splitFigString[1]);
                        Vector3D b = Vector3D.Parse(splitFigString[2]);
                        currentFigure = new LineSegment(a, b);
                        break;
                    }
                case "triangle":
                    {
                        Vector3D a = Vector3D.Parse(splitFigString[1]);
                        Vector3D b = Vector3D.Parse(splitFigString[2]);
                        Vector3D c = Vector3D.Parse(splitFigString[3]);
                        currentFigure = new Triangle(a, b, c);
                        break;
                    }
            }

            this.EndCommandExecuted = false;
        }
Exemple #2
0
        public void ExecuteCommand(string commandStr)
        {
            string[] splitCommand = commandStr.Split(FigureController.separators, StringSplitOptions.RemoveEmptyEntries);

            if (this.currentFigure == null)
            {
                this.ExecuteFigureCreationCommand(splitCommand);
            }
            else if (splitCommand[0] == "end")
            {
                this.currentFigure = null;
                this.EndCommandExecuted = true;
            }
            else
            {
                this.ExecuteFigureInstanceCommand(splitCommand);
            }
        }
Exemple #3
0
 public FigureController()
 {
     this.currentFigure = null;
     this.EndCommandExecuted = false;
 }
Exemple #4
0
 public FigureController()
 {
     this.currentFigure      = null;
     this.EndCommandExecuted = false;
 }