Ejemplo n.º 1
0
 private static void CreateCircle(string[] splitCommand)
 {
     if (splitCommand.Length == 5)
     {
         double centerX = ParseToDouble(splitCommand[2]);
         double centerY = ParseToDouble(splitCommand[3]);
         double radius  = ParseToDouble(splitCommand[4]);
         if (radius <= 0)
         {
             Console.WriteLine("Radius less zero");
         }
         if (!(Double.IsNaN(centerX) || Double.IsNaN(centerY) || Double.IsNaN(radius)))
         {
             var circle = new Circle(centerX, centerY, radius, (uint)Figure.GetLastID() + 1);
             Console.WriteLine(circle.ToString());
             Figure.AddToList(circle);
         }
         else
         {
             Console.WriteLine("Incorrect syntax");
         }
     }
     else
     {
         Console.WriteLine("Unknown command");
     }
 }
Ejemplo n.º 2
0
 private static void CreateSquare(string[] splitCommand)
 {
     if (splitCommand.Length == 5)
     {
         double left = ParseToDouble(splitCommand[2]);
         double top  = ParseToDouble(splitCommand[3]);
         double side = ParseToDouble(splitCommand[4]);
         if (!(Double.IsNaN(left) || Double.IsNaN(top) || Double.IsNaN(side)))
         {
             var square = new Square(left, top, side, (uint)Figure.GetLastID() + 1);
             Console.WriteLine(square.ToString());
             Figure.AddToList(square);
         }
         else
         {
             Console.WriteLine("Incorrect syntax");
         }
     }
     else
     {
         Console.WriteLine("Unknown command");
     }
 }
Ejemplo n.º 3
0
 private static void CreateRectangle(string[] splitCommand)
 {
     if (splitCommand.Length == 6)
     {
         double left   = ParseToDouble(splitCommand[2]);
         double top    = ParseToDouble(splitCommand[3]);
         double width  = ParseToDouble(splitCommand[4]);
         double height = ParseToDouble(splitCommand[5]);
         if (!(Double.IsNaN(left) || Double.IsNaN(top) || Double.IsNaN(width) || Double.IsNaN(height)))
         {
             var rectangle = new Rectangle(left, top, width, height, (uint)Figure.GetLastID() + 1);
             Console.WriteLine(rectangle.ToString());
             Figure.AddToList(rectangle);
         }
         else
         {
             Console.WriteLine("Incorrect syntax");
         }
     }
     else
     {
         Console.WriteLine("Unknown command");
     }
 }