Final
This commit is contained in:
parent
303d404cbf
commit
38e6f2c469
@ -29,6 +29,12 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.groupBoxSettings = new System.Windows.Forms.GroupBox();
|
this.groupBoxSettings = new System.Windows.Forms.GroupBox();
|
||||||
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.listBoxMaps = new System.Windows.Forms.ListBox();
|
||||||
|
this.ButtonDeleteMap = new System.Windows.Forms.Button();
|
||||||
|
this.ButtonAddMap = new System.Windows.Forms.Button();
|
||||||
|
this.textBoxNewMapName = new System.Windows.Forms.TextBox();
|
||||||
|
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
|
||||||
this.buttonRight = new System.Windows.Forms.Button();
|
this.buttonRight = new System.Windows.Forms.Button();
|
||||||
this.buttonDown = new System.Windows.Forms.Button();
|
this.buttonDown = new System.Windows.Forms.Button();
|
||||||
this.buttonLeft = new System.Windows.Forms.Button();
|
this.buttonLeft = new System.Windows.Forms.Button();
|
||||||
@ -38,14 +44,15 @@
|
|||||||
this.buttonDeleteBus = new System.Windows.Forms.Button();
|
this.buttonDeleteBus = new System.Windows.Forms.Button();
|
||||||
this.maskedTextBoxPosition = new System.Windows.Forms.MaskedTextBox();
|
this.maskedTextBoxPosition = new System.Windows.Forms.MaskedTextBox();
|
||||||
this.buttonAddBus = new System.Windows.Forms.Button();
|
this.buttonAddBus = new System.Windows.Forms.Button();
|
||||||
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
|
|
||||||
this.pictureBox = new System.Windows.Forms.PictureBox();
|
this.pictureBox = new System.Windows.Forms.PictureBox();
|
||||||
this.groupBoxSettings.SuspendLayout();
|
this.groupBoxSettings.SuspendLayout();
|
||||||
|
this.groupBox1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// groupBoxSettings
|
// groupBoxSettings
|
||||||
//
|
//
|
||||||
|
this.groupBoxSettings.Controls.Add(this.groupBox1);
|
||||||
this.groupBoxSettings.Controls.Add(this.buttonRight);
|
this.groupBoxSettings.Controls.Add(this.buttonRight);
|
||||||
this.groupBoxSettings.Controls.Add(this.buttonDown);
|
this.groupBoxSettings.Controls.Add(this.buttonDown);
|
||||||
this.groupBoxSettings.Controls.Add(this.buttonLeft);
|
this.groupBoxSettings.Controls.Add(this.buttonLeft);
|
||||||
@ -55,21 +62,79 @@
|
|||||||
this.groupBoxSettings.Controls.Add(this.buttonDeleteBus);
|
this.groupBoxSettings.Controls.Add(this.buttonDeleteBus);
|
||||||
this.groupBoxSettings.Controls.Add(this.maskedTextBoxPosition);
|
this.groupBoxSettings.Controls.Add(this.maskedTextBoxPosition);
|
||||||
this.groupBoxSettings.Controls.Add(this.buttonAddBus);
|
this.groupBoxSettings.Controls.Add(this.buttonAddBus);
|
||||||
this.groupBoxSettings.Controls.Add(this.comboBoxSelectorMap);
|
|
||||||
this.groupBoxSettings.Dock = System.Windows.Forms.DockStyle.Right;
|
this.groupBoxSettings.Dock = System.Windows.Forms.DockStyle.Right;
|
||||||
this.groupBoxSettings.Location = new System.Drawing.Point(600, 0);
|
this.groupBoxSettings.Location = new System.Drawing.Point(645, 0);
|
||||||
this.groupBoxSettings.Name = "groupBoxSettings";
|
this.groupBoxSettings.Name = "groupBoxSettings";
|
||||||
this.groupBoxSettings.Size = new System.Drawing.Size(200, 450);
|
this.groupBoxSettings.Size = new System.Drawing.Size(200, 643);
|
||||||
this.groupBoxSettings.TabIndex = 0;
|
this.groupBoxSettings.TabIndex = 0;
|
||||||
this.groupBoxSettings.TabStop = false;
|
this.groupBoxSettings.TabStop = false;
|
||||||
this.groupBoxSettings.Text = "Инструменты";
|
this.groupBoxSettings.Text = "Инструменты";
|
||||||
//
|
//
|
||||||
|
// groupBox1
|
||||||
|
//
|
||||||
|
this.groupBox1.Controls.Add(this.listBoxMaps);
|
||||||
|
this.groupBox1.Controls.Add(this.ButtonDeleteMap);
|
||||||
|
this.groupBox1.Controls.Add(this.ButtonAddMap);
|
||||||
|
this.groupBox1.Controls.Add(this.textBoxNewMapName);
|
||||||
|
this.groupBox1.Controls.Add(this.comboBoxSelectorMap);
|
||||||
|
this.groupBox1.Location = new System.Drawing.Point(0, 22);
|
||||||
|
this.groupBox1.Name = "groupBox1";
|
||||||
|
this.groupBox1.Size = new System.Drawing.Size(200, 339);
|
||||||
|
this.groupBox1.TabIndex = 11;
|
||||||
|
this.groupBox1.TabStop = false;
|
||||||
|
this.groupBox1.Text = "Карты";
|
||||||
|
//
|
||||||
|
// listBoxMaps
|
||||||
|
//
|
||||||
|
this.listBoxMaps.FormattingEnabled = true;
|
||||||
|
this.listBoxMaps.ItemHeight = 15;
|
||||||
|
this.listBoxMaps.Location = new System.Drawing.Point(6, 150);
|
||||||
|
this.listBoxMaps.Name = "listBoxMaps";
|
||||||
|
this.listBoxMaps.Size = new System.Drawing.Size(188, 124);
|
||||||
|
this.listBoxMaps.TabIndex = 4;
|
||||||
|
this.listBoxMaps.SelectedIndexChanged += new System.EventHandler(this.listBoxMaps_SelectedIndexChanged);
|
||||||
|
//
|
||||||
|
// ButtonDeleteMap
|
||||||
|
//
|
||||||
|
this.ButtonDeleteMap.Location = new System.Drawing.Point(6, 280);
|
||||||
|
this.ButtonDeleteMap.Name = "ButtonDeleteMap";
|
||||||
|
this.ButtonDeleteMap.Size = new System.Drawing.Size(194, 53);
|
||||||
|
this.ButtonDeleteMap.TabIndex = 3;
|
||||||
|
this.ButtonDeleteMap.Text = "Удалить карту";
|
||||||
|
this.ButtonDeleteMap.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonDeleteMap.Click += new System.EventHandler(this.ButtonDeleteMap_Click);
|
||||||
|
//
|
||||||
|
// ButtonAddMap
|
||||||
|
//
|
||||||
|
this.ButtonAddMap.Location = new System.Drawing.Point(6, 84);
|
||||||
|
this.ButtonAddMap.Name = "ButtonAddMap";
|
||||||
|
this.ButtonAddMap.Size = new System.Drawing.Size(194, 53);
|
||||||
|
this.ButtonAddMap.TabIndex = 2;
|
||||||
|
this.ButtonAddMap.Text = "Добавить карту";
|
||||||
|
this.ButtonAddMap.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonAddMap.Click += new System.EventHandler(this.ButtonAddMap_Click);
|
||||||
|
//
|
||||||
|
// textBoxNewMapName
|
||||||
|
//
|
||||||
|
this.textBoxNewMapName.Location = new System.Drawing.Point(6, 22);
|
||||||
|
this.textBoxNewMapName.Name = "textBoxNewMapName";
|
||||||
|
this.textBoxNewMapName.Size = new System.Drawing.Size(188, 23);
|
||||||
|
this.textBoxNewMapName.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// comboBoxSelectorMap
|
||||||
|
//
|
||||||
|
this.comboBoxSelectorMap.FormattingEnabled = true;
|
||||||
|
this.comboBoxSelectorMap.Location = new System.Drawing.Point(6, 55);
|
||||||
|
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
|
||||||
|
this.comboBoxSelectorMap.Size = new System.Drawing.Size(188, 23);
|
||||||
|
this.comboBoxSelectorMap.TabIndex = 0;
|
||||||
|
//
|
||||||
// buttonRight
|
// buttonRight
|
||||||
//
|
//
|
||||||
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonRight.BackgroundImage = global::DoubleDeckerBus.Properties.Resources.RightArrow;
|
this.buttonRight.BackgroundImage = global::DoubleDeckerBus.Properties.Resources.RightArrow;
|
||||||
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonRight.Location = new System.Drawing.Point(109, 398);
|
this.buttonRight.Location = new System.Drawing.Point(109, 591);
|
||||||
this.buttonRight.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
this.buttonRight.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
this.buttonRight.Name = "buttonRight";
|
this.buttonRight.Name = "buttonRight";
|
||||||
this.buttonRight.Size = new System.Drawing.Size(26, 22);
|
this.buttonRight.Size = new System.Drawing.Size(26, 22);
|
||||||
@ -83,7 +148,7 @@
|
|||||||
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonDown.BackgroundImage = global::DoubleDeckerBus.Properties.Resources.DownArrow;
|
this.buttonDown.BackgroundImage = global::DoubleDeckerBus.Properties.Resources.DownArrow;
|
||||||
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonDown.Location = new System.Drawing.Point(86, 417);
|
this.buttonDown.Location = new System.Drawing.Point(86, 610);
|
||||||
this.buttonDown.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
this.buttonDown.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
this.buttonDown.Name = "buttonDown";
|
this.buttonDown.Name = "buttonDown";
|
||||||
this.buttonDown.Size = new System.Drawing.Size(26, 22);
|
this.buttonDown.Size = new System.Drawing.Size(26, 22);
|
||||||
@ -97,7 +162,7 @@
|
|||||||
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonLeft.BackgroundImage = global::DoubleDeckerBus.Properties.Resources.LeftArrow;
|
this.buttonLeft.BackgroundImage = global::DoubleDeckerBus.Properties.Resources.LeftArrow;
|
||||||
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonLeft.Location = new System.Drawing.Point(63, 398);
|
this.buttonLeft.Location = new System.Drawing.Point(63, 591);
|
||||||
this.buttonLeft.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
this.buttonLeft.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
this.buttonLeft.Name = "buttonLeft";
|
this.buttonLeft.Name = "buttonLeft";
|
||||||
this.buttonLeft.Size = new System.Drawing.Size(26, 22);
|
this.buttonLeft.Size = new System.Drawing.Size(26, 22);
|
||||||
@ -111,7 +176,7 @@
|
|||||||
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonUp.BackgroundImage = global::DoubleDeckerBus.Properties.Resources.UpArrow;
|
this.buttonUp.BackgroundImage = global::DoubleDeckerBus.Properties.Resources.UpArrow;
|
||||||
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonUp.Location = new System.Drawing.Point(85, 379);
|
this.buttonUp.Location = new System.Drawing.Point(85, 572);
|
||||||
this.buttonUp.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
this.buttonUp.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
this.buttonUp.Name = "buttonUp";
|
this.buttonUp.Name = "buttonUp";
|
||||||
this.buttonUp.Size = new System.Drawing.Size(26, 22);
|
this.buttonUp.Size = new System.Drawing.Size(26, 22);
|
||||||
@ -122,7 +187,7 @@
|
|||||||
//
|
//
|
||||||
// button1
|
// button1
|
||||||
//
|
//
|
||||||
this.button1.Location = new System.Drawing.Point(6, 320);
|
this.button1.Location = new System.Drawing.Point(6, 521);
|
||||||
this.button1.Name = "button1";
|
this.button1.Name = "button1";
|
||||||
this.button1.Size = new System.Drawing.Size(182, 35);
|
this.button1.Size = new System.Drawing.Size(182, 35);
|
||||||
this.button1.TabIndex = 5;
|
this.button1.TabIndex = 5;
|
||||||
@ -132,7 +197,7 @@
|
|||||||
//
|
//
|
||||||
// buttonShowStorage
|
// buttonShowStorage
|
||||||
//
|
//
|
||||||
this.buttonShowStorage.Location = new System.Drawing.Point(6, 261);
|
this.buttonShowStorage.Location = new System.Drawing.Point(6, 480);
|
||||||
this.buttonShowStorage.Name = "buttonShowStorage";
|
this.buttonShowStorage.Name = "buttonShowStorage";
|
||||||
this.buttonShowStorage.Size = new System.Drawing.Size(182, 35);
|
this.buttonShowStorage.Size = new System.Drawing.Size(182, 35);
|
||||||
this.buttonShowStorage.TabIndex = 4;
|
this.buttonShowStorage.TabIndex = 4;
|
||||||
@ -142,7 +207,7 @@
|
|||||||
//
|
//
|
||||||
// buttonDeleteBus
|
// buttonDeleteBus
|
||||||
//
|
//
|
||||||
this.buttonDeleteBus.Location = new System.Drawing.Point(6, 181);
|
this.buttonDeleteBus.Location = new System.Drawing.Point(6, 438);
|
||||||
this.buttonDeleteBus.Name = "buttonDeleteBus";
|
this.buttonDeleteBus.Name = "buttonDeleteBus";
|
||||||
this.buttonDeleteBus.Size = new System.Drawing.Size(188, 36);
|
this.buttonDeleteBus.Size = new System.Drawing.Size(188, 36);
|
||||||
this.buttonDeleteBus.TabIndex = 3;
|
this.buttonDeleteBus.TabIndex = 3;
|
||||||
@ -152,7 +217,7 @@
|
|||||||
//
|
//
|
||||||
// maskedTextBoxPosition
|
// maskedTextBoxPosition
|
||||||
//
|
//
|
||||||
this.maskedTextBoxPosition.Location = new System.Drawing.Point(6, 152);
|
this.maskedTextBoxPosition.Location = new System.Drawing.Point(6, 409);
|
||||||
this.maskedTextBoxPosition.Mask = "00";
|
this.maskedTextBoxPosition.Mask = "00";
|
||||||
this.maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
this.maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
||||||
this.maskedTextBoxPosition.Size = new System.Drawing.Size(188, 23);
|
this.maskedTextBoxPosition.Size = new System.Drawing.Size(188, 23);
|
||||||
@ -160,7 +225,7 @@
|
|||||||
//
|
//
|
||||||
// buttonAddBus
|
// buttonAddBus
|
||||||
//
|
//
|
||||||
this.buttonAddBus.Location = new System.Drawing.Point(6, 87);
|
this.buttonAddBus.Location = new System.Drawing.Point(6, 367);
|
||||||
this.buttonAddBus.Name = "buttonAddBus";
|
this.buttonAddBus.Name = "buttonAddBus";
|
||||||
this.buttonAddBus.Size = new System.Drawing.Size(188, 36);
|
this.buttonAddBus.Size = new System.Drawing.Size(188, 36);
|
||||||
this.buttonAddBus.TabIndex = 1;
|
this.buttonAddBus.TabIndex = 1;
|
||||||
@ -168,25 +233,12 @@
|
|||||||
this.buttonAddBus.UseVisualStyleBackColor = true;
|
this.buttonAddBus.UseVisualStyleBackColor = true;
|
||||||
this.buttonAddBus.Click += new System.EventHandler(this.ButtonAddBus_Click);
|
this.buttonAddBus.Click += new System.EventHandler(this.ButtonAddBus_Click);
|
||||||
//
|
//
|
||||||
// comboBoxSelectorMap
|
|
||||||
//
|
|
||||||
this.comboBoxSelectorMap.FormattingEnabled = true;
|
|
||||||
this.comboBoxSelectorMap.Items.AddRange(new object[] {
|
|
||||||
"Простая карта",
|
|
||||||
"Водная карта"});
|
|
||||||
this.comboBoxSelectorMap.Location = new System.Drawing.Point(6, 22);
|
|
||||||
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
|
|
||||||
this.comboBoxSelectorMap.Size = new System.Drawing.Size(188, 23);
|
|
||||||
this.comboBoxSelectorMap.TabIndex = 0;
|
|
||||||
this.comboBoxSelectorMap.Text = "Простая карта";
|
|
||||||
this.comboBoxSelectorMap.SelectedIndexChanged += new System.EventHandler(this.ComboBoxSelectorMap_SelectedIndexChanged);
|
|
||||||
//
|
|
||||||
// pictureBox
|
// pictureBox
|
||||||
//
|
//
|
||||||
this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.pictureBox.Location = new System.Drawing.Point(0, 0);
|
this.pictureBox.Location = new System.Drawing.Point(0, 0);
|
||||||
this.pictureBox.Name = "pictureBox";
|
this.pictureBox.Name = "pictureBox";
|
||||||
this.pictureBox.Size = new System.Drawing.Size(600, 450);
|
this.pictureBox.Size = new System.Drawing.Size(645, 643);
|
||||||
this.pictureBox.TabIndex = 1;
|
this.pictureBox.TabIndex = 1;
|
||||||
this.pictureBox.TabStop = false;
|
this.pictureBox.TabStop = false;
|
||||||
//
|
//
|
||||||
@ -194,13 +246,15 @@
|
|||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
this.ClientSize = new System.Drawing.Size(845, 643);
|
||||||
this.Controls.Add(this.pictureBox);
|
this.Controls.Add(this.pictureBox);
|
||||||
this.Controls.Add(this.groupBoxSettings);
|
this.Controls.Add(this.groupBoxSettings);
|
||||||
this.Name = "FormMapWithSetBuses";
|
this.Name = "FormMapWithSetBuses";
|
||||||
this.Text = "FormMapWithSetBuses";
|
this.Text = "Карты с набором объектов";
|
||||||
this.groupBoxSettings.ResumeLayout(false);
|
this.groupBoxSettings.ResumeLayout(false);
|
||||||
this.groupBoxSettings.PerformLayout();
|
this.groupBoxSettings.PerformLayout();
|
||||||
|
this.groupBox1.ResumeLayout(false);
|
||||||
|
this.groupBox1.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
@ -211,7 +265,6 @@
|
|||||||
private GroupBox groupBoxSettings;
|
private GroupBox groupBoxSettings;
|
||||||
private PictureBox pictureBox;
|
private PictureBox pictureBox;
|
||||||
private Button buttonAddBus;
|
private Button buttonAddBus;
|
||||||
private ComboBox comboBoxSelectorMap;
|
|
||||||
private Button buttonDeleteBus;
|
private Button buttonDeleteBus;
|
||||||
private MaskedTextBox maskedTextBoxPosition;
|
private MaskedTextBox maskedTextBoxPosition;
|
||||||
private Button buttonShowStorage;
|
private Button buttonShowStorage;
|
||||||
@ -220,5 +273,11 @@
|
|||||||
private Button buttonDown;
|
private Button buttonDown;
|
||||||
private Button buttonLeft;
|
private Button buttonLeft;
|
||||||
private Button buttonUp;
|
private Button buttonUp;
|
||||||
|
private GroupBox groupBox1;
|
||||||
|
private TextBox textBoxNewMapName;
|
||||||
|
private ComboBox comboBoxSelectorMap;
|
||||||
|
private Button ButtonDeleteMap;
|
||||||
|
private Button ButtonAddMap;
|
||||||
|
private ListBox listBoxMaps;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,42 +13,47 @@ namespace DoubleDeckerBus
|
|||||||
{
|
{
|
||||||
public partial class FormMapWithSetBuses : Form
|
public partial class FormMapWithSetBuses : Form
|
||||||
{
|
{
|
||||||
private MapWithSetBusesGeneric<DrawingObjectBus, AbstractMap> _mapBusesCollectionGeneric;
|
|
||||||
|
private readonly Dictionary<string, AbstractMap> _mapsDict = new Dictionary<string, AbstractMap>() {
|
||||||
|
{ "Простая карта", new SimpleMap() },
|
||||||
|
{ "Водная карта", new WaterMap() }
|
||||||
|
};
|
||||||
|
|
||||||
|
private readonly MapsCollection _mapsCollection;
|
||||||
|
|
||||||
public FormMapWithSetBuses()
|
public FormMapWithSetBuses()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
AbstractMap map = new SimpleMap();
|
_mapsCollection = new MapsCollection(pictureBox.Width, pictureBox.Height);
|
||||||
_mapBusesCollectionGeneric = new MapWithSetBusesGeneric<DrawingObjectBus, AbstractMap>(
|
comboBoxSelectorMap.Items.Clear();
|
||||||
pictureBox.Width, pictureBox.Height, map);
|
foreach (var item in _mapsDict) {
|
||||||
|
comboBoxSelectorMap.Items.Add(item.Key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e)
|
private void ReloadMaps()
|
||||||
{
|
{
|
||||||
AbstractMap map = null;
|
int index = listBoxMaps.SelectedIndex;
|
||||||
switch (comboBoxSelectorMap.Text)
|
|
||||||
|
listBoxMaps.Items.Clear();
|
||||||
|
for (int i = 0; i < _mapsCollection.Keys.Count; i++)
|
||||||
{
|
{
|
||||||
case "Простая карта":
|
listBoxMaps.Items.Add(_mapsCollection.Keys[i]);
|
||||||
map = new SimpleMap();
|
|
||||||
break;
|
|
||||||
case "Водная карта":
|
|
||||||
map = new WaterMap();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (map != null)
|
|
||||||
|
if (listBoxMaps.Items.Count > 0 && (index == -1 || index >= listBoxMaps.Items.Count))
|
||||||
{
|
{
|
||||||
_mapBusesCollectionGeneric = new MapWithSetBusesGeneric<DrawingObjectBus, AbstractMap>(
|
listBoxMaps.SelectedIndex = 0;
|
||||||
pictureBox.Width, pictureBox.Height, map);
|
|
||||||
}
|
}
|
||||||
else
|
else if (listBoxMaps.Items.Count > 0 && index > -1 && index < listBoxMaps.Items.Count)
|
||||||
{
|
{
|
||||||
_mapBusesCollectionGeneric = null;
|
listBoxMaps.SelectedIndex = index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonAddBus_Click(object sender, EventArgs e)
|
private void ButtonAddBus_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_mapBusesCollectionGeneric == null)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -63,10 +68,10 @@ namespace DoubleDeckerBus
|
|||||||
|
|
||||||
DrawingObjectBus bus = new(form.SelectedBus);
|
DrawingObjectBus bus = new(form.SelectedBus);
|
||||||
|
|
||||||
if (_mapBusesCollectionGeneric + bus != -1)
|
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + bus != -1)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект добавлен");
|
MessageBox.Show("Объект добавлен");
|
||||||
pictureBox.Image = _mapBusesCollectionGeneric.ShowSet();
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -86,10 +91,10 @@ namespace DoubleDeckerBus
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||||
if (_mapBusesCollectionGeneric - pos != null)
|
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] - pos != null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект удален");
|
MessageBox.Show("Объект удален");
|
||||||
pictureBox.Image = _mapBusesCollectionGeneric.ShowSet();
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -99,25 +104,25 @@ namespace DoubleDeckerBus
|
|||||||
|
|
||||||
private void ButtonShowStorage_Click(object sender, EventArgs e)
|
private void ButtonShowStorage_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_mapBusesCollectionGeneric == null)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pictureBox.Image = _mapBusesCollectionGeneric.ShowSet();
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonShowOnMap_Click(object sender, EventArgs e)
|
private void ButtonShowOnMap_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_mapBusesCollectionGeneric == null)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pictureBox.Image = _mapBusesCollectionGeneric.ShowOnMap();
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowOnMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonMove_Click(object sender, EventArgs e)
|
private void ButtonMove_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_mapBusesCollectionGeneric == null)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -139,7 +144,42 @@ namespace DoubleDeckerBus
|
|||||||
dir = Direction.Right;
|
dir = Direction.Right;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pictureBox.Image = _mapBusesCollectionGeneric.MoveObject(dir);
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].MoveObject(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonAddMap_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (comboBoxSelectorMap.SelectedIndex == -1 || string.IsNullOrEmpty(textBoxNewMapName.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!_mapsDict.ContainsKey(comboBoxSelectorMap.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Нет такой карты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_mapsCollection.AddMap(textBoxNewMapName.Text, _mapsDict[comboBoxSelectorMap.Text]);
|
||||||
|
ReloadMaps();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void listBoxMaps_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonDeleteMap_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MessageBox.Show($"Удалить карту {listBoxMaps.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
_mapsCollection.DelMap(listBoxMaps.SelectedItem?.ToString() ?? string.Empty);
|
||||||
|
ReloadMaps();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,14 +50,10 @@ namespace DoubleDeckerBus
|
|||||||
public Bitmap ShowOnMap()
|
public Bitmap ShowOnMap()
|
||||||
{
|
{
|
||||||
Shaking();
|
Shaking();
|
||||||
for (int i = 0; i < _setBuses.Count; i++)
|
foreach (var bus in _setBuses.GetBuses())
|
||||||
{
|
|
||||||
var bus = _setBuses.Get(i);
|
|
||||||
if (bus != null)
|
|
||||||
{
|
{
|
||||||
return _map.CreateMap(_pictureWidth, _pictureHeight, bus);
|
return _map.CreateMap(_pictureWidth, _pictureHeight, bus);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return new(_pictureWidth, _pictureHeight);
|
return new(_pictureWidth, _pictureHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,11 +71,11 @@ namespace DoubleDeckerBus
|
|||||||
int j = _setBuses.Count - 1;
|
int j = _setBuses.Count - 1;
|
||||||
for (int i = 0; i < _setBuses.Count; i++)
|
for (int i = 0; i < _setBuses.Count; i++)
|
||||||
{
|
{
|
||||||
if (_setBuses.Get(i) == null)
|
if (_setBuses[i] == null)
|
||||||
{
|
{
|
||||||
for (; j > i; j--)
|
for (; j > i; j--)
|
||||||
{
|
{
|
||||||
var bus = _setBuses.Get(j);
|
var bus = _setBuses[j];
|
||||||
if (bus != null)
|
if (bus != null)
|
||||||
{
|
{
|
||||||
_setBuses.Insert(bus, i);
|
_setBuses.Insert(bus, i);
|
||||||
@ -126,12 +122,13 @@ namespace DoubleDeckerBus
|
|||||||
int currentWidth = width - 1;
|
int currentWidth = width - 1;
|
||||||
int currentHeight = 0;
|
int currentHeight = 0;
|
||||||
|
|
||||||
for (int i = 0; i < _setBuses.Count; i++) {
|
foreach (var bus in _setBuses.GetBuses())
|
||||||
|
{
|
||||||
|
|
||||||
_setBuses.Get(i)?.SetObject(currentWidth * _placeSizeWidth,
|
bus?.SetObject(currentWidth * _placeSizeWidth,
|
||||||
currentHeight * _placeSizeHeight,
|
currentHeight * _placeSizeHeight,
|
||||||
_pictureWidth, _pictureHeight);
|
_pictureWidth, _pictureHeight);
|
||||||
_setBuses.Get(i)?.DrawingObject(g);
|
bus?.DrawingObject(g);
|
||||||
|
|
||||||
if (currentWidth > 0)
|
if (currentWidth > 0)
|
||||||
currentWidth--;
|
currentWidth--;
|
||||||
|
43
DoubleDeckerBus/DoubleDeckerBus/MapsCollection.cs
Normal file
43
DoubleDeckerBus/DoubleDeckerBus/MapsCollection.cs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
using DoubleDeckerBus;
|
||||||
|
|
||||||
|
namespace DoubleDeckerBus
|
||||||
|
{
|
||||||
|
internal class MapsCollection
|
||||||
|
{
|
||||||
|
|
||||||
|
readonly Dictionary<string, MapWithSetBusesGeneric<DrawingObjectBus, AbstractMap>> _mapStorages;
|
||||||
|
|
||||||
|
public List<string> Keys => _mapStorages.Keys.ToList();
|
||||||
|
|
||||||
|
private readonly int _pictureWidth;
|
||||||
|
|
||||||
|
private readonly int _pictureHeight;
|
||||||
|
|
||||||
|
public MapsCollection(int pictureWidth, int pictureHeight)
|
||||||
|
{
|
||||||
|
_mapStorages = new Dictionary<string, MapWithSetBusesGeneric<DrawingObjectBus, AbstractMap>>();
|
||||||
|
_pictureWidth = pictureWidth;
|
||||||
|
_pictureHeight = pictureHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddMap(string name, AbstractMap map)
|
||||||
|
{
|
||||||
|
if (Keys.Contains(name)) return;
|
||||||
|
_mapStorages.Add(name, new MapWithSetBusesGeneric<DrawingObjectBus, AbstractMap>(_pictureWidth, _pictureHeight, map));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DelMap(string name)
|
||||||
|
{
|
||||||
|
_mapStorages.Remove(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MapWithSetBusesGeneric<DrawingObjectBus, AbstractMap> this[string ind]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
_mapStorages.TryGetValue(ind, out var result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,14 +9,17 @@ namespace DoubleDeckerBus
|
|||||||
internal class SetBusesGeneric<T>
|
internal class SetBusesGeneric<T>
|
||||||
where T : class
|
where T : class
|
||||||
{
|
{
|
||||||
private readonly T[] _places;
|
private readonly List<T> _places;
|
||||||
|
|
||||||
public int Count => _places.Length;
|
public int Count => _places.Count;
|
||||||
private int BusyPlaces = 0;
|
private int BusyPlaces = 0;
|
||||||
|
|
||||||
|
private readonly int _maxCount;
|
||||||
|
|
||||||
public SetBusesGeneric(int count)
|
public SetBusesGeneric(int count)
|
||||||
{
|
{
|
||||||
_places = new T[count];
|
_maxCount = count;
|
||||||
|
_places = new List<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Insert(T bus)
|
public int Insert(T bus)
|
||||||
@ -26,33 +29,44 @@ namespace DoubleDeckerBus
|
|||||||
|
|
||||||
public int Insert(T bus, int position)
|
public int Insert(T bus, int position)
|
||||||
{
|
{
|
||||||
if (position < 0 || position >= _places.Length || BusyPlaces == _places.Length) return -1;
|
if (position < 0 || position >= _maxCount || BusyPlaces == _maxCount) return -1;
|
||||||
|
|
||||||
BusyPlaces++;
|
BusyPlaces++;
|
||||||
while (_places[position] != null) {
|
_places.Insert(position, bus);
|
||||||
for (int i = _places.Length - 1; i > 0; --i) {
|
|
||||||
if (_places[i] == null && _places[i - 1] != null) {
|
|
||||||
_places[i] = _places[i - 1];
|
|
||||||
_places[i - 1] = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_places[position] = bus;
|
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T Remove(int position)
|
public T Remove(int position)
|
||||||
{
|
{
|
||||||
if (position < 0 || position >= _places.Length) return null;
|
if (position < 0 || position >= _maxCount) return null;
|
||||||
T savedBus = _places[position];
|
T savedBus = _places[position];
|
||||||
_places[position] = null;
|
_places.RemoveAt(position);
|
||||||
return savedBus;
|
return savedBus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T Get(int position)
|
public T this[int position] {
|
||||||
{
|
get {
|
||||||
if (position < 0 || position >= _places.Length) return null;
|
if (position < 0 || position >= _maxCount) return null;
|
||||||
return _places[position];
|
return _places[position];
|
||||||
}
|
}
|
||||||
|
set {
|
||||||
|
Insert(value, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<T> GetBuses() {
|
||||||
|
foreach (var bus in _places)
|
||||||
|
{
|
||||||
|
if (bus != null)
|
||||||
|
{
|
||||||
|
yield return bus;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user