2024-04-24 22:45:48 +04:00
|
|
|
|
using lab1.Drawnings;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace lab1.CollectionGenericObjects;
|
|
|
|
|
|
|
|
|
|
public class TrackedVehicleSharingService : AbstractCompany
|
|
|
|
|
{
|
|
|
|
|
public TrackedVehicleSharingService(int picWidth, int picHeight, ICollectionGenericObjects<DrawningTrackedVehicle> collection) : base(picWidth, picHeight, collection)
|
|
|
|
|
{
|
|
|
|
|
}
|
2024-08-29 23:07:11 +04:00
|
|
|
|
|
2024-10-22 13:37:29 +04:00
|
|
|
|
internal static int getAmountOfObjects()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-24 22:45:48 +04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Вывод заднего фона
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="g"></param>
|
|
|
|
|
protected override void DrawBackgound(Graphics g)
|
|
|
|
|
{
|
|
|
|
|
int width = _pictureWidth / _placeSizeWidth;
|
|
|
|
|
int height = _pictureHeight / _placeSizeHeight;
|
|
|
|
|
Pen pen = new(Color.Black, 2);
|
|
|
|
|
for (int i = 0; i < width; i++)
|
|
|
|
|
{
|
|
|
|
|
for (int j = 0; j < height + 1; ++j)
|
|
|
|
|
{
|
|
|
|
|
g.DrawLine(pen, i * _placeSizeWidth + 15, j * _placeSizeHeight, i * _placeSizeWidth + 15 + _placeSizeWidth - 55, j * _placeSizeHeight);
|
|
|
|
|
g.DrawLine(pen, i * _placeSizeWidth + 15, j * _placeSizeHeight, i * _placeSizeWidth + 15, j * _placeSizeHeight - _placeSizeHeight);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Расстановка объектов
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected override void SetObjectsPosition()
|
|
|
|
|
{
|
|
|
|
|
int width = _pictureWidth / _placeSizeWidth;
|
|
|
|
|
int height = _pictureHeight / _placeSizeHeight;
|
|
|
|
|
int curWidth = width - 1;
|
|
|
|
|
int curHeight = 0;
|
|
|
|
|
for (int i = 0; i < (_collection?.Count ?? 0); i++)
|
|
|
|
|
{
|
2024-10-02 10:44:28 +04:00
|
|
|
|
try
|
2024-04-24 22:45:48 +04:00
|
|
|
|
{
|
2024-10-02 10:44:28 +04:00
|
|
|
|
_collection?.Get(i)?.SetPictureSize(_pictureWidth, _pictureHeight);
|
|
|
|
|
_collection?.Get(i)?.SetPosition(_placeSizeWidth * curWidth+28, curHeight * _placeSizeHeight + 28);
|
2024-04-24 22:45:48 +04:00
|
|
|
|
}
|
2024-10-02 10:44:28 +04:00
|
|
|
|
catch (Exception) { }
|
2024-04-24 22:45:48 +04:00
|
|
|
|
if (curWidth > 0)
|
|
|
|
|
curWidth--;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
curWidth = width - 1;
|
|
|
|
|
curHeight++;
|
|
|
|
|
}
|
|
|
|
|
if (curHeight > height)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|