Третья лабораторная работа

This commit is contained in:
10Г Егор Романов 2022-10-10 19:53:02 +03:00
parent 3e6dcd8f81
commit 00ab8a92f2
2 changed files with 14 additions and 12 deletions

View File

@ -35,7 +35,9 @@ namespace HoistingCrane
private MapWithSetHoistingCraneGeneric<DrawingObjectHoistingCrane, AbstractMap> _mapHoistingCraneCollectionGeneric;
public FormMapWithSetHoistingCrane()
{
InitializeComponent();
}
private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e)
@ -43,6 +45,7 @@ namespace HoistingCrane
AbstractMap map = null;
switch (comboBoxSelectorMap.Text)
{
case "Первая карта":
map = new SimpleMap();
break;
case "Вторая карта":
@ -86,25 +89,21 @@ namespace HoistingCrane
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
_logger.LogInformation($"Переход на карту {listBoxMaps.SelectedItem?.ToString()}");
}
/// <summary>
/// Удаление карты
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonDeleteMap_Click(object sender, EventArgs e)
{
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
private void ButtonAddHoistingCrane_Click(object sender, EventArgs e)
{
if (_mapHoistingCraneCollectionGeneric == null)
{
return;
}
FormHoistingCrane form = new();
if (form.ShowDialog() == DialogResult.OK)
{
DrawingObjectHoistingCrane hoistingCrane = new(form.SelectedHoistingCrane);
if (_mapHoistingCraneCollectionGeneric + hoistingCrane == 1)
{
MessageBox.Show("Объект добавлен");
pictureBox.Image = _mapHoistingCraneCollectionGeneric.ShowSet();
}
else
{
@ -112,6 +111,7 @@ namespace HoistingCrane
}
}
}
private void ButtonRemoveHoistingCrane_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text))
@ -175,6 +175,7 @@ namespace HoistingCrane
enums = Direction.Right;
break;
}
pictureBox.Image = _mapHoistingCraneCollectionGeneric.MoveObject(enums);
}
private void pictureBox_Click(object sender, EventArgs e)

View File

@ -42,7 +42,7 @@ namespace HoistingCrane
Bitmap bmp = new(_pictureWidth, _pictureWidth);
Graphics gr = Graphics.FromImage(bmp);
DrawBackground(gr);
DrawHoistingCranes(gr);
DrawBulldozers(gr);
return bmp;
}
@ -107,6 +107,7 @@ namespace HoistingCrane
}
}
private void DrawBulldozers(Graphics gr)
{
int heightEl = _pictureHeight / _placeSizeHeight;
int widthEl = _pictureWidth / _placeSizeWidth;