diff --git a/AirBomber/src/AirBomberPackage/DrawingObjectAirBomber.java b/AirBomber/src/AirBomberPackage/DrawingObjectAirBomber.java
index 66ee1b7..b2c78c8 100644
--- a/AirBomber/src/AirBomberPackage/DrawingObjectAirBomber.java
+++ b/AirBomber/src/AirBomberPackage/DrawingObjectAirBomber.java
@@ -57,4 +57,14 @@ public class DrawingObjectAirBomber implements IDrawingObject {
_airBomber.DrawTransport(g);
}
}
+
+ @Override
+ public String GetInfo() {
+ if (_airBomber != null) return ExtentionAirBomber.ExtentionedAirBomber.GetDataForSave(_airBomber);
+ else return "";
+ }
+
+ public static IDrawingObject Create(String data){
+ return new DrawingObjectAirBomber(ExtentionAirBomber.ExtentionedAirBomber.CreateDrawningAirBomber(data));
+ }
}
diff --git a/AirBomber/src/AirBomberPackage/ExtentionAirBomber.java b/AirBomber/src/AirBomberPackage/ExtentionAirBomber.java
new file mode 100644
index 0000000..5145857
--- /dev/null
+++ b/AirBomber/src/AirBomberPackage/ExtentionAirBomber.java
@@ -0,0 +1,77 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
+ */
+package AirBomberPackage;
+
+import java.awt.Color;
+
+/**
+ *
+ * @author Андрей
+ */
+public class ExtentionAirBomber{
+ public static class ExtentionedAirBomber {
+ ///
+ /// Разделитель для записи информации по объекту в файл
+ ///
+ private static String _separatorForObject = ":";
+ ///
+ /// Создание объекта из строки
+ ///
+ ///
+ ///
+ public static DrawingAirBomber CreateDrawningAirBomber(String info)
+ {
+ String[] strs = info.split(_separatorForObject);
+ if (strs.length == 7) //заменить на передачу RGB
+ {
+ EnginesType enginesType = null;
+ switch (strs[6]) {
+ case "DrawingEngines":
+ enginesType = EnginesType.RECTANGLE;
+ break;
+ case "DrawingEnginesTriangle":
+ enginesType = EnginesType.TRIANGLE;
+ break;
+ case "DrawingEnginesOval":
+ enginesType = EnginesType.OVAL;
+ break;
+ }
+ return new DrawingAirBomber(Integer.parseInt(strs[0]),
+ Integer.parseInt(strs[1]), new Color(Integer.parseInt(strs[2]), Integer.parseInt(strs[3]), Integer.parseInt(strs[4])), Integer.parseInt(strs[5]), enginesType);
+ }
+ if (strs.length == 13)
+ {
+ EnginesType enginesType = null;
+ switch (strs[6]) {
+ case "DrawingEngines":
+ enginesType = EnginesType.RECTANGLE;
+ break;
+ case "DrawingEnginesTriangle":
+ enginesType = EnginesType.TRIANGLE;
+ break;
+ case "DrawingEnginesOval":
+ enginesType = EnginesType.OVAL;
+ break;
+ }
+ return new DrawingHeavyAirBomber(Integer.parseInt(strs[0]), Float.parseFloat(strs[1]),
+ new Color(Integer.parseInt(strs[2]), Integer.parseInt(strs[3]),Integer.parseInt(strs[4])),
+ Integer.parseInt(strs[5]), enginesType,
+ new Color(Integer.parseInt(strs[7]), Integer.parseInt(strs[8]), Integer.parseInt(strs[9])),
+ Boolean.parseBoolean(strs[10]),Boolean.parseBoolean(strs[11]), Boolean.parseBoolean(strs[12]));
+ }
+ return null;
+ }
+ public static String GetDataForSave(DrawingAirBomber drawningAirBomber)
+ {
+ var airBomber = drawningAirBomber.AirBomber;
+ var str = String.format("%s%s%s%s%s%s%s%s%s%s%s%s%s", airBomber.getSpeed(), _separatorForObject, Math.round(airBomber.getWeight()), _separatorForObject, airBomber.getBodyColor().getRed(), _separatorForObject, airBomber.getBodyColor().getGreen(), _separatorForObject, airBomber.getBodyColor().getBlue(), _separatorForObject, drawningAirBomber.drawingEngines.getNumberOfEngines(), _separatorForObject, drawningAirBomber.drawingEngines.getClass().getSimpleName());
+ if (airBomber instanceof EntityHeavyAirBomber heavyAirBomber)
+ {
+ return String.format("%s%s%s%s%s%s%s%s%s%s%s%s%s", str,_separatorForObject,heavyAirBomber.getDopColor().getRed(),_separatorForObject, heavyAirBomber.getDopColor().getGreen(), _separatorForObject, heavyAirBomber.getDopColor().getBlue(), _separatorForObject, heavyAirBomber.getBombs(), _separatorForObject, heavyAirBomber.getFuelTank(), _separatorForObject, heavyAirBomber.getTailLine());
+ }
+ else return str;
+ }
+ }
+}
diff --git a/AirBomber/src/AirBomberPackage/IDrawingObject.java b/AirBomber/src/AirBomberPackage/IDrawingObject.java
index ba533bc..104bf8c 100644
--- a/AirBomber/src/AirBomberPackage/IDrawingObject.java
+++ b/AirBomber/src/AirBomberPackage/IDrawingObject.java
@@ -37,4 +37,6 @@ public interface IDrawingObject {
///
///
float[] GetCurrentPosition();
+
+ String GetInfo();
}
diff --git a/AirBomber/src/AirBomberPackage/JFrameMapWithSetAirBombers.form b/AirBomber/src/AirBomberPackage/JFrameMapWithSetAirBombers.form
index 6a13a04..b5b3911 100644
--- a/AirBomber/src/AirBomberPackage/JFrameMapWithSetAirBombers.form
+++ b/AirBomber/src/AirBomberPackage/JFrameMapWithSetAirBombers.form
@@ -1,10 +1,58 @@