Compare commits
No commits in common. "LabWork05" and "main" have entirely different histories.
@ -1,112 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ProjectDumpTruck.Drawnings;
|
|
||||||
|
|
||||||
namespace ProjectDumpTruck.CollectionGenericObject;
|
|
||||||
|
|
||||||
public abstract class AbstractCompany
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Размер места (ширина)
|
|
||||||
/// </summary>
|
|
||||||
protected readonly int _placeSizeWidth = 310;
|
|
||||||
/// <summary>
|
|
||||||
/// Размер места (высота)
|
|
||||||
/// </summary>
|
|
||||||
protected readonly int _placeSizeHeight = 125;
|
|
||||||
/// <summary>
|
|
||||||
/// Ширина окна
|
|
||||||
/// </summary>
|
|
||||||
protected readonly int _pictureWidth;
|
|
||||||
/// <summary>
|
|
||||||
/// Высота окна
|
|
||||||
/// </summary>
|
|
||||||
protected readonly int _pictureHeight;
|
|
||||||
/// <summary>
|
|
||||||
/// Коллекция грузовиков
|
|
||||||
/// </summary>
|
|
||||||
protected ICollectionGenericObject<DrawningTruck>? _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,
|
|
||||||
ICollectionGenericObject<DrawningTruck> collection)
|
|
||||||
{
|
|
||||||
_pictureWidth = picWidth;
|
|
||||||
_pictureHeight = picHeight;
|
|
||||||
_collection = collection;
|
|
||||||
_collection.SetMaxCount = GetMaxCount;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Перегрузка оператора сложения для класса
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="company">Компания</param>
|
|
||||||
/// <param name="truck">Добавляемый объект</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static int operator +(AbstractCompany company, DrawningTruck truck)
|
|
||||||
{
|
|
||||||
return company._collection.Insert(truck);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Перегрузка оператора удаления для класса
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="company">Компания</param>
|
|
||||||
/// <param name="position">Номер удаляемого объекта</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static DrawningTruck? operator -(AbstractCompany company, int position)
|
|
||||||
{
|
|
||||||
return company._collection?.Remove(position-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Получение случайного объекта из коллекции
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public DrawningTruck? 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);
|
|
||||||
DrawBackground(graphics);
|
|
||||||
|
|
||||||
SetObjectsPosition();
|
|
||||||
for (int i = 0; i < (_collection?.Count ?? 0); ++i)
|
|
||||||
{
|
|
||||||
DrawningTruck? obj = _collection?.Get(i);
|
|
||||||
obj?.DrawTransport(graphics);
|
|
||||||
}
|
|
||||||
return bitmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Вывод заднего фона
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="g"></param>
|
|
||||||
protected abstract void DrawBackground(Graphics g);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Расстановка объектов
|
|
||||||
/// </summary>
|
|
||||||
protected abstract void SetObjectsPosition();
|
|
||||||
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
using ProjectDumpTruck.Drawnings;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectDumpTruck.CollectionGenericObject;
|
|
||||||
|
|
||||||
public class Autopark : AbstractCompany
|
|
||||||
{
|
|
||||||
public Autopark(int picWidth, int picHeight, ICollectionGenericObject<DrawningTruck> collection) : base(picWidth, picHeight, collection)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void DrawBackground(Graphics g)
|
|
||||||
{
|
|
||||||
Pen pen = new(Color.Black, 2);
|
|
||||||
Pen Pen2 = new(Color.Black, 3);
|
|
||||||
|
|
||||||
for (int i = 0; i < _pictureHeight / _placeSizeHeight; i++)
|
|
||||||
{
|
|
||||||
int y = _placeSizeHeight;
|
|
||||||
y *= i;
|
|
||||||
|
|
||||||
for (int j = 0; j <= _pictureWidth / _placeSizeWidth; j++)
|
|
||||||
{
|
|
||||||
int x = _placeSizeWidth;
|
|
||||||
x *= j;
|
|
||||||
|
|
||||||
g.DrawLine(Pen2, x+10, y, x + _placeSizeWidth / 2, y);
|
|
||||||
g.DrawLine(Pen2, x+10, y + _placeSizeHeight - 10, x + _placeSizeWidth / 2, y + _placeSizeHeight - 10);
|
|
||||||
g.DrawLine(pen, x + 10, y, x+10, y + _placeSizeHeight - 10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void SetObjectsPosition()
|
|
||||||
{
|
|
||||||
int n = 0;
|
|
||||||
int m = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < (_collection?.Count ?? 0); i++)
|
|
||||||
{
|
|
||||||
if (_collection?.Get(i) != null)
|
|
||||||
{
|
|
||||||
int x = 20 + _placeSizeWidth * n;
|
|
||||||
int y = 10 + _placeSizeHeight * m;
|
|
||||||
|
|
||||||
_collection?.Get(i)?.SetPictureSize(_pictureWidth, _pictureHeight);
|
|
||||||
_collection?.Get(i)?.SetPosition(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n < _pictureWidth / _placeSizeWidth)
|
|
||||||
n++;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
n = 0;
|
|
||||||
m++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectDumpTruck.CollectionGenericObject;
|
|
||||||
|
|
||||||
public enum CollectionType
|
|
||||||
{
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Неопределено
|
|
||||||
/// </summary>
|
|
||||||
None = 0,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Массив
|
|
||||||
/// </summary>
|
|
||||||
Massive = 1,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Список
|
|
||||||
/// </summary>
|
|
||||||
List = 2
|
|
||||||
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectDumpTruck.CollectionGenericObject;
|
|
||||||
|
|
||||||
public interface ICollectionGenericObject<T>
|
|
||||||
where T : class
|
|
||||||
{
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Кол-во объектов в коллекции
|
|
||||||
/// </summary>
|
|
||||||
int Count { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Установка макс кол-ва элементов
|
|
||||||
/// </summary>
|
|
||||||
int SetMaxCount { 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);
|
|
||||||
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectDumpTruck.CollectionGenericObject;
|
|
||||||
|
|
||||||
public class ListGenericObjects<T> : ICollectionGenericObject<T>
|
|
||||||
where T: class
|
|
||||||
{
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Список объектов, которые храним
|
|
||||||
/// </summary>
|
|
||||||
private readonly List<T?> _collection;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Максимально допустимое число объектов в списке
|
|
||||||
/// </summary>
|
|
||||||
private int _maxCount;
|
|
||||||
|
|
||||||
public int Count => _collection.Count;
|
|
||||||
|
|
||||||
public int SetMaxCount { set { if (value > 0) { _maxCount = value; } } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор
|
|
||||||
/// </summary>
|
|
||||||
public ListGenericObjects()
|
|
||||||
{
|
|
||||||
_collection = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
public T? Get(int position)
|
|
||||||
{
|
|
||||||
if (position < 0 || position >= Count)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _collection[position];
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Insert(T obj)
|
|
||||||
{
|
|
||||||
if (Count == _maxCount)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
_collection.Add(obj);
|
|
||||||
return _collection.Count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Insert(T obj, int position)
|
|
||||||
{
|
|
||||||
if (Count == _maxCount || position < 0 || position > Count)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
_collection.Insert(position, obj);
|
|
||||||
return position;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T? Remove(int position)
|
|
||||||
{
|
|
||||||
if (position < 0 || position > Count)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
T? obj = _collection[position];
|
|
||||||
_collection.RemoveAt(position);
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,118 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection.Metadata.Ecma335;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectDumpTruck.CollectionGenericObject;
|
|
||||||
|
|
||||||
public class MassiveGenericObjects<T> : ICollectionGenericObject<T>
|
|
||||||
where T : class
|
|
||||||
{
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Массив объектов, которые храним
|
|
||||||
/// </summary>
|
|
||||||
private T?[] _collection;
|
|
||||||
|
|
||||||
public int Count => _collection.Length;
|
|
||||||
|
|
||||||
public int SetMaxCount
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value > 0)
|
|
||||||
{
|
|
||||||
if (_collection.Length > 0)
|
|
||||||
{
|
|
||||||
Array.Resize(ref _collection, value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_collection = new T?[value];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор
|
|
||||||
/// </summary>
|
|
||||||
public MassiveGenericObjects()
|
|
||||||
{
|
|
||||||
_collection = Array.Empty<T?>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public T? Get(int position)
|
|
||||||
{
|
|
||||||
// TODO проверка позиции
|
|
||||||
if (position < 0 || position >= Count)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return _collection[position];
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Insert(T obj)
|
|
||||||
{
|
|
||||||
// TODO вставка в свободное место набора
|
|
||||||
for (int i = 0; i < Count; i++)
|
|
||||||
{
|
|
||||||
if (_collection[i] == null)
|
|
||||||
{
|
|
||||||
_collection[i] = obj;
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Insert(T obj, int position)
|
|
||||||
{
|
|
||||||
if (position < 0 || position >= Count)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_collection[position] == null)
|
|
||||||
{
|
|
||||||
_collection[position] = obj;
|
|
||||||
return position;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = position + 1; i < Count; i++)
|
|
||||||
{
|
|
||||||
if (_collection[i] == null)
|
|
||||||
{
|
|
||||||
_collection[i] = obj;
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = position - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
if (_collection[i] == null)
|
|
||||||
{
|
|
||||||
_collection[i] = obj;
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
public T? Remove(int position)
|
|
||||||
{
|
|
||||||
// проверка позиции
|
|
||||||
if (position < 0 || position >= Count)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_collection[position] == null) return null;
|
|
||||||
|
|
||||||
T? temp = _collection[position];
|
|
||||||
_collection[position] = null;
|
|
||||||
return temp;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectDumpTruck.CollectionGenericObject;
|
|
||||||
|
|
||||||
public class StorageCollection<T>
|
|
||||||
where T : class
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Словарь (хранилище) с коллекциями
|
|
||||||
/// </summary>
|
|
||||||
readonly Dictionary<string, ICollectionGenericObject<T>> _storages;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Возвращение списка названий коллекций
|
|
||||||
/// </summary>
|
|
||||||
public List<string> Keys => _storages.Keys.ToList();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор
|
|
||||||
/// </summary>
|
|
||||||
public StorageCollection()
|
|
||||||
{
|
|
||||||
_storages = new Dictionary<string, ICollectionGenericObject<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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (collectionType == CollectionType.Massive)
|
|
||||||
{
|
|
||||||
_storages.Add(name, new MassiveGenericObjects<T>());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (collectionType == CollectionType.List)
|
|
||||||
{
|
|
||||||
_storages.Add(name, new ListGenericObjects<T>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <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 ICollectionGenericObject<T>? this[string name]
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_storages.ContainsKey(name))
|
|
||||||
{
|
|
||||||
return _storages[name];
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectDumpTruck.Drawnings
|
|
||||||
{
|
|
||||||
public enum DirectionType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Неизвестное направление
|
|
||||||
/// </summary>
|
|
||||||
Unknow = -1,
|
|
||||||
/// <summary>
|
|
||||||
/// Вверх
|
|
||||||
/// </summary>
|
|
||||||
Up = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Вниз
|
|
||||||
/// </summary>
|
|
||||||
Down = 2,
|
|
||||||
/// <summary>
|
|
||||||
/// Влево
|
|
||||||
/// </summary>
|
|
||||||
Left = 3,
|
|
||||||
/// <summary>
|
|
||||||
/// Вправо
|
|
||||||
/// </summary>
|
|
||||||
Right = 4
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ProjectDumpTruck.Entities;
|
|
||||||
|
|
||||||
namespace ProjectDumpTruck.Drawnings;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
|
||||||
/// </summary>
|
|
||||||
public class DrawningDumpTruck : DrawningTruck
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="speed">Скорость</param>
|
|
||||||
/// <param name="weight">Вес</param>
|
|
||||||
/// <param name="bodyColor">Основной цвет</param>
|
|
||||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
|
||||||
/// <param name="awning">Признак наличия обвеса</param>
|
|
||||||
/// <param name="tent">Признак наличия антикрыла</param>
|
|
||||||
public DrawningDumpTruck(int speed, double weight, Color bodyColor, Color additionalColor, bool awning, bool tent) : base(135, 85)
|
|
||||||
{
|
|
||||||
EntityTruck = new EntityDumpTruck(speed, weight, bodyColor, additionalColor, awning, tent);
|
|
||||||
}
|
|
||||||
public override void DrawTransport(Graphics g)
|
|
||||||
{
|
|
||||||
if (EntityTruck == null || EntityTruck is not EntityDumpTruck dumpTruck || !_startPosX.HasValue || !_startPosY.HasValue)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
base.DrawTransport(g);
|
|
||||||
|
|
||||||
Pen pen = new(Color.Black);
|
|
||||||
Brush additionalBrush = new SolidBrush(dumpTruck.AdditionalColor);
|
|
||||||
|
|
||||||
//Отрисовка кузова
|
|
||||||
if (dumpTruck.Awning)
|
|
||||||
{
|
|
||||||
g.FillRectangle(additionalBrush, _startPosX.Value, _startPosY.Value, 90, 35);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Отрисовка тента
|
|
||||||
if (dumpTruck.Awning & dumpTruck.Tent)
|
|
||||||
{
|
|
||||||
Brush tent = new SolidBrush(dumpTruck.AdditionalColor);
|
|
||||||
g.FillRectangle(tent, _startPosX.Value, _startPosY.Value, 95, 10);
|
|
||||||
g.FillRectangle(tent, _startPosX.Value, _startPosY.Value, 95, 3);
|
|
||||||
g.FillRectangle(tent, _startPosX.Value + 30, _startPosY.Value, 3, 40);
|
|
||||||
g.FillRectangle(tent, _startPosX.Value + 70, _startPosY.Value, 3, 40);
|
|
||||||
|
|
||||||
Pen t = new(Color.Black);
|
|
||||||
g.DrawRectangle(t, _startPosX.Value, _startPosY.Value, 95, 10);
|
|
||||||
g.DrawRectangle(t, _startPosX.Value + 30, _startPosY.Value, 3, 40);
|
|
||||||
g.DrawRectangle(t, _startPosX.Value + 70, _startPosY.Value, 3, 40);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,245 +0,0 @@
|
|||||||
using ProjectDumpTruck.Entities;
|
|
||||||
|
|
||||||
namespace ProjectDumpTruck.Drawnings;
|
|
||||||
|
|
||||||
public class DrawningTruck
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Класс-сущность
|
|
||||||
/// </summary>
|
|
||||||
public EntityTruck? EntityTruck { 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 _drawningTruckWidth = 135;
|
|
||||||
/// <summary>
|
|
||||||
/// Высота прорисовки автомобиля
|
|
||||||
/// </summary>
|
|
||||||
private readonly int _drawningTruckHeight = 85;
|
|
||||||
/// <summary>
|
|
||||||
/// Координата x объекта
|
|
||||||
/// </summary>
|
|
||||||
public int? GetPosX => _startPosX;
|
|
||||||
/// <summary>
|
|
||||||
/// Координата y объекта
|
|
||||||
/// </summary>
|
|
||||||
public int? GetPosY => _startPosY;
|
|
||||||
/// <summary>
|
|
||||||
/// Ширина объекта
|
|
||||||
/// </summary>
|
|
||||||
public int GetWidth => _drawningTruckWidth;
|
|
||||||
/// <summary>
|
|
||||||
/// Высота объекта
|
|
||||||
/// </summary>
|
|
||||||
public int GetHeight => _drawningTruckHeight;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Пустой конструктор
|
|
||||||
/// </summary>
|
|
||||||
private DrawningTruck()
|
|
||||||
{
|
|
||||||
_pictureWidth = null;
|
|
||||||
_pictureHeight = null;
|
|
||||||
_startPosX = null;
|
|
||||||
_startPosY = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="speed">Скорость</param>
|
|
||||||
/// <param name="weight">Вес</param>
|
|
||||||
/// <param name="bodyColor">Основной цвет</param>
|
|
||||||
public DrawningTruck(int speed, double weight, Color bodyColor) : this()
|
|
||||||
{
|
|
||||||
EntityTruck = new EntityTruck(speed, weight, bodyColor);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор для наследников
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="drawningTruckWidth">Ширина прорисовки самосвала</param>
|
|
||||||
/// <param name="drawningTruckHeight">Высота прорисовки самосвала</param>
|
|
||||||
public DrawningTruck(int drawningTruckWidth, int drawningTruckHeight) : this()
|
|
||||||
{
|
|
||||||
_drawningTruckWidth = drawningTruckWidth;
|
|
||||||
_drawningTruckHeight= drawningTruckHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Установка границ поля
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="width">Ширина поля</param>
|
|
||||||
/// <param name="height">Высота поля</param>
|
|
||||||
public bool SetPictureSize(int width, int height)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (width >= _drawningTruckWidth && height >= _drawningTruckHeight)
|
|
||||||
{
|
|
||||||
_pictureWidth = width;
|
|
||||||
_pictureHeight = height;
|
|
||||||
if (_startPosX != null && _startPosY != null)
|
|
||||||
{
|
|
||||||
if (_startPosX.Value + _drawningTruckWidth > _pictureWidth)
|
|
||||||
{
|
|
||||||
_startPosX = _pictureWidth - _drawningTruckWidth;
|
|
||||||
}
|
|
||||||
if (_startPosY.Value + _drawningTruckHeight > _pictureHeight)
|
|
||||||
{
|
|
||||||
_startPosY = _pictureHeight - _drawningTruckHeight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Установка позиции
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="x">Координата X</param>
|
|
||||||
/// <param name="y">Координата Y</param>
|
|
||||||
public void SetPosition(int x, int y)
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
if (!_pictureHeight.HasValue || !_pictureWidth.HasValue)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_startPosX = x;
|
|
||||||
_startPosY = y;
|
|
||||||
|
|
||||||
if (_startPosX < 0) _startPosX = 0;
|
|
||||||
if (_startPosY < 0) _startPosY = 0;
|
|
||||||
|
|
||||||
if (_startPosX + _drawningTruckWidth > _pictureWidth.Value)
|
|
||||||
{
|
|
||||||
_startPosX = _pictureWidth.Value - _drawningTruckWidth;
|
|
||||||
}
|
|
||||||
if (_startPosY + _drawningTruckHeight > _pictureHeight.Value)
|
|
||||||
{
|
|
||||||
_startPosY = _pictureHeight.Value - _drawningTruckHeight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveTransport(DirectionType direction)
|
|
||||||
{
|
|
||||||
if (EntityTruck == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
switch (direction)
|
|
||||||
{
|
|
||||||
//влево
|
|
||||||
case DirectionType.Left:
|
|
||||||
if (_startPosX.Value - EntityTruck.Step > 0)
|
|
||||||
{
|
|
||||||
_startPosX -= (int)EntityTruck.Step;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
//вверх
|
|
||||||
case DirectionType.Up:
|
|
||||||
if (_startPosY.Value - EntityTruck.Step > 0)
|
|
||||||
{
|
|
||||||
_startPosY -= (int)EntityTruck.Step;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
//вниз
|
|
||||||
case DirectionType.Down:
|
|
||||||
if (_startPosY.Value + EntityTruck.Step + _drawningTruckHeight < _pictureHeight)
|
|
||||||
{
|
|
||||||
_startPosY += (int)EntityTruck.Step;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
//вправо
|
|
||||||
case DirectionType.Right:
|
|
||||||
if (_startPosX.Value + EntityTruck.Step + _drawningTruckWidth < _pictureWidth)
|
|
||||||
{
|
|
||||||
_startPosX += (int)EntityTruck.Step;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void DrawTransport(Graphics g)
|
|
||||||
{
|
|
||||||
if (EntityTruck == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Pen pen = new(Color.Black);
|
|
||||||
|
|
||||||
//Кабина и основа
|
|
||||||
Brush body = new SolidBrush(EntityTruck.BodyColor);
|
|
||||||
g.FillRectangle(body, _startPosX.Value + 100, _startPosY.Value, 30, 40);
|
|
||||||
g.DrawRectangle(pen, _startPosX.Value + 100, _startPosY.Value, 30, 40);
|
|
||||||
|
|
||||||
g.FillRectangle(body, _startPosX.Value, _startPosY.Value + 40, 130, 20);
|
|
||||||
g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 40, 130, 20);
|
|
||||||
|
|
||||||
//Фары
|
|
||||||
Brush light = new SolidBrush(Color.Yellow);
|
|
||||||
g.FillRectangle(light, _startPosX.Value + 130, _startPosY.Value + 40, 4, 5);
|
|
||||||
g.FillRectangle(light, _startPosX.Value - 5, _startPosY.Value + 40, 4, 5);
|
|
||||||
|
|
||||||
Brush light1 = new SolidBrush(Color.DarkOrange);
|
|
||||||
g.FillRectangle(light1, _startPosX.Value + 125, _startPosY.Value + 40, 5, 5);
|
|
||||||
g.FillRectangle(light1, _startPosX.Value, _startPosY.Value + 40, 5, 5);
|
|
||||||
|
|
||||||
//Стекло
|
|
||||||
Brush glass = new SolidBrush(Color.LightBlue);
|
|
||||||
g.FillRectangle(glass, _startPosX.Value + 110, _startPosY.Value + 5, 20, 25);
|
|
||||||
|
|
||||||
//Отрисовка колёс
|
|
||||||
Brush wheels = new SolidBrush(Color.Black);
|
|
||||||
g.FillEllipse(wheels, _startPosX.Value, _startPosY.Value + 60, 30, 30);
|
|
||||||
g.FillEllipse(wheels, _startPosX.Value + 30, _startPosY.Value + 60, 30, 30);
|
|
||||||
g.FillEllipse(wheels, _startPosX.Value + 100, _startPosY.Value + 60, 30, 30);
|
|
||||||
|
|
||||||
Brush kolpac = new SolidBrush(Color.Gray);
|
|
||||||
g.FillEllipse(kolpac, _startPosX.Value + 6, _startPosY.Value + 66, 17, 17);
|
|
||||||
g.FillEllipse(kolpac, _startPosX.Value + 36, _startPosY.Value + 66, 17, 17);
|
|
||||||
g.FillEllipse(kolpac, _startPosX.Value + 106, _startPosY.Value + 66, 17, 17);
|
|
||||||
|
|
||||||
//Отрисовка границ
|
|
||||||
|
|
||||||
|
|
||||||
g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 40, 130, 20);
|
|
||||||
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 60, 30, 30);
|
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 60, 30, 30);
|
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 100, _startPosY.Value + 60, 30, 30);
|
|
||||||
|
|
||||||
Pen glass_ = new(Color.DarkGray);
|
|
||||||
g.DrawRectangle(glass_, _startPosX.Value + 110, _startPosY.Value + 5, 20, 25);
|
|
||||||
|
|
||||||
Pen light_ = new(Color.LightBlue);
|
|
||||||
g.DrawRectangle(light_, _startPosX.Value + 130, _startPosY.Value + 40, 4, 5);
|
|
||||||
g.DrawRectangle(light_, _startPosX.Value + 125, _startPosY.Value + 40, 5, 5);
|
|
||||||
g.DrawRectangle(light_, _startPosX.Value - 5, _startPosY.Value + 40, 4, 5);
|
|
||||||
g.DrawRectangle(light_, _startPosX.Value, _startPosY.Value + 40, 5, 5);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
namespace ProjectDumpTruck.Entities;
|
|
||||||
|
|
||||||
public class EntityDumpTruck : EntityTruck
|
|
||||||
{
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Дополнительный цвет (для опциональных элементов)
|
|
||||||
/// </summary>
|
|
||||||
public Color AdditionalColor { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Метод передачи дополнительного цвета
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="additionalColor"></param>
|
|
||||||
public void SetAdditionalColor(Color additionalColor)
|
|
||||||
{
|
|
||||||
AdditionalColor = additionalColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Признак (опция) наличие кузова
|
|
||||||
/// </summary>
|
|
||||||
public bool Awning { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Признак (опция) наличия тента
|
|
||||||
/// </summary>
|
|
||||||
public bool Tent { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Инициализация полей объекта-класса самосвала
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="speed">Скорость</param>
|
|
||||||
/// <param name="weight">Вес автомобиля</param>
|
|
||||||
/// <param name="bodyColor">Основной цвет</param>
|
|
||||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
|
||||||
/// <param name="awning">Признак наличия обвеса</param>
|
|
||||||
/// <param name="tent">Признак наличия антикрыла</param>
|
|
||||||
public EntityDumpTruck(int speed, double weight, Color bodyColor, Color
|
|
||||||
additionalColor, bool awning, bool tent) : base(speed, weight, bodyColor)
|
|
||||||
{
|
|
||||||
AdditionalColor = additionalColor;
|
|
||||||
Awning = awning;
|
|
||||||
Tent = tent;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Xml;
|
|
||||||
|
|
||||||
namespace ProjectDumpTruck.Entities;
|
|
||||||
/// <summary>
|
|
||||||
/// Класс-сущность самосвал без кузова
|
|
||||||
/// </summary>
|
|
||||||
public class EntityTruck
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Скорость
|
|
||||||
/// </summary>
|
|
||||||
public int Speed { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Вес
|
|
||||||
/// </summary>
|
|
||||||
public double Weight { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Основной цвет
|
|
||||||
/// </summary>
|
|
||||||
public Color BodyColor { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Метод передачи базового цвета
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="bodyColor"></param>
|
|
||||||
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 EntityTruck(int speed, double weight, Color bodyColor)
|
|
||||||
{
|
|
||||||
Speed = speed;
|
|
||||||
Weight = weight;
|
|
||||||
BodyColor = bodyColor;
|
|
||||||
}
|
|
||||||
}
|
|
39
ProjectDumpTruck/ProjectDumpTruck/Form1.Designer.cs
generated
Normal file
39
ProjectDumpTruck/ProjectDumpTruck/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
namespace ProjectDumpTruck
|
||||||
|
{
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
10
ProjectDumpTruck/ProjectDumpTruck/Form1.cs
Normal file
10
ProjectDumpTruck/ProjectDumpTruck/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace ProjectDumpTruck
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,147 +0,0 @@
|
|||||||
namespace ProjectDumpTruck
|
|
||||||
{
|
|
||||||
partial class FormDumpTruck
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
buttonLeft = new Button();
|
|
||||||
buttonRight = new Button();
|
|
||||||
buttonUp = new Button();
|
|
||||||
buttonDown = new Button();
|
|
||||||
comboBoxStrategy = new ComboBox();
|
|
||||||
buttonStrategyStep = new Button();
|
|
||||||
pictureBoxDumpTruck = new PictureBox();
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxDumpTruck).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// buttonLeft
|
|
||||||
//
|
|
||||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonLeft.BackgroundImage = Properties.Resources.влево;
|
|
||||||
buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonLeft.Location = new Point(850, 469);
|
|
||||||
buttonLeft.Name = "buttonLeft";
|
|
||||||
buttonLeft.Size = new Size(40, 40);
|
|
||||||
buttonLeft.TabIndex = 2;
|
|
||||||
buttonLeft.UseVisualStyleBackColor = true;
|
|
||||||
buttonLeft.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// buttonRight
|
|
||||||
//
|
|
||||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonRight.BackgroundImage = Properties.Resources.вправо;
|
|
||||||
buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonRight.Location = new Point(942, 469);
|
|
||||||
buttonRight.Name = "buttonRight";
|
|
||||||
buttonRight.Size = new Size(40, 40);
|
|
||||||
buttonRight.TabIndex = 3;
|
|
||||||
buttonRight.UseVisualStyleBackColor = true;
|
|
||||||
buttonRight.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// buttonUp
|
|
||||||
//
|
|
||||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonUp.BackgroundImage = Properties.Resources.вверх;
|
|
||||||
buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonUp.Location = new Point(896, 423);
|
|
||||||
buttonUp.Name = "buttonUp";
|
|
||||||
buttonUp.Size = new Size(40, 40);
|
|
||||||
buttonUp.TabIndex = 4;
|
|
||||||
buttonUp.UseVisualStyleBackColor = true;
|
|
||||||
buttonUp.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// buttonDown
|
|
||||||
//
|
|
||||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonDown.BackgroundImage = Properties.Resources.вниз;
|
|
||||||
buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonDown.Location = new Point(896, 469);
|
|
||||||
buttonDown.Name = "buttonDown";
|
|
||||||
buttonDown.Size = new Size(40, 40);
|
|
||||||
buttonDown.TabIndex = 5;
|
|
||||||
buttonDown.UseVisualStyleBackColor = true;
|
|
||||||
buttonDown.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(831, 21);
|
|
||||||
comboBoxStrategy.Name = "comboBoxStrategy";
|
|
||||||
comboBoxStrategy.Size = new Size(151, 28);
|
|
||||||
comboBoxStrategy.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// buttonStrategyStep
|
|
||||||
//
|
|
||||||
buttonStrategyStep.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
buttonStrategyStep.Location = new Point(890, 55);
|
|
||||||
buttonStrategyStep.Name = "buttonStrategyStep";
|
|
||||||
buttonStrategyStep.Size = new Size(94, 29);
|
|
||||||
buttonStrategyStep.TabIndex = 9;
|
|
||||||
buttonStrategyStep.Text = "Шаг";
|
|
||||||
buttonStrategyStep.UseVisualStyleBackColor = true;
|
|
||||||
buttonStrategyStep.Click += ButtonStrategyStep_Click;
|
|
||||||
//
|
|
||||||
// pictureBoxDumpTruck
|
|
||||||
//
|
|
||||||
pictureBoxDumpTruck.Dock = DockStyle.Fill;
|
|
||||||
pictureBoxDumpTruck.Location = new Point(0, 0);
|
|
||||||
pictureBoxDumpTruck.Name = "pictureBoxDumpTruck";
|
|
||||||
pictureBoxDumpTruck.Size = new Size(1004, 527);
|
|
||||||
pictureBoxDumpTruck.TabIndex = 10;
|
|
||||||
pictureBoxDumpTruck.TabStop = false;
|
|
||||||
//
|
|
||||||
// FormDumpTruck
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(1004, 527);
|
|
||||||
Controls.Add(buttonStrategyStep);
|
|
||||||
Controls.Add(comboBoxStrategy);
|
|
||||||
Controls.Add(buttonDown);
|
|
||||||
Controls.Add(buttonUp);
|
|
||||||
Controls.Add(buttonRight);
|
|
||||||
Controls.Add(buttonLeft);
|
|
||||||
Controls.Add(pictureBoxDumpTruck);
|
|
||||||
Name = "FormDumpTruck";
|
|
||||||
Text = "Самосвал";
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxDumpTruck).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
private Button buttonLeft;
|
|
||||||
private Button buttonRight;
|
|
||||||
private Button buttonUp;
|
|
||||||
private Button buttonDown;
|
|
||||||
private ComboBox comboBoxStrategy;
|
|
||||||
private Button buttonStrategyStep;
|
|
||||||
private PictureBox pictureBoxDumpTruck;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,105 +0,0 @@
|
|||||||
using System.Diagnostics;
|
|
||||||
using ProjectDumpTruck.Drawnings;
|
|
||||||
using ProjectDumpTruck.MovementStrategy;
|
|
||||||
|
|
||||||
namespace ProjectDumpTruck;
|
|
||||||
|
|
||||||
public partial class FormDumpTruck : Form
|
|
||||||
|
|
||||||
{
|
|
||||||
private DrawningTruck? _drawningTruck;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Стратегия перемещения
|
|
||||||
/// </summary>
|
|
||||||
private AbstractStrategy? _strategy;
|
|
||||||
|
|
||||||
public DrawningTruck SetTruck
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_drawningTruck = value;
|
|
||||||
_drawningTruck.SetPictureSize(pictureBoxDumpTruck.Width, pictureBoxDumpTruck.Height);
|
|
||||||
comboBoxStrategy.Enabled = true;
|
|
||||||
_strategy = null;
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public FormDumpTruck()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_strategy = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Draw()
|
|
||||||
{
|
|
||||||
if (_drawningTruck == null) return;
|
|
||||||
|
|
||||||
Bitmap bmp = new(pictureBoxDumpTruck.Width,
|
|
||||||
pictureBoxDumpTruck.Height);
|
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
|
||||||
_drawningTruck.DrawTransport(gr);
|
|
||||||
pictureBoxDumpTruck.Image = bmp;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonMove_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_drawningTruck == null) return;
|
|
||||||
|
|
||||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
|
||||||
bool result = false;
|
|
||||||
switch (name)
|
|
||||||
{
|
|
||||||
case "buttonLeft":
|
|
||||||
result = _drawningTruck.MoveTransport(DirectionType.Left); break;
|
|
||||||
case "buttonDown":
|
|
||||||
result = _drawningTruck.MoveTransport(DirectionType.Down); break;
|
|
||||||
case "buttonUp":
|
|
||||||
result = _drawningTruck.MoveTransport(DirectionType.Up); break;
|
|
||||||
case "buttonRight":
|
|
||||||
result = _drawningTruck.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 (_drawningTruck == null) return;
|
|
||||||
|
|
||||||
if (comboBoxStrategy.Enabled)
|
|
||||||
{
|
|
||||||
_strategy = comboBoxStrategy.SelectedIndex switch
|
|
||||||
{
|
|
||||||
0 => new MoveToCenter(),
|
|
||||||
1 => new MoveToBorder(),
|
|
||||||
_ => null,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_strategy == null) return;
|
|
||||||
|
|
||||||
_strategy.SetData(new MoveableTruck(_drawningTruck), pictureBoxDumpTruck.Width, pictureBoxDumpTruck.Height);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_strategy == null) return;
|
|
||||||
|
|
||||||
comboBoxStrategy.Enabled = false;
|
|
||||||
_strategy.MakeStep();
|
|
||||||
Draw();
|
|
||||||
|
|
||||||
if (_strategy.GetStatus() == StrategyStatus.Finish)
|
|
||||||
{
|
|
||||||
comboBoxStrategy.Enabled = true;
|
|
||||||
_strategy = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?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>
|
|
@ -1,280 +0,0 @@
|
|||||||
namespace ProjectDumpTruck
|
|
||||||
{
|
|
||||||
partial class FormTruckCollection
|
|
||||||
{
|
|
||||||
/// <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();
|
|
||||||
panelStorage = new Panel();
|
|
||||||
buttonCollectionDel = new Button();
|
|
||||||
buttonCollectionAdd = new Button();
|
|
||||||
listBoxCollection = new ListBox();
|
|
||||||
radioButtonList = new RadioButton();
|
|
||||||
radioButtonMassive = new RadioButton();
|
|
||||||
textBoxCollectionName = new TextBox();
|
|
||||||
labelCollectionName = new Label();
|
|
||||||
buttonCompanyCreate = new Button();
|
|
||||||
panelCompanyTools = new Panel();
|
|
||||||
buttonAddTruck = new Button();
|
|
||||||
buttonRemoveTruck = new Button();
|
|
||||||
buttonRefresh = new Button();
|
|
||||||
buttonGoToCheck = new Button();
|
|
||||||
maskedTextBoxPosition = new MaskedTextBox();
|
|
||||||
comboBoxSelectorCompany = new ComboBox();
|
|
||||||
pictureBox = new PictureBox();
|
|
||||||
groupBoxTools.SuspendLayout();
|
|
||||||
panelStorage.SuspendLayout();
|
|
||||||
panelCompanyTools.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// groupBoxTools
|
|
||||||
//
|
|
||||||
groupBoxTools.Controls.Add(panelStorage);
|
|
||||||
groupBoxTools.Controls.Add(buttonCompanyCreate);
|
|
||||||
groupBoxTools.Controls.Add(panelCompanyTools);
|
|
||||||
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
|
|
||||||
groupBoxTools.Dock = DockStyle.Right;
|
|
||||||
groupBoxTools.Location = new Point(888, 0);
|
|
||||||
groupBoxTools.Name = "groupBoxTools";
|
|
||||||
groupBoxTools.Size = new Size(238, 688);
|
|
||||||
groupBoxTools.TabIndex = 0;
|
|
||||||
groupBoxTools.TabStop = false;
|
|
||||||
groupBoxTools.Text = "Инструменты";
|
|
||||||
//
|
|
||||||
// panelStorage
|
|
||||||
//
|
|
||||||
panelStorage.Controls.Add(buttonCollectionDel);
|
|
||||||
panelStorage.Controls.Add(buttonCollectionAdd);
|
|
||||||
panelStorage.Controls.Add(listBoxCollection);
|
|
||||||
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(232, 274);
|
|
||||||
panelStorage.TabIndex = 12;
|
|
||||||
//
|
|
||||||
// buttonCollectionDel
|
|
||||||
//
|
|
||||||
buttonCollectionDel.Location = new Point(0, 226);
|
|
||||||
buttonCollectionDel.Name = "buttonCollectionDel";
|
|
||||||
buttonCollectionDel.Size = new Size(226, 35);
|
|
||||||
buttonCollectionDel.TabIndex = 13;
|
|
||||||
buttonCollectionDel.Text = "Удалить коллекцию";
|
|
||||||
buttonCollectionDel.Click += ButtonCollectionDel_Click;
|
|
||||||
//
|
|
||||||
// buttonCollectionAdd
|
|
||||||
//
|
|
||||||
buttonCollectionAdd.Location = new Point(3, 95);
|
|
||||||
buttonCollectionAdd.Name = "buttonCollectionAdd";
|
|
||||||
buttonCollectionAdd.Size = new Size(226, 35);
|
|
||||||
buttonCollectionAdd.TabIndex = 12;
|
|
||||||
buttonCollectionAdd.Text = "Добавить коллекцию";
|
|
||||||
buttonCollectionAdd.Click += ButtonCollectionAdd_Click;
|
|
||||||
//
|
|
||||||
// listBoxCollection
|
|
||||||
//
|
|
||||||
listBoxCollection.FormattingEnabled = true;
|
|
||||||
listBoxCollection.ItemHeight = 20;
|
|
||||||
listBoxCollection.Location = new Point(3, 136);
|
|
||||||
listBoxCollection.Name = "listBoxCollection";
|
|
||||||
listBoxCollection.Size = new Size(226, 84);
|
|
||||||
listBoxCollection.TabIndex = 4;
|
|
||||||
//
|
|
||||||
// radioButtonList
|
|
||||||
//
|
|
||||||
radioButtonList.AutoSize = true;
|
|
||||||
radioButtonList.Location = new Point(124, 65);
|
|
||||||
radioButtonList.Name = "radioButtonList";
|
|
||||||
radioButtonList.Size = new Size(80, 24);
|
|
||||||
radioButtonList.TabIndex = 3;
|
|
||||||
radioButtonList.TabStop = true;
|
|
||||||
radioButtonList.Text = "Список";
|
|
||||||
radioButtonList.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// radioButtonMassive
|
|
||||||
//
|
|
||||||
radioButtonMassive.AutoSize = true;
|
|
||||||
radioButtonMassive.Location = new Point(27, 65);
|
|
||||||
radioButtonMassive.Name = "radioButtonMassive";
|
|
||||||
radioButtonMassive.Size = new Size(82, 24);
|
|
||||||
radioButtonMassive.TabIndex = 2;
|
|
||||||
radioButtonMassive.TabStop = true;
|
|
||||||
radioButtonMassive.Text = "Массив";
|
|
||||||
radioButtonMassive.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// textBoxCollectionName
|
|
||||||
//
|
|
||||||
textBoxCollectionName.Location = new Point(3, 32);
|
|
||||||
textBoxCollectionName.Name = "textBoxCollectionName";
|
|
||||||
textBoxCollectionName.Size = new Size(226, 27);
|
|
||||||
textBoxCollectionName.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// labelCollectionName
|
|
||||||
//
|
|
||||||
labelCollectionName.AutoSize = true;
|
|
||||||
labelCollectionName.Location = new Point(39, 9);
|
|
||||||
labelCollectionName.Name = "labelCollectionName";
|
|
||||||
labelCollectionName.Size = new Size(155, 20);
|
|
||||||
labelCollectionName.TabIndex = 0;
|
|
||||||
labelCollectionName.Text = "Название коллекции";
|
|
||||||
//
|
|
||||||
// buttonCompanyCreate
|
|
||||||
//
|
|
||||||
buttonCompanyCreate.Location = new Point(6, 337);
|
|
||||||
buttonCompanyCreate.Name = "buttonCompanyCreate";
|
|
||||||
buttonCompanyCreate.Size = new Size(226, 42);
|
|
||||||
buttonCompanyCreate.TabIndex = 11;
|
|
||||||
buttonCompanyCreate.Text = "Создание компанию\r\n";
|
|
||||||
buttonCompanyCreate.Click += ButtonCompanyCreate_Click;
|
|
||||||
//
|
|
||||||
// panelCompanyTools
|
|
||||||
//
|
|
||||||
panelCompanyTools.Controls.Add(buttonAddTruck);
|
|
||||||
panelCompanyTools.Controls.Add(buttonRemoveTruck);
|
|
||||||
panelCompanyTools.Controls.Add(buttonRefresh);
|
|
||||||
panelCompanyTools.Controls.Add(buttonGoToCheck);
|
|
||||||
panelCompanyTools.Controls.Add(maskedTextBoxPosition);
|
|
||||||
panelCompanyTools.Dock = DockStyle.Bottom;
|
|
||||||
panelCompanyTools.Enabled = false;
|
|
||||||
panelCompanyTools.Location = new Point(3, 385);
|
|
||||||
panelCompanyTools.Name = "panelCompanyTools";
|
|
||||||
panelCompanyTools.Size = new Size(232, 300);
|
|
||||||
panelCompanyTools.TabIndex = 10;
|
|
||||||
//
|
|
||||||
// buttonAddTruck
|
|
||||||
//
|
|
||||||
buttonAddTruck.Location = new Point(3, 35);
|
|
||||||
buttonAddTruck.Name = "buttonAddTruck";
|
|
||||||
buttonAddTruck.Size = new Size(226, 42);
|
|
||||||
buttonAddTruck.TabIndex = 0;
|
|
||||||
buttonAddTruck.Text = "Добваление грузовика";
|
|
||||||
buttonAddTruck.Click += ButtonAddTruck_Click;
|
|
||||||
//
|
|
||||||
// buttonRemoveTruck
|
|
||||||
//
|
|
||||||
buttonRemoveTruck.Location = new Point(3, 138);
|
|
||||||
buttonRemoveTruck.Name = "buttonRemoveTruck";
|
|
||||||
buttonRemoveTruck.Size = new Size(226, 48);
|
|
||||||
buttonRemoveTruck.TabIndex = 4;
|
|
||||||
buttonRemoveTruck.Text = "Удалить грузовик";
|
|
||||||
buttonRemoveTruck.UseVisualStyleBackColor = true;
|
|
||||||
buttonRemoveTruck.Click += ButtonRemoveTruck_Click;
|
|
||||||
//
|
|
||||||
// buttonRefresh
|
|
||||||
//
|
|
||||||
buttonRefresh.Location = new Point(3, 246);
|
|
||||||
buttonRefresh.Name = "buttonRefresh";
|
|
||||||
buttonRefresh.Size = new Size(226, 48);
|
|
||||||
buttonRefresh.TabIndex = 6;
|
|
||||||
buttonRefresh.Text = "Обновить";
|
|
||||||
buttonRefresh.UseVisualStyleBackColor = true;
|
|
||||||
buttonRefresh.Click += ButtonRefresh_Click;
|
|
||||||
//
|
|
||||||
// buttonGoToCheck
|
|
||||||
//
|
|
||||||
buttonGoToCheck.Location = new Point(3, 192);
|
|
||||||
buttonGoToCheck.Name = "buttonGoToCheck";
|
|
||||||
buttonGoToCheck.Size = new Size(226, 48);
|
|
||||||
buttonGoToCheck.TabIndex = 5;
|
|
||||||
buttonGoToCheck.Text = "Передать на тест";
|
|
||||||
buttonGoToCheck.UseVisualStyleBackColor = true;
|
|
||||||
buttonGoToCheck.Click += ButtonGoToCheck_Click;
|
|
||||||
//
|
|
||||||
// maskedTextBoxPosition
|
|
||||||
//
|
|
||||||
maskedTextBoxPosition.Location = new Point(3, 105);
|
|
||||||
maskedTextBoxPosition.Mask = "00";
|
|
||||||
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
|
||||||
maskedTextBoxPosition.Size = new Size(226, 27);
|
|
||||||
maskedTextBoxPosition.TabIndex = 3;
|
|
||||||
maskedTextBoxPosition.ValidatingType = typeof(int);
|
|
||||||
//
|
|
||||||
// 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(6, 303);
|
|
||||||
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
|
||||||
comboBoxSelectorCompany.Size = new Size(226, 28);
|
|
||||||
comboBoxSelectorCompany.TabIndex = 9;
|
|
||||||
comboBoxSelectorCompany.SelectedIndexChanged += СomboBoxSelectorCompany_SelectedIndexChanged_1;
|
|
||||||
//
|
|
||||||
// pictureBox
|
|
||||||
//
|
|
||||||
pictureBox.Dock = DockStyle.Fill;
|
|
||||||
pictureBox.Location = new Point(0, 0);
|
|
||||||
pictureBox.Name = "pictureBox";
|
|
||||||
pictureBox.Size = new Size(888, 688);
|
|
||||||
pictureBox.TabIndex = 1;
|
|
||||||
pictureBox.TabStop = false;
|
|
||||||
//
|
|
||||||
// FormTruckCollection
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(1126, 688);
|
|
||||||
Controls.Add(pictureBox);
|
|
||||||
Controls.Add(groupBoxTools);
|
|
||||||
Name = "FormTruckCollection";
|
|
||||||
Text = "Коллекция грузовиков";
|
|
||||||
groupBoxTools.ResumeLayout(false);
|
|
||||||
panelStorage.ResumeLayout(false);
|
|
||||||
panelStorage.PerformLayout();
|
|
||||||
panelCompanyTools.ResumeLayout(false);
|
|
||||||
panelCompanyTools.PerformLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private GroupBox groupBoxTools;
|
|
||||||
private Button buttonGoToCheck;
|
|
||||||
private Button buttonRemoveTruck;
|
|
||||||
private MaskedTextBox maskedTextBoxPosition;
|
|
||||||
private PictureBox pictureBox;
|
|
||||||
private Button buttonRefresh;
|
|
||||||
private ComboBox comboBoxSelectorCompany;
|
|
||||||
private Button buttonAddTruck;
|
|
||||||
private Panel panelCompanyTools;
|
|
||||||
private Button buttonCompanyCreate;
|
|
||||||
private Panel panelStorage;
|
|
||||||
private Button buttonCollectionAdd;
|
|
||||||
private ListBox listBoxCollection;
|
|
||||||
private RadioButton radioButtonList;
|
|
||||||
private RadioButton radioButtonMassive;
|
|
||||||
private TextBox textBoxCollectionName;
|
|
||||||
private Label labelCollectionName;
|
|
||||||
private Button buttonCollectionDel;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,243 +0,0 @@
|
|||||||
using ProjectDumpTruck.CollectionGenericObject;
|
|
||||||
using ProjectDumpTruck.Drawnings;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Resources;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar;
|
|
||||||
|
|
||||||
namespace ProjectDumpTruck;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Форма работы с компанией и ее коллекцией
|
|
||||||
/// </summary>
|
|
||||||
public partial class FormTruckCollection : Form
|
|
||||||
{
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Хранилище коллекций
|
|
||||||
/// </summary>
|
|
||||||
private readonly StorageCollection<DrawningTruck> _storageCollection;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Компания
|
|
||||||
/// </summary>
|
|
||||||
private AbstractCompany? _company = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор
|
|
||||||
/// </summary>
|
|
||||||
public FormTruckCollection()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_storageCollection = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Выбор компании
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void СomboBoxSelectorCompany_SelectedIndexChanged_1(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
panelCompanyTools.Enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Добавление грузовика
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void ButtonAddTruck_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
FormTruckConfig form = new FormTruckConfig();
|
|
||||||
form.Show();
|
|
||||||
form.AddEvent(SetTruck);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Добавление грузовика в автомобиль
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="truck"></param>
|
|
||||||
private void SetTruck(DrawningTruck truck)
|
|
||||||
{
|
|
||||||
if (_company == null || truck == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_company + truck != -1)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Объект добавлен");
|
|
||||||
pictureBox.Image = _company.Show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Удаление объекта
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void ButtonRemoveTruck_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text) || _company == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (MessageBox.Show("Удалить объект", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
DrawningTruck? truck = null;
|
|
||||||
int counter = 100;
|
|
||||||
while (truck == null)
|
|
||||||
{
|
|
||||||
truck = _company.GetRandomObject();
|
|
||||||
counter--;
|
|
||||||
if (counter <= 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (truck == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
FormDumpTruck form = new()
|
|
||||||
{
|
|
||||||
SetTruck = truck
|
|
||||||
};
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCollectionDel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItem == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Коллекция не выбрана");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (MessageBox.Show("Вы уверены, что хотите удалить коллекцию?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_storageCollection.DelCollection(listBoxCollection.SelectedItem.ToString());
|
|
||||||
RefreshListBoxItems();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCompanyCreate_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItem == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Коллекция не выбрана");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ICollectionGenericObject<DrawningTruck>? collection = _storageCollection[listBoxCollection.SelectedItem.ToString() ?? string.Empty];
|
|
||||||
if (collection == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Коллекция не проинициализирована");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (comboBoxSelectorCompany.Text)
|
|
||||||
{
|
|
||||||
case "Хранилище":
|
|
||||||
_company = new Autopark(pictureBox.Width, pictureBox.Height, collection);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
panelCompanyTools.Enabled = true;
|
|
||||||
RefreshListBoxItems();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,120 +0,0 @@
|
|||||||
<?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>
|
|
@ -1,390 +0,0 @@
|
|||||||
namespace ProjectDumpTruck
|
|
||||||
{
|
|
||||||
partial class FormTruckConfig
|
|
||||||
{
|
|
||||||
/// <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();
|
|
||||||
groupBoxColours = new GroupBox();
|
|
||||||
panelPurple = new Panel();
|
|
||||||
panelWhite = new Panel();
|
|
||||||
panelBlue = new Panel();
|
|
||||||
panelGreen = new Panel();
|
|
||||||
panelGray = new Panel();
|
|
||||||
panelOrange = new Panel();
|
|
||||||
panelBlack = new Panel();
|
|
||||||
panelYellow = new Panel();
|
|
||||||
panelPink = new Panel();
|
|
||||||
panelRed = new Panel();
|
|
||||||
checkBoxTent = new CheckBox();
|
|
||||||
checkBoxAwning = new CheckBox();
|
|
||||||
numericUpDownWeight = new NumericUpDown();
|
|
||||||
labelWeight = new Label();
|
|
||||||
numericUpDownSpeed = new NumericUpDown();
|
|
||||||
labelSpeed = new Label();
|
|
||||||
labelModifiedObject = new Label();
|
|
||||||
labelSimpleObject = new Label();
|
|
||||||
pictureBoxObject = new PictureBox();
|
|
||||||
buttonAdd = new Button();
|
|
||||||
buttonCancel = new Button();
|
|
||||||
panelObject = new Panel();
|
|
||||||
labelAdditionalColor = new Label();
|
|
||||||
labelBaseColor = new Label();
|
|
||||||
groupBoxConfig.SuspendLayout();
|
|
||||||
groupBoxColours.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
|
|
||||||
panelObject.SuspendLayout();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// groupBoxConfig
|
|
||||||
//
|
|
||||||
groupBoxConfig.Controls.Add(groupBoxColours);
|
|
||||||
groupBoxConfig.Controls.Add(checkBoxTent);
|
|
||||||
groupBoxConfig.Controls.Add(checkBoxAwning);
|
|
||||||
groupBoxConfig.Controls.Add(numericUpDownWeight);
|
|
||||||
groupBoxConfig.Controls.Add(labelWeight);
|
|
||||||
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(615, 266);
|
|
||||||
groupBoxConfig.TabIndex = 0;
|
|
||||||
groupBoxConfig.TabStop = false;
|
|
||||||
groupBoxConfig.Text = "Параметры";
|
|
||||||
//
|
|
||||||
// groupBoxColours
|
|
||||||
//
|
|
||||||
groupBoxColours.Controls.Add(panelPurple);
|
|
||||||
groupBoxColours.Controls.Add(panelWhite);
|
|
||||||
groupBoxColours.Controls.Add(panelBlue);
|
|
||||||
groupBoxColours.Controls.Add(panelGreen);
|
|
||||||
groupBoxColours.Controls.Add(panelGray);
|
|
||||||
groupBoxColours.Controls.Add(panelOrange);
|
|
||||||
groupBoxColours.Controls.Add(panelBlack);
|
|
||||||
groupBoxColours.Controls.Add(panelYellow);
|
|
||||||
groupBoxColours.Controls.Add(panelPink);
|
|
||||||
groupBoxColours.Controls.Add(panelRed);
|
|
||||||
groupBoxColours.Location = new Point(260, 26);
|
|
||||||
groupBoxColours.Name = "groupBoxColours";
|
|
||||||
groupBoxColours.Size = new Size(320, 135);
|
|
||||||
groupBoxColours.TabIndex = 8;
|
|
||||||
groupBoxColours.TabStop = false;
|
|
||||||
groupBoxColours.Text = "Цвета";
|
|
||||||
//
|
|
||||||
// panelPurple
|
|
||||||
//
|
|
||||||
panelPurple.BackColor = Color.Purple;
|
|
||||||
panelPurple.Location = new Point(135, 77);
|
|
||||||
panelPurple.Name = "panelPurple";
|
|
||||||
panelPurple.Size = new Size(45, 45);
|
|
||||||
panelPurple.TabIndex = 5;
|
|
||||||
panelPurple.MouseDown += Panel_MouseDown;
|
|
||||||
//
|
|
||||||
// panelWhite
|
|
||||||
//
|
|
||||||
panelWhite.BackColor = Color.White;
|
|
||||||
panelWhite.Location = new Point(262, 77);
|
|
||||||
panelWhite.Name = "panelWhite";
|
|
||||||
panelWhite.Size = new Size(45, 45);
|
|
||||||
panelWhite.TabIndex = 7;
|
|
||||||
panelWhite.MouseDown += Panel_MouseDown;
|
|
||||||
//
|
|
||||||
// panelBlue
|
|
||||||
//
|
|
||||||
panelBlue.BackColor = Color.Blue;
|
|
||||||
panelBlue.Location = new Point(135, 26);
|
|
||||||
panelBlue.Name = "panelBlue";
|
|
||||||
panelBlue.Size = new Size(45, 45);
|
|
||||||
panelBlue.TabIndex = 4;
|
|
||||||
panelBlue.MouseDown += Panel_MouseDown;
|
|
||||||
//
|
|
||||||
// panelGreen
|
|
||||||
//
|
|
||||||
panelGreen.BackColor = Color.Green;
|
|
||||||
panelGreen.Location = new Point(75, 77);
|
|
||||||
panelGreen.Name = "panelGreen";
|
|
||||||
panelGreen.Size = new Size(45, 45);
|
|
||||||
panelGreen.TabIndex = 3;
|
|
||||||
panelGreen.MouseDown += Panel_MouseDown;
|
|
||||||
//
|
|
||||||
// panelGray
|
|
||||||
//
|
|
||||||
panelGray.BackColor = Color.Gray;
|
|
||||||
panelGray.Location = new Point(200, 77);
|
|
||||||
panelGray.Name = "panelGray";
|
|
||||||
panelGray.Size = new Size(45, 45);
|
|
||||||
panelGray.TabIndex = 5;
|
|
||||||
panelGray.MouseDown += Panel_MouseDown;
|
|
||||||
//
|
|
||||||
// panelOrange
|
|
||||||
//
|
|
||||||
panelOrange.BackColor = Color.Orange;
|
|
||||||
panelOrange.Location = new Point(15, 77);
|
|
||||||
panelOrange.Name = "panelOrange";
|
|
||||||
panelOrange.Size = new Size(45, 45);
|
|
||||||
panelOrange.TabIndex = 1;
|
|
||||||
panelOrange.MouseDown += Panel_MouseDown;
|
|
||||||
//
|
|
||||||
// panelBlack
|
|
||||||
//
|
|
||||||
panelBlack.BackColor = Color.Black;
|
|
||||||
panelBlack.Location = new Point(262, 26);
|
|
||||||
panelBlack.Name = "panelBlack";
|
|
||||||
panelBlack.Size = new Size(45, 45);
|
|
||||||
panelBlack.TabIndex = 6;
|
|
||||||
panelBlack.MouseDown += Panel_MouseDown;
|
|
||||||
//
|
|
||||||
// panelYellow
|
|
||||||
//
|
|
||||||
panelYellow.BackColor = Color.Yellow;
|
|
||||||
panelYellow.Location = new Point(75, 26);
|
|
||||||
panelYellow.Name = "panelYellow";
|
|
||||||
panelYellow.Size = new Size(45, 45);
|
|
||||||
panelYellow.TabIndex = 2;
|
|
||||||
panelYellow.MouseDown += Panel_MouseDown;
|
|
||||||
//
|
|
||||||
// panelPink
|
|
||||||
//
|
|
||||||
panelPink.BackColor = Color.Pink;
|
|
||||||
panelPink.Location = new Point(200, 26);
|
|
||||||
panelPink.Name = "panelPink";
|
|
||||||
panelPink.Size = new Size(45, 45);
|
|
||||||
panelPink.TabIndex = 4;
|
|
||||||
panelPink.MouseDown += Panel_MouseDown;
|
|
||||||
//
|
|
||||||
// panelRed
|
|
||||||
//
|
|
||||||
panelRed.AllowDrop = true;
|
|
||||||
panelRed.BackColor = Color.Red;
|
|
||||||
panelRed.Location = new Point(15, 26);
|
|
||||||
panelRed.Name = "panelRed";
|
|
||||||
panelRed.Size = new Size(45, 45);
|
|
||||||
panelRed.TabIndex = 0;
|
|
||||||
panelRed.MouseDown += Panel_MouseDown;
|
|
||||||
//
|
|
||||||
// checkBoxTent
|
|
||||||
//
|
|
||||||
checkBoxTent.AutoSize = true;
|
|
||||||
checkBoxTent.Location = new Point(24, 204);
|
|
||||||
checkBoxTent.Name = "checkBoxTent";
|
|
||||||
checkBoxTent.Size = new Size(195, 24);
|
|
||||||
checkBoxTent.TabIndex = 7;
|
|
||||||
checkBoxTent.Text = "Признак наличия тента";
|
|
||||||
checkBoxTent.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// checkBoxAwning
|
|
||||||
//
|
|
||||||
checkBoxAwning.AutoSize = true;
|
|
||||||
checkBoxAwning.Location = new Point(24, 153);
|
|
||||||
checkBoxAwning.Name = "checkBoxAwning";
|
|
||||||
checkBoxAwning.Size = new Size(204, 24);
|
|
||||||
checkBoxAwning.TabIndex = 6;
|
|
||||||
checkBoxAwning.Text = "Признак наличия кузова";
|
|
||||||
checkBoxAwning.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// numericUpDownWeight
|
|
||||||
//
|
|
||||||
numericUpDownWeight.Location = new Point(94, 86);
|
|
||||||
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(120, 27);
|
|
||||||
numericUpDownWeight.TabIndex = 5;
|
|
||||||
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
|
||||||
//
|
|
||||||
// labelWeight
|
|
||||||
//
|
|
||||||
labelWeight.AutoSize = true;
|
|
||||||
labelWeight.Location = new Point(52, 88);
|
|
||||||
labelWeight.Name = "labelWeight";
|
|
||||||
labelWeight.Size = new Size(36, 20);
|
|
||||||
labelWeight.TabIndex = 4;
|
|
||||||
labelWeight.Text = "Вес:";
|
|
||||||
//
|
|
||||||
// numericUpDownSpeed
|
|
||||||
//
|
|
||||||
numericUpDownSpeed.Location = new Point(94, 33);
|
|
||||||
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(120, 27);
|
|
||||||
numericUpDownSpeed.TabIndex = 3;
|
|
||||||
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
|
||||||
//
|
|
||||||
// labelSpeed
|
|
||||||
//
|
|
||||||
labelSpeed.AutoSize = true;
|
|
||||||
labelSpeed.Location = new Point(12, 33);
|
|
||||||
labelSpeed.Name = "labelSpeed";
|
|
||||||
labelSpeed.Size = new Size(76, 20);
|
|
||||||
labelSpeed.TabIndex = 2;
|
|
||||||
labelSpeed.Text = "Скорость:";
|
|
||||||
//
|
|
||||||
// labelModifiedObject
|
|
||||||
//
|
|
||||||
labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
labelModifiedObject.Location = new Point(432, 184);
|
|
||||||
labelModifiedObject.Name = "labelModifiedObject";
|
|
||||||
labelModifiedObject.Size = new Size(148, 44);
|
|
||||||
labelModifiedObject.TabIndex = 1;
|
|
||||||
labelModifiedObject.Text = "Продвинутый";
|
|
||||||
labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
|
|
||||||
labelModifiedObject.MouseDown += LabelObject_MouseDown;
|
|
||||||
//
|
|
||||||
// labelSimpleObject
|
|
||||||
//
|
|
||||||
labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
labelSimpleObject.Location = new Point(260, 184);
|
|
||||||
labelSimpleObject.Name = "labelSimpleObject";
|
|
||||||
labelSimpleObject.Size = new Size(148, 44);
|
|
||||||
labelSimpleObject.TabIndex = 0;
|
|
||||||
labelSimpleObject.Text = "Простой";
|
|
||||||
labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
|
|
||||||
labelSimpleObject.MouseDown += LabelObject_MouseDown;
|
|
||||||
//
|
|
||||||
// pictureBoxObject
|
|
||||||
//
|
|
||||||
pictureBoxObject.Location = new Point(3, 61);
|
|
||||||
pictureBoxObject.Name = "pictureBoxObject";
|
|
||||||
pictureBoxObject.Size = new Size(226, 143);
|
|
||||||
pictureBoxObject.TabIndex = 1;
|
|
||||||
pictureBoxObject.TabStop = false;
|
|
||||||
//
|
|
||||||
// buttonAdd
|
|
||||||
//
|
|
||||||
buttonAdd.Location = new Point(627, 225);
|
|
||||||
buttonAdd.Name = "buttonAdd";
|
|
||||||
buttonAdd.Size = new Size(94, 29);
|
|
||||||
buttonAdd.TabIndex = 2;
|
|
||||||
buttonAdd.Text = "Добавить";
|
|
||||||
buttonAdd.UseVisualStyleBackColor = true;
|
|
||||||
buttonAdd.Click += ButtonAdd_Click;
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
buttonCancel.Location = new Point(751, 225);
|
|
||||||
buttonCancel.Name = "buttonCancel";
|
|
||||||
buttonCancel.Size = new Size(94, 29);
|
|
||||||
buttonCancel.TabIndex = 3;
|
|
||||||
buttonCancel.Text = "Отмена";
|
|
||||||
buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// panelObject
|
|
||||||
//
|
|
||||||
panelObject.AllowDrop = true;
|
|
||||||
panelObject.Controls.Add(labelAdditionalColor);
|
|
||||||
panelObject.Controls.Add(labelBaseColor);
|
|
||||||
panelObject.Controls.Add(pictureBoxObject);
|
|
||||||
panelObject.Location = new Point(621, 12);
|
|
||||||
panelObject.Name = "panelObject";
|
|
||||||
panelObject.Size = new Size(232, 207);
|
|
||||||
panelObject.TabIndex = 4;
|
|
||||||
panelObject.DragDrop += PanelObject_DragDrop;
|
|
||||||
panelObject.DragEnter += PanelObject_DragEnter;
|
|
||||||
//
|
|
||||||
// labelAdditionalColor
|
|
||||||
//
|
|
||||||
labelAdditionalColor.AllowDrop = true;
|
|
||||||
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
labelAdditionalColor.Location = new Point(122, 9);
|
|
||||||
labelAdditionalColor.Name = "labelAdditionalColor";
|
|
||||||
labelAdditionalColor.Size = new Size(102, 44);
|
|
||||||
labelAdditionalColor.TabIndex = 3;
|
|
||||||
labelAdditionalColor.Text = "Доп. цвет";
|
|
||||||
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
|
|
||||||
labelAdditionalColor.DragDrop += LabelAdditionalColor_DragDrop;
|
|
||||||
labelAdditionalColor.DragEnter += LabelAdditionalColor_DragEnter;
|
|
||||||
//
|
|
||||||
// labelBaseColor
|
|
||||||
//
|
|
||||||
labelBaseColor.AllowDrop = true;
|
|
||||||
labelBaseColor.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
labelBaseColor.Location = new Point(14, 9);
|
|
||||||
labelBaseColor.Name = "labelBaseColor";
|
|
||||||
labelBaseColor.Size = new Size(102, 44);
|
|
||||||
labelBaseColor.TabIndex = 2;
|
|
||||||
labelBaseColor.Text = "Цвет";
|
|
||||||
labelBaseColor.TextAlign = ContentAlignment.MiddleCenter;
|
|
||||||
labelBaseColor.DragDrop += LabelBodyColor_DragDrop;
|
|
||||||
labelBaseColor.DragEnter += LabelBodyColor_DragEnter;
|
|
||||||
//
|
|
||||||
// FormTruckConfig
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(863, 266);
|
|
||||||
Controls.Add(panelObject);
|
|
||||||
Controls.Add(buttonCancel);
|
|
||||||
Controls.Add(buttonAdd);
|
|
||||||
Controls.Add(groupBoxConfig);
|
|
||||||
Name = "FormTruckConfig";
|
|
||||||
Text = "Создание объекта";
|
|
||||||
groupBoxConfig.ResumeLayout(false);
|
|
||||||
groupBoxConfig.PerformLayout();
|
|
||||||
groupBoxColours.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
|
|
||||||
panelObject.ResumeLayout(false);
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private GroupBox groupBoxConfig;
|
|
||||||
private Label labelSimpleObject;
|
|
||||||
private NumericUpDown numericUpDownWeight;
|
|
||||||
private Label labelWeight;
|
|
||||||
private NumericUpDown numericUpDownSpeed;
|
|
||||||
private Label labelSpeed;
|
|
||||||
private Label labelModifiedObject;
|
|
||||||
private CheckBox checkBoxAwning;
|
|
||||||
private CheckBox checkBoxTent;
|
|
||||||
private GroupBox groupBoxColours;
|
|
||||||
private Panel panelPurple;
|
|
||||||
private Panel panelWhite;
|
|
||||||
private Panel panelBlue;
|
|
||||||
private Panel panelGreen;
|
|
||||||
private Panel panelGray;
|
|
||||||
private Panel panelOrange;
|
|
||||||
private Panel panelBlack;
|
|
||||||
private Panel panelYellow;
|
|
||||||
private Panel panelPink;
|
|
||||||
private Panel panelRed;
|
|
||||||
private PictureBox pictureBoxObject;
|
|
||||||
private Button buttonAdd;
|
|
||||||
private Button buttonCancel;
|
|
||||||
private Panel panelObject;
|
|
||||||
private Label labelBaseColor;
|
|
||||||
private Label labelAdditionalColor;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,183 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using ProjectDumpTruck.Drawnings;
|
|
||||||
using ProjectDumpTruck.Entities;
|
|
||||||
|
|
||||||
|
|
||||||
namespace ProjectDumpTruck;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Форма конфигурации объекта
|
|
||||||
/// </summary>
|
|
||||||
public partial class FormTruckConfig : Form
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Объект - прорисовка грузовика
|
|
||||||
/// </summary>
|
|
||||||
private DrawningTruck? _truck;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Событие для передачи объекта
|
|
||||||
/// </summary>
|
|
||||||
private event Action<DrawningTruck>? TruckDelegate;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор
|
|
||||||
/// </summary>
|
|
||||||
public FormTruckConfig()
|
|
||||||
{
|
|
||||||
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
panelRed.MouseDown += Panel_MouseDown;
|
|
||||||
panelOrange.MouseDown += Panel_MouseDown;
|
|
||||||
panelYellow.MouseDown += Panel_MouseDown;
|
|
||||||
panelGreen.MouseDown += Panel_MouseDown;
|
|
||||||
panelBlue.MouseDown += Panel_MouseDown;
|
|
||||||
panelPurple.MouseDown += Panel_MouseDown;
|
|
||||||
panelPink.MouseDown += Panel_MouseDown;
|
|
||||||
panelGray.MouseDown += Panel_MouseDown;
|
|
||||||
panelBlack.MouseDown += Panel_MouseDown;
|
|
||||||
panelWhite.MouseDown += Panel_MouseDown;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
buttonCancel.Click += (sender, e) => Close();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddEvent(Action<DrawningTruck> truckDelegate)
|
|
||||||
{
|
|
||||||
TruckDelegate += truckDelegate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Прорисовка объекта
|
|
||||||
/// </summary>
|
|
||||||
private void DrawObject()
|
|
||||||
{
|
|
||||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
|
||||||
_truck?.SetPictureSize(pictureBoxObject.Width, pictureBoxObject.Height);
|
|
||||||
_truck?.SetPosition(30, 30);
|
|
||||||
_truck?.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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Действия при приеме перетаскиваемой информации
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void PanelObject_DragDrop(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
switch (e.Data?.GetData(DataFormats.Text)?.ToString())
|
|
||||||
{
|
|
||||||
case "labelSimpleObject":
|
|
||||||
_truck = new DrawningTruck((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "labelModifiedObject":
|
|
||||||
_truck = new DrawningDumpTruck((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White, Color.Black,
|
|
||||||
checkBoxAwning.Checked, checkBoxTent.Checked);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
DrawObject();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Панель отправка цвета при нажатии на Panel
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void Panel_MouseDown(object? sender, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
(sender as Control)?.DoDragDrop((sender as Control)?.BackColor!, DragDropEffects.Move | DragDropEffects.Copy);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Передача объекта
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_truck != null)
|
|
||||||
{
|
|
||||||
TruckDelegate?.Invoke(_truck);
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Действия при приеме перетаскиваемой информации(Основной цвет)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void LabelBodyColor_DragDrop(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
_truck?.EntityTruck?.SetBodyColor((Color)e.Data?.GetData(typeof(Color)));
|
|
||||||
DrawObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LabelBodyColor_DragEnter(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
e.Effect = e.Data?.GetDataPresent(typeof(Color)) ?? false ? DragDropEffects.Copy : DragDropEffects.None;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LabelAdditionalColor_DragDrop(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
if (_truck?.EntityTruck is EntityDumpTruck _dumpTruck)
|
|
||||||
{
|
|
||||||
_dumpTruck.SetAdditionalColor((Color)e.Data.GetData(typeof(Color)));
|
|
||||||
}
|
|
||||||
DrawObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LabelAdditionalColor_DragEnter(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
if (_truck is DrawningDumpTruck)
|
|
||||||
{
|
|
||||||
if (e.Data.GetDataPresent(typeof(Color)))
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.Copy;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.None;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,140 +0,0 @@
|
|||||||
|
|
||||||
namespace ProjectDumpTruck.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>
|
|
||||||
/// <returns></returns>
|
|
||||||
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>
|
|
||||||
/// <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 MoveDown() => MoveTo(MovementDirection.Down);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Перемещение вверх
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Результаты перемещения (true - удалось переместиться,false - неудача)</returns>
|
|
||||||
protected bool MoveUp() => MoveTo(MovementDirection.Up);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public void MakeStep()
|
|
||||||
{
|
|
||||||
|
|
||||||
if (_state != StrategyStatus.InProgress) return;
|
|
||||||
|
|
||||||
if (IsTargetDestination())
|
|
||||||
{
|
|
||||||
|
|
||||||
_state = StrategyStatus.Finish;
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
MoveToTarget();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <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>
|
|
||||||
/// <returns></returns>
|
|
||||||
protected abstract void MoveToTarget();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Достигнута ли цель
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
protected abstract bool IsTargetDestination();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Попытка перемещения в требуемом направлении
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="movementDirection"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private bool MoveTo(MovementDirection movementDirection)
|
|
||||||
{
|
|
||||||
if (_state != StrategyStatus.InProgress) return false;
|
|
||||||
|
|
||||||
return _moveableObject?.TryMoveableObject(movementDirection) ?? false;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
|
|
||||||
namespace ProjectDumpTruck.MovementStrategy;
|
|
||||||
|
|
||||||
public interface IMoveableObject
|
|
||||||
{
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Получение координаты объекта
|
|
||||||
/// </summary>
|
|
||||||
ObjectParameters? GetObjectPosition { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Шаг объекта
|
|
||||||
/// </summary>
|
|
||||||
int GetStep { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Попытка переместить объект в указанном направлении
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="direction">Направление</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
bool TryMoveableObject(MovementDirection direction);
|
|
||||||
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
|
|
||||||
namespace ProjectDumpTruck.MovementStrategy;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Стратегия перемещения объекта к углу
|
|
||||||
/// </summary>
|
|
||||||
public class MoveToBorder : AbstractStrategy
|
|
||||||
{
|
|
||||||
protected override bool IsTargetDestination()
|
|
||||||
{
|
|
||||||
ObjectParameters? objParams = GetObjectParameters;
|
|
||||||
if (objParams == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return objParams.LeftBorder - GetStep() <= 0 || objParams.RightBorder + GetStep() >= FieldWidth ||
|
|
||||||
objParams.TopBorder - GetStep() <= 0 || objParams.ObjectMiddleVertical + GetStep() >= FieldHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void MoveToTarget()
|
|
||||||
{
|
|
||||||
ObjectParameters? objParams = GetObjectParameters;
|
|
||||||
if (objParams == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int diffX = objParams.RightBorder - FieldWidth;
|
|
||||||
if (Math.Abs(diffX) > GetStep())
|
|
||||||
{
|
|
||||||
MoveRight();
|
|
||||||
}
|
|
||||||
|
|
||||||
int diffY = objParams.DownBorder - FieldHeight;
|
|
||||||
if (Math.Abs(diffY) > GetStep())
|
|
||||||
{
|
|
||||||
MoveDown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
|
|
||||||
namespace ProjectDumpTruck.MovementStrategy;
|
|
||||||
|
|
||||||
// <summary>
|
|
||||||
/// Стратегия перемещения объекта в центр
|
|
||||||
/// </summary>
|
|
||||||
public class MoveToCenter : AbstractStrategy
|
|
||||||
{
|
|
||||||
protected override bool IsTargetDestination()
|
|
||||||
{
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
|
|
||||||
using ProjectDumpTruck.Drawnings;
|
|
||||||
|
|
||||||
namespace ProjectDumpTruck.MovementStrategy;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Класс-реализация IMoveableObject с использованием DrawningTruck
|
|
||||||
/// </summary>
|
|
||||||
public class MoveableTruck : IMoveableObject
|
|
||||||
{
|
|
||||||
private DrawningTruck? _truck=null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="truck">Объект класса DrawningTruck</param>
|
|
||||||
public MoveableTruck(DrawningTruck? truck)
|
|
||||||
{
|
|
||||||
_truck = truck;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ObjectParameters? GetObjectPosition
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_truck == null||_truck.EntityTruck == null|| !_truck.GetPosX.HasValue|| !_truck.GetPosY.HasValue)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return new ObjectParameters(_truck.GetPosX.Value, _truck.GetPosY.Value, _truck.GetWidth, _truck.GetHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetStep => (int)(_truck?.EntityTruck?.Step ?? 0);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Конвертация из MovementDirection в DirectionType
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="direction">MovementDirection</param>
|
|
||||||
/// <returns>DirectionType</returns>
|
|
||||||
private static DirectionType GetDirectionType(MovementDirection direction)
|
|
||||||
{
|
|
||||||
return direction switch
|
|
||||||
{
|
|
||||||
MovementDirection.Up => DirectionType.Up,
|
|
||||||
MovementDirection.Down => DirectionType.Down,
|
|
||||||
MovementDirection.Left => DirectionType.Left,
|
|
||||||
MovementDirection.Right => DirectionType.Right,
|
|
||||||
_ => DirectionType.Unknow
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool TryMoveableObject(MovementDirection direction)
|
|
||||||
{
|
|
||||||
if (_truck == null || _truck.EntityTruck == null) return false;
|
|
||||||
|
|
||||||
return _truck.MoveTransport(GetDirectionType(direction));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
|
|
||||||
namespace ProjectDumpTruck.MovementStrategy
|
|
||||||
{
|
|
||||||
public enum MovementDirection
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Вверх
|
|
||||||
/// </summary>
|
|
||||||
Up = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Вниз
|
|
||||||
/// </summary>
|
|
||||||
Down = 2,
|
|
||||||
/// <summary>
|
|
||||||
/// Влево
|
|
||||||
/// </summary>
|
|
||||||
Left = 3,
|
|
||||||
/// <summary>
|
|
||||||
/// Вправо
|
|
||||||
/// </summary>
|
|
||||||
Right = 4
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
|
|
||||||
namespace ProjectDumpTruck.MovementStrategy;
|
|
||||||
|
|
||||||
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">Координата Х</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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
namespace ProjectDumpTruck.MovementStrategy
|
|
||||||
{
|
|
||||||
public enum StrategyStatus
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Все готово к началу
|
|
||||||
/// </summary>
|
|
||||||
NotInit,
|
|
||||||
/// <summary>
|
|
||||||
/// Выполняется
|
|
||||||
/// </summary>
|
|
||||||
InProgress,
|
|
||||||
/// <summary>
|
|
||||||
/// Завершено
|
|
||||||
/// </summary>
|
|
||||||
Finish
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -11,7 +11,7 @@ namespace ProjectDumpTruck
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new FormTruckCollection());
|
Application.Run(new Form1());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,19 +8,4 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</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>
|
</Project>
|
@ -1,103 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// Этот код создан программой.
|
|
||||||
// Исполняемая версия:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
|
||||||
// повторной генерации кода.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace ProjectDumpTruck.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("ProjectDumpTruck.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 вверх {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("вверх", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap влево {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("влево", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap вниз {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("вниз", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap вправо {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("вправо", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,133 +0,0 @@
|
|||||||
<?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="вверх" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\вверх.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="влево" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\влево.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="вниз" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\вниз.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="вправо" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\вправо.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
|
Binary file not shown.
Before Width: | Height: | Size: 72 KiB |
Binary file not shown.
Before Width: | Height: | Size: 74 KiB |
Binary file not shown.
Before Width: | Height: | Size: 73 KiB |
Binary file not shown.
Before Width: | Height: | Size: 75 KiB |
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user