70%
This commit is contained in:
parent
660f9be57c
commit
3394c1cf58
73
Bulldoser/Bulldoser/Form2.Designer.cs
generated
73
Bulldoser/Bulldoser/Form2.Designer.cs
generated
@ -30,12 +30,18 @@
|
|||||||
{
|
{
|
||||||
pictureBoxCollections = new PictureBox();
|
pictureBoxCollections = new PictureBox();
|
||||||
groupBoxTools = new GroupBox();
|
groupBoxTools = new GroupBox();
|
||||||
|
groupBox1 = new GroupBox();
|
||||||
|
listBoxStorage = new ListBox();
|
||||||
|
DelNabor = new Button();
|
||||||
|
AddNabor = new Button();
|
||||||
|
InputNabor = new MaskedTextBox();
|
||||||
maskedTextBoxNumbers = new MaskedTextBox();
|
maskedTextBoxNumbers = new MaskedTextBox();
|
||||||
buttonUpdateCollection = new Button();
|
buttonUpdateCollection = new Button();
|
||||||
buttonRemoveTransport = new Button();
|
buttonRemoveTransport = new Button();
|
||||||
buttonAddTransport = new Button();
|
buttonAddTransport = new Button();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxCollections).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureBoxCollections).BeginInit();
|
||||||
groupBoxTools.SuspendLayout();
|
groupBoxTools.SuspendLayout();
|
||||||
|
groupBox1.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// pictureBoxCollections
|
// pictureBoxCollections
|
||||||
@ -48,6 +54,7 @@
|
|||||||
//
|
//
|
||||||
// groupBoxTools
|
// groupBoxTools
|
||||||
//
|
//
|
||||||
|
groupBoxTools.Controls.Add(groupBox1);
|
||||||
groupBoxTools.Controls.Add(maskedTextBoxNumbers);
|
groupBoxTools.Controls.Add(maskedTextBoxNumbers);
|
||||||
groupBoxTools.Controls.Add(buttonUpdateCollection);
|
groupBoxTools.Controls.Add(buttonUpdateCollection);
|
||||||
groupBoxTools.Controls.Add(buttonRemoveTransport);
|
groupBoxTools.Controls.Add(buttonRemoveTransport);
|
||||||
@ -59,9 +66,60 @@
|
|||||||
groupBoxTools.TabStop = false;
|
groupBoxTools.TabStop = false;
|
||||||
groupBoxTools.Text = "Инструменты";
|
groupBoxTools.Text = "Инструменты";
|
||||||
//
|
//
|
||||||
|
// groupBox1
|
||||||
|
//
|
||||||
|
groupBox1.Controls.Add(listBoxStorage);
|
||||||
|
groupBox1.Controls.Add(DelNabor);
|
||||||
|
groupBox1.Controls.Add(AddNabor);
|
||||||
|
groupBox1.Controls.Add(InputNabor);
|
||||||
|
groupBox1.Location = new Point(6, 22);
|
||||||
|
groupBox1.Name = "groupBox1";
|
||||||
|
groupBox1.Size = new Size(188, 223);
|
||||||
|
groupBox1.TabIndex = 6;
|
||||||
|
groupBox1.TabStop = false;
|
||||||
|
groupBox1.Text = "Наборы";
|
||||||
|
//
|
||||||
|
// listBoxStorage
|
||||||
|
//
|
||||||
|
listBoxStorage.FormattingEnabled = true;
|
||||||
|
listBoxStorage.ItemHeight = 15;
|
||||||
|
listBoxStorage.Location = new Point(6, 85);
|
||||||
|
listBoxStorage.Name = "listBoxStorage";
|
||||||
|
listBoxStorage.Size = new Size(176, 94);
|
||||||
|
listBoxStorage.TabIndex = 10;
|
||||||
|
//
|
||||||
|
// DelNabor
|
||||||
|
//
|
||||||
|
DelNabor.Location = new Point(6, 187);
|
||||||
|
DelNabor.Name = "DelNabor";
|
||||||
|
DelNabor.Size = new Size(176, 30);
|
||||||
|
DelNabor.TabIndex = 9;
|
||||||
|
DelNabor.Text = "Удалить набор";
|
||||||
|
DelNabor.UseVisualStyleBackColor = true;
|
||||||
|
DelNabor.Click += ButtonRemoveObject_Click;
|
||||||
|
//
|
||||||
|
// AddNabor
|
||||||
|
//
|
||||||
|
AddNabor.Location = new Point(6, 49);
|
||||||
|
AddNabor.Name = "AddNabor";
|
||||||
|
AddNabor.Size = new Size(176, 30);
|
||||||
|
AddNabor.TabIndex = 8;
|
||||||
|
AddNabor.Text = "Добавить набор";
|
||||||
|
AddNabor.UseVisualStyleBackColor = true;
|
||||||
|
AddNabor.Click += ButtonAddObject_Click;
|
||||||
|
//
|
||||||
|
// InputNabor
|
||||||
|
//
|
||||||
|
InputNabor.Location = new Point(6, 21);
|
||||||
|
InputNabor.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
InputNabor.Mask = "0";
|
||||||
|
InputNabor.Name = "InputNabor";
|
||||||
|
InputNabor.Size = new Size(176, 23);
|
||||||
|
InputNabor.TabIndex = 7;
|
||||||
|
//
|
||||||
// maskedTextBoxNumbers
|
// maskedTextBoxNumbers
|
||||||
//
|
//
|
||||||
maskedTextBoxNumbers.Location = new Point(6, 106);
|
maskedTextBoxNumbers.Location = new Point(6, 312);
|
||||||
maskedTextBoxNumbers.Margin = new Padding(3, 2, 3, 2);
|
maskedTextBoxNumbers.Margin = new Padding(3, 2, 3, 2);
|
||||||
maskedTextBoxNumbers.Mask = "0";
|
maskedTextBoxNumbers.Mask = "0";
|
||||||
maskedTextBoxNumbers.Name = "maskedTextBoxNumbers";
|
maskedTextBoxNumbers.Name = "maskedTextBoxNumbers";
|
||||||
@ -70,7 +128,7 @@
|
|||||||
//
|
//
|
||||||
// buttonUpdateCollection
|
// buttonUpdateCollection
|
||||||
//
|
//
|
||||||
buttonUpdateCollection.Location = new Point(6, 220);
|
buttonUpdateCollection.Location = new Point(6, 386);
|
||||||
buttonUpdateCollection.Name = "buttonUpdateCollection";
|
buttonUpdateCollection.Name = "buttonUpdateCollection";
|
||||||
buttonUpdateCollection.Size = new Size(188, 40);
|
buttonUpdateCollection.Size = new Size(188, 40);
|
||||||
buttonUpdateCollection.TabIndex = 3;
|
buttonUpdateCollection.TabIndex = 3;
|
||||||
@ -80,7 +138,7 @@
|
|||||||
//
|
//
|
||||||
// buttonRemoveTransport
|
// buttonRemoveTransport
|
||||||
//
|
//
|
||||||
buttonRemoveTransport.Location = new Point(6, 152);
|
buttonRemoveTransport.Location = new Point(6, 340);
|
||||||
buttonRemoveTransport.Name = "buttonRemoveTransport";
|
buttonRemoveTransport.Name = "buttonRemoveTransport";
|
||||||
buttonRemoveTransport.Size = new Size(188, 40);
|
buttonRemoveTransport.Size = new Size(188, 40);
|
||||||
buttonRemoveTransport.TabIndex = 2;
|
buttonRemoveTransport.TabIndex = 2;
|
||||||
@ -90,7 +148,7 @@
|
|||||||
//
|
//
|
||||||
// buttonAddTransport
|
// buttonAddTransport
|
||||||
//
|
//
|
||||||
buttonAddTransport.Location = new Point(6, 39);
|
buttonAddTransport.Location = new Point(6, 260);
|
||||||
buttonAddTransport.Name = "buttonAddTransport";
|
buttonAddTransport.Name = "buttonAddTransport";
|
||||||
buttonAddTransport.Size = new Size(188, 47);
|
buttonAddTransport.Size = new Size(188, 47);
|
||||||
buttonAddTransport.TabIndex = 0;
|
buttonAddTransport.TabIndex = 0;
|
||||||
@ -110,6 +168,8 @@
|
|||||||
((System.ComponentModel.ISupportInitialize)pictureBoxCollections).EndInit();
|
((System.ComponentModel.ISupportInitialize)pictureBoxCollections).EndInit();
|
||||||
groupBoxTools.ResumeLayout(false);
|
groupBoxTools.ResumeLayout(false);
|
||||||
groupBoxTools.PerformLayout();
|
groupBoxTools.PerformLayout();
|
||||||
|
groupBox1.ResumeLayout(false);
|
||||||
|
groupBox1.PerformLayout();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,5 +181,10 @@
|
|||||||
private Button buttonRemoveTransport;
|
private Button buttonRemoveTransport;
|
||||||
private Button buttonAddTransport;
|
private Button buttonAddTransport;
|
||||||
private MaskedTextBox maskedTextBoxNumbers;
|
private MaskedTextBox maskedTextBoxNumbers;
|
||||||
|
private GroupBox groupBox1;
|
||||||
|
private ListBox listBoxStorage;
|
||||||
|
private Button DelNabor;
|
||||||
|
private Button AddNabor;
|
||||||
|
private MaskedTextBox InputNabor;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
using Bulldoser.Drawings;
|
using Bulldoser.Drawings;
|
||||||
using Bulldoser.Generic;
|
using Bulldoser.Generic;
|
||||||
using Bulldoser.MovementStrategy;
|
using Bulldoser.MovementStrategy;
|
||||||
|
using Bulldozer.Generics;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -15,24 +16,75 @@ namespace Bulldoser
|
|||||||
{
|
{
|
||||||
public partial class FormTractorCollection : Form
|
public partial class FormTractorCollection : Form
|
||||||
{
|
{
|
||||||
private readonly TractorGenericCollection<DrawingTractor, DrawingObjectTractor> _Tractors;
|
private readonly TractorGenericStorage _storage;
|
||||||
public FormTractorCollection()
|
public FormTractorCollection()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_Tractors = new TractorGenericCollection<DrawingTractor, DrawingObjectTractor>(pictureBoxCollections.Width,
|
_storage = new TractorGenericStorage(pictureBoxCollections.Width, pictureBoxCollections.Height);
|
||||||
pictureBoxCollections.Height);
|
|
||||||
}
|
}
|
||||||
|
private void ReloadObjects()
|
||||||
|
{
|
||||||
|
int index = listBoxStorage.SelectedIndex;
|
||||||
|
|
||||||
|
listBoxStorage.Items.Clear();
|
||||||
|
for (int i = 0; i < _storage.Keys.Count; i++)
|
||||||
|
{
|
||||||
|
listBoxStorage.Items.Add(_storage.Keys[i]);
|
||||||
|
}
|
||||||
|
if (listBoxStorage.Items.Count > 0 && (index == -1 || index >= listBoxStorage.Items.Count))
|
||||||
|
{
|
||||||
|
listBoxStorage.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
else if (listBoxStorage.Items.Count > 0 && index > -1 && index < listBoxStorage.Items.Count)
|
||||||
|
{
|
||||||
|
listBoxStorage.SelectedIndex = index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonAddObject_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(InputNabor.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не всё заполнено", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_storage.AddSet(InputNabor.Text);
|
||||||
|
ReloadObjects();
|
||||||
|
}
|
||||||
|
private void listBoxStorage_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
pictureBoxCollections.Image = _storage[listBoxStorage.SelectedItem?.ToString() ?? string.Empty]?.ShowTractors();
|
||||||
|
}
|
||||||
|
private void ButtonRemoveObject_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (listBoxStorage.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (MessageBox.Show($"Удалить объект {listBoxStorage.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo,
|
||||||
|
MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
_storage.DelSet(listBoxStorage.SelectedItem.ToString() ?? string.Empty);
|
||||||
|
ReloadObjects();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ButtonAddTractor_Click(object sender, EventArgs e)
|
private void ButtonAddTractor_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_Tractors == null) return;
|
if (listBoxStorage.SelectedIndex == -1) return;
|
||||||
|
|
||||||
|
var obj = _storage[listBoxStorage.SelectedItem.ToString() ?? string.Empty];
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
FormBulldoser form = new();
|
FormBulldoser form = new();
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
//проверяем, удалось ли нам загрузить объект
|
//проверяем, удалось ли нам загрузить объект
|
||||||
if (_Tractors + form.SelectedTractor != -1)
|
if (obj + form.SelectedTractor > -1)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект добавлен");
|
MessageBox.Show("Объект добавлен");
|
||||||
pictureBoxCollections.Image = _Tractors.ShowTractors();
|
pictureBoxCollections.Image = obj.ShowTractors();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -40,17 +92,25 @@ namespace Bulldoser
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonRemoveTractor_Click(object sender, EventArgs e)
|
private void ButtonRemoveTractor_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (listBoxStorage.SelectedIndex == -1) return;
|
||||||
|
var obj = _storage[listBoxStorage.SelectedItem.ToString() ?? string.Empty];
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int pos = Convert.ToInt32(maskedTextBoxNumbers.Text);
|
int pos = Convert.ToInt32(maskedTextBoxNumbers.Text);
|
||||||
if (_Tractors - pos != null)
|
if (obj - pos != null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект удален");
|
MessageBox.Show("Объект удален");
|
||||||
pictureBoxCollections.Image = _Tractors.ShowTractors();
|
pictureBoxCollections.Image = obj.ShowTractors();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -59,7 +119,13 @@ namespace Bulldoser
|
|||||||
}
|
}
|
||||||
private void ButtonRefreshCollection_Click(object sender, EventArgs e)
|
private void ButtonRefreshCollection_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
pictureBoxCollections.Image = _Tractors.ShowTractors();
|
if (listBoxStorage.SelectedIndex == -1) return;
|
||||||
|
var obj = _storage[listBoxStorage.SelectedItem.ToString() ?? string.Empty];
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pictureBoxCollections.Image = obj.ShowTractors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ namespace Bulldoser.Generic
|
|||||||
public static T? operator -(TractorGenericCollection<T, U> collect, int
|
public static T? operator -(TractorGenericCollection<T, U> collect, int
|
||||||
pos)
|
pos)
|
||||||
{
|
{
|
||||||
T obj = collect._collection.Get(pos);
|
T obj = collect._collection[pos];
|
||||||
if (obj != null)
|
if (obj != null)
|
||||||
{
|
{
|
||||||
return collect._collection.Remove(pos);
|
return collect._collection.Remove(pos);
|
||||||
@ -50,7 +50,7 @@ namespace Bulldoser.Generic
|
|||||||
// получение объекта imoveableObj
|
// получение объекта imoveableObj
|
||||||
public U? GetU(int pos)
|
public U? GetU(int pos)
|
||||||
{
|
{
|
||||||
return (U?)_collection.Get(pos)?.GetMoveableObject;
|
return (U?)_collection[pos]?.GetMoveableObject;
|
||||||
}
|
}
|
||||||
/// Вывод всего набора объектов
|
/// Вывод всего набора объектов
|
||||||
public Bitmap ShowTractors()
|
public Bitmap ShowTractors()
|
||||||
@ -76,19 +76,19 @@ namespace Bulldoser.Generic
|
|||||||
}
|
}
|
||||||
private void DrawObjects(Graphics g)
|
private void DrawObjects(Graphics g)
|
||||||
{
|
{
|
||||||
int HeightObjCount = _pictureHeight / _placeSizeHeight;
|
int width = _pictureWidth / _placeSizeWidth;
|
||||||
int WidthObjCount = _pictureWidth / _placeSizeWidth;
|
int height = _pictureHeight / _placeSizeHeight;
|
||||||
for (int i = 0; i < _collection.Count; i++)
|
for (int i = 0; i < _collection.Count; i++)
|
||||||
{
|
{
|
||||||
T t = _collection.Get(i);
|
// Получение объекта
|
||||||
if (t != null)
|
var obj = _collection[i];
|
||||||
{
|
// Установка позиции
|
||||||
{
|
obj?.SetPosition(
|
||||||
t.SetPosition((_collection.Count - i - 1) % (_pictureWidth / _placeSizeWidth) * _placeSizeWidth,
|
(int)((width - 1) * _placeSizeWidth - (i % width * _placeSizeWidth)),
|
||||||
(_collection.Count - i - 1) / (_pictureWidth / _placeSizeWidth) * _placeSizeHeight);
|
(int)((height - 1) * _placeSizeHeight - (i / width * _placeSizeHeight))
|
||||||
t.DrawTransport(g);
|
);
|
||||||
}
|
// Прорисовка объекта
|
||||||
}
|
obj?.DrawTransport(g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,13 +6,15 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace Bulldoser.Generic
|
namespace Bulldoser.Generic
|
||||||
{
|
{
|
||||||
public class SetGeneric<T> where T : class
|
internal class SetGeneric<T> where T : class
|
||||||
{
|
{
|
||||||
private readonly T[] _places;
|
private readonly List<T?> _places;
|
||||||
public int Count => _places.Length;
|
public int Count => _places.Count;
|
||||||
|
private readonly int _maxCount;
|
||||||
public SetGeneric(int count)
|
public SetGeneric(int count)
|
||||||
{
|
{
|
||||||
_places = new T[count];
|
_places = new List<T?>(count);
|
||||||
|
_maxCount = count;
|
||||||
}
|
}
|
||||||
public int Insert(T tract)
|
public int Insert(T tract)
|
||||||
{
|
{
|
||||||
@ -20,48 +22,46 @@ namespace Bulldoser.Generic
|
|||||||
}
|
}
|
||||||
public int Insert(T tract, int position)
|
public int Insert(T tract, int position)
|
||||||
{
|
{
|
||||||
int NoEmpty = 0, temp = 0;
|
if (position < 0 || position >= _maxCount) return -1;
|
||||||
for (int i = position; i < Count; i++)
|
_places.Insert(position, tract);
|
||||||
{
|
|
||||||
if (_places[i] != null) NoEmpty++;
|
|
||||||
}
|
|
||||||
if (NoEmpty == Count - position - 1) return -1;
|
|
||||||
|
|
||||||
if (position < Count && position >= 0)
|
|
||||||
{
|
|
||||||
for (int j = position; j < Count; j++)
|
|
||||||
{
|
|
||||||
if (_places[j] == null)
|
|
||||||
{
|
|
||||||
temp = j;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// shift right
|
|
||||||
for (int i = temp; i > position; i--)
|
|
||||||
{
|
|
||||||
_places[i] = _places[i - 1];
|
|
||||||
}
|
|
||||||
_places[position] = tract;
|
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T? Remove(int position)
|
public T? Remove(int position)
|
||||||
{
|
{
|
||||||
if (position >= Count || position < 0)
|
if (position >= Count || position < 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
T tmp = _places[position];
|
T? tmp = _places[position];
|
||||||
_places[position] = null;
|
_places[position] = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
//Получение объекта из набора по позиции
|
//Получение объекта из набора по позиции
|
||||||
public T? Get(int position)
|
public T? this[int position]
|
||||||
|
{
|
||||||
|
get
|
||||||
{
|
{
|
||||||
if (position < 0 || position >= Count) return null;
|
if (position < 0 || position >= Count) return null;
|
||||||
return _places[position];
|
return _places[position];
|
||||||
}
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (position < 0 || position >= Count || Count == _maxCount) return;
|
||||||
|
_places.Insert(position, value);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public IEnumerable<T?> GetTractors(int? maxTracts = null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _places.Count; ++i)
|
||||||
|
{
|
||||||
|
yield return _places[i];
|
||||||
|
if (maxTracts.HasValue && i == maxTracts.Value)
|
||||||
|
{
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
47
Bulldoser/Bulldoser/Generic/TractorGenericStorage.cs
Normal file
47
Bulldoser/Bulldoser/Generic/TractorGenericStorage.cs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
|
||||||
|
using Bulldoser.Drawings;
|
||||||
|
using Bulldoser.Generic;
|
||||||
|
using Bulldoser.MovementStrategy;
|
||||||
|
|
||||||
|
namespace Bulldozer.Generics
|
||||||
|
{
|
||||||
|
internal class TractorGenericStorage
|
||||||
|
{
|
||||||
|
readonly Dictionary<string, TractorGenericCollection<DrawingTractor, DrawingObjectTractor>> _TractorsStorage;
|
||||||
|
public List<string> Keys => _TractorsStorage.Keys.ToList();
|
||||||
|
private readonly int _pictureWidth;
|
||||||
|
private readonly int _pictureHeight;
|
||||||
|
public TractorGenericStorage(int pictureWidth, int pictureHeight)
|
||||||
|
{
|
||||||
|
_TractorsStorage = new Dictionary<string, TractorGenericCollection<DrawingTractor, DrawingObjectTractor>>();
|
||||||
|
_pictureWidth = pictureWidth;
|
||||||
|
_pictureHeight = pictureHeight;
|
||||||
|
}
|
||||||
|
public void AddSet(string name)
|
||||||
|
{
|
||||||
|
if (!_TractorsStorage.ContainsKey(name))
|
||||||
|
{
|
||||||
|
_TractorsStorage.Add(name, new TractorGenericCollection<DrawingTractor, DrawingObjectTractor>(_pictureWidth, _pictureHeight));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void DelSet(string name)
|
||||||
|
{
|
||||||
|
if (_TractorsStorage.ContainsKey(name))
|
||||||
|
{
|
||||||
|
_TractorsStorage.Remove(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public TractorGenericCollection<DrawingTractor, DrawingObjectTractor>?
|
||||||
|
this[string ind]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_TractorsStorage.ContainsKey(ind))
|
||||||
|
{
|
||||||
|
return _TractorsStorage[ind];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Bulldoser
|
namespace Bulldoser.MovementStrategy
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Статус выполнения операции перемещения
|
/// Статус выполнения операции перемещения
|
||||||
|
Loading…
x
Reference in New Issue
Block a user