diff --git a/HoistingCrane/HoistingCrane/CollectionGenericObjects/CarSharingService.cs b/HoistingCrane/HoistingCrane/CollectionGenericObjects/Garage.cs similarity index 70% rename from HoistingCrane/HoistingCrane/CollectionGenericObjects/CarSharingService.cs rename to HoistingCrane/HoistingCrane/CollectionGenericObjects/Garage.cs index 44f0e37..e2da629 100644 --- a/HoistingCrane/HoistingCrane/CollectionGenericObjects/CarSharingService.cs +++ b/HoistingCrane/HoistingCrane/CollectionGenericObjects/Garage.cs @@ -1,15 +1,14 @@ using HoistingCrane.Drawning; using System; +using System.Collections.Specialized; namespace HoistingCrane.CollectionGenericObjects { - public class CarSharingService : AbstractCompany + public class Garage : AbstractCompany { - public CarSharingService(int picWidth, int picHeight, ICollectionGenericObjects array) : base(picWidth, picHeight, array) + public Garage(int picWidth, int picHeight, ICollectionGenericObjects array) : base(picWidth, picHeight, array) { } - - protected override void DrawBackgound(Graphics g) { int width = pictureWidth / _placeSizeWidth; @@ -30,25 +29,25 @@ namespace HoistingCrane.CollectionGenericObjects int countWidth = pictureWidth / _placeSizeWidth; int countHeight = pictureHeight / _placeSizeHeight; - int currentPosWidth = 0; - int currentPosHeight = 0; + int currentPosWidth = countWidth - 1; + int currentPosHeight = countHeight - 1; for (int i = 0; i < (arr?.Count ?? 0); i++) { if (arr?.Get(i) != null) { arr?.Get(i)?.SetPictureSize(pictureWidth, pictureHeight); - arr?.Get(i)?.SetPosition(_placeSizeWidth * currentPosWidth + 25, currentPosHeight * _placeSizeHeight + 15); + arr?.Get(i)?.SetPosition(_placeSizeWidth * currentPosWidth + 25, _placeSizeHeight * currentPosHeight + 15); } - if (currentPosWidth < countWidth-1) - currentPosWidth++; + if (currentPosWidth > 0) + currentPosWidth--; else { - currentPosWidth = 0; - currentPosHeight++; + currentPosWidth = countWidth - 1; + currentPosHeight--; } - if (currentPosHeight > countHeight - 1) + if (currentPosHeight < 0) { break; } diff --git a/HoistingCrane/HoistingCrane/FormCarCollection.cs b/HoistingCrane/HoistingCrane/FormCarCollection.cs index 5c6c1ad..7175e29 100644 --- a/HoistingCrane/HoistingCrane/FormCarCollection.cs +++ b/HoistingCrane/HoistingCrane/FormCarCollection.cs @@ -25,7 +25,7 @@ namespace HoistingCrane switch (comboBoxSelectorCompany.Text) { case "Хранилище": - _company = new CarSharingService(pictureBox.Width, pictureBox.Height, new MassivGenericObjects()); + _company = new Garage(pictureBox.Width, pictureBox.Height, new MassivGenericObjects()); break; } }