Финальные изменения.

This commit is contained in:
Programmist73 2022-10-19 22:13:36 +04:00
parent f95c155755
commit a4ff15a113
3 changed files with 13 additions and 37 deletions

View File

@ -127,12 +127,14 @@ namespace Airbus
Brush asphaltBrush = new SolidBrush(Color.DarkGray); Brush asphaltBrush = new SolidBrush(Color.DarkGray);
Brush marcupBrush = new SolidBrush(Color.White); Brush marcupBrush = new SolidBrush(Color.White);
g.FillRectangle(concreteBrush, 0, 0, _pictureWidth, _pictureHeight); //заливаем область в цвет бетона //заливаем область в цвет бетона
g.FillRectangle(concreteBrush, 0, 0, _pictureWidth, _pictureHeight);
for(int i = 0; i < _pictureWidth / _placeSizeWidth - 1; i++) for(int i = 0; i < _pictureWidth / _placeSizeWidth - 1; i++)
{ {
for(int j = 2; j < _pictureHeight / _placeSizeHeight + 1; ++j) //линия разметки места
{//линия разметки места 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 - 20, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2 + 5, j * _placeSizeHeight);
} }
@ -180,8 +182,6 @@ namespace Airbus
//метод прорисовки объеков //метод прорисовки объеков
public void DrawPlanes(Graphics g) public void DrawPlanes(Graphics g)
{ {
int position = 0;
int index = 0;
int currentWidth = 2; int currentWidth = 2;
int currentHeight = 7; int currentHeight = 7;
@ -189,17 +189,14 @@ namespace Airbus
{ {
plane.SetObject(currentWidth * _placeSizeWidth + 20, currentHeight * _placeSizeHeight + 20, _pictureWidth, _pictureHeight); plane.SetObject(currentWidth * _placeSizeWidth + 20, currentHeight * _placeSizeHeight + 20, _pictureWidth, _pictureHeight);
plane.DrawningObject(g); plane.DrawningObject(g);
index++;
if(position % 2 == 0) if(currentWidth != 0)
{ {
position++;
currentWidth--; currentWidth--;
} }
else else
{ {
position = 0; currentWidth = 2;
currentWidth = 1;
currentHeight--; currentHeight--;
} }
} }

View File

@ -32,31 +32,15 @@ namespace Airbus
//добавление карты //добавление карты
public void AddMap(string name, AbstractMap map) public void AddMap(string name, AbstractMap map)
{ {
if (Keys.Contains(name)) var NewElem = new MapWithSetPlanesGeneric<DrawningObjectPlane, AbstractMap>(
{ _pictureWidth, _pictureHeight, map);
MessageBox.Show("Такая карта уже есть"); _mapStorage.Add(name, NewElem);
return;
}
else
{
var NewElem = new MapWithSetPlanesGeneric<DrawningObjectPlane, AbstractMap>(
_pictureWidth, _pictureHeight, map);
_mapStorage.Add(name, NewElem);
}
} }
//удаление карты //удаление карты
public void DelMap(string name) public void DelMap(string name)
{ {
if (Keys.Contains(name)) _mapStorage.Remove(name);
{
_mapStorage.Remove(name);
}
else
{
MessageBox.Show("Такой карты нет");
return;
}
} }
//Доступ к аэродрому //Доступ к аэродрому
@ -64,13 +48,7 @@ namespace Airbus
{ {
get get
{ {
if (Keys.Contains(ind)) return _mapStorage[ind];
{
return _mapStorage[ind];
}
MessageBox.Show("Такой карты нет");
return null;
} }
} }
} }

View File

@ -83,6 +83,7 @@ namespace Airbus
return _places[position]; return _places[position];
} }
set set
{ {
if (position < _maxCount && position >= 0) if (position < _maxCount && position >= 0)