Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6663b98a92 | ||
|
|
015b2df664 | ||
|
|
dcdcdaaa20 |
71
AircraftFactory.java
Normal file
71
AircraftFactory.java
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
import java.awt.*;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class AircraftFactory {
|
||||||
|
private static char _separatorForObject = ':';
|
||||||
|
private static Color convertStrToColor(String str) {
|
||||||
|
String color[] = str.split(",");
|
||||||
|
int r = Integer.parseInt(color[0]);
|
||||||
|
int g = Integer.parseInt(color[1]);
|
||||||
|
int b = Integer.parseInt(color[2]);
|
||||||
|
|
||||||
|
return new Color(r, g, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DrawingAircraft createAircraftFromData(String data) {
|
||||||
|
String strsArr[] = data.split(_separatorForObject + "");
|
||||||
|
|
||||||
|
DrawingAircraft result;
|
||||||
|
IDrawingEngines engines;
|
||||||
|
|
||||||
|
switch(strsArr[3]) {
|
||||||
|
case "DrawingTruncatedEngines":
|
||||||
|
engines = new DrawingTruncatedEngines(Integer.parseInt(strsArr[4]), convertStrToColor(strsArr[5]));
|
||||||
|
break;
|
||||||
|
case "DrawingWavyEngines":
|
||||||
|
engines = new DrawingWavyEngines(Integer.parseInt(strsArr[4]), convertStrToColor(strsArr[5]));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
engines = new DrawingEngines(Integer.parseInt(strsArr[4]), convertStrToColor(strsArr[5]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strsArr.length == 9) {
|
||||||
|
result = new DrawingModernAircraft(
|
||||||
|
Integer.parseInt(strsArr[0]), Float.parseFloat(strsArr[1]), convertStrToColor(strsArr[2]),
|
||||||
|
convertStrToColor(strsArr[6]), Objects.equals(strsArr[8], "true"), Objects.equals(strsArr[7], "true")
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
result = new DrawingAircraft(
|
||||||
|
Integer.parseInt(strsArr[0]), Float.parseFloat(strsArr[1]), convertStrToColor(strsArr[2])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
result.setEngines(engines);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDataForSave(DrawingAircraft drawingAircraft) {
|
||||||
|
EntityAircraft aircraft = drawingAircraft.AirFighter;
|
||||||
|
|
||||||
|
String res = aircraft.Speed + "" + _separatorForObject;
|
||||||
|
res += aircraft.Weight + "" + _separatorForObject;
|
||||||
|
res += aircraft.BodyColor.getRed() + "," + aircraft.BodyColor.getGreen() + "," + aircraft.BodyColor.getBlue();
|
||||||
|
res += _separatorForObject;
|
||||||
|
|
||||||
|
IDrawingEngines engines = drawingAircraft.getEngines();
|
||||||
|
|
||||||
|
res += engines.getClass().getName() + _separatorForObject;
|
||||||
|
res += engines.getCount() + "" + _separatorForObject;
|
||||||
|
res += engines.getColor().getRed() + "," + engines.getColor().getGreen() + "," + engines.getColor().getBlue();
|
||||||
|
|
||||||
|
if(aircraft instanceof EntityModernAircraft a) {
|
||||||
|
res += _separatorForObject;
|
||||||
|
res += a.DopColor.getRed() + "," + a.DopColor.getGreen() + "," + a.DopColor.getBlue();
|
||||||
|
res += _separatorForObject;
|
||||||
|
res += a.Rockets + "" + _separatorForObject;
|
||||||
|
res += a.DopWings + "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -51,6 +51,21 @@ class DrawingAircraft
|
|||||||
_airFighterHeight = airFighterHeight;
|
_airFighterHeight = airFighterHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setEngines(IDrawingEngines engines) {
|
||||||
|
drawingEngines = engines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IDrawingEngines getEngines() {
|
||||||
|
return drawingEngines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColor(Color color) {
|
||||||
|
AirFighter.BodyColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color getColor() {
|
||||||
|
return AirFighter.BodyColor;
|
||||||
|
}
|
||||||
|
|
||||||
public void SetPosition(int x, int y, int width, int height)
|
public void SetPosition(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,6 +16,23 @@ public class DrawingEngines implements IDrawingEngines {
|
|||||||
else enginesCount = EnginesCount.Four;
|
else enginesCount = EnginesCount.Four;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setColor(Color color) {
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
if(enginesCount == EnginesCount.Two) return 2;
|
||||||
|
if(enginesCount == EnginesCount.Four) return 4;
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
public void draw(Graphics2D g, int startPosX, int startPosY) {
|
public void draw(Graphics2D g, int startPosX, int startPosY) {
|
||||||
g.setPaint(color);
|
g.setPaint(color);
|
||||||
g.fillOval(startPosX + 80, startPosY + 10, 30, 15);
|
g.fillOval(startPosX + 80, startPosY + 10, 30, 15);
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ public class DrawingModernAircraft extends DrawingAircraft
|
|||||||
super(speed, weight, bodyColor, 195, 166);
|
super(speed, weight, bodyColor, 195, 166);
|
||||||
AirFighter = new EntityModernAircraft(speed, weight, bodyColor, dopColor, dopWings, rockets);
|
AirFighter = new EntityModernAircraft(speed, weight, bodyColor, dopColor, dopWings, rockets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDopColor(Color color) {
|
||||||
|
((EntityModernAircraft)AirFighter).DopColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void DrawTransport(Graphics2D g)
|
public void DrawTransport(Graphics2D g)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,4 +43,13 @@ public class DrawingObjectAircraft implements IDrawingObject
|
|||||||
if(_aircraft == null) return new Point(0,0);
|
if(_aircraft == null) return new Point(0,0);
|
||||||
return _aircraft.getRightBottom();
|
return _aircraft.getRightBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetInfo() {
|
||||||
|
return AircraftFactory.getDataForSave(_aircraft);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DrawingObjectAircraft Create(String data) {
|
||||||
|
return new DrawingObjectAircraft(AircraftFactory.createAircraftFromData(data));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,23 @@ public class DrawingTruncatedEngines implements IDrawingEngines {
|
|||||||
else enginesCount = EnginesCount.Four;
|
else enginesCount = EnginesCount.Four;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setColor(Color color) {
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
if(enginesCount == EnginesCount.Two) return 2;
|
||||||
|
if(enginesCount == EnginesCount.Four) return 4;
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
public void draw(Graphics2D g, int startPosX, int startPosY) {
|
public void draw(Graphics2D g, int startPosX, int startPosY) {
|
||||||
g.setPaint(color);
|
g.setPaint(color);
|
||||||
g.fillArc(startPosX + 90, startPosY + 10, 30, 15, 90, 180);
|
g.fillArc(startPosX + 90, startPosY + 10, 30, 15, 90, 180);
|
||||||
|
|||||||
@@ -16,6 +16,23 @@ public class DrawingWavyEngines implements IDrawingEngines {
|
|||||||
else enginesCount = EnginesCount.Four;
|
else enginesCount = EnginesCount.Four;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setColor(Color color) {
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
if(enginesCount == EnginesCount.Two) return 2;
|
||||||
|
if(enginesCount == EnginesCount.Four) return 4;
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
private void drawEngine(Graphics2D g, int x, int y) {
|
private void drawEngine(Graphics2D g, int x, int y) {
|
||||||
g.setColor(color);
|
g.setColor(color);
|
||||||
g.fillRect(x, y, 21, 10);
|
g.fillRect(x, y, 21, 10);
|
||||||
|
|||||||
478
FormAircraftConfig.form
Normal file
478
FormAircraftConfig.form
Normal file
@@ -0,0 +1,478 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="FormAircraftConfig">
|
||||||
|
<grid id="27dc6" binding="mainPane" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<xy x="20" y="20" width="813" height="425"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<grid id="11ed" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<grid id="6bdf" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<grid id="b99b4" layout-manager="GridLayoutManager" row-count="4" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none" title="Параметры самолета"/>
|
||||||
|
<children>
|
||||||
|
<grid id="bf610" binding="colorsPane" layout-manager="GridLayoutManager" row-count="2" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||||
|
<minimum-size width="250" height="130"/>
|
||||||
|
<preferred-size width="250" height="130"/>
|
||||||
|
<maximum-size width="250" height="130"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none" title="Цвета"/>
|
||||||
|
<children>
|
||||||
|
<grid id="b0657" binding="panelRed" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<background color="-4389370"/>
|
||||||
|
</properties>
|
||||||
|
<border type="none"/>
|
||||||
|
<children/>
|
||||||
|
</grid>
|
||||||
|
<grid id="454fe" binding="panelYellow" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<background color="-7414"/>
|
||||||
|
</properties>
|
||||||
|
<border type="none"/>
|
||||||
|
<children/>
|
||||||
|
</grid>
|
||||||
|
<grid id="acb3b" binding="panelGreen" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<background color="-16408064"/>
|
||||||
|
</properties>
|
||||||
|
<border type="none"/>
|
||||||
|
<children/>
|
||||||
|
</grid>
|
||||||
|
<grid id="e10ed" binding="panelBlue" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<background color="-14474274"/>
|
||||||
|
</properties>
|
||||||
|
<border type="none"/>
|
||||||
|
<children/>
|
||||||
|
</grid>
|
||||||
|
<grid id="6a752" binding="panelWhite" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<background color="-1"/>
|
||||||
|
</properties>
|
||||||
|
<border type="none"/>
|
||||||
|
<children/>
|
||||||
|
</grid>
|
||||||
|
<grid id="4650b" binding="panelGray" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<background color="-5723992"/>
|
||||||
|
</properties>
|
||||||
|
<border type="none"/>
|
||||||
|
<children/>
|
||||||
|
</grid>
|
||||||
|
<grid id="37a23" binding="panelBlack" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<background color="-16777216"/>
|
||||||
|
</properties>
|
||||||
|
<border type="none"/>
|
||||||
|
<children/>
|
||||||
|
</grid>
|
||||||
|
<grid id="6424" binding="panelPurple" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="3" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<background color="-5166919"/>
|
||||||
|
</properties>
|
||||||
|
<border type="none"/>
|
||||||
|
<children/>
|
||||||
|
</grid>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
<hspacer id="acd9a">
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
</hspacer>
|
||||||
|
<grid id="f9e1b" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||||
|
<minimum-size width="130" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<component id="290f9" class="javax.swing.JSpinner" binding="spinnerSpeed">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
</component>
|
||||||
|
<component id="76346" class="javax.swing.JSpinner" binding="spinnerWeight">
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
</component>
|
||||||
|
<component id="f3384" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Скорость: "/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="28dee" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Вес:"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
<vspacer id="15d55">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
</vspacer>
|
||||||
|
<grid id="7ab15" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<grid id="add02" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="line"/>
|
||||||
|
<children>
|
||||||
|
<component id="30e35" class="javax.swing.JLabel" binding="labelBase">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<font size="16"/>
|
||||||
|
<horizontalAlignment value="0"/>
|
||||||
|
<horizontalTextPosition value="0"/>
|
||||||
|
<text value="Простой"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
<grid id="28265" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="line"/>
|
||||||
|
<children>
|
||||||
|
<component id="72db3" class="javax.swing.JLabel" binding="labelAdvanced">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<font size="16"/>
|
||||||
|
<horizontalAlignment value="0"/>
|
||||||
|
<horizontalTextPosition value="0"/>
|
||||||
|
<text value="Продвинутый"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
<grid id="12688" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<component id="e5986" class="javax.swing.JCheckBox" binding="checkboxDopWings">
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Дополнительные крылья"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="cfe9b" class="javax.swing.JCheckBox" binding="checkboxRockets">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="ракеты"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
<vspacer id="18b96">
|
||||||
|
<constraints>
|
||||||
|
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
</vspacer>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
<grid id="6e579" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none" title="Параметры двигателей"/>
|
||||||
|
<children>
|
||||||
|
<grid id="b79df" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<component id="8c10b" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Количество двигателей:"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="609e1" class="javax.swing.JSpinner" binding="spinnerEnginesCount">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||||
|
<maximum-size width="100" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
<grid id="83f65" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<grid id="28e30" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="line"/>
|
||||||
|
<children>
|
||||||
|
<component id="f884f" class="javax.swing.JLabel" binding="labelTruncatedEngine">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<font size="16"/>
|
||||||
|
<horizontalAlignment value="0"/>
|
||||||
|
<text value="Усеченный"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
<grid id="96986" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="line"/>
|
||||||
|
<children>
|
||||||
|
<component id="492da" class="javax.swing.JLabel" binding="labelWavyEngine">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<font size="16"/>
|
||||||
|
<horizontalAlignment value="0"/>
|
||||||
|
<text value="Волнистый"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
<grid id="5bd24" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="line"/>
|
||||||
|
<children>
|
||||||
|
<component id="43319" class="javax.swing.JLabel" binding="labelBaseEngine">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<font size="16"/>
|
||||||
|
<horizontalAlignment value="0"/>
|
||||||
|
<text value="Простой"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
<grid id="1e193" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||||
|
<minimum-size width="300" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none" title="Превью"/>
|
||||||
|
<children>
|
||||||
|
<grid id="c4ea7" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<grid id="b8c0b" binding="panelBaseColor" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||||
|
<minimum-size width="-1" height="50"/>
|
||||||
|
<maximum-size width="-1" height="50"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="line"/>
|
||||||
|
<children>
|
||||||
|
<component id="b477" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<font size="16"/>
|
||||||
|
<horizontalAlignment value="0"/>
|
||||||
|
<text value="Цвет"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
<grid id="e2d48" binding="panelDopColor" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||||
|
<minimum-size width="-1" height="50"/>
|
||||||
|
<maximum-size width="-1" height="50"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="line"/>
|
||||||
|
<children>
|
||||||
|
<component id="13ad3" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<font size="16"/>
|
||||||
|
<horizontalAlignment value="0"/>
|
||||||
|
<text value="Доп. цвет"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
<grid id="74d53" binding="panelDraw" layout-manager="CardLayout" hgap="0" vgap="0">
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||||
|
<minimum-size width="-1" height="300"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="line"/>
|
||||||
|
<children/>
|
||||||
|
</grid>
|
||||||
|
<component id="14b28" class="javax.swing.JButton" binding="buttonAdd">
|
||||||
|
<constraints>
|
||||||
|
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Добавить"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="7f448" class="javax.swing.JButton" binding="buttonCancel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Отмена"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
</form>
|
||||||
171
FormAircraftConfig.java
Normal file
171
FormAircraftConfig.java
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
public class FormAircraftConfig implements Form {
|
||||||
|
private JPanel mainPane;
|
||||||
|
private JSpinner spinnerSpeed;
|
||||||
|
private JSpinner spinnerWeight;
|
||||||
|
private JPanel colorsPane;
|
||||||
|
private JCheckBox checkboxDopWings;
|
||||||
|
private JCheckBox checkboxRockets;
|
||||||
|
private JSpinner spinnerEnginesCount;
|
||||||
|
private JButton buttonAdd;
|
||||||
|
private JButton buttonCancel;
|
||||||
|
private JPanel panelRed;
|
||||||
|
private JPanel panelYellow;
|
||||||
|
private JPanel panelGreen;
|
||||||
|
private JPanel panelBlue;
|
||||||
|
private JPanel panelWhite;
|
||||||
|
private JPanel panelGray;
|
||||||
|
private JPanel panelBlack;
|
||||||
|
private JPanel panelPurple;
|
||||||
|
private JPanel panelBaseColor;
|
||||||
|
private JPanel panelDopColor;
|
||||||
|
private JPanel panelDraw;
|
||||||
|
private JLabel labelBase;
|
||||||
|
private JLabel labelAdvanced;
|
||||||
|
private JLabel labelTruncatedEngine;
|
||||||
|
private JLabel labelWavyEngine;
|
||||||
|
private JLabel labelBaseEngine;
|
||||||
|
|
||||||
|
private JFrame jframe = getFrame();
|
||||||
|
private DrawingAircraft aircraft;
|
||||||
|
private boolean isMousePressed = false;
|
||||||
|
private Canvas canv = new Canvas(this);
|
||||||
|
private ArrayList<Consumer<DrawingAircraft>> listeners = new ArrayList<>();
|
||||||
|
|
||||||
|
private JFrame getFrame() {
|
||||||
|
JFrame frame = new JFrame();
|
||||||
|
frame.setVisible(true);
|
||||||
|
frame.setBounds(300, 100, 800, 500);
|
||||||
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addListener(Consumer<DrawingAircraft> l) {
|
||||||
|
listeners.add(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
jframe.add(mainPane);
|
||||||
|
panelDraw.add(canv);
|
||||||
|
|
||||||
|
buttonAdd.addActionListener(e -> {
|
||||||
|
jframe.dispose();
|
||||||
|
for(var l : listeners) l.accept(aircraft);
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonCancel.addActionListener(e -> jframe.dispose());
|
||||||
|
|
||||||
|
MouseAdapter mouseHandler = new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mouseEntered(MouseEvent e) {
|
||||||
|
super.mouseEntered(e);
|
||||||
|
jframe.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseExited(MouseEvent e) {
|
||||||
|
super.mouseExited(e);
|
||||||
|
if(!isMousePressed) jframe.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mousePressed(MouseEvent e) {
|
||||||
|
super.mousePressed(e);
|
||||||
|
isMousePressed = true;
|
||||||
|
jframe.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseReleased(MouseEvent e) {
|
||||||
|
super.mouseReleased(e);
|
||||||
|
isMousePressed = false;
|
||||||
|
jframe.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||||
|
drop((JComponent) e.getSource());
|
||||||
|
canv.repaint();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
spinnerSpeed.setModel(new SpinnerNumberModel(100, 70, 200, 1));
|
||||||
|
spinnerWeight.setModel(new SpinnerNumberModel(700, 600, 1500, 1));
|
||||||
|
spinnerEnginesCount.setModel(new SpinnerNumberModel(4, 2, 6, 2));
|
||||||
|
|
||||||
|
panelRed.addMouseListener(mouseHandler);
|
||||||
|
panelYellow.addMouseListener(mouseHandler);
|
||||||
|
panelGreen.addMouseListener(mouseHandler);
|
||||||
|
panelBlue.addMouseListener(mouseHandler);
|
||||||
|
panelWhite.addMouseListener(mouseHandler);
|
||||||
|
panelGray.addMouseListener(mouseHandler);
|
||||||
|
panelBlack.addMouseListener(mouseHandler);
|
||||||
|
panelPurple.addMouseListener(mouseHandler);
|
||||||
|
|
||||||
|
labelBase.addMouseListener(mouseHandler);
|
||||||
|
labelAdvanced.addMouseListener(mouseHandler);
|
||||||
|
|
||||||
|
labelTruncatedEngine.addMouseListener(mouseHandler);
|
||||||
|
labelWavyEngine.addMouseListener(mouseHandler);
|
||||||
|
labelBaseEngine.addMouseListener(mouseHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drop(JComponent elem) {
|
||||||
|
if(elem instanceof JPanel panel) {
|
||||||
|
if(aircraft == null) return;
|
||||||
|
if(panelBaseColor.getMousePosition() != null) {
|
||||||
|
aircraft.setColor(panel.getBackground());
|
||||||
|
aircraft.getEngines().setColor(panel.getBackground());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(panelDopColor.getMousePosition() != null && aircraft instanceof DrawingModernAircraft advanced) {
|
||||||
|
advanced.setDopColor(panel.getBackground());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Point test = panelDraw.getMousePosition();
|
||||||
|
|
||||||
|
if(elem instanceof JLabel label && test != null) {
|
||||||
|
int speed = (int)spinnerSpeed.getValue();
|
||||||
|
int weight = (int)spinnerWeight.getValue();
|
||||||
|
int enginesCount = (int)spinnerEnginesCount.getValue();
|
||||||
|
|
||||||
|
if(label == labelBase) {
|
||||||
|
aircraft = new DrawingAircraft(speed, weight, Color.WHITE);
|
||||||
|
aircraft.SetPosition(20, 40, canv.getWidth(), canv.getHeight());
|
||||||
|
|
||||||
|
aircraft.getEngines().setCount(enginesCount);
|
||||||
|
aircraft.getEngines().setColor(Color.WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(label == labelAdvanced) {
|
||||||
|
aircraft = new DrawingModernAircraft(speed, weight, Color.WHITE, Color.BLACK,
|
||||||
|
checkboxDopWings.isSelected(), checkboxRockets.isSelected());
|
||||||
|
|
||||||
|
aircraft.SetPosition(10, 10, canv.getWidth(), canv.getHeight());
|
||||||
|
aircraft.getEngines().setCount(enginesCount);
|
||||||
|
aircraft.getEngines().setColor(Color.WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(aircraft == null) return;
|
||||||
|
|
||||||
|
if(label == labelBaseEngine) {
|
||||||
|
aircraft.setEngines(new DrawingEngines(enginesCount, aircraft.getColor()));
|
||||||
|
}
|
||||||
|
if(label == labelTruncatedEngine) {
|
||||||
|
aircraft.setEngines(new DrawingTruncatedEngines(enginesCount, aircraft.getColor()));
|
||||||
|
}
|
||||||
|
if(label == labelWavyEngine) {
|
||||||
|
aircraft.setEngines(new DrawingWavyEngines(enginesCount, aircraft.getColor()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Draw(Graphics2D g) {
|
||||||
|
if(aircraft == null) return;
|
||||||
|
aircraft.DrawTransport(g);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -22,6 +23,8 @@ public class FormMapWithSetAircrafts implements Form {
|
|||||||
private JButton buttonDeleteMap;
|
private JButton buttonDeleteMap;
|
||||||
private JButton buttonShowDeleted;
|
private JButton buttonShowDeleted;
|
||||||
|
|
||||||
|
private JMenuBar menu;
|
||||||
|
|
||||||
private MapsCollection _mapsCollection;
|
private MapsCollection _mapsCollection;
|
||||||
private HashMap<String, AbstractMap> _mapsDict = new HashMap<>(){{
|
private HashMap<String, AbstractMap> _mapsDict = new HashMap<>(){{
|
||||||
put( "Простая карта", new SimpleMap() );
|
put( "Простая карта", new SimpleMap() );
|
||||||
@@ -62,6 +65,83 @@ public class FormMapWithSetAircrafts implements Form {
|
|||||||
|
|
||||||
jFrame.revalidate();
|
jFrame.revalidate();
|
||||||
|
|
||||||
|
menu = new JMenuBar();
|
||||||
|
JMenu fileActions = new JMenu("Файл");
|
||||||
|
|
||||||
|
menu.add(fileActions);
|
||||||
|
jFrame.setJMenuBar(menu);
|
||||||
|
|
||||||
|
JMenuItem saveItem = new JMenuItem("Сохранить");
|
||||||
|
JMenuItem loadItem = new JMenuItem("Загрузить");
|
||||||
|
JMenuItem saveMapItem = new JMenuItem("Сохранить карту");
|
||||||
|
JMenuItem loadMapItem = new JMenuItem("Загрузить карту");
|
||||||
|
|
||||||
|
fileActions.add(saveItem);
|
||||||
|
fileActions.add(loadItem);
|
||||||
|
fileActions.add(saveMapItem);
|
||||||
|
fileActions.add(loadMapItem);
|
||||||
|
|
||||||
|
saveItem.addActionListener(e -> {
|
||||||
|
JFileChooser chooser = new JFileChooser();
|
||||||
|
chooser.setFileFilter(new FileNameExtensionFilter("TXT format", "txt"));
|
||||||
|
chooser.showSaveDialog(jFrame);
|
||||||
|
|
||||||
|
if(chooser.getSelectedFile() == null) return;
|
||||||
|
|
||||||
|
String path = chooser.getSelectedFile().getAbsolutePath();
|
||||||
|
|
||||||
|
if(_mapsCollection.SaveData(path)) {
|
||||||
|
JOptionPane.showMessageDialog(jFrame, "Сохранение прошло успешно");
|
||||||
|
} else JOptionPane.showMessageDialog(jFrame, "Не сохранилось");
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
loadItem.addActionListener(e -> {
|
||||||
|
JFileChooser chooser = new JFileChooser();
|
||||||
|
chooser.setFileFilter(new FileNameExtensionFilter("TXT format", "txt"));
|
||||||
|
chooser.showOpenDialog(jFrame);
|
||||||
|
|
||||||
|
if(chooser.getSelectedFile() == null) return;
|
||||||
|
|
||||||
|
String path = chooser.getSelectedFile().getAbsolutePath();
|
||||||
|
if(_mapsCollection.LoadData(path)) {
|
||||||
|
JOptionPane.showMessageDialog(jFrame, "Загрузка прошла успешно");
|
||||||
|
ReloadMaps();
|
||||||
|
} else JOptionPane.showMessageDialog(jFrame, "Не загрузилось");
|
||||||
|
});
|
||||||
|
|
||||||
|
saveMapItem.addActionListener(e -> {
|
||||||
|
if(_mapsCollection == null) return;
|
||||||
|
if(listBoxMaps.getSelectedValue() == null) return;
|
||||||
|
|
||||||
|
JFileChooser chooser = new JFileChooser();
|
||||||
|
chooser.setFileFilter(new FileNameExtensionFilter("TXT format", "txt"));
|
||||||
|
chooser.showSaveDialog(jFrame);
|
||||||
|
|
||||||
|
if(chooser.getSelectedFile() == null) return;
|
||||||
|
|
||||||
|
String path = chooser.getSelectedFile().getAbsolutePath();
|
||||||
|
|
||||||
|
if(_mapsCollection.SaveMap(path, listBoxMaps.getSelectedValue().toString())) {
|
||||||
|
JOptionPane.showMessageDialog(jFrame, "Сохранение прошло успешно");
|
||||||
|
} else JOptionPane.showMessageDialog(jFrame, "Не сохранилось");
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
loadMapItem.addActionListener(e -> {
|
||||||
|
JFileChooser chooser = new JFileChooser();
|
||||||
|
chooser.setFileFilter(new FileNameExtensionFilter("TXT format", "txt"));
|
||||||
|
chooser.showOpenDialog(jFrame);
|
||||||
|
|
||||||
|
if(chooser.getSelectedFile() == null) return;
|
||||||
|
|
||||||
|
String path = chooser.getSelectedFile().getAbsolutePath();
|
||||||
|
if(_mapsCollection.LoadMap(path)) {
|
||||||
|
JOptionPane.showMessageDialog(jFrame, "Загрузка прошла успешно");
|
||||||
|
ReloadMaps();
|
||||||
|
} else JOptionPane.showMessageDialog(jFrame, "Не загрузилось");
|
||||||
|
});
|
||||||
|
|
||||||
_mapsCollection = new MapsCollection(canv.getSize().width, canv.getSize().height);
|
_mapsCollection = new MapsCollection(canv.getSize().width, canv.getSize().height);
|
||||||
comboBoxSelectorMap.removeAllItems();
|
comboBoxSelectorMap.removeAllItems();
|
||||||
|
|
||||||
@@ -114,17 +194,13 @@ public class FormMapWithSetAircrafts implements Form {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FormAircraft dialog = new FormAircraft();
|
FormAircraftConfig formConfig = new FormAircraftConfig();
|
||||||
dialog.run();
|
formConfig.run();
|
||||||
dialog.setSize(800, 500);
|
|
||||||
dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
|
|
||||||
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
|
||||||
|
|
||||||
dialog.setVisible(true);
|
formConfig.addListener(drawingAircraft -> {
|
||||||
|
if(drawingAircraft == null) return;
|
||||||
|
|
||||||
if (dialog.getSelectedAircraft() == null) return;
|
DrawingObjectAircraft aircraft = new DrawingObjectAircraft(drawingAircraft);
|
||||||
|
|
||||||
DrawingObjectAircraft aircraft = new DrawingObjectAircraft(dialog.getSelectedAircraft());
|
|
||||||
if (_mapsCollection.getMap(listBoxMaps.getSelectedValue().toString()).addAircraft(aircraft) != -1)
|
if (_mapsCollection.getMap(listBoxMaps.getSelectedValue().toString()).addAircraft(aircraft) != -1)
|
||||||
{
|
{
|
||||||
JOptionPane.showMessageDialog(jFrame, "Объект добавлен");
|
JOptionPane.showMessageDialog(jFrame, "Объект добавлен");
|
||||||
@@ -136,6 +212,7 @@ public class FormMapWithSetAircrafts implements Form {
|
|||||||
JOptionPane.showMessageDialog(jFrame, "Не удалось добавить объект");
|
JOptionPane.showMessageDialog(jFrame, "Не удалось добавить объект");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
buttonRemoveAircraft.addActionListener(e -> {
|
buttonRemoveAircraft.addActionListener(e -> {
|
||||||
String text = textBoxPosition.getText();
|
String text = textBoxPosition.getText();
|
||||||
|
|||||||
@@ -2,5 +2,8 @@ import java.awt.*;
|
|||||||
|
|
||||||
public interface IDrawingEngines {
|
public interface IDrawingEngines {
|
||||||
void setCount(int count);
|
void setCount(int count);
|
||||||
|
void setColor(Color color);
|
||||||
|
int getCount();
|
||||||
|
Color getColor();
|
||||||
void draw(Graphics2D g, int x, int y);
|
void draw(Graphics2D g, int x, int y);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,4 +8,5 @@ public interface IDrawingObject
|
|||||||
void DrawningObject(Graphics2D g);
|
void DrawningObject(Graphics2D g);
|
||||||
Point GetLeftTop();
|
Point GetLeftTop();
|
||||||
Point GetRightBottom();
|
Point GetRightBottom();
|
||||||
|
String GetInfo();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.util.ListIterator;
|
||||||
|
|
||||||
public class MapWithSetAircraftsGeneric<T extends IDrawingObject, U extends AbstractMap>
|
public class MapWithSetAircraftsGeneric<T extends IDrawingObject, U extends AbstractMap>
|
||||||
{
|
{
|
||||||
@@ -7,27 +8,53 @@ public class MapWithSetAircraftsGeneric<T extends IDrawingObject, U extends Abst
|
|||||||
private int _pictureHeight;
|
private int _pictureHeight;
|
||||||
private int _placeSizeWidth = 210;
|
private int _placeSizeWidth = 210;
|
||||||
private int _placeSizeHeight = 170;
|
private int _placeSizeHeight = 170;
|
||||||
private SetAircraftsGeneric<T> _setCars;
|
private SetAircraftsGeneric<T> _setAircrafts;
|
||||||
private U _map;
|
private U _map;
|
||||||
|
|
||||||
public MapWithSetAircraftsGeneric(int picWidth, int picHeight, U map)
|
public MapWithSetAircraftsGeneric(int picWidth, int picHeight, U map)
|
||||||
{
|
{
|
||||||
int width = picWidth / _placeSizeWidth;
|
int width = picWidth / _placeSizeWidth;
|
||||||
int height = picHeight / _placeSizeHeight;
|
int height = picHeight / _placeSizeHeight;
|
||||||
_setCars = new SetAircraftsGeneric<T>(width * height);
|
_setAircrafts = new SetAircraftsGeneric<T>(width * height);
|
||||||
_pictureWidth = picWidth;
|
_pictureWidth = picWidth;
|
||||||
_pictureHeight = picHeight;
|
_pictureHeight = picHeight;
|
||||||
_map = map;
|
_map = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public U getMap() {
|
||||||
|
return _map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String GetData(char separatorType, char separatorData)
|
||||||
|
{
|
||||||
|
String data = _map.getClass().getName() + "" + separatorType;
|
||||||
|
ListIterator<T> iter = _setAircrafts.GetElems();
|
||||||
|
while (iter.hasNext())
|
||||||
|
{
|
||||||
|
data += iter.next().GetInfo() + separatorData;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearMap() {
|
||||||
|
_setAircrafts.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadData(String[] records) {
|
||||||
|
for (String rec : records)
|
||||||
|
{
|
||||||
|
_setAircrafts.Insert((T)DrawingObjectAircraft.Create(rec));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int addAircraft(T aircraft)
|
public int addAircraft(T aircraft)
|
||||||
{
|
{
|
||||||
return _setCars.Insert(aircraft);
|
return _setAircrafts.Insert(aircraft);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T removeAircraft(int position)
|
public T removeAircraft(int position)
|
||||||
{
|
{
|
||||||
return _setCars.Remove(position);
|
return _setAircrafts.Remove(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image ShowSet()
|
public Image ShowSet()
|
||||||
@@ -47,9 +74,9 @@ public class MapWithSetAircraftsGeneric<T extends IDrawingObject, U extends Abst
|
|||||||
Graphics2D g = (Graphics2D) img.getGraphics();
|
Graphics2D g = (Graphics2D) img.getGraphics();
|
||||||
|
|
||||||
Shaking();
|
Shaking();
|
||||||
for (int i = 0; i < _setCars.getCount(); i++)
|
for (int i = 0; i < _setAircrafts.getCount(); i++)
|
||||||
{
|
{
|
||||||
var car = _setCars.Get(i);
|
var car = _setAircrafts.Get(i);
|
||||||
if (car != null)
|
if (car != null)
|
||||||
{
|
{
|
||||||
_map.CreateMap(_pictureWidth, _pictureHeight, car);
|
_map.CreateMap(_pictureWidth, _pictureHeight, car);
|
||||||
@@ -74,20 +101,24 @@ public class MapWithSetAircraftsGeneric<T extends IDrawingObject, U extends Abst
|
|||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ListIterator<T> getAircraftsIter() {
|
||||||
|
return _setAircrafts.GetElems();
|
||||||
|
}
|
||||||
|
|
||||||
private void Shaking()
|
private void Shaking()
|
||||||
{
|
{
|
||||||
int j = _setCars.getCount() - 1;
|
int j = _setAircrafts.getCount() - 1;
|
||||||
for (int i = 0; i < _setCars.getCount(); i++)
|
for (int i = 0; i < _setAircrafts.getCount(); i++)
|
||||||
{
|
{
|
||||||
if (_setCars.Get(i) == null)
|
if (_setAircrafts.Get(i) == null)
|
||||||
{
|
{
|
||||||
for (; j > i; j--)
|
for (; j > i; j--)
|
||||||
{
|
{
|
||||||
var car = _setCars.Get(j);
|
var car = _setAircrafts.Get(j);
|
||||||
if (car != null)
|
if (car != null)
|
||||||
{
|
{
|
||||||
_setCars.Insert(car, i);
|
_setAircrafts.Insert(car, i);
|
||||||
_setCars.Remove(j);
|
_setAircrafts.Remove(j);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,12 +168,12 @@ public class MapWithSetAircraftsGeneric<T extends IDrawingObject, U extends Abst
|
|||||||
{
|
{
|
||||||
int width = _pictureWidth / _placeSizeWidth;
|
int width = _pictureWidth / _placeSizeWidth;
|
||||||
|
|
||||||
for (int i = 0; i < _setCars.getCount(); i++)
|
for (int i = 0; i < _setAircrafts.getCount(); i++)
|
||||||
{
|
{
|
||||||
int x = i % width;
|
int x = i % width;
|
||||||
int y = i / width;
|
int y = i / width;
|
||||||
|
|
||||||
T current =_setCars.Get(i);
|
T current =_setAircrafts.Get(i);
|
||||||
|
|
||||||
if(current == null) continue;
|
if(current == null) continue;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.ListIterator;
|
||||||
|
|
||||||
public class MapsCollection
|
public class MapsCollection
|
||||||
{
|
{
|
||||||
@@ -7,6 +12,9 @@ public class MapsCollection
|
|||||||
private int _pictureWidth;
|
private int _pictureWidth;
|
||||||
private int _pictureHeight;
|
private int _pictureHeight;
|
||||||
|
|
||||||
|
private char separatorDict = '|';
|
||||||
|
private char separatorData = ';';
|
||||||
|
|
||||||
public List<String> getKeys() { return _mapStorages.keySet().stream().toList(); }
|
public List<String> getKeys() { return _mapStorages.keySet().stream().toList(); }
|
||||||
|
|
||||||
public MapsCollection(int pictureWidth, int pictureHeight)
|
public MapsCollection(int pictureWidth, int pictureHeight)
|
||||||
@@ -16,6 +24,137 @@ public class MapsCollection
|
|||||||
_pictureHeight = pictureHeight;
|
_pictureHeight = pictureHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean SaveData(String filename)
|
||||||
|
{
|
||||||
|
File file = new File(filename);
|
||||||
|
if (file.exists()) file.delete();
|
||||||
|
|
||||||
|
try {
|
||||||
|
file.createNewFile();
|
||||||
|
|
||||||
|
FileWriter writer = new FileWriter(file);
|
||||||
|
writer.append("MapsCollection\n");
|
||||||
|
|
||||||
|
for(String key : _mapStorages.keySet()) {
|
||||||
|
String record = key + separatorDict + _mapStorages.get(key).GetData(separatorDict, separatorData) + "\n";
|
||||||
|
writer.append(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.flush();
|
||||||
|
writer.close();
|
||||||
|
} catch(Exception err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean LoadData(String filename)
|
||||||
|
{
|
||||||
|
File file = new File(filename);
|
||||||
|
if (!file.exists()) return false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||||
|
String current = reader.readLine();
|
||||||
|
|
||||||
|
if (!current.equals("MapsCollection")) return false;
|
||||||
|
_mapStorages.clear();
|
||||||
|
|
||||||
|
while ((current = reader.readLine()) != null)
|
||||||
|
{
|
||||||
|
String elem[] = current.split("\\" + separatorDict);
|
||||||
|
AbstractMap map = null;
|
||||||
|
switch (elem[1])
|
||||||
|
{
|
||||||
|
case "SimpleMap":
|
||||||
|
map = new SimpleMap();
|
||||||
|
break;
|
||||||
|
case "MyMap":
|
||||||
|
map = new MyMap();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_mapStorages.put(elem[0], new MapWithSetAircraftsGeneric<DrawingObjectAircraft, AbstractMap>(_pictureWidth, _pictureHeight, map));
|
||||||
|
_mapStorages.get(elem[0]).LoadData(elem[2].split(separatorData + ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
reader.close();
|
||||||
|
} catch(Exception err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean SaveMap(String filename, String key) {
|
||||||
|
File file = new File(filename);
|
||||||
|
if(file.exists()) file.delete();
|
||||||
|
|
||||||
|
MapWithSetAircraftsGeneric<DrawingObjectAircraft, AbstractMap> item = _mapStorages.getOrDefault(key, null);
|
||||||
|
if(item == null) return false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
file.createNewFile();
|
||||||
|
FileWriter writer = new FileWriter(file);
|
||||||
|
|
||||||
|
writer.append("Map\n");
|
||||||
|
writer.append(key + "\n");
|
||||||
|
writer.append(item.getMap().getClass().getName() + "\n");
|
||||||
|
ListIterator<DrawingObjectAircraft> iter = item.getAircraftsIter();
|
||||||
|
while(iter.hasNext()) {
|
||||||
|
writer.append(AircraftFactory.getDataForSave(iter.next().getAircraft()) + "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.flush();
|
||||||
|
writer.close();
|
||||||
|
} catch(Exception err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean LoadMap(String filename) {
|
||||||
|
File file = new File(filename);
|
||||||
|
if (!file.exists()) return false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||||
|
String format = reader.readLine();
|
||||||
|
if (!format.equals("Map")) return false;
|
||||||
|
|
||||||
|
String key = reader.readLine();
|
||||||
|
String mapStr = reader.readLine();
|
||||||
|
|
||||||
|
AbstractMap map = null;
|
||||||
|
|
||||||
|
switch (mapStr)
|
||||||
|
{
|
||||||
|
case "SimpleMap":
|
||||||
|
map = new SimpleMap();
|
||||||
|
break;
|
||||||
|
case "MyMap":
|
||||||
|
map = new MyMap();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_mapStorages.containsKey(key)) _mapStorages.get(key).ClearMap();
|
||||||
|
else _mapStorages.put(key, new MapWithSetAircraftsGeneric<>(_pictureWidth, _pictureHeight, map));
|
||||||
|
|
||||||
|
String current = null;
|
||||||
|
while ((current = reader.readLine()) != null)
|
||||||
|
{
|
||||||
|
_mapStorages.get(key).addAircraft(DrawingObjectAircraft.Create(current));
|
||||||
|
}
|
||||||
|
reader.close();
|
||||||
|
} catch(Exception err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void AddMap(String name, AbstractMap map)
|
public void AddMap(String name, AbstractMap map)
|
||||||
{
|
{
|
||||||
// TODO Прописать логику для добавления
|
// TODO Прописать логику для добавления
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.ListIterator;
|
||||||
|
|
||||||
public class SetAircraftsGeneric<T>
|
public class SetAircraftsGeneric<T>
|
||||||
{
|
{
|
||||||
@@ -34,6 +35,14 @@ public class SetAircraftsGeneric<T>
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ListIterator<T> GetElems() {
|
||||||
|
return _places.listIterator();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Clear() {
|
||||||
|
_places.clear();
|
||||||
|
}
|
||||||
|
|
||||||
public T Get(int position)
|
public T Get(int position)
|
||||||
{
|
{
|
||||||
return _places.get(position);
|
return _places.get(position);
|
||||||
|
|||||||
Reference in New Issue
Block a user