Esempio n. 1
0
        /// <summary>
        /// Constructor for the Shape class.
        /// </summary>
        /// <param name="Vertices">The coordinates of the points that describe the shape</param>
        /// <param name="Owner">The user owning the shape</param>
        /// <param name="Config">The graphical configuration of the shape</param>
        /// <param name="ID">The unique id of the shape</param>
        protected Shape(List <Tuple <double, double> > Vertices, User Owner = null, ShapeConfig Config = null, uint ID = 0)
        {
            if (ID == 0)
            {
                this.ID = IDs;
                IDs++;
            }
            else
            {
                this.ID = ID;
            }

            this.Vertices = Vertices;
            this.Owner    = Owner;
            if (Config == null)
            {
                this.Config = ShapeConfig.DefaultConfig;
            }
            else
            {
                this.Config = Config;
            }

            // Default values for shape code and policy.
            this.Code = ShapeCode.Pencil;
            this.OverrideUserPolicy = 0;
        }
Esempio n. 2
0
        static bool Loop()
        {
            SetTextColor(ConsoleColor.White);
            Console.Write("Select (T)riangle, (R)ectangle, (C)irlce (A)amount (D)one: ");
            string input = GreenInput().ToUpper();

            if (input == "D")
            {
                return(false);
            }
            if (input == "A")
            {
                Console.WriteLine("You have " + allShapes.Count() + " shapes in the list.");
            }


            ShapeCode shapeCode = Enum.GetValues(typeof(ShapeCode)).Cast <ShapeCode>()
                                  .FirstOrDefault(code => SameFirstLetter(code.ToString(), input) == true);

            //Create a new shape matching the code
            if (shapeCode != ShapeCode.NULL)
            {
                switch (shapeCode)
                {
                case ShapeCode.Circle:
                    CreateShape_Circle();
                    break;

                case ShapeCode.Rectangle:
                    CreateShape_Rectangle();
                    break;

                case ShapeCode.Triangle:
                    CreateShape_Triangle();
                    break;
                }
            }

            return(true);
        }
Esempio n. 3
0
 public Brick(double x, double y, ShapeCode color)
 {
     this.x     = x;
     this.y     = y;
     this.color = color;
 }
Esempio n. 4
0
 public BaseShape(int width, int height, string shapeString, ShapeCode shapeCode)
 {
     this.ShapeCode = shapeCode;
     LoadData(width, height, shapeString);
 }