From 44c31f0029a663ea5dd4a9cdfb8870282af6f3a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B0=D0=B2=D0=B5=D0=BB=20=D0=9F=D1=83=D1=82=D0=B8?= =?UTF-8?q?=D0=BB=D0=B8=D0=BD?= Date: Thu, 24 Nov 2022 18:32:22 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B4=D0=B5=D0=BB=D0=B0=D0=BD?= =?UTF-8?q?=D0=B0=203=20=D1=83=D1=81=D0=BB=D0=BE=D0=B6=D0=BD=D1=91=D0=BD?= =?UTF-8?q?=D0=BD=D0=B0=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AirplaneWithRadar/FormMap.Designer.cs | 251 ------------------ .../AirplaneWithRadar/FormMap.cs | 127 --------- .../AirplaneWithRadar/FormMap.resx | 63 ----- .../FormMapWithSetAirplanes.cs | 7 +- 4 files changed, 2 insertions(+), 446 deletions(-) delete mode 100644 AirplaneWithRadar/AirplaneWithRadar/FormMap.Designer.cs delete mode 100644 AirplaneWithRadar/AirplaneWithRadar/FormMap.cs delete mode 100644 AirplaneWithRadar/AirplaneWithRadar/FormMap.resx diff --git a/AirplaneWithRadar/AirplaneWithRadar/FormMap.Designer.cs b/AirplaneWithRadar/AirplaneWithRadar/FormMap.Designer.cs deleted file mode 100644 index 5fe8327..0000000 --- a/AirplaneWithRadar/AirplaneWithRadar/FormMap.Designer.cs +++ /dev/null @@ -1,251 +0,0 @@ -namespace AirplaneWithRadar -{ - partial class FormMap - { - /// - /// 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.statusStrip1 = new System.Windows.Forms.StatusStrip(); - this.toolStripStatusLabelSpeed = new System.Windows.Forms.ToolStripStatusLabel(); - this.toolStripStatusLabelWeight = new System.Windows.Forms.ToolStripStatusLabel(); - this.toolStripStatusLabelBodyColor = new System.Windows.Forms.ToolStripStatusLabel(); - this.pictureBoxAirplane = new System.Windows.Forms.PictureBox(); - this.buttonCreate = new System.Windows.Forms.Button(); - this.buttonUp = new System.Windows.Forms.Button(); - this.buttonLeft = new System.Windows.Forms.Button(); - this.buttonDown = new System.Windows.Forms.Button(); - this.buttonRight = new System.Windows.Forms.Button(); - this.buttonCreateModif = new System.Windows.Forms.Button(); - this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox(); - this.comboBoxTypePortholes = new System.Windows.Forms.ComboBox(); - this.comboBoxPortholes = new System.Windows.Forms.ComboBox(); - this.labelPortholes = new System.Windows.Forms.Label(); - this.statusStrip1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxAirplane)).BeginInit(); - this.SuspendLayout(); - // - // statusStrip1 - // - this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripStatusLabelSpeed, - this.toolStripStatusLabelWeight, - this.toolStripStatusLabelBodyColor}); - this.statusStrip1.Location = new System.Drawing.Point(0, 428); - this.statusStrip1.Name = "statusStrip1"; - this.statusStrip1.Size = new System.Drawing.Size(800, 22); - this.statusStrip1.TabIndex = 0; - this.statusStrip1.Text = "statusStrip1"; - // - // toolStripStatusLabelSpeed - // - this.toolStripStatusLabelSpeed.Name = "toolStripStatusLabelSpeed"; - this.toolStripStatusLabelSpeed.Size = new System.Drawing.Size(62, 17); - this.toolStripStatusLabelSpeed.Text = "Скорость:"; - // - // toolStripStatusLabelWeight - // - this.toolStripStatusLabelWeight.Name = "toolStripStatusLabelWeight"; - this.toolStripStatusLabelWeight.Size = new System.Drawing.Size(29, 17); - this.toolStripStatusLabelWeight.Text = "Вес:"; - // - // toolStripStatusLabelBodyColor - // - this.toolStripStatusLabelBodyColor.Name = "toolStripStatusLabelBodyColor"; - this.toolStripStatusLabelBodyColor.Size = new System.Drawing.Size(36, 17); - this.toolStripStatusLabelBodyColor.Text = "Цвет:"; - // - // pictureBoxAirplane - // - this.pictureBoxAirplane.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBoxAirplane.Location = new System.Drawing.Point(0, 0); - this.pictureBoxAirplane.Name = "pictureBoxAirplane"; - this.pictureBoxAirplane.Size = new System.Drawing.Size(800, 428); - this.pictureBoxAirplane.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; - this.pictureBoxAirplane.TabIndex = 1; - this.pictureBoxAirplane.TabStop = false; - // - // buttonCreate - // - this.buttonCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.buttonCreate.Location = new System.Drawing.Point(12, 395); - this.buttonCreate.Name = "buttonCreate"; - this.buttonCreate.Size = new System.Drawing.Size(96, 23); - this.buttonCreate.TabIndex = 2; - this.buttonCreate.Text = "Создать"; - this.buttonCreate.UseVisualStyleBackColor = true; - this.buttonCreate.Click += new System.EventHandler(this.ButtonCreate_Click); - // - // buttonUp - // - this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonUp.BackgroundImage = global::AirplaneWithRadar.Properties.Resources.arrUp; - this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonUp.Location = new System.Drawing.Point(722, 359); - this.buttonUp.Name = "buttonUp"; - this.buttonUp.Size = new System.Drawing.Size(30, 30); - this.buttonUp.TabIndex = 3; - this.buttonUp.UseVisualStyleBackColor = true; - this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click); - // - // buttonLeft - // - this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonLeft.BackgroundImage = global::AirplaneWithRadar.Properties.Resources.arrLeft; - this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonLeft.Location = new System.Drawing.Point(686, 395); - this.buttonLeft.Name = "buttonLeft"; - this.buttonLeft.Size = new System.Drawing.Size(30, 30); - this.buttonLeft.TabIndex = 4; - this.buttonLeft.UseVisualStyleBackColor = true; - this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click); - // - // buttonDown - // - this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonDown.BackgroundImage = global::AirplaneWithRadar.Properties.Resources.arrDown; - this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonDown.Location = new System.Drawing.Point(722, 395); - this.buttonDown.Name = "buttonDown"; - this.buttonDown.Size = new System.Drawing.Size(30, 30); - this.buttonDown.TabIndex = 5; - this.buttonDown.UseVisualStyleBackColor = true; - this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click); - // - // buttonRight - // - this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonRight.BackgroundImage = global::AirplaneWithRadar.Properties.Resources.arrRight; - this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonRight.Location = new System.Drawing.Point(758, 395); - this.buttonRight.Name = "buttonRight"; - this.buttonRight.Size = new System.Drawing.Size(30, 30); - this.buttonRight.TabIndex = 6; - this.buttonRight.UseVisualStyleBackColor = true; - this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click); - // - // buttonCreateModif - // - this.buttonCreateModif.Location = new System.Drawing.Point(114, 395); - this.buttonCreateModif.Name = "buttonCreateModif"; - this.buttonCreateModif.Size = new System.Drawing.Size(96, 23); - this.buttonCreateModif.TabIndex = 7; - this.buttonCreateModif.Text = "Модификация"; - this.buttonCreateModif.UseVisualStyleBackColor = true; - this.buttonCreateModif.Click += new System.EventHandler(this.ButtonCreateModif_Click); - // - // comboBoxSelectorMap - // - this.comboBoxSelectorMap.FormattingEnabled = true; - this.comboBoxSelectorMap.Items.AddRange(new object[] { - "Простая карта", - "Моя карта"}); - this.comboBoxSelectorMap.Location = new System.Drawing.Point(27, 34); - this.comboBoxSelectorMap.Name = "comboBoxSelectorMap"; - this.comboBoxSelectorMap.Size = new System.Drawing.Size(121, 23); - this.comboBoxSelectorMap.TabIndex = 8; - this.comboBoxSelectorMap.Text = "Простая карта"; - this.comboBoxSelectorMap.SelectedIndexChanged += new System.EventHandler(this.ComboBoxSelectorMap_SelectedIndexChanged); - // - // comboBoxTypePortholes - // - this.comboBoxTypePortholes.FormattingEnabled = true; - this.comboBoxTypePortholes.Items.AddRange(new object[] { - "Квадратные", - "Треугольные", - "Ромбовидные"}); - this.comboBoxTypePortholes.Location = new System.Drawing.Point(12, 337); - this.comboBoxTypePortholes.Name = "comboBoxTypePortholes"; - this.comboBoxTypePortholes.Size = new System.Drawing.Size(121, 23); - this.comboBoxTypePortholes.TabIndex = 9; - this.comboBoxTypePortholes.Text = "Квадратные"; - // - // comboBoxPortholes - // - this.comboBoxPortholes.FormattingEnabled = true; - this.comboBoxPortholes.Items.AddRange(new object[] { - "10", - "20", - "30"}); - this.comboBoxPortholes.Location = new System.Drawing.Point(195, 368); - this.comboBoxPortholes.Name = "comboBoxPortholes"; - this.comboBoxPortholes.Size = new System.Drawing.Size(44, 23); - this.comboBoxPortholes.TabIndex = 11; - this.comboBoxPortholes.Text = "10"; - // - // labelPortholes - // - this.labelPortholes.AutoSize = true; - this.labelPortholes.Location = new System.Drawing.Point(12, 371); - this.labelPortholes.Name = "labelPortholes"; - this.labelPortholes.Size = new System.Drawing.Size(177, 15); - this.labelPortholes.TabIndex = 10; - this.labelPortholes.Text = "Колличество иллюминаторов:"; - // - // FormMap - // - 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.comboBoxPortholes); - this.Controls.Add(this.labelPortholes); - this.Controls.Add(this.comboBoxTypePortholes); - this.Controls.Add(this.comboBoxSelectorMap); - this.Controls.Add(this.buttonCreateModif); - this.Controls.Add(this.buttonRight); - this.Controls.Add(this.buttonDown); - this.Controls.Add(this.buttonLeft); - this.Controls.Add(this.buttonUp); - this.Controls.Add(this.buttonCreate); - this.Controls.Add(this.pictureBoxAirplane); - this.Controls.Add(this.statusStrip1); - this.Name = "FormMap"; - this.Text = "FormMap"; - this.statusStrip1.ResumeLayout(false); - this.statusStrip1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxAirplane)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - private StatusStrip statusStrip1; - private ToolStripStatusLabel toolStripStatusLabelSpeed; - private ToolStripStatusLabel toolStripStatusLabelWeight; - private ToolStripStatusLabel toolStripStatusLabelBodyColor; - private PictureBox pictureBoxAirplane; - private Button buttonCreate; - private Button buttonUp; - private Button buttonLeft; - private Button buttonDown; - private Button buttonRight; - private Button buttonCreateModif; - private ComboBox comboBoxSelectorMap; - private ComboBox comboBoxTypePortholes; - private ComboBox comboBoxPortholes; - private Label labelPortholes; - } -} \ No newline at end of file diff --git a/AirplaneWithRadar/AirplaneWithRadar/FormMap.cs b/AirplaneWithRadar/AirplaneWithRadar/FormMap.cs deleted file mode 100644 index feac0e4..0000000 --- a/AirplaneWithRadar/AirplaneWithRadar/FormMap.cs +++ /dev/null @@ -1,127 +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 System.Xml.Serialization; - -namespace AirplaneWithRadar -{ - public partial class FormMap : Form - { - private AbstractMap _abstractMap; - public FormMap() - { - InitializeComponent(); - _abstractMap = new SimpleMap(); - } - /// - /// Заполнение информации по объекту - /// - /// - private void SetData(DrawningAirplane airplane) - { - toolStripStatusLabelSpeed.Text = $"Скорость: {airplane.Airplane.Speed}"; - toolStripStatusLabelWeight.Text = $"Вес: {airplane.Airplane.Weight}"; - toolStripStatusLabelBodyColor.Text = $"Цвет: {airplane.Airplane.BodyColor.Name}"; - pictureBoxAirplane.Image = _abstractMap.CreateMap(pictureBoxAirplane.Width, pictureBoxAirplane.Height, new DrawningObjectAirplane(airplane)); - } - - /// - /// Обработка нажатия кнопки "Создать" - /// - /// - /// - /// - private void ButtonCreate_Click(object sender, EventArgs e) - { - IAirplanePortholes typeAirplanePortholes = new DrawningAirplanePortholes(); - switch (comboBoxTypePortholes.Text) - { - case "Треугольные": - typeAirplanePortholes = new DrawningDeltaPortholes(); - break; - case "Ромбовидные": - typeAirplanePortholes = new DrawningRhombusPortholes(); - break; - } - Random rnd = new(); - var airplane = new DrawningAirplane(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)), typeAirplanePortholes); - airplane.DrawningPortholes.CountPortholes = Convert.ToInt32(comboBoxPortholes.Text); - SetData(airplane); - } - - /// - /// Изменение размеров формы - /// - /// - /// - private void ButtonMove_Click(object sender, EventArgs e) - { - //получаем имя кнопки - string name = ((Button)sender)?.Name ?? string.Empty; - Direction dir = Direction.None; - switch (name) - { - case "buttonUp": - dir = Direction.Up; - break; - case "buttonDown": - dir = Direction.Down; - break; - case "buttonLeft": - dir = Direction.Left; - break; - case "buttonRight": - dir = Direction.Right; - break; - } - pictureBoxAirplane.Image = _abstractMap?.MoveObject(dir); - } - - /// - /// Обработка нажатия кнопки "Модификация" - /// - /// - /// - private void ButtonCreateModif_Click(object sender, EventArgs e) - { - IAirplanePortholes typeAirplanePortholes = new DrawningAirplanePortholes(); - switch (comboBoxTypePortholes.Text) - { - case "Треугольные": - typeAirplanePortholes = new DrawningDeltaPortholes(); - break; - case "Ромбовидные": - typeAirplanePortholes = new DrawningRhombusPortholes(); - break; - } - Random rnd = new(); - var airplane = new DrawningAirplaneWithRadar(rnd.Next(100, 300), rnd.Next(1000, 2000), - Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)), - Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)), - Convert.ToBoolean(rnd.Next(0, 2)), - Convert.ToBoolean(rnd.Next(0, 2)), - typeAirplanePortholes); - airplane.DrawningPortholes.CountPortholes = Convert.ToInt32(comboBoxPortholes.Text); - SetData(airplane); - } - - private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e) - { - switch (comboBoxSelectorMap.Text) - { - case "Простая карта": - _abstractMap = new SimpleMap(); - break; - case "Моя карта": - _abstractMap = new MyMap(); - break; - } - } - } -} diff --git a/AirplaneWithRadar/AirplaneWithRadar/FormMap.resx b/AirplaneWithRadar/AirplaneWithRadar/FormMap.resx deleted file mode 100644 index 5cb320f..0000000 --- a/AirplaneWithRadar/AirplaneWithRadar/FormMap.resx +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - 17, 17 - - \ No newline at end of file diff --git a/AirplaneWithRadar/AirplaneWithRadar/FormMapWithSetAirplanes.cs b/AirplaneWithRadar/AirplaneWithRadar/FormMapWithSetAirplanes.cs index 3935aeb..502e130 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/FormMapWithSetAirplanes.cs +++ b/AirplaneWithRadar/AirplaneWithRadar/FormMapWithSetAirplanes.cs @@ -115,8 +115,8 @@ namespace AirplaneWithRadar /// private void ButtonAddTypeOfPortholes_Click(object sender, EventArgs e) { - IAirplanePortholes? typeAirplanePortholes = null; - switch (comboTypePotholes.Text) + IAirplanePortholes typeAirplanePortholes = new DrawningAirplanePortholes(); + switch (comboTypePortholes.Text) { case "Треугольные": typeAirplanePortholes = new DrawningDeltaPortholes(); @@ -124,9 +124,6 @@ namespace AirplaneWithRadar case "Ромбовидные": typeAirplanePortholes = new DrawningRhombusPortholes(); break; - default: - typeAirplanePortholes = new DrawningAirplanePortholes(); - break; } typeAirplanePortholes.CountPortholes = Convert.ToInt32(comboBoxPortholes.Text); _generatorAirplane.AddTypeOfPortholes(typeAirplanePortholes);