Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
786c0debb5 | |||
9c06d0a188 | |||
4479e1cfe7 | |||
34b237b368 | |||
ede3b91de8 | |||
9528b933c3 | |||
aef37af39e | |||
0846e11d19 |
@ -0,0 +1,116 @@
|
||||
using ProjectExcavator.Drawnings;
|
||||
|
||||
namespace ProjectExcavator.CollectionGenericObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Абстракция компании, хранящий коллекцию экскаваторов/Гусеничных машин
|
||||
/// </summary>
|
||||
public abstract class AbstractCompany
|
||||
{
|
||||
/// <summary>
|
||||
/// Размер места (ширина)
|
||||
/// </summary>
|
||||
protected readonly int _placeSizeWidth = 180;
|
||||
|
||||
/// <summary>
|
||||
/// Размер места (высота)
|
||||
/// </summary>
|
||||
protected readonly int _placeSizeHeight = 60;
|
||||
|
||||
/// <summary>
|
||||
/// Ширина окна
|
||||
/// </summary>
|
||||
protected readonly int _pictureWidth;
|
||||
|
||||
/// <summary>
|
||||
/// Высота окна
|
||||
/// </summary>
|
||||
protected readonly int _pictureHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Коллекция экскаваторов/Гусеничных машин
|
||||
/// </summary>
|
||||
protected ICollectionGenericObjects<DrawningTrackedVehicle>? _collection = null;
|
||||
|
||||
/// <summary>
|
||||
/// Вычисление максимального количества элементов, который можно разместить в окне
|
||||
/// </summary>
|
||||
private int GetMaxCount => _pictureWidth * _pictureHeight / (_placeSizeWidth * _placeSizeHeight);
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="picWidth">Ширина окна</param>
|
||||
/// <param name="picHeight">Высота окна</param>
|
||||
/// <param name="collection">Коллекция экскаваторов</param>
|
||||
public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects<DrawningTrackedVehicle> collection)
|
||||
{
|
||||
_pictureWidth = picWidth;
|
||||
_pictureHeight = picHeight;
|
||||
_collection = collection;
|
||||
_collection.MaxCount = GetMaxCount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перегрузка оператора сложения для класса
|
||||
/// </summary>
|
||||
/// <param name="company">Компания</param>
|
||||
/// <param name="excavator">Добавляемый объект</param>
|
||||
/// <returns></returns>
|
||||
public static int operator +(AbstractCompany company, DrawningTrackedVehicle excavator)
|
||||
{
|
||||
return company._collection.Insert(excavator);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перегрузка оператора удаления для класса
|
||||
/// </summary>
|
||||
/// <param name="company">Компания</param>
|
||||
/// <param name="position">Номер удаляемого объекта</param>
|
||||
/// <returns></returns>
|
||||
public static DrawningTrackedVehicle operator -(AbstractCompany company, int position)
|
||||
{
|
||||
return company._collection.Remove(position);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение случайного объекта из коллекции
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DrawningTrackedVehicle? GetRandomObject()
|
||||
{
|
||||
Random rnd = new();
|
||||
return _collection?.Get(rnd.Next(GetMaxCount));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Вывод всей коллекции
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Bitmap? Show()
|
||||
{
|
||||
Bitmap bitmap = new(_pictureWidth, _pictureHeight);
|
||||
Graphics graphics = Graphics.FromImage(bitmap);
|
||||
DrawBackgound(graphics);
|
||||
|
||||
SetObjectsPosition();
|
||||
for (int i = 0; i < (_collection?.Count ?? 0); ++i)
|
||||
{
|
||||
DrawningTrackedVehicle? obj = _collection?.Get(i);
|
||||
obj?.DrawTransport(graphics);
|
||||
}
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Вывод заднего фона
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
protected abstract void DrawBackgound(Graphics g);
|
||||
|
||||
/// <summary>
|
||||
/// Расстановка объектов
|
||||
/// </summary>
|
||||
protected abstract void SetObjectsPosition();
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
namespace ProjectExcavator.CollectionGenericObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Тип коллекции
|
||||
/// </summary>
|
||||
public enum CollectionType
|
||||
{
|
||||
/// <summary>
|
||||
/// Неопределено
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Массив
|
||||
/// </summary>
|
||||
Massive = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Список
|
||||
/// </summary>
|
||||
List = 2
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
using ProjectExcavator.Drawnings;
|
||||
|
||||
namespace ProjectExcavator.CollectionGenericObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Реализация абстрактной компании - Гараж
|
||||
/// </summary>
|
||||
internal class GarageService : AbstractCompany
|
||||
{
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="picWidth"></param>
|
||||
/// <param name="picHeight"></param>
|
||||
/// <param name="collection"></param>
|
||||
public GarageService(int picWidth, int picHeight, ICollectionGenericObjects<DrawningTrackedVehicle> collection) : base(picWidth, picHeight, collection)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void DrawBackgound(Graphics g)
|
||||
{
|
||||
Pen pen = new Pen(Color.Black, 3f);
|
||||
|
||||
|
||||
int PlaceWidth = _pictureWidth / _placeSizeWidth;
|
||||
int PlaceHeight = _pictureHeight / _placeSizeHeight;
|
||||
int Indent = 20;
|
||||
|
||||
|
||||
for (int i = 0; i < PlaceHeight / 2; i++)
|
||||
{
|
||||
g.DrawLine(pen, Indent , i * _placeSizeHeight * 2, PlaceWidth * _placeSizeWidth + Indent, i * _placeSizeHeight * 2);
|
||||
for (int j = 0; j < PlaceWidth + 1; ++j)
|
||||
{
|
||||
g.DrawLine(pen, j * _placeSizeWidth + Indent, i * _placeSizeHeight * 2, j * _placeSizeWidth + Indent, i * _placeSizeHeight * 2 + _placeSizeHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SetObjectsPosition()
|
||||
{
|
||||
int LevelWidth = 0;
|
||||
int LevelHeight = 0;
|
||||
|
||||
|
||||
for (int i = 0; i < _collection?.Count; i++)
|
||||
{
|
||||
if (_collection.Get(i) != null)
|
||||
{
|
||||
_collection?.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
|
||||
_collection?.Get(i)?.SetPosition((_pictureWidth - 190) - _placeSizeWidth * LevelWidth, 20 + (_placeSizeHeight + 60) * LevelHeight);
|
||||
}
|
||||
|
||||
if (LevelHeight + 1 > _pictureHeight / (_placeSizeHeight + 60))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (LevelWidth + 1 < _pictureWidth / _placeSizeWidth)
|
||||
{
|
||||
LevelWidth++;
|
||||
}
|
||||
else
|
||||
{
|
||||
LevelWidth = 0;
|
||||
LevelHeight++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
namespace ProjectExcavator.CollectionGenericObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Интерфейс описания действий для набора хранимых объектов
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Параметр: ограничение - ссылочный тип</typeparam>
|
||||
public interface ICollectionGenericObjects<T>
|
||||
where T : class
|
||||
{
|
||||
/// <summary>
|
||||
/// Количество объектов в коллекции
|
||||
/// </summary>
|
||||
int Count { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Установка максимального количества элементов
|
||||
/// </summary>
|
||||
int MaxCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Добавление объекта в коллекцию
|
||||
/// </summary>
|
||||
/// <param name="obj">Добавляемый объект</param>
|
||||
/// <returns>true - вставка прошла удачно, false - вставка не удалась</returns>
|
||||
int Insert(T obj);
|
||||
|
||||
/// <summary>
|
||||
/// Добавление объекта в коллекцию на конкретную позицию
|
||||
/// </summary>
|
||||
/// <param name="obj">Добавляемый объект</param>
|
||||
/// <param name="position">Позиция</param>
|
||||
/// <returns>true - вставка прошла удачно, false - вставка не удалась</returns>
|
||||
int Insert(T obj, int position);
|
||||
|
||||
/// <summary>
|
||||
/// Удаление объекта из коллекции с конкретной позиции
|
||||
/// </summary>
|
||||
/// <param name="position">Позиция</param>
|
||||
/// <returns>true - удаление прошло удачно, false - удаление не удалось</returns>
|
||||
T? Remove(int position);
|
||||
|
||||
/// <summary>
|
||||
/// Получение объекта по позиции
|
||||
/// </summary>
|
||||
/// <param name="position">Позиция</param>
|
||||
/// <returns>Объект</returns>
|
||||
T? Get(int position);
|
||||
|
||||
/// <summary>
|
||||
/// Получение типа коллекции
|
||||
/// </summary>
|
||||
CollectionType GetCollectionType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Получение объектов коллекции по одному
|
||||
/// </summary>
|
||||
/// <returns>Поэлементый вывод элементов коллекции</returns>
|
||||
IEnumerable<T?> GetItems();
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
namespace ProjectExcavator.CollectionGenericObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Параметризованный набор объектов
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Параметр: ограничение - ссылочный тип</typeparam>
|
||||
public class ListGenericObjects<T> : ICollectionGenericObjects<T>
|
||||
where T : class
|
||||
{
|
||||
/// <summary>
|
||||
/// Список объектов, которые храним
|
||||
/// </summary>
|
||||
private readonly List<T?> _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Максимально допустимое число объектов в списке
|
||||
/// </summary>
|
||||
private int _maxCount;
|
||||
|
||||
public int Count => _collection.Count;
|
||||
|
||||
public int MaxCount
|
||||
{
|
||||
get => _maxCount;
|
||||
set
|
||||
{
|
||||
if (value > 0)
|
||||
{
|
||||
_maxCount = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public CollectionType GetCollectionType => CollectionType.List;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public ListGenericObjects()
|
||||
{
|
||||
_collection = new();
|
||||
}
|
||||
|
||||
public T? Get(int position)
|
||||
{
|
||||
if (position >= 0 && position < Count)
|
||||
{
|
||||
return _collection[position];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public int Insert(T obj)
|
||||
{
|
||||
//проверка, что не превышено максимальное количество элементов
|
||||
//вставка в конец набора
|
||||
|
||||
if (_collection.Count > _maxCount)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
_collection.Add(obj);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
public int Insert(T obj, int position)
|
||||
{
|
||||
// проверка, что не превышено максимальное количество элементов
|
||||
// проверка позиции
|
||||
// вставка по позиции
|
||||
|
||||
if ((_collection.Count > _maxCount) || (position < 0 || position > Count))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
_collection.Insert(position, obj);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public T? Remove(int position)
|
||||
{
|
||||
// проверка позиции
|
||||
// удаление объекта из списка
|
||||
|
||||
if (position < 0 || position > Count)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
T? obj = _collection[position];
|
||||
_collection.RemoveAt(position);
|
||||
return obj;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public IEnumerable<T?> GetItems()
|
||||
{
|
||||
for (int i = 0; i < _collection.Count; ++i)
|
||||
{
|
||||
yield return _collection[i];
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
namespace ProjectExcavator.CollectionGenericObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Параметризованный набор объектов
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Параметр: ограничение - ссылочный тип</typeparam>
|
||||
public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
||||
where T : class
|
||||
{
|
||||
/// <summary>
|
||||
/// Массив объектов, которые храним
|
||||
/// </summary>
|
||||
private T?[] _collection;
|
||||
|
||||
public int Count => _collection.Length;
|
||||
|
||||
public int MaxCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return _collection.Length;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value > 0)
|
||||
{
|
||||
if (_collection.Length > 0)
|
||||
{
|
||||
Array.Resize(ref _collection, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
_collection = new T?[value];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CollectionType GetCollectionType => CollectionType.Massive;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public MassiveGenericObjects()
|
||||
{
|
||||
_collection = Array.Empty<T?>();
|
||||
}
|
||||
|
||||
public T? Get(int position)
|
||||
{
|
||||
//Проверка позиции
|
||||
|
||||
if (position < 0 || position > Count-1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return _collection[position];
|
||||
}
|
||||
}
|
||||
|
||||
public int Insert(T obj)
|
||||
{
|
||||
//Вставка в свободное место набора
|
||||
|
||||
return Insert(obj, 0);
|
||||
}
|
||||
|
||||
public int Insert(T obj, int position)
|
||||
{
|
||||
//Проверка позиции
|
||||
//Проверка, что элемент массива по этой позиции пустой, если нет, то
|
||||
//Ищется свободное место после этой позиции и идет вставка туда
|
||||
//если нет после, ищем до вставка
|
||||
|
||||
if (position >= Count || position < 0) return -1;
|
||||
|
||||
if (_collection[position] == null)
|
||||
{
|
||||
_collection[position] = obj;
|
||||
return position;
|
||||
}
|
||||
else
|
||||
{
|
||||
int after_position = position + 1;
|
||||
while (after_position < Count)
|
||||
{
|
||||
if (_collection[after_position] == null)
|
||||
{
|
||||
_collection[after_position] = obj;
|
||||
return after_position;
|
||||
}
|
||||
after_position ++;
|
||||
}
|
||||
|
||||
int behind_position = position - 1;
|
||||
while (behind_position >= 0)
|
||||
{
|
||||
if (_collection[behind_position] == null)
|
||||
{
|
||||
_collection[behind_position] = obj;
|
||||
return behind_position;
|
||||
}
|
||||
behind_position --;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public T? Remove(int position)
|
||||
{
|
||||
// Проверка позиции
|
||||
// Удаление объекта из массива, присвоив элементу массива значение null
|
||||
|
||||
if (position < 0 || _collection[position] == null || position > Count -1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
T obj = _collection[position];
|
||||
_collection[position] = null;
|
||||
return obj;
|
||||
}
|
||||
|
||||
public IEnumerable<T?> GetItems()
|
||||
{
|
||||
for (int i = 0; i < _collection.Length; ++i)
|
||||
{
|
||||
yield return _collection[i];
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,214 @@
|
||||
using ProjectExcavator.Drawnings;
|
||||
using System.Text;
|
||||
|
||||
namespace ProjectExcavator.CollectionGenericObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Класс-хранилище коллекций
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class StorageCollection<T>
|
||||
where T : DrawningTrackedVehicle
|
||||
{
|
||||
/// <summary>
|
||||
/// Словарь (хранилище) с коллекциями
|
||||
/// </summary>
|
||||
readonly Dictionary<string, ICollectionGenericObjects<T>> _storages;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Возвращение списка названий коллекций
|
||||
/// </summary>
|
||||
public List<string> Keys => _storages.Keys.ToList();
|
||||
|
||||
/// <summary>
|
||||
/// Ключевое слово, с которого должен начинаться файл
|
||||
/// </summary>
|
||||
private readonly string _collectionKey = "CollectionsStorage";
|
||||
|
||||
/// <summary>
|
||||
/// Разделитель для записи ключа и значения элемента словаря
|
||||
/// </summary>
|
||||
private readonly string _separatorForKeyValue = "|";
|
||||
|
||||
/// <summary>
|
||||
/// Разделитель для записей коллекции данных в файл
|
||||
/// </summary>
|
||||
private readonly string _separatorItems = ";";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public StorageCollection()
|
||||
{
|
||||
_storages = new Dictionary<string, ICollectionGenericObjects<T>>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавление коллекции в хранилище
|
||||
/// </summary>
|
||||
/// <param name="name">Название коллекции</param>
|
||||
/// <param name="collectionType">тип коллекции</param>
|
||||
public void AddCollection(string name, CollectionType collectionType)
|
||||
{
|
||||
if (name == null || _storages.ContainsKey(name))
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (collectionType)
|
||||
{
|
||||
case CollectionType.None:
|
||||
return;
|
||||
case CollectionType.List:
|
||||
_storages.Add(name, new ListGenericObjects<T> { });
|
||||
return;
|
||||
case CollectionType.Massive:
|
||||
_storages.Add(name, new MassiveGenericObjects<T> { });
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удаление коллекции
|
||||
/// </summary>
|
||||
/// <param name="name">Название коллекции</param>
|
||||
public void DelCollection(string name)
|
||||
{
|
||||
if (name == null || !_storages.ContainsKey(name)) { return; }
|
||||
_storages.Remove(name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Доступ к коллекции
|
||||
/// </summary>
|
||||
/// <param name="name">Название коллекции</param>
|
||||
/// <returns></returns>
|
||||
|
||||
public ICollectionGenericObjects<T>? this[string name]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (name == null || !_storages.ContainsKey(name)) { return null; }
|
||||
return _storages[name];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Сохранение информации по машинам в хранилище в файл
|
||||
/// </summary>
|
||||
/// <param name="filename">Путь и имя файла</param>
|
||||
/// <returns>true - сохранение прошло успешно, false - ошибка при сохранении данных</returns>
|
||||
public bool SaveData(string filename)
|
||||
{
|
||||
if (_storages.Count == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
File.Delete(filename);
|
||||
}
|
||||
|
||||
StringBuilder sb = new();
|
||||
|
||||
using (StreamWriter fs = new StreamWriter(filename))
|
||||
{
|
||||
fs.WriteLine(_collectionKey.ToString());
|
||||
foreach (KeyValuePair<string, ICollectionGenericObjects<T>> kvpair in _storages)
|
||||
{
|
||||
// не сохраняем пустые коллекции
|
||||
if (kvpair.Value.Count == 0)
|
||||
continue;
|
||||
sb.Append(kvpair.Key);
|
||||
sb.Append(_separatorForKeyValue);
|
||||
sb.Append(kvpair.Value.GetCollectionType);
|
||||
sb.Append(_separatorForKeyValue);
|
||||
sb.Append(kvpair.Value.MaxCount);
|
||||
sb.Append(_separatorForKeyValue);
|
||||
foreach (T? item in kvpair.Value.GetItems())
|
||||
{
|
||||
string data = item?.GetDataForSave() ?? string.Empty;
|
||||
if (string.IsNullOrEmpty(data))
|
||||
continue;
|
||||
sb.Append(data);
|
||||
sb.Append(_separatorItems);
|
||||
}
|
||||
fs.WriteLine(sb.ToString());
|
||||
sb.Clear();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Загрузка информации по машинам в хранилище из файла
|
||||
/// </summary>
|
||||
/// <param name="filename">Путь и имя файла</param>
|
||||
/// <returns>true - загрузка прошла успешно, false - ошибка при загрузке данных</returns>
|
||||
public bool LoadData(string filename)
|
||||
{
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
using (StreamReader sr = new StreamReader(filename))
|
||||
{
|
||||
string? str;
|
||||
str = sr.ReadLine();
|
||||
if (str != _collectionKey.ToString())
|
||||
return false;
|
||||
_storages.Clear();
|
||||
while ((str = sr.ReadLine()) != null)
|
||||
{
|
||||
string[] record = str.Split(_separatorForKeyValue);
|
||||
if (record.Length != 4)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
CollectionType collectionType = (CollectionType)Enum.Parse(typeof(CollectionType), record[1]);
|
||||
ICollectionGenericObjects<T>? collection = StorageCollection<T>.CreateCollection(collectionType);
|
||||
if (collection == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
collection.MaxCount = Convert.ToInt32(record[2]);
|
||||
|
||||
string[] set = record[3].Split(_separatorItems, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string elem in set)
|
||||
{
|
||||
if (elem?.CreateDrawningTrackedVehicle() is T boat)
|
||||
{
|
||||
if (collection.Insert(boat) == -1)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
_storages.Add(record[0], collection);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание коллекции по типу
|
||||
/// </summary>
|
||||
/// <param name="collectionType"></param>
|
||||
/// <returns></returns>
|
||||
private static ICollectionGenericObjects<T>? CreateCollection(CollectionType collectionType)
|
||||
{
|
||||
return collectionType switch
|
||||
{
|
||||
CollectionType.Massive => new MassiveGenericObjects<T>(),
|
||||
CollectionType.List => new ListGenericObjects<T>(),
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
}
|
32
ProjectExcavator/ProjectExcavator/Drawnings/DirectionType.cs
Normal file
32
ProjectExcavator/ProjectExcavator/Drawnings/DirectionType.cs
Normal file
@ -0,0 +1,32 @@
|
||||
namespace ProjectExcavator.Drawnings;
|
||||
|
||||
/// <summary>
|
||||
/// Направление перемещения
|
||||
/// </summary>
|
||||
public enum DirectionType
|
||||
{
|
||||
/// <summary>
|
||||
/// Неизвестное направление
|
||||
/// </summary>
|
||||
Unknow = -1,
|
||||
|
||||
/// <summary>
|
||||
/// Вверх
|
||||
/// </summary>
|
||||
Up = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Вниз
|
||||
/// </summary>
|
||||
Down = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Влево
|
||||
/// </summary>
|
||||
Left = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Вправо
|
||||
/// </summary>
|
||||
Right = 4
|
||||
}
|
138
ProjectExcavator/ProjectExcavator/Drawnings/DrawningExcavator.cs
Normal file
138
ProjectExcavator/ProjectExcavator/Drawnings/DrawningExcavator.cs
Normal file
@ -0,0 +1,138 @@
|
||||
using ProjectExcavator.Entities;
|
||||
|
||||
namespace ProjectExcavator.Drawnings;
|
||||
|
||||
/// <summary>
|
||||
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
||||
/// </summary>
|
||||
public class DrawningExcavator : DrawningTrackedVehicle
|
||||
{
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||
/// <param name="bucket">Признак наличия ковша</param>
|
||||
/// <param name="supports">Признак наличия поддержки</param>
|
||||
public DrawningExcavator(int speed, double weight, Color bodyColor, Color additionalColor, bool bucket, bool supports) : base(125, 60)
|
||||
{
|
||||
EntityTrackedVehicle = new EntityExcavator(speed, weight, bodyColor, additionalColor, bucket, supports);
|
||||
}
|
||||
/// <returns>true - объект создан, false - проверка не пройдена, нельзя создать объект в этих размерах</returns>
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор через сущность
|
||||
/// </summary>
|
||||
/// <param name="trackedVehicle">Объект класса-сущность</param>
|
||||
public DrawningExcavator(EntityTrackedVehicle trackedVehicle) : base(125,60)
|
||||
{
|
||||
EntityTrackedVehicle = trackedVehicle;
|
||||
}
|
||||
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityTrackedVehicle == null|| EntityTrackedVehicle is not EntityExcavator excavator || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Pen pen = new(Color.Black);
|
||||
Brush additionalBrush = new SolidBrush(excavator.AdditionalColor);
|
||||
Pen blackPen = new Pen(Color.Black, 2);
|
||||
Brush brBrown = new SolidBrush(Color.DarkSlateGray);
|
||||
|
||||
//Ковш со стрелой
|
||||
if (excavator.Bucket)
|
||||
{
|
||||
//стрела
|
||||
Point point1 = new Point(_startPosX.Value + 70, _startPosY.Value + 11);
|
||||
Point point2 = new Point(_startPosX.Value + 110, _startPosY.Value + 3);
|
||||
Point point3 = new Point(_startPosX.Value + 120, _startPosY.Value + 4);
|
||||
Point point4 = new Point(_startPosX.Value + 120, _startPosY.Value + 7);
|
||||
Point point5 = new Point(_startPosX.Value + 70, _startPosY.Value + 28);
|
||||
Point[] BucketPart1 =
|
||||
{
|
||||
point1,
|
||||
point2,
|
||||
point3,
|
||||
point4,
|
||||
point5
|
||||
};
|
||||
g.DrawPolygon(blackPen, BucketPart1);
|
||||
g.FillPolygon(additionalBrush, BucketPart1);
|
||||
|
||||
Point point6 = new Point(_startPosX.Value + 112, _startPosY.Value + 2);
|
||||
Point point7 = new Point(_startPosX.Value + 120, _startPosY.Value + 3);
|
||||
Point point8 = new Point(_startPosX.Value + 125, _startPosY.Value + 7);
|
||||
Point point9 = new Point(_startPosX.Value + 135, _startPosY.Value + 35);
|
||||
Point point10 = new Point(_startPosX.Value + 132, _startPosY.Value + 35);
|
||||
Point[] BucketPart2 =
|
||||
{
|
||||
point6,
|
||||
point7,
|
||||
point8,
|
||||
point9,
|
||||
point10
|
||||
};
|
||||
g.DrawPolygon(pen, BucketPart2);
|
||||
g.FillPolygon(additionalBrush, BucketPart2);
|
||||
|
||||
//ковш
|
||||
Point point21 = new Point(_startPosX.Value + 130, _startPosY.Value + 35);
|
||||
Point point22 = new Point(_startPosX.Value + 135, _startPosY.Value + 35);
|
||||
Point point23 = new Point(_startPosX.Value + 135, _startPosY.Value + 40);
|
||||
Point point24 = new Point(_startPosX.Value + 125, _startPosY.Value + 45);
|
||||
Point point25 = new Point(_startPosX.Value + 115, _startPosY.Value + 40);
|
||||
Point[] BucketPart3 =
|
||||
{
|
||||
point21,
|
||||
point22,
|
||||
point23,
|
||||
point24,
|
||||
point25,
|
||||
};
|
||||
g.DrawPolygon(blackPen, BucketPart3);
|
||||
g.FillPolygon(brBrown, BucketPart3);
|
||||
|
||||
//шарниры
|
||||
g.DrawEllipse(pen, _startPosX.Value + 114, _startPosY.Value + 3, 6, 6);
|
||||
g.FillEllipse(brBrown, _startPosX.Value + 114, _startPosY.Value + 3, 6, 6);
|
||||
|
||||
g.FillEllipse(brBrown, _startPosX.Value + 127, _startPosY.Value + 32, 6, 6);
|
||||
}
|
||||
|
||||
_startPosX += 14;
|
||||
_startPosY += 10;
|
||||
base.DrawTransport(g);
|
||||
_startPosX -= 14;
|
||||
_startPosY -= 10;
|
||||
|
||||
//поддержка
|
||||
if (excavator.Supports)
|
||||
{
|
||||
Point point1 = new Point(_startPosX.Value + 22, _startPosY.Value + 55);
|
||||
Point point2 = new Point(_startPosX.Value + 22, _startPosY.Value + 50);
|
||||
Point point3 = new Point(_startPosX.Value + 15, _startPosY.Value + 50);
|
||||
Point point4 = new Point(_startPosX.Value + 8, _startPosY.Value + 80);
|
||||
Point point5 = new Point(_startPosX.Value, _startPosY.Value + 82);
|
||||
Point point6 = new Point(_startPosX.Value + 12, _startPosY.Value + 82);
|
||||
Point[] BuckePoint =
|
||||
{
|
||||
point1,
|
||||
point2,
|
||||
point3,
|
||||
point4,
|
||||
point5,
|
||||
point6
|
||||
};
|
||||
g.DrawPolygon(pen, BuckePoint);
|
||||
g.FillPolygon(additionalBrush, BuckePoint);
|
||||
|
||||
g.DrawEllipse(blackPen, _startPosX.Value + 17, _startPosY.Value + 47, 6, 6);
|
||||
g.FillEllipse(brBrown, _startPosX.Value + 17, _startPosY.Value + 47, 6, 6);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,279 @@
|
||||
using ProjectExcavator.Entities;
|
||||
|
||||
namespace ProjectExcavator.Drawnings;
|
||||
|
||||
/// <summary>
|
||||
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
||||
/// </summary>
|
||||
public class DrawningTrackedVehicle
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс-сущность
|
||||
/// </summary>
|
||||
public EntityTrackedVehicle? EntityTrackedVehicle { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ширина окна
|
||||
/// </summary>
|
||||
private int? _pictureWidth;
|
||||
|
||||
/// <summary>
|
||||
/// Высота окна
|
||||
/// </summary>
|
||||
private int? _pictureHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Левая координата прорисовки Гусеничной машины
|
||||
/// </summary>
|
||||
protected int? _startPosX;
|
||||
|
||||
/// <summary>
|
||||
/// Верхняя кооридната прорисовки гусеничной машины
|
||||
/// </summary>
|
||||
protected int? _startPosY;
|
||||
|
||||
/// <summary>
|
||||
/// Ширина прорисовки гусеничной машины
|
||||
/// </summary>
|
||||
private readonly int _drawningTrackedVehicleWidth = 78;
|
||||
|
||||
/// <summary>
|
||||
/// Высота прорисовки гусеничной машины
|
||||
/// </summary>
|
||||
private readonly int _drawningTrackedVehicleHeight = 63;
|
||||
|
||||
/// <summary>
|
||||
/// Координата X объекта
|
||||
/// </summary>
|
||||
public int? GetPosX => _startPosX;
|
||||
|
||||
/// <summary>
|
||||
/// Координата Y объекта
|
||||
/// </summary>
|
||||
public int? GetPosY => _startPosY;
|
||||
|
||||
/// <summary>
|
||||
/// Ширина объекта
|
||||
/// </summary>
|
||||
public int GetWidth => _drawningTrackedVehicleWidth;
|
||||
|
||||
/// <summary>
|
||||
/// Высота объекта
|
||||
/// </summary>
|
||||
public int GetHeight => _drawningTrackedVehicleHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Пустой конструктор
|
||||
/// </summary>
|
||||
protected DrawningTrackedVehicle()
|
||||
{
|
||||
_pictureWidth = null;
|
||||
_pictureHeight = null;
|
||||
_startPosX = null;
|
||||
_startPosY = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
public DrawningTrackedVehicle(int speed, double weight, Color bodyColor) : this()
|
||||
{
|
||||
EntityTrackedVehicle = new EntityTrackedVehicle(speed, weight, bodyColor);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="trackedVehicle">Класс-сущность</param>
|
||||
public DrawningTrackedVehicle(EntityTrackedVehicle trackedVehicle) : base()
|
||||
{
|
||||
EntityTrackedVehicle = trackedVehicle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор для наследников
|
||||
/// </summary>
|
||||
/// <param name="drawningExcavatorWidth">Ширина прорисовки гусеничной машины</param>
|
||||
/// <param name="drawningExcavatorHeight">Высота прорисовки гусеничной машины</param>
|
||||
protected DrawningTrackedVehicle(int drawningExcavatorWidth, int drawningExcavatorHeight) : this()
|
||||
{
|
||||
_drawningTrackedVehicleWidth = drawningExcavatorWidth;
|
||||
_drawningTrackedVehicleHeight = drawningExcavatorHeight;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Установка границ поля
|
||||
/// </summary>
|
||||
/// <param name="width">Ширина поля</param>
|
||||
/// <param name="height">Высота поля</param>
|
||||
/// <returns>true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах</returns>
|
||||
public bool SetPictureSize(int width, int height)
|
||||
{
|
||||
//проверка, что объект "влезает" в размеры поля
|
||||
if (_drawningTrackedVehicleWidth > width || _drawningTrackedVehicleHeight > height)
|
||||
{
|
||||
EntityTrackedVehicle = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
// если влезает, сохраняем границы и корректируем позицию объекта, если она была уже установлена
|
||||
else
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
|
||||
if (_startPosX.HasValue && (_startPosX.Value + _drawningTrackedVehicleWidth > _pictureWidth))
|
||||
{
|
||||
_startPosX = _pictureWidth - _drawningTrackedVehicleWidth;
|
||||
}
|
||||
|
||||
if (_startPosY.HasValue && (_startPosY + _drawningTrackedVehicleHeight > _pictureHeight))
|
||||
{
|
||||
_startPosY = _pictureHeight - _drawningTrackedVehicleHeight;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Установка позиции
|
||||
/// </summary>
|
||||
/// <param name="x">Координата X</param>
|
||||
/// <param name="y">Координата Y</param>
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
// если при установке объекта в эти координаты, он будет "выходить" за границы формы
|
||||
// то надо изменить координаты, чтобы он оставался в этих границах
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
if (_startPosX + _drawningTrackedVehicleWidth > _pictureWidth)
|
||||
{
|
||||
_startPosX = _pictureWidth - _drawningTrackedVehicleWidth;
|
||||
}
|
||||
|
||||
if (_startPosX < 0)
|
||||
{
|
||||
_startPosX = 0;
|
||||
}
|
||||
|
||||
if (_startPosY + _drawningTrackedVehicleHeight > _pictureHeight)
|
||||
{
|
||||
_startPosY = _pictureHeight - _drawningTrackedVehicleHeight;
|
||||
}
|
||||
|
||||
if (_startPosY < 0)
|
||||
{
|
||||
_startPosY = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Изменение направления перемещения
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
/// <returns>true - перемещене выполнено, false - перемещение невозможно</returns>
|
||||
public bool MoveTransport(DirectionType direction)
|
||||
{
|
||||
if (EntityTrackedVehicle == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
//влево
|
||||
case DirectionType.Left:
|
||||
if (_startPosX.Value - EntityTrackedVehicle.Step > 0)
|
||||
{
|
||||
_startPosX -= (int)EntityTrackedVehicle.Step;
|
||||
}
|
||||
return true;
|
||||
//вверх
|
||||
case DirectionType.Up:
|
||||
if (_startPosY.Value - EntityTrackedVehicle.Step > 0)
|
||||
{
|
||||
_startPosY -= (int)EntityTrackedVehicle.Step;
|
||||
}
|
||||
return true;
|
||||
// вправо
|
||||
case DirectionType.Right:
|
||||
if (_startPosX.Value + EntityTrackedVehicle.Step < _pictureWidth - _drawningTrackedVehicleWidth)
|
||||
{
|
||||
_startPosX += (int)EntityTrackedVehicle.Step;
|
||||
}
|
||||
return true;
|
||||
//вниз
|
||||
case DirectionType.Down:
|
||||
if (_startPosY.Value + EntityTrackedVehicle.Step < _pictureHeight - _drawningTrackedVehicleHeight)
|
||||
{
|
||||
_startPosY += (int)EntityTrackedVehicle.Step;
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Прорисовка объекта
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityTrackedVehicle == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Pen pen = new(Color.Black);
|
||||
Pen blackPen = new Pen(Color.Black, 2);
|
||||
Brush brBrown = new SolidBrush(Color.DarkSlateGray);
|
||||
|
||||
//контур и заливка основы
|
||||
Brush br = new SolidBrush(EntityTrackedVehicle.BodyColor);
|
||||
g.FillRectangle(br, _startPosX.Value + 51, _startPosY.Value, 25, 25);//кабина
|
||||
g.DrawRectangle(pen, _startPosX.Value + 51, _startPosY.Value, 25, 25);
|
||||
|
||||
g.FillRectangle(br, _startPosX.Value + 6, _startPosY.Value + 25 , 70, 20);//основа
|
||||
g.DrawRectangle(pen, _startPosX.Value + 6, _startPosY.Value + 25 , 70, 20);
|
||||
|
||||
Brush brBlue = new SolidBrush(Color.LightBlue);
|
||||
g.FillRectangle(brBlue, _startPosX.Value + 58 , _startPosY.Value + 2 , 15, 15);//окно
|
||||
g.DrawRectangle(pen, _startPosX.Value + 58 , _startPosY.Value + 2 , 15, 15);
|
||||
|
||||
g.FillRectangle(br, _startPosX.Value + 26 , _startPosY.Value + 3 , 5, 22);//труба
|
||||
g.DrawRectangle(pen, _startPosX.Value + 26 , _startPosY.Value + 3 , 5, 22);
|
||||
|
||||
g.FillEllipse(brBrown, _startPosX.Value + 3 , _startPosY.Value + 49 , 13, 13);//большое правое колесо
|
||||
g.DrawEllipse(pen, _startPosX.Value + 3 , _startPosY.Value + 49 , 13, 13);
|
||||
|
||||
g.FillEllipse(brBrown, _startPosX.Value + 66 , _startPosY.Value + 49 , 13, 13);//большое левое колесо
|
||||
g.DrawEllipse(pen, _startPosX.Value + 66 , _startPosY.Value + 49 , 13, 13);
|
||||
|
||||
g.FillEllipse(brBrown, _startPosX.Value + 20 , _startPosY.Value + 53 , 9, 9);//среднее правое колесо
|
||||
g.DrawEllipse(pen, _startPosX.Value + 20 , _startPosY.Value + 53 , 9, 9);
|
||||
|
||||
g.FillEllipse(brBrown, _startPosX.Value + 36 , _startPosY.Value + 53 , 9, 9);//средние колесо в середине
|
||||
g.DrawEllipse(pen, _startPosX.Value + 36 , _startPosY.Value + 53 , 9, 9);
|
||||
|
||||
g.FillEllipse(brBrown, _startPosX.Value + 52 , _startPosY.Value + 53 , 9, 9);//среднее левое колесо
|
||||
g.DrawEllipse(pen, _startPosX.Value + 52, _startPosY.Value + 53 , 9, 9);
|
||||
|
||||
g.FillEllipse(brBrown, _startPosX.Value + 30 , _startPosY.Value + 49 , 5, 5);//маленькое правое колесо
|
||||
g.DrawEllipse(pen, _startPosX.Value + 30 , _startPosY.Value + 49 , 5, 5);
|
||||
|
||||
g.FillEllipse(brBrown, _startPosX.Value + 45, _startPosY.Value + 49 , 5, 5);//маленькое левое колесо
|
||||
g.DrawEllipse(pen, _startPosX.Value + 45, _startPosY.Value + 49 , 5, 5);
|
||||
|
||||
//гусеницы
|
||||
g.DrawArc(blackPen, _startPosX.Value , _startPosY.Value + 46 , 20, 20, 125, 125);//правая дуга
|
||||
g.DrawArc(blackPen, _startPosX.Value + 62, _startPosY.Value + 46 , 20, 20, 290, 125);//левая дуга
|
||||
g.DrawLine(blackPen, _startPosX.Value + 6 , _startPosY.Value + 47 , _startPosX.Value + 76 , _startPosY.Value + 47 );
|
||||
g.DrawLine(blackPen, _startPosX.Value + 6 , _startPosY.Value + 64 , _startPosX.Value + 77 , _startPosY.Value + 64 );
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
using ProjectExcavator.Drawnings;
|
||||
using ProjectExcavator.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Расширение для класса TrackedVehicle
|
||||
/// </summary>
|
||||
public static class ExtentionDrawningTrackedVehicle
|
||||
{
|
||||
/// <summary>
|
||||
/// Разделитель для записи информации по объекту в файл
|
||||
/// </summary>
|
||||
private static readonly string _separatorForObject = ":";
|
||||
|
||||
/// <summary>
|
||||
/// Создание объекта из строки
|
||||
/// </summary>
|
||||
/// <param name="info">Строка с данными для создания объекта</param>
|
||||
/// <returns>Объект</returns>
|
||||
public static DrawningTrackedVehicle? CreateDrawningTrackedVehicle(this string info)
|
||||
{
|
||||
string[] strs = info.Split(_separatorForObject);
|
||||
EntityTrackedVehicle? trackedVehicle = EntityExcavator.CreateEntityExcavator(strs);
|
||||
if (trackedVehicle != null)
|
||||
{
|
||||
return new DrawningExcavator(trackedVehicle);
|
||||
}
|
||||
|
||||
trackedVehicle = EntityTrackedVehicle.CreateEntityTrackedVehicle(strs);
|
||||
if (trackedVehicle != null)
|
||||
{
|
||||
return new DrawningTrackedVehicle(trackedVehicle);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение данных для сохранения в файл
|
||||
/// </summary>
|
||||
/// <param name="drawningTrackedVehicle">Сохраняемый объект</param>
|
||||
/// <returns>Строка с данными по объекту</returns>
|
||||
public static string GetDataForSave(this DrawningTrackedVehicle drawningTrackedVehicle)
|
||||
{
|
||||
string[]? array = drawningTrackedVehicle?.EntityTrackedVehicle?.GetStringRepresentation();
|
||||
|
||||
if (array == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return string.Join(_separatorForObject, array);
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
using System.ComponentModel;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace ProjectExcavator.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Класс-сущность "Экскаватор"
|
||||
/// </summary>
|
||||
public class EntityExcavator : EntityTrackedVehicle
|
||||
{
|
||||
/// <summary>
|
||||
/// Дополнительный цвет (для опциональных элементов)
|
||||
/// </summary>
|
||||
public Color AdditionalColor { get; private set; }
|
||||
|
||||
public void SetAdditionalColor(Color additionalColor)
|
||||
{
|
||||
AdditionalColor = additionalColor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Признак (опция) наличия ковша
|
||||
/// </summary>
|
||||
public bool Bucket { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Признак (опция) наличия опоры для фиксации
|
||||
/// </summary>
|
||||
public bool Supports { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор сущности
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес Экскаватора</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||
/// <param name="bucket">Признак (опция) наличия ковша</param>
|
||||
/// <param name="supports">Признак (опция) наличия поддержки</param>
|
||||
|
||||
public EntityExcavator(int speed, double weight, Color bodyColor, Color additionalColor, bool bucket, bool supports) : base (speed, weight,bodyColor)
|
||||
{
|
||||
AdditionalColor = additionalColor;
|
||||
Bucket = bucket;
|
||||
Supports = supports;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение строк со значениями свойств объекта класса-сущности
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string[] GetStringRepresentation()
|
||||
{
|
||||
return new[] { nameof(EntityExcavator), Speed.ToString(), Weight.ToString(), BodyColor.Name, AdditionalColor.Name, Bucket.ToString(), Supports.ToString()};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание объекта из массива строк
|
||||
/// </summary>
|
||||
/// <param name="strs"></param>
|
||||
/// <returns></returns>
|
||||
public static EntityExcavator? CreateEntityExcavator(string[] strs)
|
||||
{
|
||||
if (strs.Length != 7 || strs[0] != nameof(EntityExcavator))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new EntityExcavator(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]), Color.FromName(strs[4]), Convert.ToBoolean(strs[5]), Convert.ToBoolean(strs[6]));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
namespace ProjectExcavator.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Класс-сущность "Гусеничная Машина"
|
||||
/// </summary>
|
||||
public class EntityTrackedVehicle
|
||||
{
|
||||
/// <summary>
|
||||
/// Скорость
|
||||
/// </summary>
|
||||
public int Speed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Вес
|
||||
/// </summary>
|
||||
public double Weight { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Основной цвет
|
||||
/// </summary>
|
||||
public Color BodyColor { get; private set; }
|
||||
|
||||
public void SetBodyColor(Color bodyColor)
|
||||
{
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Шаг перемещения Экскаватора/Гусеничной машины
|
||||
/// </summary>
|
||||
public double Step => Speed * 100 / Weight;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор сущности
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
|
||||
public EntityTrackedVehicle(int speed, double weight, Color bodyColor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение строк со значениями свойств объекта класса-сущности
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual string[] GetStringRepresentation()
|
||||
{
|
||||
return new[] { nameof(EntityTrackedVehicle), Speed.ToString(), Weight.ToString(), BodyColor.Name };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание объекта из массива строк
|
||||
/// </summary>
|
||||
/// <param name="strs"></param>
|
||||
/// <returns></returns>
|
||||
public static EntityTrackedVehicle? CreateEntityTrackedVehicle(string[] strs)
|
||||
{
|
||||
if (strs.Length != 4 || strs[0] != nameof(EntityTrackedVehicle))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new EntityTrackedVehicle(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]));
|
||||
}
|
||||
}
|
39
ProjectExcavator/ProjectExcavator/Form1.Designer.cs
generated
39
ProjectExcavator/ProjectExcavator/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
||||
namespace ProjectExcavator
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace ProjectExcavator
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
148
ProjectExcavator/ProjectExcavator/FormExcavator.Designer.cs
generated
Normal file
148
ProjectExcavator/ProjectExcavator/FormExcavator.Designer.cs
generated
Normal file
@ -0,0 +1,148 @@
|
||||
namespace ProjectExcavator
|
||||
{
|
||||
partial class FormExcavator
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
pictureBoxExcavator = new PictureBox();
|
||||
buttonLeft = new Button();
|
||||
buttonDown = new Button();
|
||||
buttonUp = new Button();
|
||||
buttonRight = new Button();
|
||||
comboBoxStrategy = new ComboBox();
|
||||
buttonStrategyStep = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxExcavator).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// pictureBoxExcavator
|
||||
//
|
||||
pictureBoxExcavator.Dock = DockStyle.Fill;
|
||||
pictureBoxExcavator.Location = new Point(0, 0);
|
||||
pictureBoxExcavator.Name = "pictureBoxExcavator";
|
||||
pictureBoxExcavator.Size = new Size(905, 597);
|
||||
pictureBoxExcavator.TabIndex = 0;
|
||||
pictureBoxExcavator.TabStop = false;
|
||||
//
|
||||
// buttonLeft
|
||||
//
|
||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonLeft.BackgroundImage = Properties.Resources.white_Left_30;
|
||||
buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonLeft.Location = new Point(745, 540);
|
||||
buttonLeft.Name = "buttonLeft";
|
||||
buttonLeft.Size = new Size(45, 45);
|
||||
buttonLeft.TabIndex = 1;
|
||||
buttonLeft.UseVisualStyleBackColor = true;
|
||||
buttonLeft.Click += ButtonMove_Click;
|
||||
//
|
||||
// buttonDown
|
||||
//
|
||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonDown.BackgroundImage = Properties.Resources.white_arrow_30;
|
||||
buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDown.Location = new Point(796, 540);
|
||||
buttonDown.Name = "buttonDown";
|
||||
buttonDown.Size = new Size(45, 45);
|
||||
buttonDown.TabIndex = 2;
|
||||
buttonDown.UseVisualStyleBackColor = true;
|
||||
buttonDown.Click += ButtonMove_Click;
|
||||
//
|
||||
// buttonUp
|
||||
//
|
||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonUp.BackgroundImage = Properties.Resources.white_UP;
|
||||
buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUp.Location = new Point(796, 489);
|
||||
buttonUp.Name = "buttonUp";
|
||||
buttonUp.Size = new Size(45, 45);
|
||||
buttonUp.TabIndex = 3;
|
||||
buttonUp.UseVisualStyleBackColor = true;
|
||||
buttonUp.Click += ButtonMove_Click;
|
||||
//
|
||||
// buttonRight
|
||||
//
|
||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonRight.BackgroundImage = Properties.Resources.white_right_30;
|
||||
buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonRight.Location = new Point(847, 540);
|
||||
buttonRight.Name = "buttonRight";
|
||||
buttonRight.Size = new Size(45, 45);
|
||||
buttonRight.TabIndex = 4;
|
||||
buttonRight.UseVisualStyleBackColor = true;
|
||||
buttonRight.Click += ButtonMove_Click;
|
||||
//
|
||||
// comboBoxStrategy
|
||||
//
|
||||
comboBoxStrategy.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxStrategy.FormattingEnabled = true;
|
||||
comboBoxStrategy.Items.AddRange(new object[] { "К центру", "К краю" });
|
||||
comboBoxStrategy.Location = new Point(741, 12);
|
||||
comboBoxStrategy.Name = "comboBoxStrategy";
|
||||
comboBoxStrategy.Size = new Size(151, 28);
|
||||
comboBoxStrategy.TabIndex = 6;
|
||||
//
|
||||
// buttonStrategyStep
|
||||
//
|
||||
buttonStrategyStep.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
buttonStrategyStep.Location = new Point(796, 46);
|
||||
buttonStrategyStep.Name = "buttonStrategyStep";
|
||||
buttonStrategyStep.Size = new Size(94, 30);
|
||||
buttonStrategyStep.TabIndex = 7;
|
||||
buttonStrategyStep.Text = "Шаг";
|
||||
buttonStrategyStep.UseVisualStyleBackColor = true;
|
||||
buttonStrategyStep.Click += ButtonStrategyStep_Click;
|
||||
//
|
||||
// FormExcavator
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(905, 597);
|
||||
Controls.Add(buttonStrategyStep);
|
||||
Controls.Add(comboBoxStrategy);
|
||||
Controls.Add(buttonRight);
|
||||
Controls.Add(buttonUp);
|
||||
Controls.Add(buttonDown);
|
||||
Controls.Add(buttonLeft);
|
||||
Controls.Add(pictureBoxExcavator);
|
||||
Name = "FormExcavator";
|
||||
Text = "Экскаватор";
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxExcavator).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBoxExcavator;
|
||||
private Button buttonLeft;
|
||||
private Button buttonDown;
|
||||
private Button buttonUp;
|
||||
private Button buttonRight;
|
||||
private ComboBox comboBoxStrategy;
|
||||
private Button buttonStrategyStep;
|
||||
}
|
||||
}
|
141
ProjectExcavator/ProjectExcavator/FormExcavator.cs
Normal file
141
ProjectExcavator/ProjectExcavator/FormExcavator.cs
Normal file
@ -0,0 +1,141 @@
|
||||
using ProjectExcavator.Drawnings;
|
||||
using ProjectExcavator.MovementStrategy;
|
||||
|
||||
namespace ProjectExcavator;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Форма работы с объектом "Экскаватор"
|
||||
/// </summary>
|
||||
public partial class FormExcavator : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Поле-объект для прорисовки объекта
|
||||
/// </summary>
|
||||
private DrawningTrackedVehicle? _drawningTrackedVehicle;
|
||||
|
||||
/// <summary>
|
||||
/// Стратегия перемещения
|
||||
/// </summary>
|
||||
private AbstractStrategy? _strategy;
|
||||
|
||||
/// <summary>
|
||||
/// Получение объекта
|
||||
/// </summary>
|
||||
public DrawningTrackedVehicle SetTrackedVehicle
|
||||
{
|
||||
set
|
||||
{
|
||||
_drawningTrackedVehicle = value;
|
||||
_drawningTrackedVehicle.SetPictureSize(pictureBoxExcavator.Width, pictureBoxExcavator.Height);
|
||||
comboBoxStrategy.Enabled = true;
|
||||
_strategy = null;
|
||||
Draw();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор формы
|
||||
/// </summary>
|
||||
public FormExcavator()
|
||||
{
|
||||
InitializeComponent();
|
||||
_strategy = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Метод прорисовки экскаватора
|
||||
/// </summary>
|
||||
private void Draw()
|
||||
{
|
||||
if (_drawningTrackedVehicle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Bitmap bmp = new(pictureBoxExcavator.Width, pictureBoxExcavator.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawningTrackedVehicle.DrawTransport(gr);
|
||||
pictureBoxExcavator.Image = bmp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перемещение объекта по форме (нажатие кнопок навигации)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningTrackedVehicle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
bool result = false;
|
||||
switch (name)
|
||||
{
|
||||
case "buttonUp":
|
||||
result = _drawningTrackedVehicle.MoveTransport(DirectionType.Up);
|
||||
break;
|
||||
case "buttonDown":
|
||||
result = _drawningTrackedVehicle.MoveTransport(DirectionType.Down);
|
||||
break;
|
||||
case "buttonLeft":
|
||||
result = _drawningTrackedVehicle.MoveTransport(DirectionType.Left);
|
||||
break;
|
||||
case "buttonRight":
|
||||
result = _drawningTrackedVehicle.MoveTransport(DirectionType.Right);
|
||||
break;
|
||||
}
|
||||
|
||||
if (result)
|
||||
{
|
||||
Draw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Обработка нажатия кнопки "Шаг"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonStrategyStep_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningTrackedVehicle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (comboBoxStrategy.Enabled)
|
||||
{
|
||||
_strategy = comboBoxStrategy.SelectedIndex switch
|
||||
{
|
||||
0 => new MoveToCenter(),
|
||||
1 => new MoveToBorder(),
|
||||
_ => null,
|
||||
};
|
||||
if (_strategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_strategy.SetData(new MoveableTrackedVehicle(_drawningTrackedVehicle), pictureBoxExcavator.Width, pictureBoxExcavator.Height);
|
||||
}
|
||||
|
||||
if (_strategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
comboBoxStrategy.Enabled = false;
|
||||
_strategy.MakeStep();
|
||||
Draw();
|
||||
|
||||
if (_strategy.GetStatus() == StrategyStatus.Finish)
|
||||
{
|
||||
comboBoxStrategy.Enabled = true;
|
||||
_strategy = null;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +1,17 @@
|
||||
<?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
|
||||
|
||||
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>
|
||||
@ -26,36 +26,36 @@
|
||||
<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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
359
ProjectExcavator/ProjectExcavator/FormExcavatorCollection.Designer.cs
generated
Normal file
359
ProjectExcavator/ProjectExcavator/FormExcavatorCollection.Designer.cs
generated
Normal file
@ -0,0 +1,359 @@
|
||||
namespace ProjectExcavator
|
||||
{
|
||||
partial class FormExcavatorCollection
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
groupBoxTools = new GroupBox();
|
||||
panelCompanyTools = new Panel();
|
||||
buttonAddTrackedVehicle = new Button();
|
||||
buttonRefresh = new Button();
|
||||
maskedTextBoxPosition = new MaskedTextBox();
|
||||
buttonGoToCheck = new Button();
|
||||
ButtonRemoveExcavator = new Button();
|
||||
buttonCreateCompany = new Button();
|
||||
panelStorage = new Panel();
|
||||
buttonCollectionDel = new Button();
|
||||
listBoxCollection = new ListBox();
|
||||
buttonCollectionAdd = new Button();
|
||||
radioButtonList = new RadioButton();
|
||||
radioButtonMassive = new RadioButton();
|
||||
textBoxCollectionName = new TextBox();
|
||||
labelCollectionName = new Label();
|
||||
comboBoxSelectorCompany = new ComboBox();
|
||||
pictureBox = new PictureBox();
|
||||
menuStrip = new MenuStrip();
|
||||
файлToolStripMenuItem = new ToolStripMenuItem();
|
||||
saveToolStripMenuItem = new ToolStripMenuItem();
|
||||
loadToolStripMenuItem = new ToolStripMenuItem();
|
||||
saveFileDialog = new SaveFileDialog();
|
||||
openFileDialog = new OpenFileDialog();
|
||||
groupBoxTools.SuspendLayout();
|
||||
panelCompanyTools.SuspendLayout();
|
||||
panelStorage.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||
menuStrip.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBoxTools
|
||||
//
|
||||
groupBoxTools.Controls.Add(panelCompanyTools);
|
||||
groupBoxTools.Controls.Add(buttonCreateCompany);
|
||||
groupBoxTools.Controls.Add(panelStorage);
|
||||
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
|
||||
groupBoxTools.Dock = DockStyle.Right;
|
||||
groupBoxTools.Location = new Point(777, 28);
|
||||
groupBoxTools.Name = "groupBoxTools";
|
||||
groupBoxTools.Size = new Size(225, 646);
|
||||
groupBoxTools.TabIndex = 0;
|
||||
groupBoxTools.TabStop = false;
|
||||
groupBoxTools.Text = "Инструменты";
|
||||
//
|
||||
// panelCompanyTools
|
||||
//
|
||||
panelCompanyTools.Controls.Add(buttonAddTrackedVehicle);
|
||||
panelCompanyTools.Controls.Add(buttonRefresh);
|
||||
panelCompanyTools.Controls.Add(maskedTextBoxPosition);
|
||||
panelCompanyTools.Controls.Add(buttonGoToCheck);
|
||||
panelCompanyTools.Controls.Add(ButtonRemoveExcavator);
|
||||
panelCompanyTools.Enabled = false;
|
||||
panelCompanyTools.Location = new Point(2, 350);
|
||||
panelCompanyTools.Name = "panelCompanyTools";
|
||||
panelCompanyTools.Size = new Size(220, 289);
|
||||
panelCompanyTools.TabIndex = 2;
|
||||
//
|
||||
// buttonAddTrackedVehicle
|
||||
//
|
||||
buttonAddTrackedVehicle.Anchor = AnchorStyles.Top;
|
||||
buttonAddTrackedVehicle.Location = new Point(3, 3);
|
||||
buttonAddTrackedVehicle.Name = "buttonAddTrackedVehicle";
|
||||
buttonAddTrackedVehicle.Size = new Size(215, 50);
|
||||
buttonAddTrackedVehicle.TabIndex = 1;
|
||||
buttonAddTrackedVehicle.Text = "Добавление гусеничной машины";
|
||||
buttonAddTrackedVehicle.UseVisualStyleBackColor = true;
|
||||
buttonAddTrackedVehicle.Click += ButtonAddTrackedVehicle_Click;
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Anchor = AnchorStyles.Top;
|
||||
buttonRefresh.Location = new Point(3, 240);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Size = new Size(215, 40);
|
||||
buttonRefresh.TabIndex = 6;
|
||||
buttonRefresh.Text = "Обновить";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
buttonRefresh.Click += ButtonRefresh_Click;
|
||||
//
|
||||
// maskedTextBoxPosition
|
||||
//
|
||||
maskedTextBoxPosition.Anchor = AnchorStyles.Top;
|
||||
maskedTextBoxPosition.Location = new Point(3, 115);
|
||||
maskedTextBoxPosition.Mask = "00";
|
||||
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
||||
maskedTextBoxPosition.Size = new Size(215, 27);
|
||||
maskedTextBoxPosition.TabIndex = 3;
|
||||
maskedTextBoxPosition.ValidatingType = typeof(int);
|
||||
//
|
||||
// buttonGoToCheck
|
||||
//
|
||||
buttonGoToCheck.Anchor = AnchorStyles.Top;
|
||||
buttonGoToCheck.Location = new Point(3, 194);
|
||||
buttonGoToCheck.Name = "buttonGoToCheck";
|
||||
buttonGoToCheck.Size = new Size(215, 40);
|
||||
buttonGoToCheck.TabIndex = 5;
|
||||
buttonGoToCheck.Text = "Передать на тесты";
|
||||
buttonGoToCheck.UseVisualStyleBackColor = true;
|
||||
buttonGoToCheck.Click += ButtonGoToCheck_Click;
|
||||
//
|
||||
// ButtonRemoveExcavator
|
||||
//
|
||||
ButtonRemoveExcavator.Anchor = AnchorStyles.Top;
|
||||
ButtonRemoveExcavator.Location = new Point(3, 148);
|
||||
ButtonRemoveExcavator.Name = "ButtonRemoveExcavator";
|
||||
ButtonRemoveExcavator.Size = new Size(215, 40);
|
||||
ButtonRemoveExcavator.TabIndex = 4;
|
||||
ButtonRemoveExcavator.Text = "Удаление транспорта";
|
||||
ButtonRemoveExcavator.UseVisualStyleBackColor = true;
|
||||
ButtonRemoveExcavator.Click += ButtonRemoveExcavator_Click;
|
||||
//
|
||||
// buttonCreateCompany
|
||||
//
|
||||
buttonCreateCompany.Location = new Point(13, 317);
|
||||
buttonCreateCompany.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonCreateCompany.Name = "buttonCreateCompany";
|
||||
buttonCreateCompany.Size = new Size(200, 30);
|
||||
buttonCreateCompany.TabIndex = 9;
|
||||
buttonCreateCompany.Text = "Создать компанию";
|
||||
buttonCreateCompany.UseVisualStyleBackColor = true;
|
||||
buttonCreateCompany.Click += ButtonCreateCompany_Click;
|
||||
//
|
||||
// panelStorage
|
||||
//
|
||||
panelStorage.Controls.Add(buttonCollectionDel);
|
||||
panelStorage.Controls.Add(listBoxCollection);
|
||||
panelStorage.Controls.Add(buttonCollectionAdd);
|
||||
panelStorage.Controls.Add(radioButtonList);
|
||||
panelStorage.Controls.Add(radioButtonMassive);
|
||||
panelStorage.Controls.Add(textBoxCollectionName);
|
||||
panelStorage.Controls.Add(labelCollectionName);
|
||||
panelStorage.Dock = DockStyle.Top;
|
||||
panelStorage.Location = new Point(3, 23);
|
||||
panelStorage.Name = "panelStorage";
|
||||
panelStorage.Size = new Size(219, 253);
|
||||
panelStorage.TabIndex = 7;
|
||||
//
|
||||
// buttonCollectionDel
|
||||
//
|
||||
buttonCollectionDel.Anchor = AnchorStyles.Top;
|
||||
buttonCollectionDel.Location = new Point(3, 222);
|
||||
buttonCollectionDel.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonCollectionDel.Name = "buttonCollectionDel";
|
||||
buttonCollectionDel.Size = new Size(215, 27);
|
||||
buttonCollectionDel.TabIndex = 7;
|
||||
buttonCollectionDel.Text = "Удалить коллекцию";
|
||||
buttonCollectionDel.UseVisualStyleBackColor = true;
|
||||
buttonCollectionDel.Click += ButtonCollectionDel_Click;
|
||||
//
|
||||
// listBoxCollection
|
||||
//
|
||||
listBoxCollection.Anchor = AnchorStyles.Top;
|
||||
listBoxCollection.FormattingEnabled = true;
|
||||
listBoxCollection.ItemHeight = 20;
|
||||
listBoxCollection.Location = new Point(3, 135);
|
||||
listBoxCollection.Name = "listBoxCollection";
|
||||
listBoxCollection.Size = new Size(215, 84);
|
||||
listBoxCollection.TabIndex = 6;
|
||||
//
|
||||
// buttonCollectionAdd
|
||||
//
|
||||
buttonCollectionAdd.Anchor = AnchorStyles.Top;
|
||||
buttonCollectionAdd.Location = new Point(3, 100);
|
||||
buttonCollectionAdd.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonCollectionAdd.Name = "buttonCollectionAdd";
|
||||
buttonCollectionAdd.Size = new Size(215, 27);
|
||||
buttonCollectionAdd.TabIndex = 5;
|
||||
buttonCollectionAdd.Text = "Добавить коллекцию";
|
||||
buttonCollectionAdd.UseVisualStyleBackColor = true;
|
||||
buttonCollectionAdd.Click += ButtonCollectionAdd_Click;
|
||||
//
|
||||
// radioButtonList
|
||||
//
|
||||
radioButtonList.AutoSize = true;
|
||||
radioButtonList.Location = new Point(130, 70);
|
||||
radioButtonList.Margin = new Padding(3, 4, 3, 4);
|
||||
radioButtonList.Name = "radioButtonList";
|
||||
radioButtonList.Size = new Size(80, 24);
|
||||
radioButtonList.TabIndex = 4;
|
||||
radioButtonList.TabStop = true;
|
||||
radioButtonList.Text = "Список";
|
||||
radioButtonList.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// radioButtonMassive
|
||||
//
|
||||
radioButtonMassive.AutoSize = true;
|
||||
radioButtonMassive.Location = new Point(10, 70);
|
||||
radioButtonMassive.Margin = new Padding(3, 4, 3, 4);
|
||||
radioButtonMassive.Name = "radioButtonMassive";
|
||||
radioButtonMassive.Size = new Size(82, 24);
|
||||
radioButtonMassive.TabIndex = 3;
|
||||
radioButtonMassive.TabStop = true;
|
||||
radioButtonMassive.Text = "Массив";
|
||||
radioButtonMassive.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBoxCollectionName
|
||||
//
|
||||
textBoxCollectionName.Anchor = AnchorStyles.Top;
|
||||
textBoxCollectionName.Location = new Point(3, 34);
|
||||
textBoxCollectionName.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxCollectionName.Name = "textBoxCollectionName";
|
||||
textBoxCollectionName.Size = new Size(215, 27);
|
||||
textBoxCollectionName.TabIndex = 2;
|
||||
//
|
||||
// labelCollectionName
|
||||
//
|
||||
labelCollectionName.Anchor = AnchorStyles.Top;
|
||||
labelCollectionName.AutoSize = true;
|
||||
labelCollectionName.Location = new Point(31, 11);
|
||||
labelCollectionName.Name = "labelCollectionName";
|
||||
labelCollectionName.Size = new Size(158, 20);
|
||||
labelCollectionName.TabIndex = 0;
|
||||
labelCollectionName.Text = "Название коллекции:";
|
||||
//
|
||||
// comboBoxSelectorCompany
|
||||
//
|
||||
comboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxSelectorCompany.FormattingEnabled = true;
|
||||
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
|
||||
comboBoxSelectorCompany.Location = new Point(13, 282);
|
||||
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
||||
comboBoxSelectorCompany.Size = new Size(200, 28);
|
||||
comboBoxSelectorCompany.TabIndex = 0;
|
||||
comboBoxSelectorCompany.SelectedIndexChanged += ComboBoxSelectorCompany_SelectedIndexChanged;
|
||||
//
|
||||
// pictureBox
|
||||
//
|
||||
pictureBox.Dock = DockStyle.Fill;
|
||||
pictureBox.Location = new Point(0, 28);
|
||||
pictureBox.Name = "pictureBox";
|
||||
pictureBox.Size = new Size(777, 646);
|
||||
pictureBox.TabIndex = 1;
|
||||
pictureBox.TabStop = false;
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { файлToolStripMenuItem });
|
||||
menuStrip.Location = new Point(0, 0);
|
||||
menuStrip.Name = "menuStrip";
|
||||
menuStrip.Size = new Size(1002, 28);
|
||||
menuStrip.TabIndex = 2;
|
||||
menuStrip.Text = "menuStrip1";
|
||||
//
|
||||
// файлToolStripMenuItem
|
||||
//
|
||||
файлToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { saveToolStripMenuItem, loadToolStripMenuItem });
|
||||
файлToolStripMenuItem.Name = "файлToolStripMenuItem";
|
||||
файлToolStripMenuItem.Size = new Size(59, 24);
|
||||
файлToolStripMenuItem.Text = "Файл";
|
||||
//
|
||||
// saveToolStripMenuItem
|
||||
//
|
||||
saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||
saveToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
|
||||
saveToolStripMenuItem.Size = new Size(227, 26);
|
||||
saveToolStripMenuItem.Text = "Сохранение";
|
||||
saveToolStripMenuItem.Click += SaveToolStripMenuItem_Click;
|
||||
//
|
||||
// loadToolStripMenuItem
|
||||
//
|
||||
loadToolStripMenuItem.Name = "loadToolStripMenuItem";
|
||||
loadToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.L;
|
||||
loadToolStripMenuItem.Size = new Size(227, 26);
|
||||
loadToolStripMenuItem.Text = "Загрузка";
|
||||
loadToolStripMenuItem.Click += LoadToolStripMenuItem_Click;
|
||||
//
|
||||
// saveFileDialog
|
||||
//
|
||||
saveFileDialog.Filter = "txt file | *.txt";
|
||||
//
|
||||
// openFileDialog
|
||||
//
|
||||
openFileDialog.FileName = "openFileDialog1";
|
||||
openFileDialog.Filter = "txt file | *.txt";
|
||||
//
|
||||
// FormExcavatorCollection
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1002, 674);
|
||||
Controls.Add(pictureBox);
|
||||
Controls.Add(groupBoxTools);
|
||||
Controls.Add(menuStrip);
|
||||
MainMenuStrip = menuStrip;
|
||||
Name = "FormExcavatorCollection";
|
||||
Text = "Коллекция экскаваторов";
|
||||
groupBoxTools.ResumeLayout(false);
|
||||
panelCompanyTools.ResumeLayout(false);
|
||||
panelCompanyTools.PerformLayout();
|
||||
panelStorage.ResumeLayout(false);
|
||||
panelStorage.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||
menuStrip.ResumeLayout(false);
|
||||
menuStrip.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBoxTools;
|
||||
private ComboBox comboBoxSelectorCompany;
|
||||
private Button buttonAddTrackedVehicle;
|
||||
private PictureBox pictureBox;
|
||||
private Button ButtonRemoveExcavator;
|
||||
private MaskedTextBox maskedTextBoxPosition;
|
||||
private Button buttonGoToCheck;
|
||||
private Button buttonRefresh;
|
||||
private Panel panelStorage;
|
||||
private Label labelCollectionName;
|
||||
private RadioButton radioButtonList;
|
||||
private RadioButton radioButtonMassive;
|
||||
private TextBox textBoxCollectionName;
|
||||
private ListBox listBoxCollection;
|
||||
private Button buttonCollectionAdd;
|
||||
private Button buttonCollectionDel;
|
||||
private Button buttonCreateCompany;
|
||||
private Panel panelCompanyTools;
|
||||
private MenuStrip menuStrip;
|
||||
private ToolStripMenuItem файлToolStripMenuItem;
|
||||
private ToolStripMenuItem saveToolStripMenuItem;
|
||||
private ToolStripMenuItem loadToolStripMenuItem;
|
||||
private SaveFileDialog saveFileDialog;
|
||||
private OpenFileDialog openFileDialog;
|
||||
}
|
||||
}
|
297
ProjectExcavator/ProjectExcavator/FormExcavatorCollection.cs
Normal file
297
ProjectExcavator/ProjectExcavator/FormExcavatorCollection.cs
Normal file
@ -0,0 +1,297 @@
|
||||
using ProjectExcavator.CollectionGenericObjects;
|
||||
using ProjectExcavator.Drawnings;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ProjectExcavator;
|
||||
/// <summary>
|
||||
/// Форма работы с компанией и ее коллекцией
|
||||
/// </summary>
|
||||
public partial class FormExcavatorCollection : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Хранилише коллекций
|
||||
/// </summary>
|
||||
private readonly StorageCollection<DrawningTrackedVehicle> _storageCollection;
|
||||
|
||||
/// <summary>
|
||||
/// Компания
|
||||
/// </summary>
|
||||
private AbstractCompany? _company = null;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public FormExcavatorCollection()
|
||||
{
|
||||
InitializeComponent();
|
||||
_storageCollection = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Выбор компании
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ComboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
switch (comboBoxSelectorCompany.Text)
|
||||
{
|
||||
case "Хранилище":
|
||||
_company = new GarageService(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects<DrawningTrackedVehicle>());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавление гусеничной машины/ экскаватора
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonAddTrackedVehicle_Click(object sender, EventArgs e)
|
||||
{
|
||||
FormExcavatorConfig form = new();
|
||||
form.Show();
|
||||
form.AddEvent(SetTrackedVehicle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавление экскаватора/гусинечной машины в коллекцию
|
||||
/// </summary>
|
||||
/// <param name="trackedVehicle"></param>
|
||||
private void SetTrackedVehicle(DrawningTrackedVehicle? trackedVehicle)
|
||||
{
|
||||
if (_company == null || trackedVehicle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_company + trackedVehicle != -1)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBox.Image = _company.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удаление объекта
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonRemoveExcavator_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text) || _company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||
if ((_company - pos) != null)
|
||||
{
|
||||
MessageBox.Show("Объект удален!");
|
||||
pictureBox.Image = _company.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось удалить объект");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Передача объекта в другую форму
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonGoToCheck_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DrawningTrackedVehicle? TrackedVehicle = null;
|
||||
int counter = 100;
|
||||
while (TrackedVehicle == null)
|
||||
{
|
||||
TrackedVehicle = _company.GetRandomObject();
|
||||
counter--;
|
||||
if (counter <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (TrackedVehicle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FormExcavator form = new()
|
||||
{
|
||||
SetTrackedVehicle = TrackedVehicle
|
||||
};
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перерисовка коллекции
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pictureBox.Image = _company.Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавление коллекции
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonCollectionAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (string.IsNullOrEmpty(textBoxCollectionName.Text) || (!radioButtonList.Checked && !radioButtonMassive.Checked))
|
||||
{
|
||||
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
CollectionType collectionType = CollectionType.None;
|
||||
if (radioButtonMassive.Checked)
|
||||
{
|
||||
collectionType = CollectionType.Massive;
|
||||
}
|
||||
else if (radioButtonList.Checked)
|
||||
{
|
||||
collectionType = CollectionType.List;
|
||||
}
|
||||
|
||||
_storageCollection.AddCollection(textBoxCollectionName.Text, collectionType);
|
||||
RefreshListBoxItems();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удаление коллекции
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonCollectionDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItems == null)
|
||||
{
|
||||
MessageBox.Show("Коллекция не выбрана");
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить коллекцию?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_storageCollection.DelCollection(listBoxCollection.SelectedItem.ToString());
|
||||
RefreshListBoxItems();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обновление списка в listBoxCollection
|
||||
/// </summary>
|
||||
private void RefreshListBoxItems()
|
||||
{
|
||||
listBoxCollection.Items.Clear();
|
||||
|
||||
for (int i = 0; i < _storageCollection.Keys?.Count; ++i)
|
||||
{
|
||||
string? colName = _storageCollection.Keys?[i];
|
||||
if (!string.IsNullOrEmpty(colName))
|
||||
{
|
||||
listBoxCollection.Items.Add(colName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание компании
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonCreateCompany_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItem == null)
|
||||
{
|
||||
MessageBox.Show("Коллекция не выбрана");
|
||||
return;
|
||||
}
|
||||
|
||||
ICollectionGenericObjects<DrawningTrackedVehicle>? collection = _storageCollection[listBoxCollection.SelectedItem.ToString() ?? string.Empty];
|
||||
if (collection == null)
|
||||
{
|
||||
MessageBox.Show("Коллекция не проинициализирована");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (comboBoxSelectorCompany.Text)
|
||||
{
|
||||
case "Хранилище":
|
||||
_company = new GarageService(pictureBox.Width, pictureBox.Height, collection);
|
||||
break;
|
||||
}
|
||||
|
||||
panelCompanyTools.Enabled = true;
|
||||
RefreshListBoxItems();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработка нажатия "Сохранение"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SaveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (_storageCollection.SaveData(saveFileDialog.FileName))
|
||||
{
|
||||
MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не сохранилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработка нажатия "Загрузка"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void LoadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (_storageCollection.LoadData(openFileDialog.FileName))
|
||||
{
|
||||
RefreshListBoxItems();
|
||||
MessageBox.Show("Загрузка прошла успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Загрузка не выполнена", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
132
ProjectExcavator/ProjectExcavator/FormExcavatorCollection.resx
Normal file
132
ProjectExcavator/ProjectExcavator/FormExcavatorCollection.resx
Normal file
@ -0,0 +1,132 @@
|
||||
<?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.
|
||||
-->
|
||||
<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">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>145, 17</value>
|
||||
</metadata>
|
||||
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>310, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>62</value>
|
||||
</metadata>
|
||||
</root>
|
373
ProjectExcavator/ProjectExcavator/FormExcavatorConfig.Designer.cs
generated
Normal file
373
ProjectExcavator/ProjectExcavator/FormExcavatorConfig.Designer.cs
generated
Normal file
@ -0,0 +1,373 @@
|
||||
namespace ProjectExcavator
|
||||
{
|
||||
partial class FormExcavatorConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
groupBoxConfig = new GroupBox();
|
||||
labelWeight = new Label();
|
||||
groupBoxColors = new GroupBox();
|
||||
panelPurple = new Panel();
|
||||
panelYellow = new Panel();
|
||||
panelBlack = new Panel();
|
||||
panelGray = new Panel();
|
||||
panelBlue = new Panel();
|
||||
panelWhite = new Panel();
|
||||
panelGreen = new Panel();
|
||||
panelRed = new Panel();
|
||||
checkBoxSupports = new CheckBox();
|
||||
checkBoxBucket = new CheckBox();
|
||||
numericUpDownWeight = new NumericUpDown();
|
||||
numericUpDownSpeed = new NumericUpDown();
|
||||
labelSpeed = new Label();
|
||||
labelModifiedObject = new Label();
|
||||
labelSimpleObject = new Label();
|
||||
buttonAdd = new Button();
|
||||
buttonCancel = new Button();
|
||||
panelObject = new Panel();
|
||||
pictureBoxObject = new PictureBox();
|
||||
labelBodyColor = new Label();
|
||||
labelAdditionalColor = new Label();
|
||||
groupBoxConfig.SuspendLayout();
|
||||
groupBoxColors.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
|
||||
panelObject.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBoxConfig
|
||||
//
|
||||
groupBoxConfig.Controls.Add(labelWeight);
|
||||
groupBoxConfig.Controls.Add(groupBoxColors);
|
||||
groupBoxConfig.Controls.Add(checkBoxSupports);
|
||||
groupBoxConfig.Controls.Add(checkBoxBucket);
|
||||
groupBoxConfig.Controls.Add(numericUpDownWeight);
|
||||
groupBoxConfig.Controls.Add(numericUpDownSpeed);
|
||||
groupBoxConfig.Controls.Add(labelSpeed);
|
||||
groupBoxConfig.Controls.Add(labelModifiedObject);
|
||||
groupBoxConfig.Controls.Add(labelSimpleObject);
|
||||
groupBoxConfig.Dock = DockStyle.Left;
|
||||
groupBoxConfig.Location = new Point(0, 0);
|
||||
groupBoxConfig.Name = "groupBoxConfig";
|
||||
groupBoxConfig.Size = new Size(548, 285);
|
||||
groupBoxConfig.TabIndex = 0;
|
||||
groupBoxConfig.TabStop = false;
|
||||
groupBoxConfig.Text = "Параметры";
|
||||
//
|
||||
// labelWeight
|
||||
//
|
||||
labelWeight.AutoSize = true;
|
||||
labelWeight.Location = new Point(12, 90);
|
||||
labelWeight.Name = "labelWeight";
|
||||
labelWeight.Size = new Size(36, 20);
|
||||
labelWeight.TabIndex = 12;
|
||||
labelWeight.Text = "Вес:";
|
||||
//
|
||||
// groupBoxColors
|
||||
//
|
||||
groupBoxColors.Controls.Add(panelPurple);
|
||||
groupBoxColors.Controls.Add(panelYellow);
|
||||
groupBoxColors.Controls.Add(panelBlack);
|
||||
groupBoxColors.Controls.Add(panelGray);
|
||||
groupBoxColors.Controls.Add(panelBlue);
|
||||
groupBoxColors.Controls.Add(panelWhite);
|
||||
groupBoxColors.Controls.Add(panelGreen);
|
||||
groupBoxColors.Controls.Add(panelRed);
|
||||
groupBoxColors.Location = new Point(260, 27);
|
||||
groupBoxColors.Margin = new Padding(3, 4, 3, 4);
|
||||
groupBoxColors.Name = "groupBoxColors";
|
||||
groupBoxColors.Padding = new Padding(3, 4, 3, 4);
|
||||
groupBoxColors.Size = new Size(259, 149);
|
||||
groupBoxColors.TabIndex = 10;
|
||||
groupBoxColors.TabStop = false;
|
||||
groupBoxColors.Text = "Цвета";
|
||||
//
|
||||
// panelPurple
|
||||
//
|
||||
panelPurple.BackColor = Color.MediumPurple;
|
||||
panelPurple.Location = new Point(201, 88);
|
||||
panelPurple.Margin = new Padding(3, 4, 3, 4);
|
||||
panelPurple.Name = "panelPurple";
|
||||
panelPurple.Size = new Size(39, 45);
|
||||
panelPurple.TabIndex = 3;
|
||||
//
|
||||
// panelYellow
|
||||
//
|
||||
panelYellow.BackColor = Color.Gold;
|
||||
panelYellow.Location = new Point(201, 29);
|
||||
panelYellow.Margin = new Padding(3, 4, 3, 4);
|
||||
panelYellow.Name = "panelYellow";
|
||||
panelYellow.Size = new Size(39, 45);
|
||||
panelYellow.TabIndex = 1;
|
||||
//
|
||||
// panelBlack
|
||||
//
|
||||
panelBlack.BackColor = Color.Black;
|
||||
panelBlack.Location = new Point(137, 88);
|
||||
panelBlack.Margin = new Padding(3, 4, 3, 4);
|
||||
panelBlack.Name = "panelBlack";
|
||||
panelBlack.Size = new Size(39, 45);
|
||||
panelBlack.TabIndex = 4;
|
||||
//
|
||||
// panelGray
|
||||
//
|
||||
panelGray.BackColor = Color.DarkGray;
|
||||
panelGray.Location = new Point(77, 88);
|
||||
panelGray.Margin = new Padding(3, 4, 3, 4);
|
||||
panelGray.Name = "panelGray";
|
||||
panelGray.Size = new Size(39, 45);
|
||||
panelGray.TabIndex = 5;
|
||||
//
|
||||
// panelBlue
|
||||
//
|
||||
panelBlue.BackColor = Color.LightSteelBlue;
|
||||
panelBlue.Location = new Point(137, 29);
|
||||
panelBlue.Margin = new Padding(3, 4, 3, 4);
|
||||
panelBlue.Name = "panelBlue";
|
||||
panelBlue.Size = new Size(39, 45);
|
||||
panelBlue.TabIndex = 1;
|
||||
//
|
||||
// panelWhite
|
||||
//
|
||||
panelWhite.BackColor = Color.Transparent;
|
||||
panelWhite.Location = new Point(17, 88);
|
||||
panelWhite.Margin = new Padding(3, 4, 3, 4);
|
||||
panelWhite.Name = "panelWhite";
|
||||
panelWhite.Size = new Size(39, 45);
|
||||
panelWhite.TabIndex = 2;
|
||||
//
|
||||
// panelGreen
|
||||
//
|
||||
panelGreen.BackColor = Color.Olive;
|
||||
panelGreen.Location = new Point(77, 29);
|
||||
panelGreen.Margin = new Padding(3, 4, 3, 4);
|
||||
panelGreen.Name = "panelGreen";
|
||||
panelGreen.Size = new Size(39, 45);
|
||||
panelGreen.TabIndex = 1;
|
||||
//
|
||||
// panelRed
|
||||
//
|
||||
panelRed.BackColor = Color.DarkRed;
|
||||
panelRed.Location = new Point(17, 29);
|
||||
panelRed.Margin = new Padding(3, 4, 3, 4);
|
||||
panelRed.Name = "panelRed";
|
||||
panelRed.Size = new Size(39, 45);
|
||||
panelRed.TabIndex = 0;
|
||||
//
|
||||
// checkBoxSupports
|
||||
//
|
||||
checkBoxSupports.AutoSize = true;
|
||||
checkBoxSupports.Location = new Point(12, 248);
|
||||
checkBoxSupports.Margin = new Padding(3, 4, 3, 4);
|
||||
checkBoxSupports.Name = "checkBoxSupports";
|
||||
checkBoxSupports.Size = new Size(305, 24);
|
||||
checkBoxSupports.TabIndex = 8;
|
||||
checkBoxSupports.Text = "Признак наличия опоры для фиксации";
|
||||
checkBoxSupports.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxBucket
|
||||
//
|
||||
checkBoxBucket.AutoSize = true;
|
||||
checkBoxBucket.Location = new Point(12, 208);
|
||||
checkBoxBucket.Margin = new Padding(3, 4, 3, 4);
|
||||
checkBoxBucket.Name = "checkBoxBucket";
|
||||
checkBoxBucket.Size = new Size(202, 24);
|
||||
checkBoxBucket.TabIndex = 7;
|
||||
checkBoxBucket.Text = "Признак наличия ковша";
|
||||
checkBoxBucket.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numericUpDownWeight
|
||||
//
|
||||
numericUpDownWeight.Location = new Point(109, 88);
|
||||
numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
numericUpDownWeight.Name = "numericUpDownWeight";
|
||||
numericUpDownWeight.Size = new Size(105, 27);
|
||||
numericUpDownWeight.TabIndex = 6;
|
||||
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// numericUpDownSpeed
|
||||
//
|
||||
numericUpDownSpeed.Location = new Point(109, 45);
|
||||
numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
numericUpDownSpeed.Name = "numericUpDownSpeed";
|
||||
numericUpDownSpeed.Size = new Size(105, 27);
|
||||
numericUpDownSpeed.TabIndex = 5;
|
||||
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// labelSpeed
|
||||
//
|
||||
labelSpeed.AutoSize = true;
|
||||
labelSpeed.Location = new Point(12, 47);
|
||||
labelSpeed.Name = "labelSpeed";
|
||||
labelSpeed.Size = new Size(76, 20);
|
||||
labelSpeed.TabIndex = 3;
|
||||
labelSpeed.Text = "Скорость:";
|
||||
//
|
||||
// labelModifiedObject
|
||||
//
|
||||
labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelModifiedObject.Location = new Point(404, 187);
|
||||
labelModifiedObject.Name = "labelModifiedObject";
|
||||
labelModifiedObject.Size = new Size(115, 45);
|
||||
labelModifiedObject.TabIndex = 2;
|
||||
labelModifiedObject.Text = "Продвинутый";
|
||||
labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelModifiedObject.MouseDown += LabelObject_MouseDown;
|
||||
//
|
||||
// labelSimpleObject
|
||||
//
|
||||
labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelSimpleObject.Location = new Point(261, 187);
|
||||
labelSimpleObject.Name = "labelSimpleObject";
|
||||
labelSimpleObject.Size = new Size(115, 45);
|
||||
labelSimpleObject.TabIndex = 1;
|
||||
labelSimpleObject.Text = "Простой";
|
||||
labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelSimpleObject.MouseDown += LabelObject_MouseDown;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(575, 241);
|
||||
buttonAdd.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(86, 31);
|
||||
buttonAdd.TabIndex = 3;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(740, 240);
|
||||
buttonCancel.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(86, 31);
|
||||
buttonCancel.TabIndex = 4;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// panelObject
|
||||
//
|
||||
panelObject.AllowDrop = true;
|
||||
panelObject.Controls.Add(labelAdditionalColor);
|
||||
panelObject.Controls.Add(labelBodyColor);
|
||||
panelObject.Controls.Add(pictureBoxObject);
|
||||
panelObject.Location = new Point(575, 13);
|
||||
panelObject.Margin = new Padding(3, 4, 3, 4);
|
||||
panelObject.Name = "panelObject";
|
||||
panelObject.Size = new Size(251, 219);
|
||||
panelObject.TabIndex = 5;
|
||||
panelObject.DragDrop += PanelObject_DragDrop;
|
||||
panelObject.DragEnter += PanelObject_DragEnter;
|
||||
//
|
||||
// pictureBoxObject
|
||||
//
|
||||
pictureBoxObject.Location = new Point(13, 75);
|
||||
pictureBoxObject.Margin = new Padding(3, 4, 3, 4);
|
||||
pictureBoxObject.Name = "pictureBoxObject";
|
||||
pictureBoxObject.Size = new Size(226, 132);
|
||||
pictureBoxObject.TabIndex = 1;
|
||||
pictureBoxObject.TabStop = false;
|
||||
//
|
||||
// labelBodyColor
|
||||
//
|
||||
labelBodyColor.AllowDrop = true;
|
||||
labelBodyColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelBodyColor.Location = new Point(16, 17);
|
||||
labelBodyColor.Name = "labelBodyColor";
|
||||
labelBodyColor.Size = new Size(100, 40);
|
||||
labelBodyColor.TabIndex = 2;
|
||||
labelBodyColor.Text = "Цвет";
|
||||
labelBodyColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelBodyColor.DragDrop += labelBodyColor_DragDrop;
|
||||
labelBodyColor.DragEnter += labelBodyColor_DragEnter;
|
||||
//
|
||||
// labelAdditionalColor
|
||||
//
|
||||
labelAdditionalColor.AllowDrop = true;
|
||||
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelAdditionalColor.Location = new Point(139, 17);
|
||||
labelAdditionalColor.Name = "labelAdditionalColor";
|
||||
labelAdditionalColor.Size = new Size(100, 40);
|
||||
labelAdditionalColor.TabIndex = 4;
|
||||
labelAdditionalColor.Text = "Доп. цвет";
|
||||
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelAdditionalColor.DragDrop += labelAdditionalColor_DragDrop;
|
||||
labelAdditionalColor.DragEnter += labelAdditionalColor_DragEnter;
|
||||
//
|
||||
// FormExcavatorConfig
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(838, 285);
|
||||
Controls.Add(panelObject);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(groupBoxConfig);
|
||||
Name = "FormExcavatorConfig";
|
||||
Text = "Создание объекта";
|
||||
groupBoxConfig.ResumeLayout(false);
|
||||
groupBoxConfig.PerformLayout();
|
||||
groupBoxColors.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
|
||||
panelObject.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBoxConfig;
|
||||
private Label labelSpeed;
|
||||
private Label labelModifiedObject;
|
||||
private Label labelSimpleObject;
|
||||
private NumericUpDown numericUpDownWeight;
|
||||
private NumericUpDown numericUpDownSpeed;
|
||||
private CheckBox checkBoxBucket;
|
||||
private CheckBox checkBoxSupports;
|
||||
private GroupBox groupBoxColors;
|
||||
private Panel panelPurple;
|
||||
private Panel panelYellow;
|
||||
private Panel panelBlack;
|
||||
private Panel panelGray;
|
||||
private Panel panelBlue;
|
||||
private Panel panelWhite;
|
||||
private Panel panelGreen;
|
||||
private Panel panelRed;
|
||||
private Button buttonAdd;
|
||||
private Button buttonCancel;
|
||||
private Panel panelObject;
|
||||
private PictureBox pictureBoxObject;
|
||||
private Label labelWeight;
|
||||
private Label labelAdditionalColor;
|
||||
private Label labelBodyColor;
|
||||
}
|
||||
}
|
173
ProjectExcavator/ProjectExcavator/FormExcavatorConfig.cs
Normal file
173
ProjectExcavator/ProjectExcavator/FormExcavatorConfig.cs
Normal file
@ -0,0 +1,173 @@
|
||||
using ProjectExcavator.Drawnings;
|
||||
using ProjectExcavator.Entities;
|
||||
|
||||
namespace ProjectExcavator;
|
||||
|
||||
/// <summary>
|
||||
/// Форма конфигурации объекта
|
||||
/// </summary>
|
||||
public partial class FormExcavatorConfig : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Объект - прорисовка гусеничной машины/экскаватора
|
||||
/// </summary>
|
||||
private DrawningTrackedVehicle? _trackedVehicle;
|
||||
|
||||
/// <summary>
|
||||
/// Событие для передачи объекта
|
||||
/// </summary>
|
||||
private event Action<DrawningTrackedVehicle>? _trackedVehicleDelegate;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public FormExcavatorConfig()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
panelRed.MouseDown += Panel_MouseDown;
|
||||
panelGreen.MouseDown += Panel_MouseDown;
|
||||
panelBlue.MouseDown += Panel_MouseDown;
|
||||
panelYellow.MouseDown += Panel_MouseDown;
|
||||
panelWhite.MouseDown += Panel_MouseDown;
|
||||
panelGray.MouseDown += Panel_MouseDown;
|
||||
panelBlack.MouseDown += Panel_MouseDown;
|
||||
panelPurple.MouseDown += Panel_MouseDown;
|
||||
|
||||
// buttonCancel.Click привязать анонимный метод через lambda с закрытием формы(c)
|
||||
buttonCancel.Click += (sender, e) => Close();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Привязка внешнего метода к событию
|
||||
/// </summary>
|
||||
/// <param name="excavatorDelegate"></param>
|
||||
public void AddEvent(Action<DrawningTrackedVehicle> excavatorDelegate)
|
||||
{
|
||||
_trackedVehicleDelegate += excavatorDelegate;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Прорисовка объекта
|
||||
/// </summary>
|
||||
private void DrawObject()
|
||||
{
|
||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_trackedVehicle?.SetPictureSize(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
_trackedVehicle?.SetPosition(30, 20);
|
||||
_trackedVehicle?.DrawTransport(gr);
|
||||
pictureBoxObject.Image = bmp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Передаем информацию при нажатии на Label
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Label)?.DoDragDrop((sender as Label)?.Name ?? string.Empty, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Проверка получаемой информации (ее типа на соответствие требуемому)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void PanelObject_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data?.GetDataPresent(DataFormats.Text) ?? false ? DragDropEffects.Copy : DragDropEffects.None;
|
||||
}
|
||||
|
||||
private void PanelObject_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
switch (e.Data?.GetData(DataFormats.Text)?.ToString())
|
||||
{
|
||||
case "labelSimpleObject":
|
||||
_trackedVehicle = new DrawningTrackedVehicle((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White);
|
||||
break;
|
||||
case "labelModifiedObject":
|
||||
_trackedVehicle = new DrawningExcavator((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White,
|
||||
Color.Black, checkBoxBucket.Checked, checkBoxSupports.Checked);
|
||||
break;
|
||||
}
|
||||
DrawObject();
|
||||
}
|
||||
|
||||
// <summary>
|
||||
/// Передаем информацию при нажатии на Panel
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Panel_MouseDown(object? sender, MouseEventArgs e)
|
||||
{
|
||||
//Отправка цвета в Drag&Drop
|
||||
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
|
||||
//Логика смены цветов: основного и дополнительного (для продвинутого объекта)
|
||||
private void labelBodyColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(Color)))
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
|
||||
private void labelBodyColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_trackedVehicle != null)
|
||||
{
|
||||
_trackedVehicle.EntityTrackedVehicle.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||
DrawObject();
|
||||
}
|
||||
}
|
||||
|
||||
private void labelAdditionalColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_trackedVehicle is DrawningExcavator)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(Color)))
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void labelAdditionalColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_trackedVehicle?.EntityTrackedVehicle is EntityExcavator _catamaran)
|
||||
{
|
||||
_catamaran.SetAdditionalColor((Color)e.Data.GetData(typeof(Color)));
|
||||
}
|
||||
DrawObject();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Передача объекта
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_trackedVehicle != null)
|
||||
{
|
||||
_trackedVehicleDelegate?.Invoke(_trackedVehicle);
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
120
ProjectExcavator/ProjectExcavator/FormExcavatorConfig.resx
Normal file
120
ProjectExcavator/ProjectExcavator/FormExcavatorConfig.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?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.
|
||||
-->
|
||||
<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">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -0,0 +1,139 @@
|
||||
namespace ProjectExcavator.MovementStrategy;
|
||||
|
||||
/// <summary>
|
||||
/// Класс-стратегия перемещения объекта
|
||||
/// </summary>
|
||||
public abstract class AbstractStrategy
|
||||
{
|
||||
/// <summary>
|
||||
/// Перемещаемый объект
|
||||
/// </summary>
|
||||
private IMoveableObject? _moveableObject;
|
||||
|
||||
/// <summary>
|
||||
/// Статус перемещения
|
||||
/// </summary>
|
||||
private StrategyStatus _state = StrategyStatus.NotInit;
|
||||
|
||||
/// <summary>
|
||||
/// Ширина поля
|
||||
/// </summary>
|
||||
protected int FieldWidth { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Высота поля
|
||||
/// </summary>
|
||||
protected int FieldHeight { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Статус перемещения
|
||||
/// </summary>
|
||||
public StrategyStatus GetStatus() { return _state; }
|
||||
|
||||
/// <summary>
|
||||
/// Установка данных
|
||||
/// </summary>
|
||||
/// <param name="moveableObject">Перемещаемый объект</param>
|
||||
/// <param name="width">Ширина поля</param>
|
||||
/// <param name="height">Высота поля</param>
|
||||
public void SetData(IMoveableObject moveableObject, int width, int height)
|
||||
{
|
||||
if (moveableObject == null)
|
||||
{
|
||||
_state = StrategyStatus.NotInit;
|
||||
return;
|
||||
}
|
||||
|
||||
_state = StrategyStatus.InProgress;
|
||||
_moveableObject = moveableObject;
|
||||
FieldWidth = width;
|
||||
FieldHeight = height;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Шаг перемещения
|
||||
/// </summary>
|
||||
public void MakeStep()
|
||||
{
|
||||
if (_state != StrategyStatus.InProgress)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsTargetDestinaion())
|
||||
{
|
||||
_state = StrategyStatus.Finish;
|
||||
return;
|
||||
}
|
||||
|
||||
MoveToTarget();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перемещение влево
|
||||
/// </summary>
|
||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||
protected bool MoveLeft() => MoveTo(MovementDirection.Left);
|
||||
|
||||
/// <summary>
|
||||
/// Перемещение вправо
|
||||
/// </summary>
|
||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||
protected bool MoveRight() => MoveTo(MovementDirection.Right);
|
||||
|
||||
/// <summary>
|
||||
/// Перемещение вверх
|
||||
/// </summary>
|
||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||
protected bool MoveUp() => MoveTo(MovementDirection.Up);
|
||||
|
||||
/// <summary>
|
||||
/// Перемещение вниз
|
||||
/// </summary>
|
||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||
protected bool MoveDown() => MoveTo(MovementDirection.Down);
|
||||
|
||||
/// <summary>
|
||||
/// Параметры объекта
|
||||
/// </summary>
|
||||
protected ObjectParameters? GetObjectParameters => _moveableObject?.GetObjectPosition;
|
||||
|
||||
/// <summary>
|
||||
/// Шаг объекта
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected int? GetStep()
|
||||
{
|
||||
if (_state != StrategyStatus.InProgress)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return _moveableObject?.GetStep;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перемещение к цели
|
||||
/// </summary>
|
||||
protected abstract void MoveToTarget();
|
||||
|
||||
/// <summary>
|
||||
/// Достигнута ли цель
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected abstract bool IsTargetDestinaion();
|
||||
|
||||
/// <summary>
|
||||
/// Попытка перемещения в требуемом направлении
|
||||
/// </summary>
|
||||
/// <param name="movementDirection">Направление</param>
|
||||
/// <returns>Результат попытки (true - удалось переместиться, false - неудача)</returns>
|
||||
private bool MoveTo(MovementDirection movementDirection)
|
||||
{
|
||||
if (_state != StrategyStatus.InProgress)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _moveableObject?.TryMoveObject(movementDirection) ?? false;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
namespace ProjectExcavator.MovementStrategy;
|
||||
|
||||
/// <summary>
|
||||
/// Интерфейс для работы с перемещаемым объектом
|
||||
/// </summary>
|
||||
public interface IMoveableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Получение координаты объекта
|
||||
/// </summary>
|
||||
ObjectParameters? GetObjectPosition { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Шаг объекта
|
||||
/// </summary>
|
||||
int GetStep { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Попытка переместить объект в указанном направлении
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
/// <returns>true - объект перемещен, false - перемещение невозможно</returns>
|
||||
bool TryMoveObject(MovementDirection direction);
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
namespace ProjectExcavator.MovementStrategy;
|
||||
|
||||
/// <summary>
|
||||
/// Стратегия перемещения объекта в правый нижний угол экрана
|
||||
/// </summary>
|
||||
public class MoveToBorder : AbstractStrategy
|
||||
{
|
||||
protected override bool IsTargetDestinaion()
|
||||
{
|
||||
ObjectParameters? objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return objParams.RightBorder + GetStep() >= FieldWidth
|
||||
&& objParams.DownBorder + GetStep() >= FieldHeight;
|
||||
}
|
||||
|
||||
protected override void MoveToTarget()
|
||||
{
|
||||
ObjectParameters? objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int diffX = objParams.ObjectMiddleHorizontal - FieldWidth;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
if (diffX > 0)
|
||||
{
|
||||
MoveLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveRight();
|
||||
}
|
||||
}
|
||||
|
||||
int diffY = objParams.ObjectMiddleVertical - FieldHeight;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
if (diffY > 0)
|
||||
{
|
||||
MoveUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
namespace ProjectExcavator.MovementStrategy;
|
||||
|
||||
/// <summary>
|
||||
/// Стратегия перемещения объекта в центр экрана
|
||||
/// </summary>
|
||||
public class MoveToCenter : AbstractStrategy
|
||||
{
|
||||
protected override bool IsTargetDestinaion()
|
||||
{
|
||||
ObjectParameters? objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2
|
||||
&& objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2
|
||||
&& objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2
|
||||
&& objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
|
||||
}
|
||||
|
||||
protected override void MoveToTarget()
|
||||
{
|
||||
ObjectParameters? objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
if (diffX > 0)
|
||||
{
|
||||
MoveLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveRight();
|
||||
}
|
||||
}
|
||||
|
||||
int diffY = objParams.ObjectMiddleVertical - FieldHeight / 2;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
if (diffY > 0)
|
||||
{
|
||||
MoveUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
using ProjectExcavator.Drawnings;
|
||||
|
||||
namespace ProjectExcavator.MovementStrategy;
|
||||
|
||||
/// <summary>
|
||||
/// Класс-реализация IMoveableObject с использованием DrawningTrackedVehicle
|
||||
/// </summary>
|
||||
public class MoveableTrackedVehicle : IMoveableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Поле-объект класса DrawningTrackedVehicle или его наследника
|
||||
/// </summary>
|
||||
private readonly DrawningTrackedVehicle? _TrackedVehicle = null;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="TrackedVehicle">Объект класса DrawningTrackedVehicle</param>
|
||||
public MoveableTrackedVehicle(DrawningTrackedVehicle TrackedVehicle)
|
||||
{
|
||||
_TrackedVehicle = TrackedVehicle;
|
||||
}
|
||||
|
||||
public ObjectParameters? GetObjectPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_TrackedVehicle == null || _TrackedVehicle.EntityTrackedVehicle == null || !_TrackedVehicle.GetPosX.HasValue || !_TrackedVehicle.GetPosY.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new ObjectParameters(_TrackedVehicle.GetPosX.Value, _TrackedVehicle.GetPosY.Value, _TrackedVehicle.GetWidth, _TrackedVehicle.GetHeight);
|
||||
}
|
||||
}
|
||||
|
||||
public int GetStep => (int)(_TrackedVehicle?.EntityTrackedVehicle?.Step ?? 0);
|
||||
|
||||
public bool TryMoveObject(MovementDirection direction)
|
||||
{
|
||||
if (_TrackedVehicle == null || _TrackedVehicle.EntityTrackedVehicle == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _TrackedVehicle.MoveTransport(GetDirectionType(direction));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Конвертация из MovementDirection в DirectionType
|
||||
/// </summary>
|
||||
/// <param name="direction">MovementDirection</param>
|
||||
/// <returns>DirectionType</returns>
|
||||
private static DirectionType GetDirectionType(MovementDirection direction)
|
||||
{
|
||||
return direction switch
|
||||
{
|
||||
MovementDirection.Left => DirectionType.Left,
|
||||
MovementDirection.Right => DirectionType.Right,
|
||||
MovementDirection.Up => DirectionType.Up,
|
||||
MovementDirection.Down => DirectionType.Down,
|
||||
_ => DirectionType.Unknow,
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
namespace ProjectExcavator.MovementStrategy;
|
||||
|
||||
/// <summary>
|
||||
/// Направление перемещения
|
||||
/// </summary>
|
||||
public enum MovementDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// Вверх
|
||||
/// </summary>
|
||||
Up = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Вниз
|
||||
/// </summary>
|
||||
Down = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Влево
|
||||
/// </summary>
|
||||
Left = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Вправо
|
||||
/// </summary>
|
||||
Right = 4
|
||||
}
|
||||
|
@ -0,0 +1,72 @@
|
||||
namespace ProjectExcavator.MovementStrategy;
|
||||
|
||||
/// <summary>
|
||||
/// Параметры-координаты объекта
|
||||
/// </summary>
|
||||
public class ObjectParameters
|
||||
{
|
||||
/// <summary>
|
||||
/// Координата X
|
||||
/// </summary>
|
||||
private readonly int _x;
|
||||
|
||||
/// <summary>
|
||||
/// Координата Y
|
||||
/// </summary>
|
||||
private readonly int _y;
|
||||
|
||||
/// <summary>
|
||||
/// Ширина объекта
|
||||
/// </summary>
|
||||
private readonly int _width;
|
||||
|
||||
/// <summary>
|
||||
/// Высота объекта
|
||||
/// </summary>
|
||||
private readonly int _height;
|
||||
|
||||
/// <summary>
|
||||
/// Левая граница
|
||||
/// </summary>
|
||||
public int LeftBorder => _x;
|
||||
|
||||
/// <summary>
|
||||
/// Верхняя граница
|
||||
/// </summary>
|
||||
public int TopBorder => _y;
|
||||
|
||||
/// <summary>
|
||||
/// Правая граница
|
||||
/// </summary>
|
||||
public int RightBorder => _x + _width;
|
||||
|
||||
/// <summary>
|
||||
/// Нижняя граница
|
||||
/// </summary>
|
||||
public int DownBorder => _y + _height;
|
||||
|
||||
/// <summary>
|
||||
/// Середина объекта
|
||||
/// </summary>
|
||||
public int ObjectMiddleHorizontal => _x + _width / 2;
|
||||
|
||||
/// <summary>
|
||||
/// Середина объекта
|
||||
/// </summary>
|
||||
public int ObjectMiddleVertical => _y + _height / 2;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="x">Координата X</param>
|
||||
/// <param name="y">Координата Y</param>
|
||||
/// <param name="width">Ширина объекта</param>
|
||||
/// <param name="height">Высота объекта</param>
|
||||
public ObjectParameters(int x, int y, int width, int height)
|
||||
{
|
||||
_x = x;
|
||||
_y = y;
|
||||
_width = width;
|
||||
_height = height;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
namespace ProjectExcavator.MovementStrategy;
|
||||
|
||||
/// <summary>
|
||||
/// Статус выполнения операции перемещения
|
||||
/// </summary>
|
||||
public enum StrategyStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Все готово к началу
|
||||
/// </summary>
|
||||
NotInit,
|
||||
|
||||
/// <summary>
|
||||
/// Выполняется
|
||||
/// </summary>
|
||||
InProgress,
|
||||
|
||||
/// <summary>
|
||||
/// Завершено
|
||||
/// </summary>
|
||||
Finish
|
||||
}
|
@ -11,7 +11,7 @@ namespace ProjectExcavator
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
Application.Run(new FormExcavatorCollection());
|
||||
}
|
||||
}
|
||||
}
|
@ -8,4 +8,19 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
103
ProjectExcavator/ProjectExcavator/Properties/Resources.Designer.cs
generated
Normal file
103
ProjectExcavator/ProjectExcavator/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ProjectExcavator.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||
/// </summary>
|
||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
||||
// с помощью такого средства, как ResGen или Visual Studio.
|
||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
||||
// с параметром /str или перестройте свой проект VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectExcavator.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap white_arrow_30 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("white-arrow-30", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap white_Left_30 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("white-Left-30", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap white_right_30 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("white-right-30", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap white_UP {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("white-UP", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
133
ProjectExcavator/ProjectExcavator/Properties/Resources.resx
Normal file
133
ProjectExcavator/ProjectExcavator/Properties/Resources.resx
Normal file
@ -0,0 +1,133 @@
|
||||
<?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.
|
||||
-->
|
||||
<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">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="white-arrow-30" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\white-arrow-30.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="white-Left-30" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\white-Left-30.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="white-right-30" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\white-right-30.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="white-UP" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\white-UP.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
ProjectExcavator/ProjectExcavator/Resources/white-Left-30.png
Normal file
BIN
ProjectExcavator/ProjectExcavator/Resources/white-Left-30.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 250 KiB |
BIN
ProjectExcavator/ProjectExcavator/Resources/white-UP.png
Normal file
BIN
ProjectExcavator/ProjectExcavator/Resources/white-UP.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 269 KiB |
BIN
ProjectExcavator/ProjectExcavator/Resources/white-arrow-30.png
Normal file
BIN
ProjectExcavator/ProjectExcavator/Resources/white-arrow-30.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 246 KiB |
BIN
ProjectExcavator/ProjectExcavator/Resources/white-right-30.png
Normal file
BIN
ProjectExcavator/ProjectExcavator/Resources/white-right-30.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 248 KiB |
Loading…
Reference in New Issue
Block a user