From 3d89eca38e22b95688b2caf445003b89becd6e6b Mon Sep 17 00:00:00 2001 From: devil_1nc Date: Tue, 22 Nov 2022 13:43:16 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BD=D0=B0=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D1=8B=D0=B5=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Airbus/FormMapWithSetPlanes.Designer.cs | 106 +++++++++--------- Airbus/Airbus/FormMapWithSetPlanes.cs | 9 +- Airbus/Airbus/MapWithSetPlanesGeneric.cs | 39 ++++--- 3 files changed, 82 insertions(+), 72 deletions(-) diff --git a/Airbus/Airbus/FormMapWithSetPlanes.Designer.cs b/Airbus/Airbus/FormMapWithSetPlanes.Designer.cs index 50af687..d88d944 100644 --- a/Airbus/Airbus/FormMapWithSetPlanes.Designer.cs +++ b/Airbus/Airbus/FormMapWithSetPlanes.Designer.cs @@ -29,7 +29,6 @@ private void InitializeComponent() { this.groupBoxTools = new System.Windows.Forms.GroupBox(); - this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox(); this.maskedTextBoxPosition = new System.Windows.Forms.TextBox(); this.buttonAddPlane = new System.Windows.Forms.Button(); this.buttonRemovePlane = new System.Windows.Forms.Button(); @@ -39,15 +38,16 @@ this.buttonDown = new System.Windows.Forms.Button(); this.buttonRight = new System.Windows.Forms.Button(); this.buttonUp = new System.Windows.Forms.Button(); - this.pictureBox = new System.Windows.Forms.PictureBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.textBoxNewMapName = new System.Windows.Forms.TextBox(); - this.buttonDeleteMap = new System.Windows.Forms.Button(); - this.buttonAddMap = new System.Windows.Forms.Button(); this.listBoxMaps = new System.Windows.Forms.ListBox(); + this.buttonAddMap = new System.Windows.Forms.Button(); + this.buttonDeleteMap = new System.Windows.Forms.Button(); + this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox(); + this.textBoxNewMapName = new System.Windows.Forms.TextBox(); + this.pictureBox = new System.Windows.Forms.PictureBox(); this.groupBoxTools.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); this.SuspendLayout(); // // groupBoxTools @@ -70,21 +70,6 @@ this.groupBoxTools.TabStop = false; this.groupBoxTools.Text = "Инструменты"; // - // comboBoxSelectorMap - // - this.comboBoxSelectorMap.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBoxSelectorMap.FormattingEnabled = true; - this.comboBoxSelectorMap.Items.AddRange(new object[] { - "Простая карта", - "Пустыня", - "Космос"}); - this.comboBoxSelectorMap.Location = new System.Drawing.Point(15, 50); - this.comboBoxSelectorMap.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.comboBoxSelectorMap.Name = "comboBoxSelectorMap"; - this.comboBoxSelectorMap.Size = new System.Drawing.Size(167, 23); - this.comboBoxSelectorMap.TabIndex = 9; - this.comboBoxSelectorMap.Click += new System.EventHandler(this.ComboBoxSelectorMap_SelectedIndexChanged); - // // maskedTextBoxPosition // this.maskedTextBoxPosition.Location = new System.Drawing.Point(21, 290); @@ -176,15 +161,6 @@ this.buttonUp.UseVisualStyleBackColor = true; this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click); // - // pictureBox - // - this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBox.Location = new System.Drawing.Point(0, 0); - this.pictureBox.Name = "pictureBox"; - this.pictureBox.Size = new System.Drawing.Size(627, 534); - this.pictureBox.TabIndex = 1; - this.pictureBox.TabStop = false; - // // groupBox1 // this.groupBox1.Controls.Add(this.listBoxMaps); @@ -199,21 +175,15 @@ this.groupBox1.TabStop = false; this.groupBox1.Text = "Карты"; // - // textBoxNewMapName + // listBoxMaps // - this.textBoxNewMapName.Location = new System.Drawing.Point(15, 22); - this.textBoxNewMapName.Name = "textBoxNewMapName"; - this.textBoxNewMapName.Size = new System.Drawing.Size(167, 23); - this.textBoxNewMapName.TabIndex = 11; - // - // buttonDeleteMap - // - this.buttonDeleteMap.Location = new System.Drawing.Point(15, 191); - this.buttonDeleteMap.Name = "buttonDeleteMap"; - this.buttonDeleteMap.Size = new System.Drawing.Size(167, 23); - this.buttonDeleteMap.TabIndex = 12; - this.buttonDeleteMap.Text = "Удалить карту"; - this.buttonDeleteMap.UseVisualStyleBackColor = true; + this.listBoxMaps.FormattingEnabled = true; + this.listBoxMaps.ItemHeight = 15; + this.listBoxMaps.Location = new System.Drawing.Point(15, 107); + this.listBoxMaps.Name = "listBoxMaps"; + this.listBoxMaps.Size = new System.Drawing.Size(167, 79); + this.listBoxMaps.TabIndex = 14; + this.listBoxMaps.SelectedIndexChanged += new System.EventHandler(this.ListBoxMaps_SelectedIndexChanged); // // buttonAddMap // @@ -223,15 +193,47 @@ this.buttonAddMap.TabIndex = 13; this.buttonAddMap.Text = "Добавить карту"; this.buttonAddMap.UseVisualStyleBackColor = true; + this.buttonAddMap.Click += new System.EventHandler(this.ButtonAddMap_Click_1); // - // listBoxMaps + // buttonDeleteMap // - this.listBoxMaps.FormattingEnabled = true; - this.listBoxMaps.ItemHeight = 15; - this.listBoxMaps.Location = new System.Drawing.Point(15, 107); - this.listBoxMaps.Name = "listBoxMaps"; - this.listBoxMaps.Size = new System.Drawing.Size(167, 79); - this.listBoxMaps.TabIndex = 14; + this.buttonDeleteMap.Location = new System.Drawing.Point(15, 191); + this.buttonDeleteMap.Name = "buttonDeleteMap"; + this.buttonDeleteMap.Size = new System.Drawing.Size(167, 23); + this.buttonDeleteMap.TabIndex = 12; + this.buttonDeleteMap.Text = "Удалить карту"; + this.buttonDeleteMap.UseVisualStyleBackColor = true; + this.buttonDeleteMap.Click += new System.EventHandler(this.buttonDeleteMap_Click); + // + // comboBoxSelectorMap + // + this.comboBoxSelectorMap.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxSelectorMap.FormattingEnabled = true; + this.comboBoxSelectorMap.Items.AddRange(new object[] { + "Простая карта", + "Пустыня", + "Космос"}); + this.comboBoxSelectorMap.Location = new System.Drawing.Point(15, 50); + this.comboBoxSelectorMap.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.comboBoxSelectorMap.Name = "comboBoxSelectorMap"; + this.comboBoxSelectorMap.Size = new System.Drawing.Size(167, 23); + this.comboBoxSelectorMap.TabIndex = 9; + // + // textBoxNewMapName + // + this.textBoxNewMapName.Location = new System.Drawing.Point(15, 22); + this.textBoxNewMapName.Name = "textBoxNewMapName"; + this.textBoxNewMapName.Size = new System.Drawing.Size(167, 23); + this.textBoxNewMapName.TabIndex = 11; + // + // pictureBox + // + this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.pictureBox.Location = new System.Drawing.Point(0, 0); + this.pictureBox.Name = "pictureBox"; + this.pictureBox.Size = new System.Drawing.Size(627, 534); + this.pictureBox.TabIndex = 1; + this.pictureBox.TabStop = false; // // FormMapWithSetPlanes // @@ -244,9 +246,9 @@ this.Text = "FormMapWithSetPlanes"; this.groupBoxTools.ResumeLayout(false); this.groupBoxTools.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); this.ResumeLayout(false); } diff --git a/Airbus/Airbus/FormMapWithSetPlanes.cs b/Airbus/Airbus/FormMapWithSetPlanes.cs index e1c8a63..54685c9 100644 --- a/Airbus/Airbus/FormMapWithSetPlanes.cs +++ b/Airbus/Airbus/FormMapWithSetPlanes.cs @@ -26,13 +26,13 @@ namespace Airbus public FormMapWithSetPlanes() { + InitializeComponent(); _mapsCollection = new MapsCollection(pictureBox.Width, pictureBox.Height); comboBoxSelectorMap.Items.Clear(); foreach (var element in _mapsDict) { comboBoxSelectorMap.Items.Add(element.Key); - } - InitializeComponent(); + } } //заполнение ListBoxMaps @@ -40,8 +40,12 @@ namespace Airbus { int index = listBoxMaps.SelectedIndex; + listBoxMaps.Items.Clear(); + for (int i = 0; i < _mapsCollection.Keys.Count; i++) + { listBoxMaps.Items.Add(_mapsCollection.Keys[i]); + } if (listBoxMaps.Items.Count > 0 && (index == -1 || index >= listBoxMaps.Items.Count)) { @@ -50,7 +54,6 @@ namespace Airbus else if (listBoxMaps.Items.Count > 0 && index > -1 && index < listBoxMaps.Items.Count) { listBoxMaps.SelectedIndex = index; - } } //добавление карты diff --git a/Airbus/Airbus/MapWithSetPlanesGeneric.cs b/Airbus/Airbus/MapWithSetPlanesGeneric.cs index 6756aab..50f1dbd 100644 --- a/Airbus/Airbus/MapWithSetPlanesGeneric.cs +++ b/Airbus/Airbus/MapWithSetPlanesGeneric.cs @@ -131,29 +131,31 @@ namespace Airbus //линия разметки места for (int j = 2; j < _pictureHeight / _placeSizeHeight + 1; ++j) { - g.DrawLine(pen, i * _placeSizeWidth - 20, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2 + 5, j * _placeSizeHeight); + g.DrawLine(pen, i * _placeSizeWidth +5, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2 + 5, j * _placeSizeHeight); + g.DrawLine(pen, i * _placeSizeWidth +400, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2 + 5, j * _placeSizeHeight); } - g.DrawLine(pen, i * _placeSizeWidth - 20, _placeSizeHeight * 2, i * _placeSizeWidth - 20, (_pictureHeight / _placeSizeHeight) * _placeSizeHeight); + g.DrawLine(pen, i * _placeSizeWidth +200, _placeSizeHeight *2, i * _placeSizeWidth +200, (_pictureHeight / _placeSizeHeight) * _placeSizeHeight+100); + g.DrawLine(pen, i * _placeSizeWidth +5, _placeSizeHeight *2, i * _placeSizeWidth+5, (_pictureHeight / _placeSizeHeight) * _placeSizeHeight+100); } - //отрисовка разметки взлётной полосы - g.FillRectangle(marcupBrush, _placeSizeWidth * 3 + 10, 0, 185, _pictureHeight); - g.FillRectangle(asphaltBrush, _placeSizeWidth * 3 + 15, 0, 175, _pictureHeight); - g.DrawLine(marcupPen, _placeSizeWidth * 3 + 190, 0, _placeSizeWidth * 3 + 190, _pictureHeight); - g.DrawLine(marcupPen, _placeSizeWidth * 3 + 15, 0, _placeSizeWidth * 3 + 15, _pictureHeight); - g.DrawLine(marcupPen, _placeSizeWidth * 3 + 195, 0, _placeSizeWidth * 3 + 195, _pictureHeight); - g.DrawLine(marcupPen, _placeSizeWidth * 3 + 10, 0, _placeSizeWidth * 3 + 10, _pictureHeight); + //отрисовка разметки взлётной полосы + g.FillRectangle(marcupBrush, _placeSizeWidth * 2 + 30, 0, 185, _pictureHeight); + g.FillRectangle(asphaltBrush, _placeSizeWidth * 2 + 35, 0, 175, _pictureHeight); + g.DrawLine(marcupPen, _placeSizeWidth * 2 + 210, 0, _placeSizeWidth * 2 + 210, _pictureHeight); + g.DrawLine(marcupPen, _placeSizeWidth * 2 + 35, 0, _placeSizeWidth * 2 + 35, _pictureHeight); + g.DrawLine(marcupPen, _placeSizeWidth * 2 + 215, 0, _placeSizeWidth * 2 + 215, _pictureHeight); + g.DrawLine(marcupPen, _placeSizeWidth * 2 + 30, 0, _placeSizeWidth * 2 + 30, _pictureHeight); for (int i = 0; i < _pictureHeight / _placeSizeHeight; ++i) { - g.DrawLine(marcupPen, _placeSizeWidth * 3 + 105, 20 + i * _placeSizeHeight, _placeSizeWidth * 3 + 105, (i + 1) * _placeSizeHeight - 20); + g.DrawLine(marcupPen, _placeSizeWidth * 2 + 125, 20 + i * _placeSizeHeight, _placeSizeWidth * 2 + 125, (i + 1) * _placeSizeHeight - 20); } for (int i = 0; i < _pictureHeight / 20; i++) { - g.DrawLine(signalFirePen, _placeSizeWidth * 3 - 5, 20 + i * _placeSizeHeight / 2, _placeSizeWidth * 3 - 5, (i + 1) * _placeSizeHeight / 2 - 20); - g.DrawLine(signalFirePen, _placeSizeWidth * 4, 20 + i * _placeSizeHeight / 2, _placeSizeWidth * 4, (i + 1) * _placeSizeHeight / 2 - 20); + g.DrawLine(signalFirePen, _placeSizeWidth * 2 + 15, 20 + i * _placeSizeHeight / 2, _placeSizeWidth * 2 + 15, (i + 1) * _placeSizeHeight / 2 - 20); + g.DrawLine(signalFirePen, _placeSizeWidth * 3+20, 20 + i * _placeSizeHeight / 2, _placeSizeWidth * 3+20, (i + 1) * _placeSizeHeight / 2 - 20); } //отрисовка сочков @@ -182,20 +184,23 @@ namespace Airbus int width = _pictureWidth / _placeSizeWidth; int height = _pictureHeight / _placeSizeHeight; - int currentWidth = 2; - int currentHeight = 7; + int position = 0; + int currentWidth = 1; + int currentHeight = 5; foreach (var plane in _setPlanes.GetAirbus()) { plane.SetObject(currentWidth * _placeSizeWidth + 20, currentHeight * _placeSizeHeight + 20, _pictureWidth, _pictureHeight); plane.DrawningObject(g); - if (currentWidth!= 0) - { + if (position % 2 == 0) + { + position++; currentWidth--; } else { - currentWidth = 2; + position = 0; + currentWidth = 1; currentHeight--; } }