Теперь точно всё готово. Лабораторная работа 3

This commit is contained in:
sqdselo 2024-04-01 01:15:33 +04:00
parent 0be2471e88
commit b967200792
2 changed files with 12 additions and 13 deletions

View File

@ -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<DrawningTrackedVehicle> array) : base(picWidth, picHeight, array)
public Garage(int picWidth, int picHeight, ICollectionGenericObjects<DrawningTrackedVehicle> 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;
}

View File

@ -25,7 +25,7 @@ namespace HoistingCrane
switch (comboBoxSelectorCompany.Text)
{
case "Хранилище":
_company = new CarSharingService(pictureBox.Width, pictureBox.Height, new MassivGenericObjects<DrawningTrackedVehicle>());
_company = new Garage(pictureBox.Width, pictureBox.Height, new MassivGenericObjects<DrawningTrackedVehicle>());
break;
}
}