Changeset 33446 in osm for applications/editors/josm/plugins/pt_assistant
- Timestamp:
- 2017-07-14T18:51:47+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/pt_assistant
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/actions/SortPTStopsAction.java
r33442 r33446 21 21 import org.openstreetmap.josm.actions.relation.DownloadSelectedIncompleteMembersAction; 22 22 import org.openstreetmap.josm.command.ChangeCommand; 23 import org.openstreetmap.josm.command.Command;24 23 import org.openstreetmap.josm.data.coor.EastNorth; 25 24 import org.openstreetmap.josm.data.osm.Node; … … 44 43 public class SortPTStopsAction extends JosmAction { 45 44 46 private static final long serialVersionUID = 1714879296430852530L;47 45 private static final String ACTION_NAME = "Sort PT Stops"; 48 46 … … 87 85 88 86 private void continueAfterDownload(Relation rel) { 89 Main.main.undoRedo.add(getSortPTStopCommand(rel));90 }91 92 public Command getSortPTStopCommand(Relation rel) {93 87 Relation newRel = new Relation(rel); 94 List<RelationMember> members = newRel.getMembers(); 88 sortPTStops(newRel); 89 Main.main.undoRedo.add(new ChangeCommand(rel, newRel)); 90 } 91 92 public void sortPTStops(Relation rel) { 93 List<RelationMember> members = rel.getMembers(); 95 94 for (int i = 0; i < members.size(); i++) { 96 newRel.removeMember(0);95 rel.removeMember(0); 97 96 } 98 97 members = new RelationSorter().sortMembers(members); … … 154 153 if (stop != null) { 155 154 if (stop.getStopPositionRM() != null) 156 newRel.addMember(stop.getStopPositionRM());155 rel.addMember(stop.getStopPositionRM()); 157 156 if (stop.getPlatformRM() != null) 158 newRel.addMember(stop.getPlatformRM());157 rel.addMember(stop.getPlatformRM()); 159 158 } 160 159 }); … … 164 163 } 165 164 166 wayMembers.forEach(newRel::addMember); 167 168 return new ChangeCommand(rel, newRel); 165 wayMembers.forEach(rel::addMember); 169 166 } 170 167 -
applications/editors/josm/plugins/pt_assistant/test/unit/org/openstreetmap/josm/plugins/pt_assistant/AbstractTest.java
r33404 r33446 40 40 public static final String PATH_TO_ROUNDABOUT_ONEWAY = "test/data/duesseldorf_roundabout.osm"; 41 41 42 public static final String PATH_TO_SORT_PT_STOPS = "test/data/sort_test.osm"; 43 42 44 public static final String PATH_TO_ROAD_TYPE_ERROR = "test/data/road-type.osm"; 43 45
Note:
See TracChangeset
for help on using the changeset viewer.