diff --git a/AccordionBus/AccordionBus/DrawningBus.cs b/AccordionBus/AccordionBus/DrawningBus.cs
index 04898e3..49f6e09 100644
--- a/AccordionBus/AccordionBus/DrawningBus.cs
+++ b/AccordionBus/AccordionBus/DrawningBus.cs
@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Reflection.Metadata.Ecma335;
using System.Text;
using System.Threading.Tasks;
@@ -190,5 +191,13 @@ namespace AccordionBus
_startPosY = _pictureHeight.Value - _busHeight;
}
}
+ ///
+ /// Получение текущей позиции объекта
+ ///
+ ///
+ public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
+ {
+ return (_startPosX, _startPosY, _startPosX + _busWidth, _startPosY + _busHeight);
+ }
}
}
\ No newline at end of file
diff --git a/AccordionBus/AccordionBus/DrawningObjectBus.cs b/AccordionBus/AccordionBus/DrawningObjectBus.cs
new file mode 100644
index 0000000..41b7d73
--- /dev/null
+++ b/AccordionBus/AccordionBus/DrawningObjectBus.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AccordionBus
+{
+ internal class DrawningObjectBus : IDrawningObject
+ {
+ public DrawningBus _bus = null;
+
+ public DrawningObjectBus(DrawningBus bus)
+ {
+ _bus = bus;
+ }
+ public float Step => _bus?.Bus?.Step ?? 0;
+
+ public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
+ {
+ return _bus?.GetCurrentPosition() ?? default;
+ }
+
+ public void MoveObject(Direction direction)
+ {
+ _bus?.MoveTransport(direction);
+ }
+
+ public void SetObject(int x, int y, int width, int height)
+ {
+ _bus.SetPosition(x, y, width, height);
+ }
+
+ void IDrawningObject.DrawningObject(Graphics g)
+ {
+ _bus?.DrawTransport(g);
+ }
+ }
+}
diff --git a/AccordionBus/AccordionBus/IDrawningObject.cs b/AccordionBus/AccordionBus/IDrawningObject.cs
new file mode 100644
index 0000000..a9136d8
--- /dev/null
+++ b/AccordionBus/AccordionBus/IDrawningObject.cs
@@ -0,0 +1,44 @@
+using AccordionBus;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AccordionBus
+{
+ ///
+ /// Интерфейс для работы с объектом, прорисовываемым на форме
+ ///
+ internal interface IDrawningObject
+ {
+ ///
+ /// Шаг перемещения объекта
+ ///
+ public float Step { get; }
+ ///
+ /// Установка позиции объекта
+ ///
+ /// Координата X
+ /// Координата Y
+ /// Ширина полотна
+ /// Высота полотна
+ void SetObject(int x, int y, int width, int height);
+ ///
+ /// Изменение направления перемещения объекта
+ ///
+ /// Направление
+ ///
+ void MoveObject(Direction direction);
+ ///
+ /// Отрисовка объекта
+ ///
+ ///
+ void DrawningObject(Graphics g);
+ ///
+ /// Получение текущей позиции объекта
+ ///
+ ///
+ (float Left, float Right, float Top, float Bottom) GetCurrentPosition();
+ }
+}