Changeset 14402 in josm for trunk/src/org
- Timestamp:
- 2018-11-02T18:07:31+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r14120 r14402 1298 1298 boolean useSelected, Collection<OsmPrimitive> preferredRefs) { 1299 1299 WaySegment wayseg = null; 1300 WaySegment ntsel = null;1301 WaySegment ntref = null;1302 1300 if (preferredRefs != null && preferredRefs.isEmpty()) 1303 1301 preferredRefs = null; 1304 1302 1305 searchLoop:for (List<WaySegment> wslist : getNearestWaySegmentsImpl(p, predicate).values()) {1303 for (List<WaySegment> wslist : getNearestWaySegmentsImpl(p, predicate).values()) { 1306 1304 for (WaySegment ws : wslist) { 1307 1305 if (wayseg == null) { 1308 1306 wayseg = ws; 1309 1307 } 1310 if (ntsel == null && ws.way.isSelected()) { 1311 ntsel = ws; 1312 break searchLoop; 1313 } 1314 if (ntref == null && preferredRefs != null) { 1308 if (useSelected && ws.way.isSelected()) { 1309 return ws; 1310 } 1311 if (preferredRefs != null && !preferredRefs.isEmpty()) { 1315 1312 // prefer ways containing given nodes 1316 for (Node nd: ws.way.getNodes()) { 1317 if (preferredRefs.contains(nd)) { 1318 ntref = ws; 1319 break searchLoop; 1320 } 1313 if (preferredRefs.contains(ws.getFirstNode()) || preferredRefs.contains(ws.getSecondNode())) { 1314 return ws; 1321 1315 } 1322 1316 Collection<OsmPrimitive> wayRefs = ws.way.getReferrers(); … … 1324 1318 for (OsmPrimitive ref: preferredRefs) { 1325 1319 if (ref instanceof Relation && wayRefs.contains(ref)) { 1326 ntref = ws; 1327 break searchLoop; 1320 return ws; 1328 1321 } 1329 1322 } … … 1331 1324 } 1332 1325 } 1333 if (ntsel != null && useSelected)1334 return ntsel;1335 if (ntref != null)1336 return ntref;1337 1326 return wayseg; 1338 1327 }
Note:
See TracChangeset
for help on using the changeset viewer.