Теперь точно всё готово. Лабораторная работа 3
This commit is contained in:
parent
0be2471e88
commit
b967200792
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user