Changeset 5016 in josm


Ignore:
Timestamp:
2012-02-22T14:38:02+01:00 (8 years ago)
Author:
akks
Message:

Patch by JoshDoe [Faster relation selection with Alt+click and middle-click], fix #7314, #7317

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r4982 r5016  
    605605                }
    606606            } else {
    607                 if (osm instanceof Node) {
    608                     cycleList = new LinkedList<OsmPrimitive>(mv.getNearestNodes(p, OsmPrimitive.isSelectablePredicate));
    609                 } else if (osm instanceof Way) {
    610                     cycleList = new LinkedList<OsmPrimitive>(mv.getNearestWays(p, OsmPrimitive.isSelectablePredicate));
    611                 }
     607                cycleList = mv.getAllNearest(p, OsmPrimitive.isSelectablePredicate);
    612608
    613609                if (cycleList.size() > 1) {
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r4968 r5016  
    3636import org.openstreetmap.josm.data.osm.Node;
    3737import org.openstreetmap.josm.data.osm.OsmPrimitive;
     38import org.openstreetmap.josm.data.osm.Relation;
    3839import org.openstreetmap.josm.data.osm.Way;
    3940import org.openstreetmap.josm.data.osm.WaySegment;
     
    10911092        Set<Way> wset = new HashSet<Way>();
    10921093
     1094        // add nearby ways
    10931095        for (List<WaySegment> wss : getNearestWaySegmentsImpl(p, predicate).values()) {
    10941096            for (WaySegment ws : wss) {
     
    10981100            }
    10991101        }
     1102       
     1103        // add nearby nodes
    11001104        for (List<Node> nlist : getNearestNodesImpl(p, predicate).values()) {
    11011105            nearestList.addAll(nlist);
    11021106        }
     1107       
     1108        // add parent relations of nearby nodes and ways
     1109        Set<OsmPrimitive> parentRelations = new HashSet<OsmPrimitive>();
     1110        for (OsmPrimitive o : nearestList) {
     1111            for (OsmPrimitive r : o.getReferrers()) {
     1112                if (r instanceof Relation && predicate.evaluate(r)) {
     1113                    parentRelations.add(r);
     1114                }
     1115            }
     1116        }
     1117        nearestList.addAll(parentRelations);
     1118       
    11031119        if (ignore != null) {
    11041120            nearestList.removeAll(ignore);
Note: See TracChangeset for help on using the changeset viewer.