Третья лабораторная работа
This commit is contained in:
parent
3e6dcd8f81
commit
00ab8a92f2
@ -35,7 +35,9 @@ namespace HoistingCrane
|
|||||||
|
|
||||||
private MapWithSetHoistingCraneGeneric<DrawingObjectHoistingCrane, AbstractMap> _mapHoistingCraneCollectionGeneric;
|
private MapWithSetHoistingCraneGeneric<DrawingObjectHoistingCrane, AbstractMap> _mapHoistingCraneCollectionGeneric;
|
||||||
|
|
||||||
|
public FormMapWithSetHoistingCrane()
|
||||||
{
|
{
|
||||||
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e)
|
private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
@ -43,6 +45,7 @@ namespace HoistingCrane
|
|||||||
AbstractMap map = null;
|
AbstractMap map = null;
|
||||||
switch (comboBoxSelectorMap.Text)
|
switch (comboBoxSelectorMap.Text)
|
||||||
{
|
{
|
||||||
|
case "Первая карта":
|
||||||
map = new SimpleMap();
|
map = new SimpleMap();
|
||||||
break;
|
break;
|
||||||
case "Вторая карта":
|
case "Вторая карта":
|
||||||
@ -86,25 +89,21 @@ namespace HoistingCrane
|
|||||||
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
_logger.LogInformation($"Переход на карту {listBoxMaps.SelectedItem?.ToString()}");
|
_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)
|
private void ButtonAddHoistingCrane_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_mapHoistingCraneCollectionGeneric == null)
|
if (_mapHoistingCraneCollectionGeneric == null)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
FormHoistingCrane form = new();
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
|
DrawingObjectHoistingCrane hoistingCrane = new(form.SelectedHoistingCrane);
|
||||||
|
if (_mapHoistingCraneCollectionGeneric + hoistingCrane == 1)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект добавлен");
|
MessageBox.Show("Объект добавлен");
|
||||||
|
pictureBox.Image = _mapHoistingCraneCollectionGeneric.ShowSet();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -112,6 +111,7 @@ namespace HoistingCrane
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonRemoveHoistingCrane_Click(object sender, EventArgs e)
|
private void ButtonRemoveHoistingCrane_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text))
|
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text))
|
||||||
@ -175,6 +175,7 @@ namespace HoistingCrane
|
|||||||
enums = Direction.Right;
|
enums = Direction.Right;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
pictureBox.Image = _mapHoistingCraneCollectionGeneric.MoveObject(enums);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pictureBox_Click(object sender, EventArgs e)
|
private void pictureBox_Click(object sender, EventArgs e)
|
||||||
|
@ -42,7 +42,7 @@ namespace HoistingCrane
|
|||||||
Bitmap bmp = new(_pictureWidth, _pictureWidth);
|
Bitmap bmp = new(_pictureWidth, _pictureWidth);
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
DrawBackground(gr);
|
DrawBackground(gr);
|
||||||
DrawHoistingCranes(gr);
|
DrawBulldozers(gr);
|
||||||
return bmp;
|
return bmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,6 +107,7 @@ namespace HoistingCrane
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DrawBulldozers(Graphics gr)
|
||||||
{
|
{
|
||||||
int heightEl = _pictureHeight / _placeSizeHeight;
|
int heightEl = _pictureHeight / _placeSizeHeight;
|
||||||
int widthEl = _pictureWidth / _placeSizeWidth;
|
int widthEl = _pictureWidth / _placeSizeWidth;
|
||||||
|
Loading…
Reference in New Issue
Block a user