Compare commits

...

3 Commits

Author SHA1 Message Date
sqdselo
70b6a0b727 / 2024-06-06 10:50:56 +04:00
sqdselo
9fa0365307 Merge branch 'LabWork07' of http://student.git.athene.tech/sqdselo/pibd-12_Tangatarov.I.A._Base into LabWork07 2024-06-06 10:48:56 +04:00
sqdselo
6a1f539b10 Борьба с конфликтами 2024-06-06 10:48:49 +04:00

View File

@ -76,7 +76,7 @@ public abstract class AbstractCompany
public DrawningTrackedVehicle? GetRandomObject() public DrawningTrackedVehicle? GetRandomObject()
{ {
Random rnd = new(); Random rnd = new();
return _collection?.Get(rnd.Next(GetMaxCount)); return arr?.Get(rnd.Next(GetMaxCount));
} }
/// <summary> /// <summary>
@ -85,15 +85,19 @@ public abstract class AbstractCompany
/// <returns></returns> /// <returns></returns>
public Bitmap? Show() public Bitmap? Show()
{ {
Bitmap bitmap = new(_pictureWidth, _pictureHeight); Bitmap bitmap = new(pictureWidth, pictureHeight);
Graphics graphics = Graphics.FromImage(bitmap); Graphics graphics = Graphics.FromImage(bitmap);
DrawBackgound(graphics); DrawBackgound(graphics);
SetObjectsPosition(); SetObjectsPosition();
for (int i = 0; i < (_collection?.Count ?? 0); ++i) for (int i = 0; i < (arr?.Count ?? 0); ++i)
{ {
DrawningTrackedVehicle? obj = _collection?.Get(i); try
{
DrawningTrackedVehicle? obj = arr?.Get(i);
obj?.DrawTransport(graphics); obj?.DrawTransport(graphics);
} }
catch (Exception) { }
}
return bitmap; return bitmap;
} }