Parse() public static method

public static Parse ( string s ) : Vector3D
s string
return Vector3D
Esempio n. 1
0
        protected virtual void ExecuteFigureInstanceCommand(string[] splitCommand)
        {
            switch (splitCommand[0])
            {
            case "translate":
            {
                Vector3D transVector = Vector3D.Parse(splitCommand[1]);
                this.currentFigure.Translate(transVector);
                break;
            }

            case "rotate":
            {
                Vector3D center  = Vector3D.Parse(splitCommand[1]);
                double   degrees = double.Parse(splitCommand[2]);
                this.currentFigure.RotateInXY(center, degrees);
                break;
            }

            case "scale":
            {
                Vector3D center = Vector3D.Parse(splitCommand[1]);
                double   factor = double.Parse(splitCommand[2]);
                this.currentFigure.Scale(center, factor);
                break;
            }

            case "center":
            {
                Vector3D figCenter = this.currentFigure.GetCenter();
                Console.WriteLine(figCenter.ToString());
                break;
            }

            case "measure":
            {
                Console.WriteLine("{0:0.00}", this.currentFigure.GetPrimaryMeasure());
                break;
            }
            }
        }
Esempio n. 2
0
 public override void ExecuteFigureCreationCommand(string[] splitFigString)
 {
     if (splitFigString[0] == "circle")
     {
         Vector3D location = Vector3D.Parse(splitFigString[1]);
         double   radius   = double.Parse(splitFigString[2]);
         currentFigure = new Circle(location, radius);
     }
     else if (splitFigString[0] == "cylinder")
     {
         Vector3D bottom = Vector3D.Parse(splitFigString[1]);
         Vector3D top    = Vector3D.Parse(splitFigString[2]);
         double   radius = double.Parse(splitFigString[3]);
         currentFigure = new Cylinder(bottom, top, radius);
     }
     else
     {
         base.ExecuteFigureCreationCommand(splitFigString);
     }
     this.EndCommandExecuted = false;
 }
        public override void ExecuteFigureCreationCommand(string[] splitFigString)
        {
            switch (splitFigString[0])
            {
            case "circle":
            {
                Vector3D center = Vector3D.Parse(splitFigString[1]);
                currentFigure = new Circle(center, double.Parse(splitFigString[2]));
                break;
            }

            case "cylinder":
            {
                Vector3D bottom = Vector3D.Parse(splitFigString[1]);
                Vector3D top    = Vector3D.Parse(splitFigString[2]);
                currentFigure = new Cylinder(bottom, top, double.Parse(splitFigString[3]));
                break;
            }
            }

            base.ExecuteFigureCreationCommand(splitFigString);
        }
Esempio n. 4
0
        public override void ExecuteFigureCreationCommand(string[] splitFigString)
        {
            switch (splitFigString[0])
            {
            case "circle":
            {
                Vector3D location = Vector3D.Parse(splitFigString[1]);
                double   radius   = double.Parse(splitFigString[2]);
                currentFigure = new Circle(location, radius);
                break;
            }

            case "cylinder":
            {
                Vector3D top    = Vector3D.Parse(splitFigString[1]);
                Vector3D bottom = Vector3D.Parse(splitFigString[2]);
                double   radius = double.Parse(splitFigString[3]);
                currentFigure = new Cylinder(top, bottom, radius);
                break;
            }
            }
            base.ExecuteFigureCreationCommand(splitFigString);
        }
Esempio n. 5
0
        public override void ExecuteFigureCreationCommand(string[] splitFigString)
        {
            base.ExecuteFigureCreationCommand(splitFigString);
            switch (splitFigString[0])
            {
            case "circle":
            {
                Vector3D a      = Vector3D.Parse(splitFigString[1]);
                double   radius = double.Parse(splitFigString[2]);
                currentFigure = new Circle(a, radius);
                break;
            }

            case "cylinder":
            {
                Vector3D a      = Vector3D.Parse(splitFigString[1]);
                Vector3D b      = Vector3D.Parse(splitFigString[2]);
                double   radius = double.Parse(splitFigString[3]);
                currentFigure = new Cylinder(a, b, radius);
                break;
            }
            }
        }
Esempio n. 6
0
        public override void ExecuteFigureCreationCommand(string[] splitFigString)
        {
            switch (splitFigString[0])
            {
            case "circle":
            {
                currentFigure = new Circle(Vector3D.Parse(splitFigString[1]), double.Parse(splitFigString[2]));
                break;
            }

            case "cylinder":
            {
                currentFigure = new Cylinder(Vector3D.Parse(splitFigString[1]), Vector3D.Parse(splitFigString[2]), double.Parse(splitFigString[3]));
                break;
            }

            default:
            {
                base.ExecuteFigureCreationCommand(splitFigString);
                break;
            }
            }
            this.EndCommandExecuted = false;
        }
Esempio n. 7
0
        protected virtual void ExecuteFigureInstanceCommand(string[] splitCommand)
        {
            switch (splitCommand[0])
            {
            case "translate":
            {
                Vector3D transVector = Vector3D.Parse(splitCommand[1]);
                this.currentFigure.Translate(transVector);
                break;
            }

            case "rotate":
            {
                Vector3D center  = Vector3D.Parse(splitCommand[1]);
                double   degrees = double.Parse(splitCommand[2]);
                this.currentFigure.RotateInXY(center, degrees);
                break;
            }

            case "scale":
            {
                Vector3D center = Vector3D.Parse(splitCommand[1]);
                double   factor = double.Parse(splitCommand[2]);
                this.currentFigure.Scale(center, factor);
                break;
            }

            case "center":
            {
                Vector3D figCenter = this.currentFigure.GetCenter();
                Console.WriteLine(figCenter.ToString());
                break;
            }

            case "measure":
            {
                Console.WriteLine("{0:0.00}", this.currentFigure.GetPrimaryMeasure());
                break;
            }

            case "area":
            {
                var currFigure = this.currentFigure as IAreaMeasurable;

                if (currFigure == null)
                {
                    Console.WriteLine("undefined");
                }
                else
                {
                    Console.WriteLine("{0:0.00}", (this.currentFigure as IAreaMeasurable).GetArea());
                }

                break;
            }

            case "normal":
            {
                var currFigure = this.currentFigure as IFlat;

                if (currFigure == null)
                {
                    Console.WriteLine("undefined");
                }
                else
                {
                    Console.WriteLine(((this.currentFigure as IFlat).GetNormal()).ToString());
                }

                break;
            }

            case "volume":
            {
                var currFigure = this.currentFigure as IVolumeMeasurable;

                if (currFigure == null)
                {
                    Console.WriteLine("undefined");
                }
                else
                {
                    Console.WriteLine("{0:0.00}", (this.currentFigure as IVolumeMeasurable).GetVolume());
                }

                break;
            }
            }
        }