53 lines
1.7 KiB
C#
53 lines
1.7 KiB
C#
using ProjectElectricLocomotive.Drawnings;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ProjectElectricLocomotive.CollectionGenericObjects;
|
|
|
|
public class LocomotiveDepo : AbstractCompany
|
|
{
|
|
public LocomotiveDepo(int picWidth, int picHeight, ICollectionGenericObjects<DrawningLocomotive> collection) : base(picWidth, picHeight, collection)
|
|
{
|
|
}
|
|
|
|
protected override void DrawBackgound(Graphics g)
|
|
{
|
|
Pen steel = new Pen(Color.Gray);
|
|
Pen wood = new Pen(Color.Brown);
|
|
g.DrawRectangle(steel,0, _pictureHeight - 50,_pictureWidth,40 );
|
|
for(int i = 0; i < _pictureWidth; i += 20)
|
|
{
|
|
g.DrawLine(wood, i, _pictureHeight - 50, i + 10, _pictureHeight - 10);
|
|
g.DrawLine(wood, i, _pictureHeight - 190, i + 10, _pictureHeight - 150);
|
|
g.DrawLine(wood, i, _pictureHeight - 325, i + 10, _pictureHeight - 285);
|
|
|
|
}
|
|
g.DrawRectangle(steel, 0, _pictureHeight - 190, _pictureWidth, 40);
|
|
g.DrawRectangle(steel, 0, _pictureHeight - 325, _pictureWidth, 40);
|
|
|
|
//g.DrawRectangle(steel, 0, _pictureHeight - 40, _pictureWidth, 1000);
|
|
|
|
}
|
|
|
|
protected override void SetObjectsPosition(ICollectionGenericObjects<DrawningLocomotive> collection)
|
|
{
|
|
|
|
int index = 0;
|
|
for(int i = _pictureHeight - _placeSizeHeight; i >= 0; i-= _placeSizeHeight)
|
|
{
|
|
for(int j = 0; j <= _pictureWidth - _placeSizeWidth; j += _placeSizeWidth)
|
|
{
|
|
if (collection.Get(index) != null)
|
|
{
|
|
collection.Get(index).SetPosition(j + 10, i + 10);
|
|
index++;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|