Eliseev E.E. LabWork04 #4

Closed
ElEgEv wants to merge 14 commits from LabWork04 into LabWork03
4 changed files with 70 additions and 20 deletions
Showing only changes of commit bf37aa4f29 - Show all commits

View File

@ -3,7 +3,7 @@
<grid id="27dc6" binding="MainPanel" 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="994" height="647"/>
<xy x="20" y="20" width="994" height="654"/>
</constraints>
<properties/>
<border type="none"/>
@ -20,7 +20,7 @@
<border type="none"/>
<children/>
</grid>
<grid id="4871f" binding="ButtonGroupPanel" layout-manager="GridLayoutManager" row-count="17" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="4871f" binding="ButtonGroupPanel" layout-manager="GridLayoutManager" row-count="16" 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="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
@ -34,7 +34,7 @@
<children>
<component id="d0967" class="javax.swing.JButton" binding="ButtonLeft">
<constraints>
<grid row="16" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="4" fill="0" indent="0" use-parent-layout="false">
<grid row="15" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="4" fill="0" indent="0" use-parent-layout="false">
<minimum-size width="45" height="45"/>
<preferred-size width="45" height="45"/>
<maximum-size width="45" height="45"/>
@ -46,7 +46,7 @@
</component>
<component id="d9af3" class="javax.swing.JButton" binding="ButtonDown">
<constraints>
<grid row="16" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<grid row="15" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="45" height="45"/>
<preferred-size width="45" height="45"/>
<maximum-size width="45" height="45"/>
@ -58,7 +58,7 @@
</component>
<component id="9e43" class="javax.swing.JButton" binding="ButtonRight">
<constraints>
<grid row="16" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
<grid row="15" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
<minimum-size width="45" height="45"/>
<preferred-size width="45" height="45"/>
<maximum-size width="45" height="45"/>
@ -70,7 +70,7 @@
</component>
<component id="4d1dd" class="javax.swing.JButton" binding="ButtonUp">
<constraints>
<grid row="15" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<grid row="14" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="45" height="45"/>
<preferred-size width="45" height="45"/>
<maximum-size width="45" height="45"/>
@ -82,7 +82,7 @@
</component>
<component id="67190" class="javax.swing.JButton" binding="ButtonShowOnMap">
<constraints>
<grid row="13" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<grid row="12" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="220" height="30"/>
<preferred-size width="220" height="30"/>
<maximum-size width="220" height="30"/>
@ -94,7 +94,7 @@
</component>
<component id="28576" class="javax.swing.JButton" binding="ButtonShowStorage">
<constraints>
<grid row="11" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<grid row="10" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="220" height="30"/>
<preferred-size width="220" height="30"/>
<maximum-size width="220" height="30"/>
@ -118,7 +118,7 @@
</component>
<component id="6f119" class="javax.swing.JTextField" binding="MaskedTextBoxPosition">
<constraints>
<grid row="8" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="6" anchor="0" fill="0" indent="0" use-parent-layout="false">
<grid row="7" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="6" anchor="0" fill="0" indent="0" use-parent-layout="false">
<minimum-size width="220" height="30"/>
<preferred-size width="220" height="30"/>
<maximum-size width="220" height="30"/>
@ -131,7 +131,7 @@
</component>
<component id="d75e9" class="javax.swing.JButton" binding="ButtonRemovePlane">
<constraints>
<grid row="9" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<grid row="8" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="220" height="30"/>
<preferred-size width="220" height="30"/>
<maximum-size width="220" height="30"/>
@ -141,24 +141,19 @@
<text value="Удалить самолёт"/>
</properties>
</component>
<vspacer id="ed421">
<constraints>
<grid row="7" 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>
<vspacer id="f972a">
<constraints>
<grid row="10" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="9" 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>
<vspacer id="65c78">
<constraints>
<grid row="12" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="11" 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>
<vspacer id="7d70b">
<constraints>
<grid row="14" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="13" 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>
<vspacer id="d4b8a">
@ -212,7 +207,7 @@
<text value="Добавить карту"/>
</properties>
</component>
<component id="9a389" class="javax.swing.JList" binding="list1" default-binding="true">
<component id="9a389" class="javax.swing.JList" binding="ListMaps">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="2" anchor="0" fill="3" indent="0" use-parent-layout="false">
<minimum-size width="220" height="100"/>

View File

@ -23,7 +23,7 @@ public class FormMapWithSetPlanesGeneric {
private JButton ButtonRemovePlane;
private JTextField TextBoxNewMapName;
private JButton ButtonAddMap;
private JList list1;
private JList ListMaps;
private JButton ButtonDeleteMap;
//объект от класса карты с набором объектов

View File

@ -204,4 +204,9 @@ public class MapWithSetPlanesGeneric <T extends IDrawningObject, U extends Abstr
}
}
}
public MapWithSetPlanesGeneric<T,U> GetPlaneInList(int index)
{
}
}

View File

@ -1,4 +1,54 @@
import java.util.*;
//класс для хранения коллекции карт
public class MapsCollection
{
//словарь (хранилище) с картами
public HashMap<String, MapWithSetPlanesGeneric<DrawningObjectPlane, AbstractMap>> _mapStorage;
//возвращение списка названий карт
public List<String> Keys;
//ширина окна отрисовки
private final int _pictureWidth;
//высота окна отрисовки
private final int _pictureHeight;
//конструктор
public MapsCollection(int pictureWidth, int pictureHeight)
{
Keys = new ArrayList<String>(_mapStorage.keySet());
_mapStorage = new HashMap<>();
_pictureWidth = pictureWidth;
_pictureHeight = pictureHeight;
}
//добавление карты
public void AddMap(String name, AbstractMap map)
{
if(_mapStorage.containsKey(name))
{
return;
}
_mapStorage.put(name, new MapWithSetPlanesGeneric<>(_pictureWidth, _pictureHeight, map));
}
//удаление карты
public void DelMap(String name)
{
_mapStorage.remove(name);
}
//Доступ к аэродрому
public MapWithSetPlanesGeneric<DrawningObjectPlane, AbstractMap> Get(String name, int index)
{
if(_mapStorage.containsKey(name))
{
return _mapStorage.get(name).GetPlaneInList(index);
}
return null;
}
}