Compare commits

..

23 Commits
main ... 3LAB

Author SHA1 Message Date
10Г Егор Романов
10d24f297c gg 2022-12-25 14:10:22 +04:00
10Г Егор Романов
f9d91c8677 gg 2022-12-25 14:08:25 +04:00
10Г Егор Романов
04bbe74044 gg 2022-12-25 14:08:12 +04:00
10Г Егор Романов
84a017e3dd gg 2022-12-25 14:06:52 +04:00
10Г Егор Романов
c8a4a8615f gg 2022-12-25 14:06:49 +04:00
10Г Егор Романов
2cb6da3972 gg 2022-12-25 13:42:10 +04:00
10Г Егор Романов
842a2ccd5e решение конфликтов 2022-12-25 13:25:14 +04:00
10Г Егор Романов
b0d69d693f gg 2022-12-25 13:24:23 +04:00
10Г Егор Романов
0200164a1c решение конфликтов 2022-12-25 13:21:31 +04:00
10Г Егор Романов
e1680fd063 решение конфликтов 2022-12-25 13:07:23 +04:00
10Г Егор Романов
342f4211e0 исправления 2022-12-25 13:07:07 +04:00
10Г Егор Романов
6223ac3f78 gg 2022-12-25 13:07:05 +04:00
10Г Егор Романов
c030426cc4 устранение конфликтов 2022-12-25 12:08:39 +04:00
10Г Егор Романов
b51ad978fc Третья лабораторная работа 2022-10-10 19:53:02 +03:00
10Г Егор Романов
a050412eed Вторая лабораторная работа 2022-10-10 18:59:31 +03:00
10Г Егор Романов
f7aa2de3dc Изменение названий 2022-10-10 17:38:26 +03:00
ab95f876c5 Загрузил(а) файлы в 'HoistingCrane' 2022-10-10 18:28:21 +04:00
10Г Егор Романов
0fb498e55d Изменение названий 2022-10-10 17:25:02 +03:00
10Г Егор Романов
db900bee31 Изменение названий 2022-10-10 17:00:42 +03:00
10Г Егор Романов
3c394c5451 Удаление лишней папки 2022-10-10 16:39:33 +03:00
10Г Егор Романов
52377c82d3 Изменение названий 2022-10-10 16:36:17 +03:00
10Г Егор Романов
6638bb7e9b Изменение названий 2022-10-10 16:33:38 +03:00
10Г Егор Романов
7d15ea92da Изменение названий проекта 2022-10-10 16:32:04 +03:00
32 changed files with 1054 additions and 605 deletions

View File

@ -1,9 +1,9 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.3.32922.545 VisualStudioVersion = 17.0.32112.339
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HoistingCrane", "HoistingCrane\HoistingCrane.csproj", "{44B433E0-4B64-464F-B7B2-85F92D68A14D}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HoistingCrane", "HoistingCrane\HoistingCrane.csproj", "{D80E7B00-5088-4976-A795-E42A2FE183D6}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -11,15 +11,15 @@ Global
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{44B433E0-4B64-464F-B7B2-85F92D68A14D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D80E7B00-5088-4976-A795-E42A2FE183D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{44B433E0-4B64-464F-B7B2-85F92D68A14D}.Debug|Any CPU.Build.0 = Debug|Any CPU {D80E7B00-5088-4976-A795-E42A2FE183D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{44B433E0-4B64-464F-B7B2-85F92D68A14D}.Release|Any CPU.ActiveCfg = Release|Any CPU {D80E7B00-5088-4976-A795-E42A2FE183D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{44B433E0-4B64-464F-B7B2-85F92D68A14D}.Release|Any CPU.Build.0 = Release|Any CPU {D80E7B00-5088-4976-A795-E42A2FE183D6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FF7CBA77-84DA-4B39-BFC8-808056D2EEAF} SolutionGuid = {F67B9958-A88C-4E5E-9405-BA7150E626AF}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@ -0,0 +1,176 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HoistingCrane
{
internal abstract class AbstractMap
{
private IDrawingObject _drawingObject = null;
protected int[,] _map = null;
protected int _width;
protected int _height;
protected float _size_x;
protected float _size_y;
protected readonly Random _random = new();
protected readonly int _freeRoad = 0;
protected readonly int _barrier = 1;
public Bitmap CreateMap(int width, int height, IDrawingObject drawingObject)
{
_width = width;
_height = height;
_drawingObject = drawingObject;
GenerateMap();
while (!SetObjectOnMap())
{
GenerateMap();
}
return DrawMapWithObject();
}
public Bitmap MoveObject(Direction direction)
{
bool isFree = true;
int startPosX = (int)(_drawingObject.GetCurrentPosition().Left / _size_x);
int startPosY = (int)(_drawingObject.GetCurrentPosition().Right / _size_y);
int hoistingCraneWidth = (int)(_drawingObject.GetCurrentPosition().Top / _size_x);
int hoistingCraneHeight = (int)(_drawingObject.GetCurrentPosition().Bottom / _size_y);
switch (direction)
{
// вправо
case Direction.Right:
for (int i = hoistingCraneWidth; i <= hoistingCraneWidth + (int)(_drawingObject.Step / _size_x); i++)
{
for (int j = startPosY; j <= hoistingCraneHeight; j++)
{
if (_map[i, j] == _barrier)
{
isFree = false;
break;
}
}
}
break;
//влево
case Direction.Left:
for (int i = startPosX; i >= (int)(_drawingObject.Step / _size_x); i--)
{
for (int j = startPosY; j <= hoistingCraneHeight; j++)
{
if (_map[i, j] == _barrier)
{
isFree = false;
break;
}
}
}
break;
//вверх
case Direction.Up:
for (int i = startPosX; i <= hoistingCraneWidth; i++)
{
for (int j = startPosY; j >= (int)(_drawingObject.Step / _size_y); j--)
{
if (_map[i, j] == _barrier)
{
isFree = false;
break;
}
}
}
break;
//вниз
case Direction.Down:
for (int i = startPosX; i <= hoistingCraneWidth; i++)
{
for (int j = hoistingCraneHeight; j <= hoistingCraneHeight + (int)(_drawingObject.Step / _size_y); j++)
{
if (_map[i, j] == _barrier)
{
isFree = false;
break;
}
}
}
break;
}
if (isFree)
{
_drawingObject.MoveObject(direction);
}
else _drawingObject.MoveObject(SetOppositDirection(direction));
return DrawMapWithObject();
}
private Direction SetOppositDirection(Direction dir)
{
switch (dir)
{
case Direction.Up:
return Direction.Down;
case Direction.Down:
return Direction.Up;
case Direction.Left:
return Direction.Right;
case Direction.Right:
return Direction.Left;
}
return Direction.None;
}
private bool SetObjectOnMap()
{
if (_drawingObject == null || _map == null)
{
return false;
}
int x = _random.Next(0, 10);
int y = _random.Next(0, 10);
_drawingObject.SetObject(x, y, _width, _height);
int startPosX = (int)(_drawingObject.GetCurrentPosition().Left / _size_x);
int startPosY = (int)(_drawingObject.GetCurrentPosition().Right / _size_y);
int hoistingcraneWidth = (int)(_drawingObject.GetCurrentPosition().Top / _size_x);
int hoistingCraneHeight = (int)(_drawingObject.GetCurrentPosition().Bottom / _size_y);
for (int i = startPosX; i <= hoistingcraneWidth; i++)
{
for (int j = startPosY; j <= hoistingCraneHeight; j++)
{
if (_map[i, j] == _barrier)
{
return false;
}
}
}
return true;
}
private Bitmap DrawMapWithObject()
{
Bitmap bmp = new(_width, _height);
if (_drawingObject == null || _map == null)
{
return bmp;
}
Graphics gr = Graphics.FromImage(bmp);
for (int i = 0; i < _map.GetLength(0); i++)
{
for (int j = 0; j < _map.GetLength(1); j++)
{
if (_map[i, j] == _freeRoad)
{
DrawRoadPart(gr, i, j);
}
else if (_map[i, j] == _barrier)
{
DrawBarrierPart(gr, i, j);
}
}
}
_drawingObject.DrawingObject(gr);
return bmp;
}
protected abstract void GenerateMap();
protected abstract void DrawRoadPart(Graphics g, int i, int j);
protected abstract void DrawBarrierPart(Graphics g, int i, int j);
}
}

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HoistingCrane
{
public enum Direction
{
None = 0,
Up = 1,
Down = 2,
Left = 3,
Right = 4
}
}

View File

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HoistingCrane
{
internal class DrawingAdvancedHoistingCrane : DrawingHoistingCrane
{
public DrawingAdvancedHoistingCrane(int speed, float weight, Color bodyColor, Color dopColor, bool bucket, bool ripper) :
base(speed, weight, bodyColor, 152, 65)
{
HoistingCrane = new EntityAdvancedHoistingCrane(speed, weight, bodyColor, dopColor, bucket, ripper);
}
public override void DrawTransport(Graphics g)
{
if (HoistingCrane is not EntityAdvancedHoistingCrane advancedHoistingCrane)
{
return;
}
Pen pen = new(Color.Black, 3);
Brush dopBrush = new SolidBrush(advancedHoistingCrane.DopColor);
if (advancedHoistingCrane.Сounterweight)
{
g.DrawLine(pen, _startPosX + 15, _startPosY + 60, _startPosX + 40, _startPosY + 75);
g.DrawLine(pen, _startPosX + 15, _startPosY + 45, _startPosX + 45, _startPosY + 65);
g.FillRectangle(dopBrush, _startPosX + 4, _startPosY + 38, 12, 25);
g.DrawRectangle(pen, _startPosX + 4, _startPosY + 38, 12, 25);
}
if (advancedHoistingCrane.Crane)
{
g.FillRectangle(dopBrush, _startPosX + 100, _startPosY + 30, 10, 25);
g.DrawRectangle(pen, _startPosX + 100, _startPosY + 30, 10, 25);
g.FillRectangle(dopBrush, _startPosX + 110, _startPosY + 15, 10, 25);
g.DrawRectangle(pen, _startPosX + 110, _startPosY + 15, 10, 25);
g.FillRectangle(dopBrush, _startPosX + 120, _startPosY + 15, 25, 10);
g.DrawRectangle(pen, _startPosX + 120, _startPosY + 15, 25, 10);
g.FillRectangle(dopBrush, _startPosX + 145, _startPosY + 15, 10, 60);
g.DrawRectangle(pen, _startPosX + 145, _startPosY + 15, 10, 60);
g.FillRectangle(dopBrush, _startPosX + 145, _startPosY + 65, 25, 10);
g.DrawRectangle(pen, _startPosX + 145, _startPosY + 65, 25, 10);
}
_startPosX += 40;
_startPosY += 30;
base.DrawTransport(g);
_startPosY -= 30;
_startPosX -= 40;
}
}
}

View File

@ -0,0 +1,150 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HoistingCrane
{
public class DrawingHoistingCrane
{
public EntityHoistingCrane HoistingCrane { get; protected set; }
protected float _startPosX;
protected float _startPosY;
private int? _pictureWidth = null;
private int? _pictureHeight = null;
private readonly int _hoistingCraneWidth = 80;
private readonly int _hoistingCraneHeight = 50;
protected DrawingHoistingCrane(int speed, float weight, Color bodyColor, int hoistingCraneWidth, int hoistingCraneHeigth) :
this(speed, weight, bodyColor)
{
_hoistingCraneHeight = hoistingCraneHeigth;
_hoistingCraneWidth = hoistingCraneWidth;
}
public DrawingHoistingCrane(int speed, float weight, Color bodyColor)
{
HoistingCrane = new EntityHoistingCrane(speed, weight, bodyColor);
}
public void SetPosition(int x, int y, int width, int height)
{
// TODO checks
_startPosX = x;
_startPosY = y;
_pictureWidth = width;
_pictureHeight = height;
}
public void MoveTransport(Direction direction)
{
if (!_pictureWidth.HasValue || !_pictureHeight.HasValue)
{
return;
}
switch (direction)
{
// вправо
case Direction.Right:
if (_startPosX + _hoistingCraneWidth + HoistingCrane.Step < _pictureWidth)
{
_startPosX += HoistingCrane.Step;
}
break;
//влево
case Direction.Left:
if (_startPosX - HoistingCrane.Step > 0)
{
_startPosX -= HoistingCrane.Step;
}
break;
//вверх
case Direction.Up:
if (_startPosY - HoistingCrane.Step > 0)
{
_startPosY -= HoistingCrane.Step;
}
break;
//вниз
case Direction.Down:
if (_startPosY + _hoistingCraneHeight + HoistingCrane.Step < _pictureHeight)
{
_startPosY += HoistingCrane.Step;
}
break;
}
}
public virtual void DrawTransport(Graphics g)
{
if (_startPosX < 0 || _startPosY < 0
|| !_pictureHeight.HasValue || !_pictureWidth.HasValue)
{
return;
}
Pen pen = new Pen(Color.Black);
//границы
g.DrawRectangle(pen, _startPosX, _startPosY + 25, 75, 20);
g.DrawRectangle(pen, _startPosX, _startPosY, 25, 25);
g.DrawRectangle(pen, _startPosX + 4, _startPosY + 4, 17, 17);
g.DrawRectangle(pen, _startPosX + 52, _startPosY + 7, 6, 18);
g.DrawEllipse(pen, _startPosX - 5, _startPosY + 45, 20, 20);
g.DrawEllipse(pen, _startPosX + 63, _startPosY + 45, 20, 20);
g.DrawRectangle(pen, _startPosX + 5, _startPosY + 45, 68, 20);
g.DrawEllipse(pen, _startPosX - 1, _startPosY + 46, 18, 18);
g.DrawEllipse(pen, _startPosX + 62, _startPosY + 46, 18, 18);
g.DrawEllipse(pen, _startPosX + 20, _startPosY + 53, 10, 10);
g.DrawEllipse(pen, _startPosX + 35, _startPosY + 53, 10, 10);
g.DrawEllipse(pen, _startPosX + 50, _startPosY + 53, 10, 10);
g.DrawRectangle(pen, _startPosX + 30, _startPosY + 45, 4, 6);
g.DrawRectangle(pen, _startPosX + 45, _startPosY + 45, 4, 6);
//корпус
Brush br = new SolidBrush(HoistingCrane?.BodyColor ?? Color.Black);
g.FillRectangle(br, _startPosX, _startPosY + 25, 75, 25);
g.FillRectangle(br, _startPosX, _startPosY, 25, 25);
//окно
Brush brBlue = new SolidBrush(Color.Blue);
g.FillRectangle(brBlue, _startPosX + 4, _startPosY + 4, 17, 17);
//выхлопная труба
Brush brBrown = new SolidBrush(Color.DarkGray);
g.FillRectangle(brBrown, _startPosX + 52, _startPosY + 7, 6, 18);
//гусеница
Brush brDarkGray = new SolidBrush(Color.DarkGray);
g.FillEllipse(brDarkGray, _startPosX - 5, _startPosY + 45, 20, 20);
g.FillEllipse(brDarkGray, _startPosX + 63, _startPosY + 45, 20, 20);
g.FillRectangle(brDarkGray, _startPosX + 5, _startPosY + 45, 68, 20);
Brush brBlack = new SolidBrush(Color.Black);
g.FillEllipse(brBlack, _startPosX - 1, _startPosY + 46, 18, 18);
g.FillEllipse(brBlack, _startPosX + 62, _startPosY + 46, 18, 18);
g.FillEllipse(brBlack, _startPosX + 20, _startPosY + 53, 10, 10);
g.FillEllipse(brBlack, _startPosX + 35, _startPosY + 53, 10, 10);
g.FillEllipse(brBlack, _startPosX + 50, _startPosY + 53, 10, 10);
g.FillRectangle(brBlack, _startPosX + 30, _startPosY + 45, 4, 6);
g.FillRectangle(brBlack, _startPosX + 45, _startPosY + 45, 4, 6);
}
public void ChangeBorders(int width, int height)
{
_pictureWidth = width;
_pictureHeight = height;
if (_pictureWidth <= _hoistingCraneWidth || _pictureHeight <= _hoistingCraneHeight)
{
_pictureWidth = null;
_pictureHeight = null;
return;
}
if (_startPosX + _hoistingCraneWidth > _pictureWidth)
{
_startPosX = _pictureWidth.Value - _hoistingCraneWidth;
}
if (_startPosY + _hoistingCraneHeight > _pictureHeight)
{
_startPosY = _pictureHeight.Value - _hoistingCraneHeight;
}
}
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
{
return (_startPosX, _startPosY, _startPosX + _hoistingCraneWidth, _startPosY + _hoistingCraneHeight);
}
}
}

View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HoistingCrane
{
internal class DrawingObjectHoistingCrane : IDrawingObject
{
private DrawingHoistingCrane _hoistingCrane = null;
public DrawingObjectHoistingCrane(DrawingHoistingCrane hoistingCrane)
{
_hoistingCrane = hoistingCrane;
}
public float Step => _hoistingCrane?.HoistingCrane?.Step ?? 0;
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
{
return _hoistingCrane?.GetCurrentPosition() ?? default;
}
public void MoveObject(Direction direction)
{
_hoistingCrane?.MoveTransport(direction);
}
public void SetObject(int x, int y, int width, int height)
{
_hoistingCrane.SetPosition(x, y, width, height);
}
public void DrawingObject(Graphics g)
{
_hoistingCrane?.DrawTransport(g);
}
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HoistingCrane
{
internal class EntityAdvancedHoistingCrane : EntityHoistingCrane
{
// наличие крана
public bool Crane { get; private set; }
// наличие противовеса
public bool Сounterweight { get; private set; }
public Color DopColor { get; private set; }
public EntityAdvancedHoistingCrane(int speed, float weight, Color bodyColor, Color dopColor, bool crane, bool counterweight) :
base(speed, weight, bodyColor)
{
Crane = crane;
Сounterweight = counterweight;
DopColor = dopColor;
}
}
}

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HoistingCrane
{
public class EntityHoistingCrane
{
public int Speed { get; private set; }
public float Weight { get; private set; }
public Color BodyColor { get; private set; }
public float Step => Speed * 100 / Weight;
public EntityHoistingCrane(int speed, float weight, Color bodyColor)
{
Random rnd = new();
Speed = speed <= 0 ? rnd.Next(30, 100) : speed;
Weight = weight <= 0 ? rnd.Next(300, 500) : weight;
BodyColor = bodyColor;
}
}
}

View File

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,134 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace HoistingCrane
{
public partial class FormHoistingCraneConfig : Form
{
//переменная-выбранный кран
DrawingHoistingCrane _hoistingCrane = null;
public DrawingHoistingCrane SelectedHoistingCrane { get; private set; }
//событие
private event Action<DrawingHoistingCrane> EventAddHoistingCrane;
//конструктор
public FormHoistingCraneConfig()
{
InitializeComponent();
panelBlack.MouseDown += PanelColor_MouseDown;
panelPurple.MouseDown += PanelColor_MouseDown;
panelGray.MouseDown += PanelColor_MouseDown;
panelGreen.MouseDown += PanelColor_MouseDown;
panelRed.MouseDown += PanelColor_MouseDown;
panelWhite.MouseDown += PanelColor_MouseDown;
panelYellow.MouseDown += PanelColor_MouseDown;
panelBlue.MouseDown += PanelColor_MouseDown;
buttonCancel.Click += (object sender, EventArgs e) => Close();
}
//отрисовка кран
private void DrawHoistingCrane()
{
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
Graphics gr = Graphics.FromImage(bmp);
_hoistingCrane?.SetPosition(5, 5, pictureBoxObject.Width, pictureBoxObject.Height);
_hoistingCrane?.DrawTransport(gr);
pictureBoxObject.Image = bmp;
}
//добавление события
public void AddEvent(Action<DrawingHoistingCrane> ev)
{
if (EventAddHoistingCrane == null)
{
EventAddHoistingCrane = new Action<DrawingHoistingCrane>(ev);
}
else
{
EventAddHoistingCrane += ev;
}
}
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
{
(sender as Label).DoDragDrop((sender as Label).Name, DragDropEffects.Move | DragDropEffects.Copy);
}
//проверка получаемой информации (ее типа на соответствие требуемому)
private void PanelObject_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.Text))
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
//действия при приеме перетаскиваемой информации
private void PanelObject_DragDrop(object sender, DragEventArgs e)
{
switch (e.Data.GetData(DataFormats.Text).ToString())
{
case "labelSimpleObject":
_hoistingCrane = new DrawingHoistingCrane((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, labelBaseColor.BackColor);
break;
case "labelModifiedObject":
_hoistingCrane = new DrawingAdvancedHoistingCrane((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, labelBaseColor.BackColor, labelDopColor.BackColor,
checkBoxCounterweight.Checked, checkBoxCrane.Checked);
break;
}
DrawHoistingCrane();
}
//отправляем цвет с панели
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
{
(sender as Control).DoDragDrop((sender as Control).BackColor, DragDropEffects.Move | DragDropEffects.Copy);
}
//проверка получаемой информации (её типа на соответсвие требуемому)
private void LabelColor_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(Color)))
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
//принимаем основной цвет
private void LabelBaseColor_DragDrop(object sender, DragEventArgs e)
{
//проверка на пустоту объекта
if (_hoistingCrane != null)
{
_hoistingCrane.HoistingCrane.BodyColor = (Color)e.Data.GetData(typeof(Color));
DrawHoistingCrane();
}
}
//принимаем дополнительный цвет
private void LabelDopColor_DragDrop(object sender, DragEventArgs e)
{
//проверка на пустоту объекта и правильную сущноть
if (_hoistingCrane != null && _hoistingCrane.HoistingCrane is EntityAdvancedHoistingCrane entityHoistingCrane)
{
entityHoistingCrane.DopColor = (Color)e.Data.GetData(typeof(Color));
DrawHoistingCrane();
}
}
//добавление крана
private void ButtonAddObject_Click(object sender, EventArgs e)
{
EventAddHoistingCrane?.Invoke(_hoistingCrane);
Close();
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,208 @@
namespace HoistingCrane
{
partial class FormMap
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.buttonUp = new System.Windows.Forms.Button();
this.buttonLeft = new System.Windows.Forms.Button();
this.buttonRight = new System.Windows.Forms.Button();
this.buttonDown = new System.Windows.Forms.Button();
this.buttonCreate = new System.Windows.Forms.Button();
this.statusStrip = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabelSpeed = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabelWeight = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabelBodyColor = new System.Windows.Forms.ToolStripStatusLabel();
this.pictureBoxHoistingCrane = new System.Windows.Forms.PictureBox();
this.buttonCreateModify = new System.Windows.Forms.Button();
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
this.statusStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxHoistingCrane)).BeginInit();
this.SuspendLayout();
//
// buttonUp
//
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonUp.BackgroundImage = global::HoistingCrane.Properties.Resources.up;
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonUp.Location = new System.Drawing.Point(722, 353);
this.buttonUp.Name = "buttonUp";
this.buttonUp.Size = new System.Drawing.Size(30, 30);
this.buttonUp.TabIndex = 0;
this.buttonUp.UseVisualStyleBackColor = true;
this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonLeft
//
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonLeft.BackgroundImage = global::HoistingCrane.Properties.Resources.left;
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonLeft.Location = new System.Drawing.Point(686, 389);
this.buttonLeft.Name = "buttonLeft";
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
this.buttonLeft.TabIndex = 1;
this.buttonLeft.UseVisualStyleBackColor = true;
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonRight
//
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonRight.BackgroundImage = global::HoistingCrane.Properties.Resources.right;
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonRight.Location = new System.Drawing.Point(758, 389);
this.buttonRight.Name = "buttonRight";
this.buttonRight.Size = new System.Drawing.Size(30, 30);
this.buttonRight.TabIndex = 2;
this.buttonRight.UseVisualStyleBackColor = true;
this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonDown
//
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDown.BackgroundImage = global::HoistingCrane.Properties.Resources.down;
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonDown.Location = new System.Drawing.Point(722, 389);
this.buttonDown.Name = "buttonDown";
this.buttonDown.Size = new System.Drawing.Size(30, 30);
this.buttonDown.TabIndex = 3;
this.buttonDown.UseVisualStyleBackColor = true;
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonCreate
//
this.buttonCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonCreate.Location = new System.Drawing.Point(12, 393);
this.buttonCreate.Name = "buttonCreate";
this.buttonCreate.Size = new System.Drawing.Size(75, 23);
this.buttonCreate.TabIndex = 4;
this.buttonCreate.Text = "Создать";
this.buttonCreate.UseVisualStyleBackColor = true;
this.buttonCreate.Click += new System.EventHandler(this.ButtonCreate_Click);
//
// statusStrip
//
this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabelSpeed,
this.toolStripStatusLabelWeight,
this.toolStripStatusLabelBodyColor});
this.statusStrip.Location = new System.Drawing.Point(0, 428);
this.statusStrip.Name = "statusStrip";
this.statusStrip.Size = new System.Drawing.Size(800, 22);
this.statusStrip.TabIndex = 5;
this.statusStrip.Text = "statusStrip";
//
// toolStripStatusLabelSpeed
//
this.toolStripStatusLabelSpeed.Name = "toolStripStatusLabelSpeed";
this.toolStripStatusLabelSpeed.Size = new System.Drawing.Size(62, 17);
this.toolStripStatusLabelSpeed.Text = "Скорость:";
//
// toolStripStatusLabelWeight
//
this.toolStripStatusLabelWeight.Name = "toolStripStatusLabelWeight";
this.toolStripStatusLabelWeight.Size = new System.Drawing.Size(29, 17);
this.toolStripStatusLabelWeight.Text = "Вес:";
//
// toolStripStatusLabelBodyColor
//
this.toolStripStatusLabelBodyColor.Name = "toolStripStatusLabelBodyColor";
this.toolStripStatusLabelBodyColor.Size = new System.Drawing.Size(36, 17);
this.toolStripStatusLabelBodyColor.Text = "Цвет:";
//
// pictureBoxBulldozer
//
this.pictureBoxHoistingCrane.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBoxHoistingCrane.Location = new System.Drawing.Point(0, 0);
this.pictureBoxHoistingCrane.Name = "pictureBoxHoistingCrane";
this.pictureBoxHoistingCrane.Size = new System.Drawing.Size(800, 428);
this.pictureBoxHoistingCrane.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBoxHoistingCrane.TabIndex = 6;
this.pictureBoxHoistingCrane.TabStop = false;
this.pictureBoxHoistingCrane.Click += new System.EventHandler(this.pictureBoxHoistingCrane_Click);
//
// buttonCreateModify
//
this.buttonCreateModify.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonCreateModify.Location = new System.Drawing.Point(93, 393);
this.buttonCreateModify.Name = "buttonCreateModify";
this.buttonCreateModify.Size = new System.Drawing.Size(100, 23);
this.buttonCreateModify.TabIndex = 7;
this.buttonCreateModify.Text = "Модификация";
this.buttonCreateModify.UseVisualStyleBackColor = true;
this.buttonCreateModify.Click += new System.EventHandler(this.ButtonCreateModify_Click);
//
// comboBoxSelectorMap
//
this.comboBoxSelectorMap.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxSelectorMap.FormattingEnabled = true;
this.comboBoxSelectorMap.Items.AddRange(new object[] {
"Простая карта",
"Вторая карта"});
this.comboBoxSelectorMap.Location = new System.Drawing.Point(12, 12);
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
this.comboBoxSelectorMap.Size = new System.Drawing.Size(121, 23);
this.comboBoxSelectorMap.TabIndex = 8;
this.comboBoxSelectorMap.SelectedIndexChanged += new System.EventHandler(this.ComboBoxSelectorMap_SelectedIndexChanged);
//
// FormMap
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.comboBoxSelectorMap);
this.Controls.Add(this.buttonCreateModify);
this.Controls.Add(this.buttonCreate);
this.Controls.Add(this.buttonDown);
this.Controls.Add(this.buttonRight);
this.Controls.Add(this.buttonLeft);
this.Controls.Add(this.buttonUp);
this.Controls.Add(this.pictureBoxHoistingCrane);
this.Controls.Add(this.statusStrip);
this.Name = "FormMap";
this.Text = "FormMap";
this.statusStrip.ResumeLayout(false);
this.statusStrip.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxHoistingCrane)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Button buttonUp;
private Button buttonLeft;
private Button buttonRight;
private Button buttonDown;
private Button buttonCreate;
private StatusStrip statusStrip;
private ToolStripStatusLabel toolStripStatusLabelSpeed;
private ToolStripStatusLabel toolStripStatusLabelWeight;
private ToolStripStatusLabel toolStripStatusLabelBodyColor;
private PictureBox pictureBoxHoistingCrane;
private Button buttonCreateModify;
private ComboBox comboBoxSelectorMap;
}
}

View File

@ -32,7 +32,7 @@ namespace HoistingCrane
private void ButtonCreate_Click(object sender, EventArgs e) private void ButtonCreate_Click(object sender, EventArgs e)
{ {
Random rnd = new(); Random rnd = new();
var hoistingCrane = new DrawingHoistingCrane(rnd.Next(30, 100), rnd.Next(300, 500), var bulldozer = new DrawingHoistingCrane(rnd.Next(30, 100), rnd.Next(300, 500),
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
SetData(bulldozer); SetData(bulldozer);
} }

View File

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -12,10 +12,9 @@ namespace HoistingCrane
{ {
public partial class FormMapWithSetHoistingCrane : Form public partial class FormMapWithSetHoistingCrane : Form
{ {
/// Словарь для выпадающего списка
private MapWithSetHoistingCraneGeneric<DrawingObjectHoistingCrane, AbstractMap> _mapHoistingCraneCollectionGeneric; /// </summary>
private readonly Dictionary<string, AbstractMap> _mapsDict = new()
public FormMapWithSetHoistingCrane()
{ {
{ "Простая карта", new SimpleMap() }, { "Простая карта", new SimpleMap() },
{ "Вторая карта", new SecondMap() }, { "Вторая карта", new SecondMap() },
@ -29,6 +28,7 @@ namespace HoistingCrane
private readonly MapsCollection _mapsCollection; private readonly MapsCollection _mapsCollection;
/// <summary> /// <summary>
public FormMapWithSetHoistingCrane(ILogger<FormMapWithSetHoistingCrane> logger) public FormMapWithSetHoistingCrane(ILogger<FormMapWithSetHoistingCrane> logger)
{
{ {
InitializeComponent(); InitializeComponent();
} }

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,81 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <Project Sdk="Microsoft.NET.Sdk">
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{44B433E0-4B64-464F-B7B2-85F92D68A14D}</ProjectGuid>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<RootNamespace>HoistingCrane</RootNamespace> <TargetFramework>net6.0-windows</TargetFramework>
<AssemblyName>HoistingCrane</AssemblyName> <Nullable>enable</Nullable>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> <UseWindowsForms>true</UseWindowsForms>
<FileAlignment>512</FileAlignment> <ImplicitUsings>enable</ImplicitUsings>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FormhoistingCrane.cs" />
<Compile Include="FormhoistingCrane.Designer.cs">
<DependentUpon>FormhoistingCrane.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="FormhoistingCrane.resx">
<DependentUpon>FormhoistingCrane.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HoistingCrane
{
internal interface IDrawingObject
{
public float Step { get; }
void SetObject(int x, int y, int width, int height);
void MoveObject(Direction direction);
void DrawingObject(Graphics g);
(float Left, float Right, float Top, float Bottom) GetCurrentPosition();
}
}

View File

@ -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,7 +107,7 @@ namespace HoistingCrane
} }
} }
private void DrawHoistingCranes(Graphics gr) private void DrawBulldozers(Graphics gr)
{ {
int heightEl = _pictureHeight / _placeSizeHeight; int heightEl = _pictureHeight / _placeSizeHeight;
int widthEl = _pictureWidth / _placeSizeWidth; int widthEl = _pictureWidth / _placeSizeWidth;

View File

@ -12,6 +12,8 @@ namespace HoistingCrane
/// Словарь (хранилище) с картами /// Словарь (хранилище) с картами
readonly Dictionary<string, MapWithSetHoistingCraneGeneric<DrawingObjectHoistingCrane, AbstractMap>> _mapStorages; readonly Dictionary<string, MapWithSetHoistingCraneGeneric<DrawingObjectHoistingCrane, AbstractMap>> _mapStorages;
/// </summary>
readonly Dictionary<string, MapWithSetHoistingCraneGeneric<IDrawingObject, AbstractMap>> _mapStorages;
/// <summary> /// <summary>
/// Возвращение списка названий карт /// Возвращение списка названий карт
/// </summary> /// </summary>
@ -29,6 +31,9 @@ namespace HoistingCrane
/// </summary> /// </summary>
/// <param name="pictureWidth"></param> /// <param name="pictureWidth"></param>
/// <param name="pictureHeight"></param> /// <param name="pictureHeight"></param>
/// private readonly char separatorDict = '|';
private readonly char separatorData = ';';
private readonly char separatorDict = '|';
public MapsCollection(int pictureWidth, int pictureHeight) public MapsCollection(int pictureWidth, int pictureHeight)
{ {
_mapStorages = new Dictionary<string, MapWithSetHoistingCraneGeneric<DrawingObjectHoistingCrane, AbstractMap>>(); _mapStorages = new Dictionary<string, MapWithSetHoistingCraneGeneric<DrawingObjectHoistingCrane, AbstractMap>>();

View File

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Общие сведения об этой сборке предоставляются следующим набором
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
// связанных со сборкой.
[assembly: AssemblyTitle("HoistingCrane")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HoistingCrane")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
// COM, следует установить атрибут ComVisible в TRUE для этого типа.
[assembly: ComVisible(false)]
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
[assembly: Guid("44b433e0-4b64-464f-b7b2-85f92d68a14d")]
// Сведения о версии сборки состоят из указанных ниже четырех значений:
//
// Основной номер версии
// Дополнительный номер версии
// Номер сборки
// Редакция
//
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,49 +1,44 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// Этот код создан программным средством. // Этот код создан программой.
// Версия среды выполнения: 4.0.30319.42000 // Исполняемая версия:4.0.30319.42000
// //
// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если // Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// код создан повторно. // повторной генерации кода.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace HoistingCrane.Properties namespace HoistingCrane.Properties {
{ using System;
/// <summary> /// <summary>
/// Класс ресурсов со строгим типом для поиска локализованных строк и пр. /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
/// </summary> /// </summary>
// Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder // Этот класс создан автоматически классом StronglyTypedResourceBuilder
// класс с помощью таких средств, как ResGen или Visual Studio. // с помощью такого средства, как ResGen или Visual Studio.
// Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
// с параметром /str или заново постройте свой VS-проект. // с параметром /str или перестройте свой проект VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources internal class Resources {
{
private static global::System.Resources.ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture; private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() internal Resources() {
{
} }
/// <summary> /// <summary>
/// Возврат кэшированного экземпляра ResourceManager, используемого этим классом. /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager internal static global::System.Resources.ResourceManager ResourceManager {
{ get {
get if (object.ReferenceEquals(resourceMan, null)) {
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HoistingCrane.Properties.Resources", typeof(Resources).Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HoistingCrane.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
@ -52,20 +47,57 @@ namespace HoistingCrane.Properties
} }
/// <summary> /// <summary>
/// Переопределяет свойство CurrentUICulture текущего потока для всех /// Перезаписывает свойство CurrentUICulture текущего потока для всех
/// подстановки ресурсов с помощью этого класса ресурсов со строгим типом. /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture internal static global::System.Globalization.CultureInfo Culture {
{ get {
get
{
return resourceCulture; return resourceCulture;
} }
set set {
{
resourceCulture = value; resourceCulture = value;
} }
} }
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap down {
get {
object obj = ResourceManager.GetObject("down", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap left {
get {
object obj = ResourceManager.GetObject("left", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap right {
get {
object obj = ResourceManager.GetObject("right", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap up {
get {
object obj = ResourceManager.GetObject("up", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
} }
} }

View File

@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
@ -60,6 +60,7 @@
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType> <xsd:complexType>
<xsd:choice maxOccurs="unbounded"> <xsd:choice maxOccurs="unbounded">
@ -68,9 +69,10 @@
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" /> <xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="assembly"> <xsd:element name="assembly">
@ -85,9 +87,10 @@
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="resheader"> <xsd:element name="resheader">
@ -109,9 +112,22 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="down" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="left" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\left.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="right" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\right.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="up" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

View File

@ -1,30 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace HoistingCrane.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HoistingCrane
{
internal class SecondMap : AbstractMap
{
private readonly Brush barrierColor = new SolidBrush(Color.Black);
private readonly Brush roadColor = new SolidBrush(Color.Yellow);
protected override void DrawBarrierPart(Graphics g, int i, int j)
{
g.FillRectangle(barrierColor, i * _size_x, j * _size_y, i * (_size_x + 1), j * (_size_y + 1));
}
protected override void DrawRoadPart(Graphics g, int i, int j)
{
g.FillRectangle(roadColor, i * _size_x, j * _size_y, i * (_size_x + 1), j * (_size_y + 1));
}
protected override void GenerateMap()
{
_map = new int[100, 100];
_size_x = (float)_width / _map.GetLength(0);
_size_y = (float)_height / _map.GetLength(1);
int counter = 0;
for (int i = 0; i < _map.GetLength(0); ++i)
{
for (int j = 0; j < _map.GetLength(1); ++j)
{
_map[i, j] = _freeRoad;
}
}
while (counter < 20)
{
int x = _random.Next(0, 100);
int y = _random.Next(0, 100);
if (_map[x, y] == _freeRoad)
{
_map[x, y] = _barrier;
counter++;
}
}
}
}
}

View File

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HoistingCrane
{
internal class SimpleMap : AbstractMap
{
private readonly Brush barrierColor = new SolidBrush(Color.Black);
private readonly Brush roadColor = new SolidBrush(Color.Gray);
protected override void DrawBarrierPart(Graphics g, int i, int j)
{
g.FillRectangle(barrierColor, i * _size_x, j * _size_y, i * (_size_x + 1), j * (_size_y + 1));
}
protected override void DrawRoadPart(Graphics g, int i, int j)
{
g.FillRectangle(roadColor, i * _size_x, j * _size_y, i * (_size_x + 1), j * (_size_y + 1));
}
protected override void GenerateMap()
{
_map = new int[100, 100];
_size_x = (float)_width / _map.GetLength(0);
_size_y = (float)_height / _map.GetLength(1);
int counter = 0;
for (int i = 0; i < _map.GetLength(0); ++i)
{
for (int j = 0; j < _map.GetLength(1); ++j)
{
_map[i, j] = _freeRoad;
}
}
while (counter < 50)
{
int x = _random.Next(0, 100);
int y = _random.Next(0, 100);
if (_map[x, y] == _freeRoad)
{
_map[x, y] = _barrier;
counter++;
}
}
}
}
}