Changeset 20747 in osm for applications/editors/josm/plugins/public_transport/src
- Timestamp:
- 2010-03-30T16:15:53+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/public_transport/src/public_transport/StopImporterAction.java
r20741 r20747 450 450 }; 451 451 452 p rivateclass WaypointTableModel extends DefaultTableModel452 public class WaypointTableModel extends DefaultTableModel 453 453 implements TableModelListener 454 454 { … … 540 540 super(tr("Create Stops from GPX ..."), null, 541 541 tr("Create Stops from a GPX file"), null, true); 542 } 543 544 public WaypointTableModel getWaypointTableModel() 545 { 546 return waypointTM; 547 } 548 549 public StopImporterDialog getDialog() 550 { 551 return dialog; 542 552 } 543 553 … … 875 885 else if ("stopImporter.waypointsAdd".equals(event.getActionCommand())) 876 886 { 877 if (dialog.getWaypointsTable().getSelectedRowCount() > 0) 878 { 879 for (int i = 0; i < waypointTM.getRowCount(); ++i) 880 { 881 if ((dialog.getWaypointsTable().isRowSelected(i)) && 882 (waypointTM.nodes.elementAt(i) == null)) 883 { 884 Node node = createNode(waypointTM.coors.elementAt(i), (String)waypointTM.getValueAt(i, 1)); 885 waypointTM.nodes.set(i, node); 886 Main.main.getCurrentDataSet().addSelected(waypointTM.nodes.elementAt(i)); 887 } 888 } 889 } 890 else 891 { 892 for (int i = 0; i < waypointTM.getRowCount(); ++i) 893 { 894 if (waypointTM.nodes.elementAt(i) == null) 895 Main.main.getCurrentDataSet().addSelected(waypointTM.nodes.elementAt(i)); 896 } 897 } 887 Main.main.undoRedo.add(new WaypointsEnableCommand(this)); 898 888 } 899 889 else if ("stopImporter.waypointsDelete".equals(event.getActionCommand())) 900 890 { 901 Vector< Node > toDelete = new Vector< Node >(); 902 for (int i = waypointTM.getRowCount()-1; i >=0; --i) 903 { 904 if (dialog.getWaypointsTable().isRowSelected(i)) 905 { 906 if ((Node)waypointTM.nodes.elementAt(i) != null) 907 toDelete.add((Node)waypointTM.nodes.elementAt(i)); 908 waypointTM.nodes.set(i, null); 909 } 910 } 911 Command cmd = DeleteCommand.delete 912 (Main.main.getEditLayer(), toDelete); 913 if (cmd != null) { 914 // cmd can be null if the user cancels dialogs DialogCommand displays 915 Main.main.undoRedo.add(cmd); 916 } 891 Main.main.undoRedo.add(new WaypointsDisableCommand(this)); 917 892 } 918 893 else if ("stopImporter.settingsStoptype".equals(event.getActionCommand())) … … 1071 1046 private Node createNode(LatLon latLon, String name) 1072 1047 { 1048 return createNode(latLon, dialog.getStoptype(), name); 1049 } 1050 1051 public static Node createNode(LatLon latLon, String type, String name) 1052 { 1073 1053 Node node = new Node(latLon); 1074 if ("bus".equals( dialog.getStoptype()))1054 if ("bus".equals(type)) 1075 1055 node.put("highway", "bus_stop"); 1076 else if ("tram".equals( dialog.getStoptype()))1056 else if ("tram".equals(type)) 1077 1057 node.put("railway", "tram_stop"); 1078 else if ("light_rail".equals( dialog.getStoptype()))1058 else if ("light_rail".equals(type)) 1079 1059 node.put("railway", "station"); 1080 else if ("subway".equals( dialog.getStoptype()))1060 else if ("subway".equals(type)) 1081 1061 node.put("railway", "station"); 1082 else if ("rail".equals( dialog.getStoptype()))1062 else if ("rail".equals(type)) 1083 1063 node.put("railway", "station"); 1084 1064 node.put("name", name);
Note:
See TracChangeset
for help on using the changeset viewer.