Eliseev E.E. LabWork06 #6
@ -24,13 +24,13 @@ public class ExtentionPlane
|
||||
Color s_color = new Color(Integer.parseInt(strs[4]));
|
||||
|
||||
return new DrawingAirbus(Integer.parseInt(strs[0]), Integer.parseInt(strs[1]), f_color, Integer.parseInt(strs[3]),
|
||||
s_color, Boolean.parseBoolean(strs[4]), Boolean.parseBoolean(strs[5]));
|
||||
s_color, Boolean.parseBoolean(strs[5]), Boolean.parseBoolean(strs[6]));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
//сохраниние объекта в строку
|
||||
//сохранение объекта в строку
|
||||
public static String GetDataForSave(DrawingPlane drawingPlane)
|
||||
{
|
||||
var plane = drawingPlane.Plane;
|
||||
@ -43,6 +43,6 @@ public class ExtentionPlane
|
||||
return str;
|
||||
}
|
||||
|
||||
return str + String.format("%c%s%c%b%c%b", _separatorForObject, airbus.AddColor(), _separatorForObject, airbus.AddEngine(), _separatorForObject, airbus.AddCompartment());
|
||||
return str + String.format("%c%s%c%b%c%b", _separatorForObject, airbus.AddColor().getRGB(), _separatorForObject, airbus.AddEngine(), _separatorForObject, airbus.AddCompartment());
|
||||
}
|
||||
}
|
||||
|
@ -11,9 +11,9 @@
|
||||
<grid id="92d87" binding="PictureBoxPlane" layout-manager="BorderLayout" hgap="0" vgap="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="730" height="650"/>
|
||||
<preferred-size width="730" height="650"/>
|
||||
<maximum-size width="730" height="650"/>
|
||||
<minimum-size width="730" height="680"/>
|
||||
<preferred-size width="730" height="680"/>
|
||||
<maximum-size width="730" height="680"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
@ -24,9 +24,9 @@
|
||||
<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">
|
||||
<minimum-size width="250" height="650"/>
|
||||
<preferred-size width="250" height="650"/>
|
||||
<maximum-size width="250" height="650"/>
|
||||
<minimum-size width="230" height="680"/>
|
||||
<preferred-size width="230" height="680"/>
|
||||
<maximum-size width="230" height="680"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
|
@ -52,7 +52,7 @@ public class FormMapWithSetPlanesGeneric extends JFrame{
|
||||
{
|
||||
super("Хранилище");
|
||||
CreateWindow();
|
||||
_mapsCollection = new MapsCollection(730, 650);
|
||||
_mapsCollection = new MapsCollection(730, 700);
|
||||
ComboBoxSelectorMap.removeAllItems();
|
||||
|
||||
for (String elem : _mapsHashMap.keySet())
|
||||
|
@ -143,7 +143,7 @@ public class MapsCollection
|
||||
|
||||
try (BufferedWriter writter = new BufferedWriter(new FileWriter(filename)))
|
||||
{
|
||||
writter.write(String.format("MapsCollection" + System.lineSeparator()));
|
||||
writter.write(String.format("SaveOneMap" + System.lineSeparator() + "Data of map:"));
|
||||
|
||||
for(Map.Entry<String, MapWithSetPlanesGeneric<IDrawningObject, AbstractMap>> entry : _mapStorage.entrySet())
|
||||
{
|
||||
@ -177,7 +177,7 @@ public class MapsCollection
|
||||
String str = "";
|
||||
|
||||
//если не содержит такую запись или пустой файл
|
||||
if ((str = reader.readLine()) == null || !str.contains("MapsCollection"))
|
||||
if ((str = reader.readLine()) == null || !str.contains("SaveOneMap"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -187,29 +187,29 @@ public class MapsCollection
|
||||
var element = str.split(String.format("\\%c", separatorDict));
|
||||
AbstractMap map = null;
|
||||
|
||||
switch (element[1])
|
||||
{
|
||||
case "SimpleMap":
|
||||
map = new SimpleMap();
|
||||
break;
|
||||
case "DesertStormMap":
|
||||
map = new DesertStormMap();
|
||||
break;
|
||||
case "StarWarsMap":
|
||||
map = new StarWarsMap();
|
||||
break;
|
||||
}
|
||||
try {
|
||||
switch (element[1]) {
|
||||
case "SimpleMap":
|
||||
map = new SimpleMap();
|
||||
break;
|
||||
case "DesertStormMap":
|
||||
map = new DesertStormMap();
|
||||
break;
|
||||
case "StarWarsMap":
|
||||
map = new StarWarsMap();
|
||||
break;
|
||||
}
|
||||
|
||||
//если имя загружаемой карты уже есть в коллекции
|
||||
if(_mapStorage.get(element[0]) != null)
|
||||
{
|
||||
_mapStorage.remove(element[0]);
|
||||
}
|
||||
//если имя загружаемой карты уже есть в коллекции
|
||||
if (_mapStorage.get(element[0]) != null) {
|
||||
_mapStorage.remove(element[0]);
|
||||
}
|
||||
|
||||
_mapStorage.put(element[0], new MapWithSetPlanesGeneric<IDrawningObject, AbstractMap>(_pictureWidth, _pictureHeight,
|
||||
map));
|
||||
_mapStorage.put(element[0], new MapWithSetPlanesGeneric<IDrawningObject, AbstractMap>(_pictureWidth, _pictureHeight,
|
||||
map));
|
||||
|
||||
|
||||
_mapStorage.get(element[0]).LoadData(element[2].split(String.valueOf(separatorData)));
|
||||
_mapStorage.get(element[0]).LoadData(element[2].split(String.valueOf(separatorData)));
|
||||
} catch (Exception ex) {}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user
И смысл проверки выше, если все равно проиходит затиранее?