ToString() public method

public ToString ( ) : string
return string
Example #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;
            }
            }
        }
Example #2
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;
            }
            }
        }