Ejemplo n.º 1
0
 /// <summary>
 /// Добавление пластины в столбец.
 /// </summary>
 /// <param name="plate"></param>
 public void Add(RandomlyPlate plate)
 {
     if (plate == null)
     {
         throw new ArgumentNullException(nameof(plate), "Plate is null");
     }
     else
     {
         if (plate.TypeSurface == 1)
         {
             if (Floor.Count == 0)
             {
                 Ceiling.WidthMainPlate -= plate.Height;
                 Ceiling.ColumnOffset   += plate.Width;
                 widthRoom = plate.Width;
             }
             Floor.Add(ref plate);
             roomPlates.Add(plate);
             FullnessFloor = Floor.Fullness;
         }
         else if (plate.TypeSurface == 2)
         {
             Ceiling.Add(ref plate);
             roomPlates.Add(plate);
             FullnessCeiling = Ceiling.Fullness;
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 ///  Перенос координат углов многоугольника
 /// </summary>
 /// <param name="plate"></param>
 public static void TransferCoordinates(ref RandomlyPlate plate)
 {
     for (int i = 0; i < plate.ContourPoints.Count; i++)
     {
         plate.ContourPoints[i].X += plate.XOffset;
         plate.ContourPoints[i].Y += plate.YOffset;
     }
     plate.YOffset = 0;
     plate.XOffset = 0;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Проверка вместимости пола и потолка столбца.
 /// </summary>
 /// <param name="plate"></param>
 /// <returns></returns>
 public bool CapacityCheck(RandomlyPlate plate, out int typeSurface)
 {
     if (plate == null)
     {
         throw new ArgumentNullException(nameof(plate), "Plate is Null");
     }
     else if (Floor.CapacityCheck(plate))
     {
         typeSurface = 1;
         return(true);
     }
     else
     {
         return(CeilingCapacityCheck(plate, out typeSurface));
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Проверка вместимости потолка
        /// </summary>
        /// <param name="plate"></param>
        /// <returns></returns>
        private bool CeilingCapacityCheck(RandomlyPlate plate, out int typeSurface)
        {
            typeSurface = 2;
            bool search = true; //Поиск.

            if (Ceiling.Plates.Count == 0)
            {
                plate.YOffset = Ceiling.CeilingOffsett - plate.Height;
                plate.XOffset = Ceiling.ColumnOffset - plate.Width;
                ColumnPlate.TransferCoordinates(ref plate);

                foreach (var item in Floor.Plates)
                {
                    if (Helper.GetIntersectionPlate(plate.ContourPoints, item.ContourPoints))
                    {
                        typeSurface = 0;
                        search      = false;
                        break;
                    }
                }

                plate.YOffset = -(Ceiling.CeilingOffsett - plate.Height);
                plate.XOffset = -(Ceiling.ColumnOffset - plate.Width);
                ColumnPlate.TransferCoordinates(ref plate);
            }
            else
            {
                var delta = Ceiling.Rapprochement(plate);//величина сближения

                foreach (var item in Floor.Plates)
                {
                    if (Helper.GetIntersectionPlate(plate.ContourPoints, item.ContourPoints))
                    {
                        typeSurface = 0;
                        search      = false;
                        break;
                    }
                }

                plate.YOffset = -(Ceiling.CeilingOffsett - Ceiling.HeightColumn - plate.Height + delta);
                plate.XOffset = -(Ceiling.ColumnOffset - plate.Width);
                ColumnPlate.TransferCoordinates(ref plate);
            }

            return(search);
        }
Ejemplo n.º 5
0
 public bool CapacityCheck(RandomlyPlate plate)
 {
     if (plate == null)
     {
         throw new ArgumentNullException(nameof(plate), "Plate is Null");
     }
     else if (heightColumn == 0 && plate.Height <= WidthMainPlate)
     {
         return(true);
     }
     else if (PlannedHeight(plate) <= WidthMainPlate)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 6
0
        public override void Add(ref RandomlyPlate plate)
        {
            if (heightColumn == 0)
            {
                plate.YOffset = CeilingOffsett - plate.Height;
                plate.XOffset = ColumnOffset - plate.Width;
                ColumnPlate.TransferCoordinates(ref plate);

                Plates.Add(plate);
                heightColumn += plate.Height;
                Fullness      = heightColumn / (double)WidthMainPlate;
            }
            else
            {
                var delta = Rapprochement(ref plate);
                heightColumn = (heightColumn + plate.Height - delta);
                Plates.Add(plate);
                Fullness = heightColumn / (double)WidthMainPlate;
            }
        }
Ejemplo n.º 7
0
        private int PlannedHeight(RandomlyPlate plate)
        {
            var plannedHeightColumn = heightColumn;

            if (heightColumn != 0)
            {
                var delta = Rapprochement(plate);//величина сближения
                plate.YOffset = -heightColumn + delta;
                plate.XOffset = -ColumnOffset;
                TransferCoordinates(ref plate);

                plannedHeightColumn = (plannedHeightColumn + plate.Height - delta);
            }
            else
            {
                plannedHeightColumn += plate.Height;
            }

            return(plannedHeightColumn);
        }
Ejemplo n.º 8
0
        public override int Rapprochement(ref RandomlyPlate plate)
        {
            var rapprochement = 0;

            plate.YOffset = CeilingOffsett - heightColumn - plate.Height;
            plate.XOffset = ColumnOffset - plate.Width;

            TransferCoordinates(ref plate);


            while (!Helper.GetIntersectionPlate(plate.ContourPoints, Plates[Plates.Count - 1].ContourPoints))
            {
                plate.YOffset++;
                TransferCoordinates(ref plate);
                rapprochement++;
            }
            plate.YOffset--;
            TransferCoordinates(ref plate);
            rapprochement--;

            return(rapprochement);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Сближение пластин друг к другу по вертикале
        /// </summary>
        /// <param name="plate"></param>
        /// <returns></returns>
        public virtual int Rapprochement(RandomlyPlate plate)
        {
            var rapprochement = 0;

            plate.YOffset = heightColumn;
            plate.XOffset = ColumnOffset;

            TransferCoordinates(ref plate);


            while (!Helper.GetIntersectionPlate(plate.ContourPoints, Plates[Plates.Count - 1].ContourPoints))
            {
                plate.YOffset--;
                TransferCoordinates(ref plate);
                rapprochement++;
            }
            plate.YOffset++;
            TransferCoordinates(ref plate);
            rapprochement--;

            return(rapprochement);
        }
Ejemplo n.º 10
0
        public virtual void Add(ref RandomlyPlate plate)
        {
            if (heightColumn == 0)
            {
                plate.YOffset = heightColumn;
                plate.XOffset = ColumnOffset;

                TransferCoordinates(ref plate);

                Plates.Add(plate);
                widthColumn   = plate.Width;
                heightColumn += plate.Height;
                Fullness      = heightColumn / (double)WidthMainPlate;
            }
            else
            {
                var delta = Rapprochement(ref plate);
                heightColumn = (heightColumn + plate.Height - delta);
                Plates.Add(plate);
                Fullness = heightColumn / (double)WidthMainPlate;
            }
        }