Compare commits
5 Commits
LabWork03.
...
LabWork03
| Author | SHA1 | Date | |
|---|---|---|---|
| a18c598b8d | |||
| a8591777d9 | |||
| 8c4a09a8b5 | |||
| 9654506023 | |||
| d39c9e27bc |
@@ -3,7 +3,7 @@
|
||||
namespace ProjectAirFighter.CollectionGenericObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Реализация абстрактной компании - ангар
|
||||
/// Реализация абстрактной компании - каршеринг
|
||||
/// </summary>
|
||||
public class Angar : AbstractCompany
|
||||
{
|
||||
|
||||
@@ -98,8 +98,8 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
||||
public T? Remove(int position)
|
||||
{
|
||||
if (position >= _collection.Length || position < 0)
|
||||
{
|
||||
return null;
|
||||
{
|
||||
return null;
|
||||
}
|
||||
T obj = _collection[position];
|
||||
_collection[position] = null;
|
||||
|
||||
@@ -17,24 +17,24 @@ public class DrawningAirFighter : DrawningMilitaryAircraft
|
||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||
/// <param name="wings">Признак наличия доп крыльев</param>
|
||||
/// <param name="rockets">Признак наличия ракет</param>
|
||||
public DrawningAirFighter(int speed, double weight, Color bodyColor, Color additionalColor, bool wings, bool rockets) : base(70, 70)
|
||||
public DrawningAirFighter (int speed, double weight, Color bodyColor, Color additionalColor, bool wings, bool rockets) : base (70, 70)
|
||||
{
|
||||
EntityMilitaryAircraft = new EntityAirFighter(speed, weight, bodyColor, additionalColor, wings, rockets);
|
||||
}
|
||||
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityMilitaryAircraft == null || EntityMilitaryAircraft is not EntityAirFighter airFighter || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
if (EntityMilitaryAircraft == null || EntityMilitaryAircraft is not EntityAirFighter militaryAircraftFighter || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Pen pen = new(Color.Black);
|
||||
Brush additionalBrush = new SolidBrush(airFighter.AdditionalColor);
|
||||
Brush additionalBrush = new SolidBrush(militaryAircraftFighter.AdditionalColor);
|
||||
|
||||
base.DrawTransport(g);
|
||||
|
||||
if (airFighter.Wings)
|
||||
if (militaryAircraftFighter.Wings)
|
||||
{
|
||||
Point wings1 = new Point(_startPosX.Value + 45, _startPosY.Value + 30);
|
||||
Point wings2 = new Point(_startPosX.Value + 45, _startPosY.Value + 15);
|
||||
@@ -53,7 +53,7 @@ public class DrawningAirFighter : DrawningMilitaryAircraft
|
||||
g.DrawPolygon(pen, DownWing);
|
||||
}
|
||||
|
||||
if (airFighter.Rockets)
|
||||
if (militaryAircraftFighter.Rockets)
|
||||
{
|
||||
Point rocket1 = new Point(_startPosX.Value + 40, _startPosY.Value + 5);
|
||||
Point rocket2 = new Point(_startPosX.Value + 15, _startPosY.Value + 5);
|
||||
|
||||
@@ -23,22 +23,22 @@ public class DrawningMilitaryAircraft
|
||||
private int? _pictureHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Левая координата прорисовки самолёта
|
||||
/// Левая координата прорисовки самолёта
|
||||
/// </summary>
|
||||
protected int? _startPosX;
|
||||
|
||||
/// <summary>
|
||||
/// Верхняя кооридната прорисовки военного самолёта
|
||||
/// Верхняя кооридната прорисовки самолёта
|
||||
/// </summary>
|
||||
protected int? _startPosY;
|
||||
|
||||
/// <summary>
|
||||
/// Ширина прорисовки военного самолёта
|
||||
/// Ширина прорисовки самолёта
|
||||
/// </summary>
|
||||
private readonly int _drawningMilitaryAircraftWidth = 70;
|
||||
|
||||
/// <summary>
|
||||
/// Высота прорисовки военного самолёта
|
||||
/// Высота прорисовки самолёта
|
||||
/// </summary>
|
||||
private readonly int _drawningMilitaryAircraftHeight = 70;
|
||||
|
||||
@@ -79,7 +79,7 @@ public class DrawningMilitaryAircraft
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
public DrawningMilitaryAircraft(int speed, double weight, Color bodyColor) : this()
|
||||
public DrawningMilitaryAircraft (int speed, double weight, Color bodyColor) : this()
|
||||
{
|
||||
EntityMilitaryAircraft = new EntityMilitaryAircraft(speed, weight, bodyColor);
|
||||
}
|
||||
@@ -87,9 +87,9 @@ public class DrawningMilitaryAircraft
|
||||
/// <summary>
|
||||
/// Конструктор для наследников
|
||||
/// </summary>
|
||||
/// <param name="drawningCarWidth">Ширина прорисовки военного самолёта</param>
|
||||
/// <param name="drawningCarHeight">Высота прорисовки военного самолёта</param>
|
||||
protected DrawningMilitaryAircraft(int drawningMilitaryAircraftWidth, int drawningMilitaryAircraftHeight) : this()
|
||||
/// <param name="drawningMilitaryAircraftWidth">Ширина прорисовки самолёта</param>
|
||||
/// <param name="drawningMilitaryAircraftHeight">Высота прорисовки самолёта</param>
|
||||
protected DrawningMilitaryAircraft(int drawningMilitaryAircraftWidth, int drawningMilitaryAircraftHeight) : this()
|
||||
{
|
||||
_drawningMilitaryAircraftWidth = drawningMilitaryAircraftWidth;
|
||||
_drawningMilitaryAircraftHeight = drawningMilitaryAircraftHeight;
|
||||
|
||||
@@ -17,10 +17,10 @@ public class EntityMilitaryAircraft
|
||||
/// Конструктор сущности
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес автомобиля</param>
|
||||
/// <param name="weight">Вес</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
|
||||
public EntityMilitaryAircraft(int speed, double weight, Color bodyColor)
|
||||
public EntityMilitaryAircraft (int speed, double weight, Color bodyColor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
name/value pmilitaryAircrafts.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
|
||||
@@ -31,10 +31,10 @@
|
||||
groupBoxTools = new GroupBox();
|
||||
buttonRefresh = new Button();
|
||||
buttonGoToCheck = new Button();
|
||||
buttonRemoveMilitaryAircraft = new Button();
|
||||
buttonRemoveAir = new Button();
|
||||
maskedTextBoxPosition = new MaskedTextBox();
|
||||
buttonAddAirFighter = new Button();
|
||||
buttonAddMilitaryAircraft = new Button();
|
||||
buttonAddAir = new Button();
|
||||
comboBoxSelectorCompany = new ComboBox();
|
||||
pictureBox = new PictureBox();
|
||||
groupBoxTools.SuspendLayout();
|
||||
@@ -45,15 +45,15 @@
|
||||
//
|
||||
groupBoxTools.Controls.Add(buttonRefresh);
|
||||
groupBoxTools.Controls.Add(buttonGoToCheck);
|
||||
groupBoxTools.Controls.Add(buttonRemoveMilitaryAircraft);
|
||||
groupBoxTools.Controls.Add(buttonRemoveAir);
|
||||
groupBoxTools.Controls.Add(maskedTextBoxPosition);
|
||||
groupBoxTools.Controls.Add(buttonAddAirFighter);
|
||||
groupBoxTools.Controls.Add(buttonAddMilitaryAircraft);
|
||||
groupBoxTools.Controls.Add(buttonAddAir);
|
||||
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
|
||||
groupBoxTools.Dock = DockStyle.Right;
|
||||
groupBoxTools.Location = new Point(610, 0);
|
||||
groupBoxTools.Location = new Point(594, 0);
|
||||
groupBoxTools.Name = "groupBoxTools";
|
||||
groupBoxTools.Size = new Size(190, 450);
|
||||
groupBoxTools.Size = new Size(206, 450);
|
||||
groupBoxTools.TabIndex = 0;
|
||||
groupBoxTools.TabStop = false;
|
||||
groupBoxTools.Text = "Инструменты";
|
||||
@@ -61,9 +61,9 @@
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonRefresh.Location = new Point(9, 389);
|
||||
buttonRefresh.Location = new Point(6, 395);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Size = new Size(175, 49);
|
||||
buttonRefresh.Size = new Size(197, 29);
|
||||
buttonRefresh.TabIndex = 7;
|
||||
buttonRefresh.Text = "Обновить";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
@@ -72,56 +72,55 @@
|
||||
// buttonGoToCheck
|
||||
//
|
||||
buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonGoToCheck.Location = new Point(9, 316);
|
||||
buttonGoToCheck.Location = new Point(6, 328);
|
||||
buttonGoToCheck.Name = "buttonGoToCheck";
|
||||
buttonGoToCheck.Size = new Size(175, 49);
|
||||
buttonGoToCheck.Size = new Size(197, 29);
|
||||
buttonGoToCheck.TabIndex = 6;
|
||||
buttonGoToCheck.Text = "Передать на тесты";
|
||||
buttonGoToCheck.UseVisualStyleBackColor = true;
|
||||
buttonGoToCheck.Click += buttonGoToCheck_Click;
|
||||
//
|
||||
// buttonRemoveMilitaryAircraft
|
||||
// buttonRemoveAir
|
||||
//
|
||||
buttonRemoveMilitaryAircraft.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonRemoveMilitaryAircraft.Location = new Point(9, 234);
|
||||
buttonRemoveMilitaryAircraft.Name = "buttonRemoveMilitaryAircraft";
|
||||
buttonRemoveMilitaryAircraft.Size = new Size(175, 49);
|
||||
buttonRemoveMilitaryAircraft.TabIndex = 5;
|
||||
buttonRemoveMilitaryAircraft.Text = "Удаление военного самолёта";
|
||||
buttonRemoveMilitaryAircraft.UseVisualStyleBackColor = true;
|
||||
buttonRemoveMilitaryAircraft.Click += buttonRemoveMilitaryAircraft_Click;
|
||||
buttonRemoveAir.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonRemoveAir.Location = new Point(5, 211);
|
||||
buttonRemoveAir.Name = "buttonRemoveAir";
|
||||
buttonRemoveAir.Size = new Size(197, 29);
|
||||
buttonRemoveAir.TabIndex = 5;
|
||||
buttonRemoveAir.Text = "Удаление самолёта";
|
||||
buttonRemoveAir.UseVisualStyleBackColor = true;
|
||||
buttonRemoveAir.Click += buttonRemoveAir_Click;
|
||||
//
|
||||
// maskedTextBoxPosition
|
||||
//
|
||||
maskedTextBoxPosition.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
maskedTextBoxPosition.Location = new Point(9, 201);
|
||||
maskedTextBoxPosition.Location = new Point(6, 161);
|
||||
maskedTextBoxPosition.Mask = "00";
|
||||
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
||||
maskedTextBoxPosition.Size = new Size(175, 27);
|
||||
maskedTextBoxPosition.Size = new Size(194, 27);
|
||||
maskedTextBoxPosition.TabIndex = 4;
|
||||
maskedTextBoxPosition.ValidatingType = typeof(int);
|
||||
//
|
||||
// buttonAddAirFighter
|
||||
//
|
||||
buttonAddAirFighter.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonAddAirFighter.Location = new Point(9, 128);
|
||||
buttonAddAirFighter.Location = new Point(6, 103);
|
||||
buttonAddAirFighter.Name = "buttonAddAirFighter";
|
||||
buttonAddAirFighter.Size = new Size(175, 49);
|
||||
buttonAddAirFighter.Size = new Size(197, 31);
|
||||
buttonAddAirFighter.TabIndex = 2;
|
||||
buttonAddAirFighter.Text = "Добавление истребителя";
|
||||
buttonAddAirFighter.UseVisualStyleBackColor = true;
|
||||
buttonAddAirFighter.Click += buttonAddAirFighter_Click;
|
||||
//
|
||||
// buttonAddMilitaryAircraft
|
||||
// buttonAddAir
|
||||
//
|
||||
buttonAddMilitaryAircraft.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonAddMilitaryAircraft.Location = new Point(9, 73);
|
||||
buttonAddMilitaryAircraft.Name = "buttonAddMilitaryAircraft";
|
||||
buttonAddMilitaryAircraft.Size = new Size(175, 49);
|
||||
buttonAddMilitaryAircraft.TabIndex = 1;
|
||||
buttonAddMilitaryAircraft.Text = "Добавление военного самолёта";
|
||||
buttonAddMilitaryAircraft.UseVisualStyleBackColor = true;
|
||||
buttonAddMilitaryAircraft.Click += buttonAddMilitaryAircraft_Click;
|
||||
buttonAddAir.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonAddAir.Location = new Point(6, 68);
|
||||
buttonAddAir.Name = "buttonAddAir";
|
||||
buttonAddAir.Size = new Size(197, 29);
|
||||
buttonAddAir.TabIndex = 1;
|
||||
buttonAddAir.Text = "Добавление самолёта";
|
||||
buttonAddAir.UseVisualStyleBackColor = true;
|
||||
buttonAddAir.Click += buttonAddAir_Click;
|
||||
//
|
||||
// comboBoxSelectorCompany
|
||||
//
|
||||
@@ -129,9 +128,9 @@
|
||||
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxSelectorCompany.FormattingEnabled = true;
|
||||
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
|
||||
comboBoxSelectorCompany.Location = new Point(9, 26);
|
||||
comboBoxSelectorCompany.Location = new Point(6, 26);
|
||||
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
||||
comboBoxSelectorCompany.Size = new Size(175, 28);
|
||||
comboBoxSelectorCompany.Size = new Size(194, 28);
|
||||
comboBoxSelectorCompany.TabIndex = 0;
|
||||
comboBoxSelectorCompany.SelectedIndexChanged += comboBoxSelectorCompany_SelectedIndexChanged;
|
||||
//
|
||||
@@ -140,19 +139,19 @@
|
||||
pictureBox.Dock = DockStyle.Fill;
|
||||
pictureBox.Location = new Point(0, 0);
|
||||
pictureBox.Name = "pictureBox";
|
||||
pictureBox.Size = new Size(610, 450);
|
||||
pictureBox.Size = new Size(594, 450);
|
||||
pictureBox.TabIndex = 3;
|
||||
pictureBox.TabStop = false;
|
||||
//
|
||||
// FormMilitaryAircraftCollection
|
||||
// FormAirCollection
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(pictureBox);
|
||||
Controls.Add(groupBoxTools);
|
||||
Name = "FormMilitaryAircraftCollection";
|
||||
Text = "Коллекция военных самолётов";
|
||||
Name = "FormAirCollection";
|
||||
Text = "Коллекция самолётов";
|
||||
groupBoxTools.ResumeLayout(false);
|
||||
groupBoxTools.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||
@@ -163,12 +162,12 @@
|
||||
|
||||
private GroupBox groupBoxTools;
|
||||
private ComboBox comboBoxSelectorCompany;
|
||||
private Button buttonAddAir;
|
||||
private Button buttonAddAirFighter;
|
||||
private Button buttonAddMilitaryAircraft;
|
||||
private MaskedTextBox maskedTextBoxPosition;
|
||||
private PictureBox pictureBox;
|
||||
private MaskedTextBox maskedTextBoxPosition;
|
||||
private Button buttonRemoveAir;
|
||||
private Button buttonRefresh;
|
||||
private Button buttonGoToCheck;
|
||||
private Button buttonRemoveMilitaryAircraft;
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ public partial class FormMilitaryAircraftCollection : Form
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonAddMilitaryAircraft_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningMilitaryAircraft));
|
||||
private void buttonAddAir_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningMilitaryAircraft));
|
||||
|
||||
/// <summary>
|
||||
/// Добавление истребителя
|
||||
@@ -104,7 +104,7 @@ public partial class FormMilitaryAircraftCollection : Form
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonRemoveMilitaryAircraft_Click(object sender, EventArgs e)
|
||||
private void buttonRemoveAir_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text) || _company == null)
|
||||
{
|
||||
|
||||
@@ -10,9 +10,9 @@ public class MoveToBorder : AbstractStrategy
|
||||
return false;
|
||||
}
|
||||
|
||||
return objParams.RightBorder <= FieldWidth &&
|
||||
return objParams.RightBorder <= FieldWidth &&
|
||||
objParams.RightBorder + GetStep() >= FieldWidth &&
|
||||
objParams.DownBorder <= FieldHeight &&
|
||||
objParams.DownBorder <= FieldHeight &&
|
||||
objParams.DownBorder + GetStep() >= FieldHeight;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ public class MoveToCenter : AbstractStrategy
|
||||
|
||||
return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2 &&
|
||||
objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 &&
|
||||
objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 &&
|
||||
objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 &&
|
||||
objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
name/value pmilitaryAircrafts.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
|
||||
Reference in New Issue
Block a user