лаб2.изм
This commit is contained in:
parent
4b6aa63101
commit
1641fc1883
@ -22,10 +22,7 @@ additionalColor, bool crane, bool containers, int width, int height) :
|
||||
}
|
||||
public override void DrawShip(Graphics g)
|
||||
{
|
||||
/*if (EntityShip is not EntityContainerShip containerShip)
|
||||
{
|
||||
return;
|
||||
}*/
|
||||
|
||||
if(EntityShip == null)
|
||||
{
|
||||
return;
|
||||
|
@ -10,9 +10,7 @@ namespace Lab1ContainersShip.DrawingObjects
|
||||
{
|
||||
public class DrawingShip
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс-сущность
|
||||
/// </summary>
|
||||
|
||||
public EntityShip EntityShip { get; protected set; }
|
||||
/// <summary>
|
||||
/// Ширина окна
|
||||
@ -72,22 +70,7 @@ namespace Lab1ContainersShip.DrawingObjects
|
||||
}
|
||||
}
|
||||
|
||||
/*public bool Init(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool crane, bool container, int width, int height)
|
||||
{
|
||||
// TODO: Продумать проверки
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
if (_pictureWidth < _shipWidth || _pictureHeight < _shipHeight)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
EntityShip = new EntityShip();
|
||||
EntityShip.Init(speed, weight, bodyColor, additionalColor,
|
||||
crane, container);
|
||||
|
||||
return true;
|
||||
}*/
|
||||
public DrawingShip(int speed, double weight, Color bodyColor, int width, int height)
|
||||
{
|
||||
if(width < _shipWidth || height < _shipHeight)
|
||||
@ -110,18 +93,7 @@ additionalColor, bool crane, bool container, int width, int height)
|
||||
_shipWidth = shipWidth;
|
||||
EntityShip = new EntityShip(speed, weight, bodyColor);
|
||||
}
|
||||
/*public bool Init(EntityContainerShip entcon, int wid, int hei)
|
||||
{
|
||||
_pictureWidth = wid;
|
||||
_pictureHeight = hei;
|
||||
if (_pictureWidth < _shipWidth || _pictureHeight < _shipHeight)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
EntityContainerShip = entcon;
|
||||
return true;
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
public void SetPosition(int x, int y)
|
||||
@ -202,32 +174,7 @@ additionalColor, bool crane, bool container, int width, int height)
|
||||
g.DrawLine(pen, _startPosX + 20, _startPosY + 55, _startPosX + 30, _startPosY + 55);
|
||||
|
||||
//контейнеры
|
||||
/*if (EntityShip.Conteiners)
|
||||
{
|
||||
g.FillRectangle(adbrush, _startPosX + 30, _startPosY + 35, 35, 10);
|
||||
g.FillRectangle(adbrush, _startPosX + 65, _startPosY + 35, 20, 10);
|
||||
g.FillRectangle(adbrush, _startPosX + 85, _startPosY + 30, 15, 15);
|
||||
g.FillRectangle(adbrush, _startPosX + 30, _startPosY + 25, 15, 10);
|
||||
g.FillRectangle(adbrush, _startPosX + 45, _startPosY + 25, 55, 5);
|
||||
g.FillRectangle(adbrush, _startPosX + 45, _startPosY + 30, 40, 5);
|
||||
|
||||
g.DrawRectangle(pen, _startPosX + 30, _startPosY + 35, 35, 10);
|
||||
g.DrawRectangle(pen, _startPosX + 65, _startPosY + 35, 20, 10);
|
||||
g.DrawRectangle(pen, _startPosX + 85, _startPosY + 30, 15, 15);
|
||||
g.DrawRectangle(pen, _startPosX + 30, _startPosY + 25, 15, 10);
|
||||
g.DrawRectangle(pen, _startPosX + 45, _startPosY + 25, 55, 5);
|
||||
g.DrawRectangle(pen, _startPosX + 45, _startPosY + 30, 40, 5);
|
||||
}
|
||||
//кран
|
||||
if (EntityShip.Crane)
|
||||
{
|
||||
g.FillRectangle(adbrush, _startPosX + 23, _startPosY, 5, 45);
|
||||
g.FillRectangle(adbrush, _startPosX + 27, _startPosY + 10, 20, 3);
|
||||
g.DrawRectangle(pen, _startPosX + 23, _startPosY, 5, 45);
|
||||
g.DrawRectangle(pen, _startPosX + 27, _startPosY + 10, 20, 3);
|
||||
g.DrawLine(pen, _startPosX + 27, _startPosY, _startPosX + 47, _startPosY + 10);
|
||||
g.DrawLine(pen, _startPosX + 47, _startPosY + 13, _startPosX + 47, _startPosY + 25);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,9 +41,7 @@ namespace Lab1ContainersShip.Entities
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
//AdditionalColor = additionalColor;
|
||||
//Crane = crane;
|
||||
//Conteiners = containers;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,9 +16,7 @@ namespace Lab1ContainersShip
|
||||
{
|
||||
private DrawingShip _drawingShip;
|
||||
|
||||
/// <summary>
|
||||
/// Стратегия перемещения
|
||||
/// </summary>
|
||||
|
||||
private AbstractStrategy _abstractStrategy;
|
||||
|
||||
|
||||
@ -26,17 +24,7 @@ namespace Lab1ContainersShip
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
/// <summary>
|
||||
/// Поле-объект для прорисовки объекта
|
||||
/// </summary>
|
||||
|
||||
/// <summary>
|
||||
/// Инициализация формы
|
||||
/// </summary>
|
||||
|
||||
/// <summary>
|
||||
/// Метод прорисовки машины
|
||||
/// </summary>
|
||||
private void Draw()
|
||||
{
|
||||
|
||||
@ -59,33 +47,7 @@ namespace Lab1ContainersShip
|
||||
}
|
||||
|
||||
|
||||
/*private void buttonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new Random();
|
||||
_drawningShip = new DrawingShip();
|
||||
EntityShip _entitycont = new EntityShip();*/
|
||||
/*_entitycont.Init(random.Next(100, 300),
|
||||
random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),
|
||||
random.Next(0, 256)),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),
|
||||
random.Next(0, 256)),
|
||||
Convert.ToBoolean(random.Next(0, 2)),
|
||||
Convert.ToBoolean(random.Next(0, 2)));*/
|
||||
/*_drawningShip.Init(random.Next(100, 300),
|
||||
random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),
|
||||
random.Next(0, 256)),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),
|
||||
random.Next(0, 256)),
|
||||
Convert.ToBoolean(random.Next(0, 2)),
|
||||
Convert.ToBoolean(random.Next(0, 2)),
|
||||
pictureBox1.Width, pictureBox1.Height);
|
||||
//_drawningShip.Init(_entitycont, pictureBox1.Width, pictureBox1.Height);
|
||||
_drawningShip.SetPosition(random.Next(10, 100),
|
||||
random.Next(10, 100));
|
||||
Draw();
|
||||
}*/
|
||||
|
||||
private void buttonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawingShip == null)
|
||||
@ -119,13 +81,7 @@ namespace Lab1ContainersShip
|
||||
}
|
||||
if (comboBoxStrategy.Enabled)
|
||||
{
|
||||
/*_abstractStrategy = comboBoxStrategy.SelectedIndex
|
||||
switch
|
||||
{
|
||||
0 => new MoveToCenter(),
|
||||
1 => new MoveToBorder(),
|
||||
_ => null,
|
||||
};*/
|
||||
|
||||
switch (comboBoxStrategy.SelectedIndex)
|
||||
{
|
||||
case 0:
|
||||
|
Loading…
Reference in New Issue
Block a user