This commit is contained in:
Anna 2023-12-02 00:24:08 +04:00
parent b68ea11c6f
commit 31f294023d
6 changed files with 395 additions and 153 deletions

View File

@ -28,26 +28,98 @@
/// </summary>
private void InitializeComponent()
{
this.pictureBoxCollection = new System.Windows.Forms.PictureBox();
this.toolsPanel = new System.Windows.Forms.Panel();
this.panelSets = new System.Windows.Forms.Panel();
this.textBoxStorageName = new System.Windows.Forms.TextBox();
this.listBoxObjects = new System.Windows.Forms.ListBox();
this.ButtonAddObject = new System.Windows.Forms.Button();
this.ButtonDelObject = new System.Windows.Forms.Button();
this.SetsLabel = new System.Windows.Forms.Label();
this.ButtonAddAirplane = new System.Windows.Forms.Button();
this.ButtonDeleteAirplane = new System.Windows.Forms.Button();
this.maskedTextBoxNumber = new System.Windows.Forms.MaskedTextBox();
this.ButtonRefreshCollection = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.maskedTextBoxNumber = new System.Windows.Forms.TextBox();
this.LabelTools = new System.Windows.Forms.Label();
this.pictureBoxCollection = new System.Windows.Forms.PictureBox();
this.toolsPanel.SuspendLayout();
this.panelSets.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit();
this.SuspendLayout();
//
// pictureBoxCollection
// toolsPanel
//
this.pictureBoxCollection.Location = new System.Drawing.Point(1, -2);
this.pictureBoxCollection.Name = "pictureBoxCollection";
this.pictureBoxCollection.Size = new System.Drawing.Size(676, 451);
this.pictureBoxCollection.TabIndex = 0;
this.pictureBoxCollection.TabStop = false;
this.toolsPanel.Controls.Add(this.panelSets);
this.toolsPanel.Controls.Add(this.ButtonAddAirplane);
this.toolsPanel.Controls.Add(this.ButtonDeleteAirplane);
this.toolsPanel.Controls.Add(this.ButtonRefreshCollection);
this.toolsPanel.Controls.Add(this.maskedTextBoxNumber);
this.toolsPanel.Controls.Add(this.LabelTools);
this.toolsPanel.Location = new System.Drawing.Point(675, -2);
this.toolsPanel.Name = "toolsPanel";
this.toolsPanel.Size = new System.Drawing.Size(220, 451);
this.toolsPanel.TabIndex = 0;
//
// panelSets
//
this.panelSets.Controls.Add(this.textBoxStorageName);
this.panelSets.Controls.Add(this.listBoxObjects);
this.panelSets.Controls.Add(this.ButtonAddObject);
this.panelSets.Controls.Add(this.ButtonDelObject);
this.panelSets.Controls.Add(this.SetsLabel);
this.panelSets.Location = new System.Drawing.Point(8, 20);
this.panelSets.Name = "panelSets";
this.panelSets.Size = new System.Drawing.Size(210, 208);
this.panelSets.TabIndex = 6;
//
// textBoxStorageName
//
this.textBoxStorageName.Location = new System.Drawing.Point(10, 27);
this.textBoxStorageName.Name = "textBoxStorageName";
this.textBoxStorageName.Size = new System.Drawing.Size(190, 27);
this.textBoxStorageName.TabIndex = 12;
//
// listBoxObjects
//
this.listBoxObjects.FormattingEnabled = true;
this.listBoxObjects.ItemHeight = 20;
this.listBoxObjects.Location = new System.Drawing.Point(10, 99);
this.listBoxObjects.Name = "listBoxObjects";
this.listBoxObjects.Size = new System.Drawing.Size(190, 64);
this.listBoxObjects.TabIndex = 11;
this.listBoxObjects.Click += new System.EventHandler(this.listBoxObjects_SelectedIndexChanged);
//
// ButtonAddObject
//
this.ButtonAddObject.Location = new System.Drawing.Point(10, 60);
this.ButtonAddObject.Name = "ButtonAddObject";
this.ButtonAddObject.Size = new System.Drawing.Size(191, 33);
this.ButtonAddObject.TabIndex = 8;
this.ButtonAddObject.Text = "Добавить набор";
this.ButtonAddObject.UseVisualStyleBackColor = true;
this.ButtonAddObject.Click += new System.EventHandler(this.ButtonAddObject_Click);
//
// ButtonDelObject
//
this.ButtonDelObject.Location = new System.Drawing.Point(10, 169);
this.ButtonDelObject.Name = "ButtonDelObject";
this.ButtonDelObject.Size = new System.Drawing.Size(192, 33);
this.ButtonDelObject.TabIndex = 7;
this.ButtonDelObject.Text = "Удалить набор\r\n";
this.ButtonDelObject.UseVisualStyleBackColor = true;
this.ButtonDelObject.Click += new System.EventHandler(this.ButtonDelObject_Click);
//
// SetsLabel
//
this.SetsLabel.AutoSize = true;
this.SetsLabel.Location = new System.Drawing.Point(13, 4);
this.SetsLabel.Name = "SetsLabel";
this.SetsLabel.Size = new System.Drawing.Size(66, 20);
this.SetsLabel.TabIndex = 0;
this.SetsLabel.Text = "Наборы";
//
// ButtonAddAirplane
//
this.ButtonAddAirplane.Location = new System.Drawing.Point(750, 77);
this.ButtonAddAirplane.Location = new System.Drawing.Point(61, 234);
this.ButtonAddAirplane.Name = "ButtonAddAirplane";
this.ButtonAddAirplane.Size = new System.Drawing.Size(103, 49);
this.ButtonAddAirplane.TabIndex = 1;
@ -57,7 +129,7 @@
//
// ButtonDeleteAirplane
//
this.ButtonDeleteAirplane.Location = new System.Drawing.Point(750, 212);
this.ButtonDeleteAirplane.Location = new System.Drawing.Point(61, 301);
this.ButtonDeleteAirplane.Name = "ButtonDeleteAirplane";
this.ButtonDeleteAirplane.Size = new System.Drawing.Size(103, 55);
this.ButtonDeleteAirplane.TabIndex = 2;
@ -65,16 +137,9 @@
this.ButtonDeleteAirplane.UseVisualStyleBackColor = true;
this.ButtonDeleteAirplane.Click += new System.EventHandler(this.ButtonDeleteAirplane_Click);
//
// maskedTextBoxNumber
//
this.maskedTextBoxNumber.Location = new System.Drawing.Point(750, 154);
this.maskedTextBoxNumber.Name = "maskedTextBoxNumber";
this.maskedTextBoxNumber.Size = new System.Drawing.Size(103, 27);
this.maskedTextBoxNumber.TabIndex = 3;
//
// ButtonRefreshCollection
//
this.ButtonRefreshCollection.Location = new System.Drawing.Point(750, 299);
this.ButtonRefreshCollection.Location = new System.Drawing.Point(61, 395);
this.ButtonRefreshCollection.Name = "ButtonRefreshCollection";
this.ButtonRefreshCollection.Size = new System.Drawing.Size(103, 56);
this.ButtonRefreshCollection.TabIndex = 4;
@ -82,41 +147,62 @@
this.ButtonRefreshCollection.UseVisualStyleBackColor = true;
this.ButtonRefreshCollection.Click += new System.EventHandler(this.ButtonRefreshCollection_Click);
//
// label1
// maskedTextBoxNumber
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(750, 31);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(103, 20);
this.label1.TabIndex = 5;
this.label1.Text = "Инструменты";
this.maskedTextBoxNumber.Location = new System.Drawing.Point(48, 362);
this.maskedTextBoxNumber.Name = "maskedTextBoxNumber";
this.maskedTextBoxNumber.Size = new System.Drawing.Size(125, 27);
this.maskedTextBoxNumber.TabIndex = 2;
//
// LabelTools
//
this.LabelTools.AutoSize = true;
this.LabelTools.Location = new System.Drawing.Point(18, 0);
this.LabelTools.Name = "LabelTools";
this.LabelTools.Size = new System.Drawing.Size(103, 20);
this.LabelTools.TabIndex = 0;
this.LabelTools.Text = "Инструменты";
//
// pictureBoxCollection
//
this.pictureBoxCollection.Location = new System.Drawing.Point(1, -2);
this.pictureBoxCollection.Name = "pictureBoxCollection";
this.pictureBoxCollection.Size = new System.Drawing.Size(676, 451);
this.pictureBoxCollection.TabIndex = 0;
this.pictureBoxCollection.TabStop = false;
//
// FormAirplaneCollection
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(900, 450);
this.Controls.Add(this.label1);
this.Controls.Add(this.ButtonRefreshCollection);
this.Controls.Add(this.maskedTextBoxNumber);
this.Controls.Add(this.ButtonDeleteAirplane);
this.Controls.Add(this.ButtonAddAirplane);
this.Controls.Add(this.pictureBoxCollection);
this.Controls.Add(this.toolsPanel);
this.Name = "FormAirplaneCollection";
this.Text = "FormAirplaneCollection";
this.toolsPanel.ResumeLayout(false);
this.toolsPanel.PerformLayout();
this.panelSets.ResumeLayout(false);
this.panelSets.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Panel toolsPanel;
private Label LabelTools;
private PictureBox pictureBoxCollection;
private Button ButtonAddAirplane;
private Button ButtonDeleteAirplane;
private MaskedTextBox maskedTextBoxNumber;
public TextBox maskedTextBoxNumber;
private Panel panelSets;
private Label SetsLabel;
private Button ButtonDelObject;
private Button ButtonAddObject;
private Button ButtonRefreshCollection;
private Label label1;
private ListBox listBoxObjects;
private TextBox textBoxStorageName;
}
}

View File

@ -21,7 +21,7 @@ namespace Airbus_Base
/// <summary>
/// Набор объектов
/// </summary>
private readonly TheAirplanesGenericCollection<DrawningAirplane, DrawningObjectAirplane> _theAirplanes;
private readonly TheAirplaneGenericStorage _storage;
/// <summary>
/// Конструктор
@ -29,8 +29,78 @@ namespace Airbus_Base
public FormAirplaneCollection()
{
InitializeComponent();
_theAirplanes = new TheAirplanesGenericCollection<DrawningAirplane, DrawningObjectAirplane>
(pictureBoxCollection.Width, pictureBoxCollection.Height);
_storage = new TheAirplaneGenericStorage(pictureBoxCollection.Width, pictureBoxCollection.Height);
}
/// <summary>
/// Заполнение listBoxObjects
/// </summary>
private void ReloadObjects()
{
int index = listBoxObjects.SelectedIndex;
listBoxObjects.Items.Clear();
for (int i = 0; i < _storage.Keys.Count; i++)
{
listBoxObjects.Items.Add(_storage.Keys[i]);
}
if (listBoxObjects.Items.Count > 0 && (index == -1 || index >= listBoxObjects.Items.Count))
{
listBoxObjects.SelectedIndex = 0;
}
else if (listBoxObjects.Items.Count > 0 && index > -1 && index < listBoxObjects.Items.Count)
{
listBoxObjects.SelectedIndex = index;
}
}
/// <summary>
/// Добавление набора в коллекцию
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonAddObject_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxStorageName.Text))
{
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
_storage.AddSet(textBoxStorageName.Text);
ReloadObjects();
}
/// <summary>
/// Выбор набора
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void listBoxObjects_SelectedIndexChanged(object sender, EventArgs e)
{
pictureBoxCollection.Image = _storage[listBoxObjects.SelectedItem?.ToString() ?? string.Empty]?.ShowTheAirplanes();
}
/// <summary>
/// Удаление набора
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonDelObject_Click(object sender, EventArgs e)
{
if (listBoxObjects.SelectedIndex == -1)
{
return;
}
if (MessageBox.Show($"Удалить объект{listBoxObjects.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo,
MessageBoxIcon.Question) == DialogResult.Yes)
{
_storage.DelSet(listBoxObjects.SelectedItem.ToString()
?? string.Empty);
ReloadObjects();
}
}
/// <summary>
@ -40,13 +110,22 @@ namespace Airbus_Base
/// <param name="e"></param>
private void ButtonAddAirplane_Click(object sender, EventArgs e)
{
if (listBoxObjects.SelectedIndex == -1)
{
return;
}
var obj = _storage[listBoxObjects.SelectedItem.ToString() ?? string.Empty];
if (obj == null)
{
return;
}
FormAirbus form = new();
if (form.ShowDialog() == DialogResult.OK)
{
if (_theAirplanes + form.SelectedAirplane != -1)
if (obj + form.SelectedAirplane)
{
MessageBox.Show("Объект добавлен");
pictureBoxCollection.Image = _theAirplanes.ShowTheAirplanes();
pictureBoxCollection.Image = obj.ShowTheAirplanes();
}
else
{
@ -62,17 +141,28 @@ namespace Airbus_Base
/// <param name="e"></param>
private void ButtonDeleteAirplane_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
if (listBoxObjects.SelectedIndex == -1)
{
return;
}
var obj = _storage[listBoxObjects.SelectedItem.ToString() ??
string.Empty];
if (obj == null)
{
return;
}
if (MessageBox.Show("Удалить объект?", "Удаление",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
return;
}
int pos = Convert.ToInt32(maskedTextBoxNumber.Text);
if (_theAirplanes - pos != true)
if (obj - pos != null)
{
MessageBox.Show("Объект удален");
pictureBoxCollection.Image = _theAirplanes.ShowTheAirplanes();
pictureBoxCollection.Image = obj.ShowTheAirplanes();
}
else
{
@ -87,7 +177,17 @@ namespace Airbus_Base
/// <param name="e"></param>
private void ButtonRefreshCollection_Click(object sender, EventArgs e)
{
pictureBoxCollection.Image = _theAirplanes.ShowTheAirplanes();
if (listBoxObjects.SelectedIndex == -1)
{
return;
}
var obj = _storage[listBoxObjects.SelectedItem.ToString() ??
string.Empty];
if (obj == null)
{
return;
}
pictureBoxCollection.Image = obj.ShowTheAirplanes();
}
}
}

View File

@ -1,64 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">

View File

@ -14,14 +14,19 @@ namespace Airbus_Base.Generics
where T : class
{
/// <summary>
/// Массив объектов, которые храним
/// Список объектов, которые храним
/// </summary>
private readonly T?[] _places;
private readonly List<T?> _places;
/// <summary>
/// Количество объектов в массиве
/// Количество объектов в cписке
/// </summary>
public int Count => _places.Length;
public int Count => _places.Count;
/// <summary>
/// Максимальное количество объектов в cписке
/// </summary>
private readonly int _maxCount;
/// <summary>
/// Конструктор
@ -29,16 +34,23 @@ namespace Airbus_Base.Generics
/// <param name="count"></param>
public SetGeneric(int count)
{
_places = new T?[count];
_maxCount = count;
_places = new List<T?>(count);
}
/// <summary>
/// Добавление объекта в набор
/// </summary>
/// <param name="airplane">Добавляемый самолёт</param>
/// <returns></returns>
public int Insert(T airplane)
public bool Insert(T airplane)
{
return Insert(airplane, 0);
if (_places.Count == _maxCount)
{
return false;
}
Insert(airplane, 0);
return true;
}
/// <summary>
@ -47,36 +59,15 @@ namespace Airbus_Base.Generics
/// <param name="airplane">Добавляемый самолёт</param>
/// <param name="position">Позиция</param>
/// <returns></returns>
public int Insert(T airplane, int position)
public bool Insert(T airplane, int position)
{
int nullIndex = -1, i;
if (position < 0 || position >= Count)
if (!(position >= 0 && position <= Count && _places.Count < _maxCount))
{
return -1;
return false;
}
for (i = position; i < Count; i++)
{
if (_places[i] == null)
{
nullIndex = i;
break;
}
}
if (nullIndex < 0)
{
return -1;
}
for (i = nullIndex; i > position; i--)
{
_places[i] = _places[i - 1];
}
_places[position] = airplane;
return position;
_places.Insert(position, airplane);
return true;
}
/// <summary>
@ -91,7 +82,7 @@ namespace Airbus_Base.Generics
return false;
}
_places[position] = null;
_places.RemoveAt(position);
return true;
}
@ -100,14 +91,43 @@ namespace Airbus_Base.Generics
/// </summary>
/// <param name="position"></param>
/// <returns></returns>
public T? Get(int position)
public T? this[int position]
{
if (position < 0 || position >= Count)
get
{
return null;
if (position < 0 || position >= _maxCount)
{
return null;
}
return _places[position];
}
return _places[position];
set
{
if (!(position >= 0 && position < Count && _places.Count < _maxCount))
{
return;
}
_places.Insert(position, value);
return;
}
}
/// <summary>
/// Проход по списку
/// </summary>
/// <returns></returns>
public IEnumerable<T?> GetTheAirplanes(int? maxTheAirplanes = null)
{
for (int i = 0; i < _places.Count; ++i)
{
yield return _places[i];
if (maxTheAirplanes.HasValue && i == maxTheAirplanes.Value)
{
yield break;
}
}
}
}
}

View File

@ -0,0 +1,89 @@
using Airbus_Base.DrawningObjects;
using Airbus_Base.MovementStrategy;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Airbus_Base.Generics
{
/// <summary>
/// Класс для хранения коллекции
/// </summary>
internal class TheAirplaneGenericStorage
{
/// <summary>
/// Словарь (хранилище)
/// </summary>
readonly Dictionary<string, TheAirplanesGenericCollection<DrawningAirplane, DrawningObjectAirplane>> _airplaneStorages;
/// <summary>
/// Возвращение списка названий наборов
/// </summary>
public List<string> Keys => _airplaneStorages.Keys.ToList();
/// <summary>
/// Ширина окна отрисовки
/// </summary>
private readonly int _pictureWidth;
/// <summary>
/// Высота окна отрисовки
/// </summary>
private readonly int _pictureHeight;
/// <summary>
/// Конструктор
/// </summary>
/// <param name="pictureWidth"></param>
/// <param name="pictureHeight"></param>
public TheAirplaneGenericStorage(int pictureWidth, int pictureHeight)
{
_airplaneStorages = new Dictionary<string, TheAirplanesGenericCollection<DrawningAirplane, DrawningObjectAirplane>>();
_pictureWidth = pictureWidth;
_pictureHeight = pictureHeight;
}
/// <summary>
/// Добавление набора
/// </summary>
/// <param name="name">Название набора</param>
public void AddSet(string name)
{
_airplaneStorages.Add(name, new TheAirplanesGenericCollection<DrawningAirplane, DrawningObjectAirplane>(_pictureWidth, _pictureHeight));
}
/// <summary>
/// Удаление набора
/// </summary>
/// <param name="name">Название набора</param>
public void DelSet(string name)
{
if (!_airplaneStorages.ContainsKey(name))
{
return;
}
_airplaneStorages.Remove(name);
}
/// <summary>
/// Доступ к набору
/// </summary>
/// <param name="ind"></param>
/// <returns></returns>
public TheAirplanesGenericCollection<DrawningAirplane, DrawningObjectAirplane>? this[string ind]
{
get
{
if (_airplaneStorages.ContainsKey(ind))
{
return _airplaneStorages[ind];
}
return null;
}
}
}
}

View File

@ -62,13 +62,13 @@ namespace Airbus_Base.Generics
/// <param name="collect"></param>
/// <param name="obj"></param>
/// <returns></returns>
public static int operator +(TheAirplanesGenericCollection<T, U> collect, T? obj)
public static bool operator +(TheAirplanesGenericCollection<T, U> collect, T? obj)
{
if (obj == null)
{
return -1;
return false;
}
return collect._collection.Insert(obj);
return collect?._collection.Insert(obj) ?? false;
}
/// <summary>
@ -77,14 +77,14 @@ namespace Airbus_Base.Generics
/// <param name="collect"></param>
/// <param name="pos"></param>
/// <returns></returns>
public static bool operator -(TheAirplanesGenericCollection<T, U> collect, int pos)
public static T? operator -(TheAirplanesGenericCollection<T, U> collect, int pos)
{
T? obj = collect._collection.Get(pos);
T? obj = collect._collection[pos];
if (obj != null)
{
collect._collection.Remove(pos);
}
return false;
return obj;
}
/// <summary>
@ -94,7 +94,7 @@ namespace Airbus_Base.Generics
/// <returns></returns>
public U? GetU(int pos)
{
return (U?)_collection.Get(pos)?.GetMoveableObject;
return (U?)_collection[pos]?.GetMoveableObject;
}
/// <summary>
@ -135,14 +135,21 @@ namespace Airbus_Base.Generics
/// <param name="g"></param
private void DrawObjects(Graphics g)
{
for (int i = 0; i < _collection.Count; i++)
int x = _pictureWidth / _placeSizeWidth - 1;
int y = _pictureHeight / _placeSizeHeight - 1;
foreach (var airplane in _collection.GetTheAirplanes())
{
DrawningAirplane airplane = _collection.Get(i);
if (airplane != null)
{
int inRow = _pictureWidth / _placeSizeWidth;
airplane.SetPosition(((inRow - 1 - (i % inRow)) * _placeSizeWidth), ((_collection.Count / inRow - 1 - i / inRow) * _placeSizeHeight));
if (x < 0)
{
x = _pictureWidth / _placeSizeWidth - 1;
--y;
}
airplane.SetPosition(_placeSizeWidth * x, _placeSizeHeight * y);
airplane.DrawTransport(g);
--x;
}
}
}