Добавление формы
This commit is contained in:
parent
63bd9b5701
commit
69701d2656
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPlane
|
||||
{
|
||||
internal enum Direction
|
||||
public enum Direction
|
||||
{
|
||||
None = 0,
|
||||
Up = 1,
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPlane
|
||||
{
|
||||
internal class DrawingPlane
|
||||
public class DrawingPlane
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPlane
|
||||
{
|
||||
internal class EntityPlane
|
||||
public class EntityPlane
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
|
39
ProjectPlane/ProjectPlane/FormMapWithSetPlanes.Designer.cs
generated
Normal file
39
ProjectPlane/ProjectPlane/FormMapWithSetPlanes.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
||||
namespace ProjectPlane
|
||||
{
|
||||
partial class FormMapWithSetPlanes
|
||||
{
|
||||
/// <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
|
||||
}
|
||||
}
|
20
ProjectPlane/ProjectPlane/FormMapWithSetPlanes.cs
Normal file
20
ProjectPlane/ProjectPlane/FormMapWithSetPlanes.cs
Normal file
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectPlane/ProjectPlane/FormMapWithSetPlanes.resx
Normal file
120
ProjectPlane/ProjectPlane/FormMapWithSetPlanes.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
13
ProjectPlane/ProjectPlane/FormPlane.Designer.cs
generated
13
ProjectPlane/ProjectPlane/FormPlane.Designer.cs
generated
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -53,11 +53,11 @@ namespace ProjectPlane
|
||||
/// Перегрузка оператора сложения
|
||||
/// </summary>
|
||||
/// <param name="map"></param>
|
||||
/// <param name="car"></param>
|
||||
/// <param name="plane"></param>
|
||||
/// <returns></returns>
|
||||
public static bool operator +(MapWithSetPlanesGeneric<T, U> map, T car)
|
||||
public static bool operator +(MapWithSetPlanesGeneric<T, U> map, T plane)
|
||||
{
|
||||
return map._setPlanes.Insert(car);
|
||||
return map._setPlanes.Insert(plane);
|
||||
}
|
||||
/// <summary>
|
||||
/// Перегрузка оператора вычитания
|
||||
@ -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;
|
||||
}
|
||||
|
@ -6,7 +6,70 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPlane
|
||||
{
|
||||
internal class SetPlanesGeneric
|
||||
internal class SetPlanesGeneric<T> where T : class
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Массив объектов, которые храним
|
||||
/// </summary>
|
||||
private readonly T[] _places;
|
||||
/// <summary>
|
||||
/// Количество объектов в массиве
|
||||
/// </summary>
|
||||
public int Count => _places.Length;
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="count"></param>
|
||||
public SetPlanesGeneric(int count)
|
||||
{
|
||||
_places = new T[count];
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление объекта в набор
|
||||
/// </summary>
|
||||
/// <param name="plane">Добавляемый самолет</param>
|
||||
/// <returns></returns>
|
||||
public bool Insert(T plane)
|
||||
{
|
||||
// TODO вставка в начало набора
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление объекта в набор на конкретную позицию
|
||||
/// </summary>
|
||||
/// <param name="plane">Добавляемый самолет</param>
|
||||
/// <param name="position">Позиция</param>
|
||||
/// <returns></returns>
|
||||
public bool Insert(T plane, int position)
|
||||
{
|
||||
// TODO проверка позиции
|
||||
// TODO проверка, что элемент массива по этой позиции пустой, если нет, то
|
||||
// проверка, что после вставляемого элемента в массиве есть пустой элемент
|
||||
// сдвиг всех объектов, находящихся справа от позиции до первого пустого элемента
|
||||
// TODO вставка по позиции
|
||||
_places[position] = plane;
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// Удаление объекта из набора с конкретной позиции
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <returns></returns>
|
||||
public bool Remove(int position)
|
||||
{
|
||||
// TODO проверка позиции
|
||||
// TODO удаление объекта из массива, присовив элементу массива значение null
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// Получение объекта из набора по позиции
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <returns></returns>
|
||||
public T Get(int position)
|
||||
{
|
||||
// TODO проверка позиции
|
||||
return _places[position];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user