diff --git a/ProjectPlane/ProjectPlane/Direction.cs b/ProjectPlane/ProjectPlane/Direction.cs index 45ee136..1b673f8 100644 --- a/ProjectPlane/ProjectPlane/Direction.cs +++ b/ProjectPlane/ProjectPlane/Direction.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace ProjectPlane { - internal enum Direction + public enum Direction { None = 0, Up = 1, diff --git a/ProjectPlane/ProjectPlane/DrawningPlane.cs b/ProjectPlane/ProjectPlane/DrawningPlane.cs index 61d0386..28ee1ae 100644 --- a/ProjectPlane/ProjectPlane/DrawningPlane.cs +++ b/ProjectPlane/ProjectPlane/DrawningPlane.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace ProjectPlane { - internal class DrawingPlane + public class DrawingPlane { /// diff --git a/ProjectPlane/ProjectPlane/EntityPlane.cs b/ProjectPlane/ProjectPlane/EntityPlane.cs index 856c101..29bc7db 100644 --- a/ProjectPlane/ProjectPlane/EntityPlane.cs +++ b/ProjectPlane/ProjectPlane/EntityPlane.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace ProjectPlane { - internal class EntityPlane + public class EntityPlane { /// diff --git a/ProjectPlane/ProjectPlane/FormMapWithSetPlanes.Designer.cs b/ProjectPlane/ProjectPlane/FormMapWithSetPlanes.Designer.cs new file mode 100644 index 0000000..b787796 --- /dev/null +++ b/ProjectPlane/ProjectPlane/FormMapWithSetPlanes.Designer.cs @@ -0,0 +1,39 @@ +namespace ProjectPlane +{ + partial class FormMapWithSetPlanes + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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 + } +} \ No newline at end of file diff --git a/ProjectPlane/ProjectPlane/FormMapWithSetPlanes.cs b/ProjectPlane/ProjectPlane/FormMapWithSetPlanes.cs new file mode 100644 index 0000000..d50f5bc --- /dev/null +++ b/ProjectPlane/ProjectPlane/FormMapWithSetPlanes.cs @@ -0,0 +1,20 @@ +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; + +namespace ProjectPlane +{ + public partial class FormMapWithSetPlanes : Form + { + public FormMapWithSetPlanes() + { + InitializeComponent(); + } + } +} diff --git a/ProjectPlane/ProjectPlane/FormMapWithSetPlanes.resx b/ProjectPlane/ProjectPlane/FormMapWithSetPlanes.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ProjectPlane/ProjectPlane/FormMapWithSetPlanes.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectPlane/ProjectPlane/FormPlane.Designer.cs b/ProjectPlane/ProjectPlane/FormPlane.Designer.cs index 06e5038..cc37f70 100644 --- a/ProjectPlane/ProjectPlane/FormPlane.Designer.cs +++ b/ProjectPlane/ProjectPlane/FormPlane.Designer.cs @@ -42,6 +42,7 @@ this.toolStripStatusLabelWeight = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabelBodyColor = new System.Windows.Forms.ToolStripStatusLabel(); this.buttonCreateModif = new System.Windows.Forms.Button(); + this.buttonSelectPlane = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlane)).BeginInit(); this.statusStrip1.SuspendLayout(); this.SuspendLayout(); @@ -148,11 +149,22 @@ this.buttonCreateModif.UseVisualStyleBackColor = false; this.buttonCreateModif.Click += new System.EventHandler(this.buttonCreateModif_Click); // + // buttonSelectPlane + // + this.buttonSelectPlane.Location = new System.Drawing.Point(541, 388); + this.buttonSelectPlane.Name = "buttonSelectPlane"; + this.buttonSelectPlane.Size = new System.Drawing.Size(75, 23); + this.buttonSelectPlane.TabIndex = 11; + this.buttonSelectPlane.Text = "Select"; + this.buttonSelectPlane.UseVisualStyleBackColor = true; + this.buttonSelectPlane.Click += new System.EventHandler(this.buttonSelectPlane_Click); + // // FormPlane // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.buttonSelectPlane); this.Controls.Add(this.buttonCreateModif); this.Controls.Add(this.buttonCreate); this.Controls.Add(this.buttonLeft); @@ -185,5 +197,6 @@ private ToolStripStatusLabel toolStripStatusLabelWeight; private ToolStripStatusLabel toolStripStatusLabelBodyColor; private Button buttonCreateModif; + private Button buttonSelectPlane; } } \ No newline at end of file diff --git a/ProjectPlane/ProjectPlane/FormPlane.cs b/ProjectPlane/ProjectPlane/FormPlane.cs index 35aa65e..76af002 100644 --- a/ProjectPlane/ProjectPlane/FormPlane.cs +++ b/ProjectPlane/ProjectPlane/FormPlane.cs @@ -4,6 +4,7 @@ { private DrawingPlane _plane; + public DrawingPlane SelectedPlane { get; private set; } public FormPlane() { @@ -62,7 +63,7 @@ SetData(); Draw(); } - private void PictureBoxCar_Resize(object sender, EventArgs e) + private void PictureBoxplane_Resize(object sender, EventArgs e) { _plane?.ChangeBorders(pictureBoxPlane.Width, pictureBoxPlane.Height); Draw(); @@ -83,6 +84,10 @@ Draw(); } - + private void buttonSelectPlane_Click(object sender, EventArgs e) + { + SelectedPlane = _plane; + DialogResult = DialogResult.OK; + } } } \ No newline at end of file diff --git a/ProjectPlane/ProjectPlane/MapWithSetPlanesGeneric.cs b/ProjectPlane/ProjectPlane/MapWithSetPlanesGeneric.cs index ce2e36d..336fe74 100644 --- a/ProjectPlane/ProjectPlane/MapWithSetPlanesGeneric.cs +++ b/ProjectPlane/ProjectPlane/MapWithSetPlanesGeneric.cs @@ -53,11 +53,11 @@ namespace ProjectPlane /// Перегрузка оператора сложения /// /// - /// + /// /// - public static bool operator +(MapWithSetPlanesGeneric map, T car) + public static bool operator +(MapWithSetPlanesGeneric map, T plane) { - return map._setPlanes.Insert(car); + return map._setPlanes.Insert(plane); } /// /// Перегрузка оператора вычитания @@ -90,10 +90,10 @@ namespace ProjectPlane Shaking(); for (int i = 0; i < _setPlanes.Count; i++) { - var car = _setPlanes.Get(i); - if (car != null) + var plane = _setPlanes.Get(i); + if (plane != null) { - return _map.CreateMap(_pictureWidth, _pictureHeight, car); + return _map.CreateMap(_pictureWidth, _pictureHeight, plane); } } return new(_pictureWidth, _pictureHeight); @@ -123,10 +123,10 @@ namespace ProjectPlane { for (; j > i; j--) { - var car = _setPlanes.Get(j); - if (car != null) + var plane = _setPlanes.Get(j); + if (plane != null) { - _setPlanes.Insert(car, i); + _setPlanes.Insert(plane, i); _setPlanes.Remove(j); break; } diff --git a/ProjectPlane/ProjectPlane/SetPlanesGeneric.cs b/ProjectPlane/ProjectPlane/SetPlanesGeneric.cs index cf3336f..568cca4 100644 --- a/ProjectPlane/ProjectPlane/SetPlanesGeneric.cs +++ b/ProjectPlane/ProjectPlane/SetPlanesGeneric.cs @@ -6,7 +6,70 @@ using System.Threading.Tasks; namespace ProjectPlane { - internal class SetPlanesGeneric + internal class SetPlanesGeneric where T : class { - } + /// + /// Массив объектов, которые храним + /// + private readonly T[] _places; + /// + /// Количество объектов в массиве + /// + public int Count => _places.Length; + /// + /// Конструктор + /// + /// + public SetPlanesGeneric(int count) + { + _places = new T[count]; + } + /// + /// Добавление объекта в набор + /// + /// Добавляемый самолет + /// + public bool Insert(T plane) + { + // TODO вставка в начало набора + return true; + } + /// + /// Добавление объекта в набор на конкретную позицию + /// + /// Добавляемый самолет + /// Позиция + /// + public bool Insert(T plane, int position) + { + // TODO проверка позиции + // TODO проверка, что элемент массива по этой позиции пустой, если нет, то + // проверка, что после вставляемого элемента в массиве есть пустой элемент + // сдвиг всех объектов, находящихся справа от позиции до первого пустого элемента + // TODO вставка по позиции + _places[position] = plane; + return true; + } + /// + /// Удаление объекта из набора с конкретной позиции + /// + /// + /// + public bool Remove(int position) + { + // TODO проверка позиции + // TODO удаление объекта из массива, присовив элементу массива значение null + return true; + } + /// + /// Получение объекта из набора по позиции + /// + /// + /// + public T Get(int position) + { + // TODO проверка позиции + return _places[position]; + } + } }