2024-03-26 23:48:45 +04:00

50 lines
1.5 KiB
C#

using ProjectSeaplane.Drawnings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectSeaplane.CollectionGenericObjects;
public class PlanePark : AbstractCompany
{
/// <summary>
/// Конструктор
/// </summary>
/// <param name="picWidth"></param>
/// <param name="picHeight"></param>
/// <param name="collection"></param>
public PlanePark(int picWidth, int picHeight, ICollectionGenericObjects<DrawingBasicSeaplane> collection) : base(picWidth, picHeight, collection)
{
}
protected override void DrawBackgound(Graphics g)
{
int width = _pictureWidth / _placeSizeWidth;
int height = _pictureHeight / _placeSizeHeight;
Pen pen = new(Color.Black, 3);
for (int i = 0; i < width; i++)
{
for (int j = 0; j < height + 1; ++j)
{
g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth - 15, j * _placeSizeHeight);
}
}
}
protected override void SetObjectsPosition()
{
int count = 0;
for (int y = 5; y + 50 < _pictureHeight; y += 90)
{
for (int x = 5; x + 200 < _pictureWidth; x += _placeSizeHeight + 90)
{
_collection?.Get(count)?.SetPictureSize(_pictureWidth, _pictureHeight);
_collection?.Get(count)?.SetPosition(x, y);
count++;
}
}
}
}