Skip to content

Commit

Permalink
Added import/export of vehicle types
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCobeti committed Sep 2, 2020
1 parent dac8d1e commit cf60ab9
Show file tree
Hide file tree
Showing 18 changed files with 131 additions and 41 deletions.
Binary file modified resources/button/add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/button/delete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/button/edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/button/editFollow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/button/export.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/button/export2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/button/import.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/button/map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/button/search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/button/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/button/template.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/control/MogenControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ public MogenControl(String[] args) {
view.update(model, MapConverter.DEFAULT_OPTIONS);
view.update(model, MapConverter.DEFAULT_ROADS);
System.out.println(Config.osmMap +" " +Config.sumoMap);
model.getvTypes().forEach((k, v) -> view.update(model, new Tuple(k, v)));

view.update(model, new Tuple<>(TableTypes.VehicleType, model.getvTypes()));

}

Expand Down Expand Up @@ -298,15 +299,14 @@ public void producedEvent(Event event, Object obj) {
} catch (FileNotFoundException | XMLStreamException ex) {
view.update(model, ex);
} finally{
model.getvTypes().forEach((k, v) -> view.update
(model, new Tuple(k, v)));
view.update(model, new Tuple<>(TableTypes.VehicleType, model.getvTypes()));
}
break;

case EXPORT_VEHICLES:

try {
exportVehicles((String)obj);
exportVehicles((String)obj + ".add.xml");
} catch (IOException ex) {
view.update(model, ex);
}
Expand Down
2 changes: 1 addition & 1 deletion src/control/ViewListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public enum Event {EXIT, NEW_MAP, NEW_VEHICLE_TYPE, NEW_SIMULATION,
REMOVE_TAZ, REMOVE_OD_ELEMENT, REMOVE_FLOW, EDIT_FLOW,
ROADS_OPTIONS,IMPORT_OD, IMPORT_VEHICLES, EXPORT_VEHICLES}

public enum TableTypes{TAZType, FlowType, ODElementType}
public enum TableTypes{TAZType, FlowType, ODElementType, VehicleType}

public void producedEvent(Event event, Object obj);

Expand Down
56 changes: 42 additions & 14 deletions src/view/MogenView.form
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="mainPanelElements" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="mainPanelElements" max="32767" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="simulationPanel" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
Expand Down Expand Up @@ -172,7 +172,7 @@
<Group type="102" attributes="0">
<Component id="mapPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="optionsMapButton" min="-2" pref="31" max="-2" attributes="0"/>
<Component id="optionsMapButton" min="-2" pref="32" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
Expand All @@ -189,14 +189,14 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="mapPanel" min="-2" pref="42" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="optionsMapButton" max="32767" attributes="0"/>
<Component id="optionsMapButton" min="-2" pref="32" max="-2" attributes="0"/>
</Group>
<Component id="mapPanel" min="-2" pref="49" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="mobilityComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="errorLabel" alignment="3" min="-2" max="-2" attributes="0"/>
Expand Down Expand Up @@ -241,9 +241,9 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="mapInfoField" pref="319" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="searchMapButton" min="-2" pref="31" max="-2" attributes="0"/>
<Component id="searchMapButton" min="-2" pref="32" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="newMapButton" min="-2" pref="31" max="-2" attributes="0"/>
<Component id="newMapButton" min="-2" pref="32" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
Expand All @@ -253,8 +253,8 @@
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="searchMapButton" pref="31" max="32767" attributes="0"/>
<Component id="newMapButton" max="32767" attributes="0"/>
<Component id="searchMapButton" pref="32" max="32767" attributes="0"/>
<Component id="newMapButton" pref="32" max="32767" attributes="0"/>
<Component id="mapInfoField" alignment="0" min="-2" pref="23" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
Expand Down Expand Up @@ -973,6 +973,10 @@
<Component id="panelElements" alignment="0" pref="400" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="exportVTypeButton" min="-2" pref="35" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="importVTypeButton" min="-2" pref="35" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="47" max="-2" attributes="0"/>
<Component id="addVTypeButton" min="-2" pref="35" max="-2" attributes="0"/>
</Group>
</Group>
Expand All @@ -986,8 +990,12 @@
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="panelElements" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="addVTypeButton" min="-2" pref="48" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="addVTypeButton" min="-2" pref="48" max="-2" attributes="0"/>
<Component id="exportVTypeButton" min="-2" pref="48" max="-2" attributes="0"/>
<Component id="importVTypeButton" min="-2" pref="48" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down Expand Up @@ -1066,6 +1074,26 @@
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="addVTypeButtonMouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="exportVTypeButton">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="EXPORT2_ICON" type="code"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="exportVTypeButtonMouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="importVTypeButton">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="IMPORT_ICON" type="code"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="importVTypeButtonMouseClicked"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
Expand Down
Loading

0 comments on commit cf60ab9

Please sign in to comment.