PIbd-14_Calimullin_A.R._Lab06_Simple #7

Closed
Bloody_Arthur wants to merge 5 commits from Lab06 into Lab05
2 changed files with 10 additions and 13 deletions
Showing only changes of commit dd0852f948 - Show all commits

View File

@ -35,7 +35,7 @@ public abstract class AbstractCompany
/// <summary>
/// Вычисление максимального количества элементов, который можно разместить в окне
/// </summary>
private int GetMaxCount => _pictureWidth * _pictureHeight / (_placeSizeWidth * _placeSizeHeight);
private int GetMaxCount => (_pictureWidth / _placeSizeWidth) * (_pictureHeight / _placeSizeHeight);
/// <summary>
/// Конструктор
@ -113,5 +113,4 @@ public abstract class AbstractCompany
/// Расстановка объектов
/// </summary>
protected abstract void SetObjectsPosition();
}
}

View File

@ -44,21 +44,19 @@ public class AirCraftAngar : AbstractCompany
/// </summary>
protected override void SetObjectsPosition()
{
int currentIndex = -1;
int currentIndex = 0;
for (int j = pamat_j; j >= 0; j--)
{
for (int i = pamat_i; i >= 0; i--)
{
currentIndex++;
if (_collection?.Get(currentIndex) == null) continue;
if (_collection?.Get(currentIndex) != null)
{
_collection.Get(currentIndex)?.SetPictureSize(_pictureWidth, _pictureHeight);
_collection.Get(currentIndex)?.SetPosition(i * _placeSizeWidth + 5, j * _placeSizeHeight + 5);
_collection.Get(currentIndex)?.SetPictureSize(_pictureWidth, _pictureHeight);
_collection.Get(currentIndex)?.SetPosition(i * _placeSizeWidth + 5, j * _placeSizeHeight + 5);
currentIndex++;
}
}
}
}
}
}