устранение замечаний преподавателя

This commit is contained in:
Мельников Игорь 2022-12-21 16:53:15 +04:00
parent 23a736f24f
commit eb06709f0a
5 changed files with 44 additions and 33 deletions

View File

@ -29,7 +29,6 @@
private void InitializeComponent()
{
this.groupBoxTools = new System.Windows.Forms.GroupBox();
this.buttonSaveSelectedMap = new System.Windows.Forms.Button();
this.buttonShowLastRemovedObject = new System.Windows.Forms.Button();
this.groupBoxMaps = new System.Windows.Forms.GroupBox();
this.buttonDeleteMap = new System.Windows.Forms.Button();
@ -51,9 +50,10 @@
this.FileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SaveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.LoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveSelectedMapToolstripmenu = new System.Windows.Forms.ToolStripMenuItem();
this.loadMapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
this.buttonLoadMap = new System.Windows.Forms.Button();
this.groupBoxTools.SuspendLayout();
this.groupBoxMaps.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotives)).BeginInit();
@ -62,8 +62,6 @@
//
// groupBoxTools
//
this.groupBoxTools.Controls.Add(this.buttonLoadMap);
this.groupBoxTools.Controls.Add(this.buttonSaveSelectedMap);
this.groupBoxTools.Controls.Add(this.buttonShowLastRemovedObject);
this.groupBoxTools.Controls.Add(this.groupBoxMaps);
this.groupBoxTools.Controls.Add(this.buttonUp);
@ -83,16 +81,6 @@
this.groupBoxTools.TabStop = false;
this.groupBoxTools.Text = "Инструменты";
//
// buttonSaveSelectedMap
//
this.buttonSaveSelectedMap.Location = new System.Drawing.Point(31, 588);
this.buttonSaveSelectedMap.Name = "buttonSaveSelectedMap";
this.buttonSaveSelectedMap.Size = new System.Drawing.Size(164, 38);
this.buttonSaveSelectedMap.TabIndex = 13;
this.buttonSaveSelectedMap.Text = "Сохранить выбранную карту";
this.buttonSaveSelectedMap.UseVisualStyleBackColor = true;
this.buttonSaveSelectedMap.Click += new System.EventHandler(this.ButtonSaveSelectedMap_Click);
//
// buttonShowLastRemovedObject
//
this.buttonShowLastRemovedObject.Location = new System.Drawing.Point(31, 517);
@ -287,7 +275,9 @@
//
this.FileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.SaveToolStripMenuItem,
this.LoadToolStripMenuItem});
this.LoadToolStripMenuItem,
this.saveSelectedMapToolstripmenu,
this.loadMapToolStripMenuItem});
this.FileToolStripMenuItem.Name = "FileToolStripMenuItem";
this.FileToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
this.FileToolStripMenuItem.Text = "Файл";
@ -295,17 +285,31 @@
// SaveToolStripMenuItem
//
this.SaveToolStripMenuItem.Name = "SaveToolStripMenuItem";
this.SaveToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
this.SaveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.SaveToolStripMenuItem.Text = "Сохранение";
this.SaveToolStripMenuItem.Click += new System.EventHandler(this.SaveToolStripMenuItem_Click);
//
// LoadToolStripMenuItem
//
this.LoadToolStripMenuItem.Name = "LoadToolStripMenuItem";
this.LoadToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
this.LoadToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.LoadToolStripMenuItem.Text = "Загрузка";
this.LoadToolStripMenuItem.Click += new System.EventHandler(this.LoadToolStripMenuItem_Click);
//
// saveSelectedMapToolstripmenu
//
this.saveSelectedMapToolstripmenu.Name = "saveSelectedMapToolstripmenu";
this.saveSelectedMapToolstripmenu.Size = new System.Drawing.Size(180, 22);
this.saveSelectedMapToolstripmenu.Text = "Сохранить карту";
this.saveSelectedMapToolstripmenu.Click += new System.EventHandler(this.SaveSelectedMapToolStripMenu_Click);
//
// loadMapToolStripMenuItem
//
this.loadMapToolStripMenuItem.Name = "loadMapToolStripMenuItem";
this.loadMapToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.loadMapToolStripMenuItem.Text = "Загрузить карту";
this.loadMapToolStripMenuItem.Click += new System.EventHandler(this.LoadMapToolStripMenu_Click);
//
// saveFileDialog
//
this.saveFileDialog.Filter = "txt file|*.txt";
@ -314,16 +318,6 @@
//
this.openFileDialog.Filter = "txt file|*.txt";
//
// buttonLoadMap
//
this.buttonLoadMap.Location = new System.Drawing.Point(31, 632);
this.buttonLoadMap.Name = "buttonLoadMap";
this.buttonLoadMap.Size = new System.Drawing.Size(164, 38);
this.buttonLoadMap.TabIndex = 14;
this.buttonLoadMap.Text = "Загрузить карту";
this.buttonLoadMap.UseVisualStyleBackColor = true;
this.buttonLoadMap.Click += new System.EventHandler(this.ButtonLoadMap_Click);
//
// FormMapWithSetLocomotives
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
@ -372,7 +366,7 @@
private ToolStripMenuItem LoadToolStripMenuItem;
private SaveFileDialog saveFileDialog;
private OpenFileDialog openFileDialog;
private Button buttonSaveSelectedMap;
private Button buttonLoadMap;
private ToolStripMenuItem saveSelectedMapToolstripmenu;
private ToolStripMenuItem loadMapToolStripMenuItem;
}
}

View File

@ -283,7 +283,7 @@
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonSaveSelectedMap_Click(object sender, EventArgs e)
private void SaveSelectedMapToolStripMenu_Click(object sender, EventArgs e)
{
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
@ -304,7 +304,7 @@
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonLoadMap_Click(object sender, EventArgs e)
private void LoadMapToolStripMenu_Click(object sender, EventArgs e)
{
if (openFileDialog.ShowDialog() == DialogResult.OK)
{

View File

@ -205,5 +205,12 @@
_setLocomotives.Insert(DrawningObjectLocomotive.Create(record) as T, 0);
}
}
/// <summary>
/// Очистка содержимого карты
/// </summary>
public void ClearObjectCollection()
{
_setLocomotives.ClearLocomotives();
}
}
}

View File

@ -99,9 +99,12 @@
}
if (_mapStorages.ContainsKey(mapName))
{
_mapStorages.Remove(mapName);
_mapStorages[mapName].ClearObjectCollection();
}
else
{
_mapStorages.Add(mapName, new MapWithSetLocomotivesGeneric<DrawningObjectLocomotive, AbstractMap>(_pictureWidth, _pictureHeight, newMap));
}
_mapStorages[mapName].LoadData(info[1].Split(separatorData, StringSplitOptions.RemoveEmptyEntries));
}
return true;

View File

@ -97,5 +97,12 @@
}
}
}
/// <summary>
/// Очистка списка объектов
/// </summary>
public void ClearLocomotives()
{
_places.Clear();
}
}
}