Esempio n. 1
0
        public void FindGroupRegion()
        {
            int minX = Int32.MaxValue, maxX = Int32.MinValue, minY = Int32.MaxValue, maxY = Int32.MinValue;

            for (int i = 0; i < shapesInGroup.Count; i++)
            {
                MyShapes shape = shapesInGroup[i] as MyShapes;
                if (shape is MyCurve curve)
                {
                    FindCurveRegion(curve);
                }
                else if (shape is MyPolygon polygon)
                {
                    FindPolygonRegion(polygon);
                }
                if (shape.P1.X < minX)
                {
                    minX = shape.P1.X;
                }
                if (shape.P2.X < minX)
                {
                    minX = shape.P2.X;
                }
                if (shape.P1.Y < minY)
                {
                    minY = shape.P1.Y;
                }
                if (shape.P2.Y < minY)
                {
                    minY = shape.P2.Y;
                }
                if (shape.P1.X > maxX)
                {
                    maxX = shape.P1.X;
                }
                if (shape.P2.X > maxX)
                {
                    maxX = shape.P2.X;
                }
                if (shape.P1.Y > maxY)
                {
                    maxY = shape.P1.Y;
                }
                if (shape.P2.Y > maxY)
                {
                    maxY = shape.P2.Y;
                }
            }
            this.P1 = new Point(minX, minY);
            this.P2 = new Point(maxX, maxY);
        }
Esempio n. 2
0
 public void Add(MyShapes shape)
 {
     shapesInGroup.Add(shape);
 }