Changeset 35760 in osm for applications/editors/josm/plugins/CustomizePublicTransportStop
- Timestamp:
- 2021-05-17T20:57:47+02:00 (4 years ago)
- Location:
- applications/editors/josm/plugins/CustomizePublicTransportStop
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/CustomizePublicTransportStop/build.xml
r35750 r35760 3 3 4 4 <!-- enter the SVN commit message --> 5 <property name="commit.message" value="CustomizePublicTransportStop: recompile for compatibility with JOSM r178 67"/>5 <property name="commit.message" value="CustomizePublicTransportStop: recompile for compatibility with JOSM r17896"/> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 <property name="plugin.main.version" value="178 67"/>7 <property name="plugin.main.version" value="17896"/> 8 8 9 9 <property name="plugin.author" value="Rodion Scherbakov"/> -
applications/editors/josm/plugins/CustomizePublicTransportStop/src/org/openstreetmap/josm/plugins/customizepublictransportstop/CreateNewStopPointOperation.java
r34501 r35760 17 17 import org.openstreetmap.josm.data.osm.BBox; 18 18 import org.openstreetmap.josm.data.osm.DataSet; 19 import org.openstreetmap.josm.data.osm.IWaySegment; 19 20 import org.openstreetmap.josm.data.osm.Node; 20 21 import org.openstreetmap.josm.data.osm.Way; … … 184 185 * their associated way segments to point p. 185 186 */ 186 private Map<Double, List< WaySegment>> getNearestWaySegmentsImpl(Point p) {187 Map<Double, List< WaySegment>> nearestMap = new TreeMap<>();187 private Map<Double, List<IWaySegment<Node, Way>>> getNearestWaySegmentsImpl(Point p) { 188 Map<Double, List<IWaySegment<Node, Way>>> nearestMap = new TreeMap<>(); 188 189 DataSet ds = getCurrentDataSet(); 189 190 … … 222 223 223 224 if (perDistSq < snapDistanceSq && a < c + snapDistanceSq && b < c + snapDistanceSq) { 224 List< WaySegment> wslist;225 List<IWaySegment<Node, Way>> wslist; 225 226 if (nearestMap.containsKey(perDistSq)) { 226 227 wslist = nearestMap.get(perDistSq); … … 229 230 nearestMap.put(perDistSq, wslist); 230 231 } 231 wslist.add(new WaySegment(w, i));232 wslist.add(new IWaySegment<>(w, i)); 232 233 } 233 234 … … 250 251 MapView mapView = MainApplication.getMap().mapView; 251 252 Point p = mapView.getPoint(platformCoord); 252 Map<Double, List< WaySegment>> dist_waySegments = getNearestWaySegmentsImpl(p);253 for (Map.Entry<Double, List< WaySegment>> entry : dist_waySegments.entrySet()) {254 for ( WaySegmentwaySegment : entry.getValue()) {255 if (testWay(waySegment. way, stopArea)) {253 Map<Double, List<IWaySegment<Node, Way>>> dist_waySegments = getNearestWaySegmentsImpl(p); 254 for (Map.Entry<Double, List<IWaySegment<Node, Way>>> entry : dist_waySegments.entrySet()) { 255 for (IWaySegment<Node, Way> waySegment : entry.getValue()) { 256 if (testWay(waySegment.getWay(), stopArea)) { 256 257 Node n = waySegment.getFirstNode(); 257 258 Node lastN = waySegment.getSecondNode(); … … 281 282 * @return Stop position node 282 283 */ 283 protected Node createNodeOnWay(Node newStopNode, WaySegmentwaySegment) {284 protected Node createNodeOnWay(Node newStopNode, IWaySegment<Node, Way> waySegment) { 284 285 UndoRedoHandler.getInstance().add(new AddCommand(MainApplication.getLayerManager().getEditDataSet(), newStopNode)); 285 List<Node> wayNodes = waySegment. way.getNodes();286 wayNodes.add(waySegment. lowerIndex + 1, newStopNode);287 Way newWay = new Way(waySegment. way);286 List<Node> wayNodes = waySegment.getWay().getNodes(); 287 wayNodes.add(waySegment.getUpperIndex(), newStopNode); 288 Way newWay = new Way(waySegment.getWay()); 288 289 newWay.setNodes(wayNodes); 289 UndoRedoHandler.getInstance().add(new ChangeCommand(waySegment. way, newWay));290 UndoRedoHandler.getInstance().add(new ChangeCommand(waySegment.getWay(), newWay)); 290 291 return newStopNode; 291 292 } -
applications/editors/josm/plugins/CustomizePublicTransportStop/src/org/openstreetmap/josm/plugins/customizepublictransportstop/NearestWaySegment.java
r34501 r35760 2 2 package org.openstreetmap.josm.plugins.customizepublictransportstop; 3 3 4 import org.openstreetmap.josm.data.osm.IWaySegment; 4 5 import org.openstreetmap.josm.data.osm.Node; 6 import org.openstreetmap.josm.data.osm.Way; 5 7 import org.openstreetmap.josm.data.osm.WaySegment; 6 8 … … 18 20 * Way segment 19 21 */ 20 public WaySegmentwaySegment;22 public IWaySegment<Node, Way> waySegment; 21 23 /** 22 24 * Node … … 31 33 * @param newNode Node 32 34 */ 33 public NearestWaySegment(Double distanceSq, WaySegmentwaySegment, Node newNode) {35 public NearestWaySegment(Double distanceSq, IWaySegment<Node, Way> waySegment, Node newNode) { 34 36 this.distanceSq = distanceSq; 35 37 this.waySegment = waySegment;
Note:
See TracChangeset
for help on using the changeset viewer.