From 397c8a2377cf10010ce8f3a456a72b45916ba7ac Mon Sep 17 00:00:00 2001 From: BoiledMilk123 Date: Wed, 5 Jun 2024 08:59:00 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B7=D0=B0=D0=BA=D0=BE=D0=BD=D1=87=D0=B8?= =?UTF-8?q?=D0=BB=20labwork03?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LocomotiveDepotService.java | 15 +++++++-------- .../SpecialGenerateLocomotive.java | 4 ++-- .../src/Forms/FormGenerateLocomotive.java | 4 ++-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ProjectElectricLocomotive/src/CollectionGenericObjects/LocomotiveDepotService.java b/ProjectElectricLocomotive/src/CollectionGenericObjects/LocomotiveDepotService.java index 4eb6a8b..9bec88c 100644 --- a/ProjectElectricLocomotive/src/CollectionGenericObjects/LocomotiveDepotService.java +++ b/ProjectElectricLocomotive/src/CollectionGenericObjects/LocomotiveDepotService.java @@ -41,17 +41,16 @@ public class LocomotiveDepotService extends AbstractCompany @Override protected void SetObjectsPosition() { if (locCoord == null || _collection == null) return; - int row = 1, col = 1; - for (int i = 0; i < _collection.getCount(); i++, col++) - { - if(_collection.get(i) == null) continue; + int row = countInRow, col = 1; + for (int i = 0; i < _collection.getCount(); i++, col++) { + if (_collection.get(i) == null) continue; _collection.get(i).SetPictureSize(_pictureWidth, _pictureHeight); - _collection.get(i).SetPosition(locCoord.get(row * countInRow - col).getKey() + 5, locCoord.get(row * countInRow - col).getValue() + 5); - if (col == countInRow) - { + _collection.get(i).SetPosition(locCoord.get((row - 1) * countInRow + (col - 1)).getKey() + 5, locCoord.get((row - 1) * countInRow + (col - 1)).getValue() + 5); + if (col == countInRow) { col = 0; - row++; + row--; } } } + } diff --git a/ProjectElectricLocomotive/src/CollectionGenericObjects/SpecialGenerateLocomotive.java b/ProjectElectricLocomotive/src/CollectionGenericObjects/SpecialGenerateLocomotive.java index 4256d97..8c51498 100644 --- a/ProjectElectricLocomotive/src/CollectionGenericObjects/SpecialGenerateLocomotive.java +++ b/ProjectElectricLocomotive/src/CollectionGenericObjects/SpecialGenerateLocomotive.java @@ -24,7 +24,7 @@ public class SpecialGenerateLocomotive