Ignore:
Timestamp:
2010-04-11T15:29:02+02:00 (14 years ago)
Author:
bastiK
Message:

Filter: improved selection handling. (Don't allow to select filtered or disabled objects by clicking on them. Don't connect to hidden ways in add mode.)

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
5 edited

Legend:

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

    r2431 r3177  
    4141
    4242        List<WaySegment> wss = Main.map.mapView.getNearestWaySegments(
    43                 Main.map.mapView.getPoint(node));
     43                Main.map.mapView.getPoint(node), OsmPrimitive.isSelectablePredicate);
    4444        HashMap<Way, List<Integer>> insertPoints = new HashMap<Way, List<Integer>>();
    4545        for (WaySegment ws : wss) {
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java

    r2986 r3177  
    1919import org.openstreetmap.josm.command.DeleteCommand;
    2020import org.openstreetmap.josm.data.osm.Node;
     21import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2122import org.openstreetmap.josm.data.osm.Relation;
    2223import org.openstreetmap.josm.data.osm.WaySegment;
     
    286287        DeleteParameters result = new DeleteParameters();
    287288
    288         result.nearestNode = Main.map.mapView.getNearestNode(e.getPoint());
     289        result.nearestNode = Main.map.mapView.getNearestNode(e.getPoint(), OsmPrimitive.isSelectablePredicate);
    289290        if (result.nearestNode == null) {
    290             result.nearestSegment = Main.map.mapView.getNearestWaySegment(e.getPoint());
     291            result.nearestSegment = Main.map.mapView.getNearestWaySegment(e.getPoint(), OsmPrimitive.isSelectablePredicate);
    291292            if (result.nearestSegment != null) {
    292293                if (shift) {
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r3116 r3177  
    164164        if (mouseOnExistingNode == null && getCurrentDataSet().getSelected().size() == 0
    165165                && mousePos != null) {
    166             mouseOnExistingNode = Main.map.mapView.getNearestNode(mousePos);
     166            mouseOnExistingNode = Main.map.mapView.getNearestNode(mousePos, OsmPrimitive.isSelectablePredicate);
    167167        }
    168168
     
    332332
    333333        if (!ctrl) {
    334             n = Main.map.mapView.getNearestNode(mousePos);
     334            n = Main.map.mapView.getNearestNode(mousePos, OsmPrimitive.isSelectablePredicate);
    335335        }
    336336
     
    366366            if (!ctrl) {
    367367                // Insert the node into all the nearby way segments
    368                 List<WaySegment> wss = Main.map.mapView.getNearestWaySegments(e.getPoint());
     368                List<WaySegment> wss = Main.map.mapView.getNearestWaySegments(e.getPoint(), OsmPrimitive.isSelectablePredicate);
    369369                Map<Way, List<Integer>> insertPoints = new HashMap<Way, List<Integer>>();
    370370                for (WaySegment ws : wss) {
     
    681681
    682682        if (!ctrl && mousePos != null) {
    683             currentMouseNode = mv.getNearestNode(mousePos);
     683            currentMouseNode = mv.getNearestNode(mousePos, OsmPrimitive.isSelectablePredicate);
    684684        }
    685685
     
    687687        // *and* there is no node nearby (because nodes beat ways when re-using)
    688688        if(!ctrl && currentMouseNode == null) {
    689             List<WaySegment> wss = mv.getNearestWaySegments(mousePos);
     689            List<WaySegment> wss = mv.getNearestWaySegments(mousePos, OsmPrimitive.isSelectablePredicate);
    690690            for(WaySegment ws : wss) {
    691691                mouseOnExistingWays.add(ws.way);
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java

    r2990 r3177  
    308308        // boolean shift = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0;
    309309
    310         selectedSegment = Main.map.mapView.getNearestWaySegment(e.getPoint());
     310        selectedSegment = Main.map.mapView.getNearestWaySegment(e.getPoint(), OsmPrimitive.isSelectablePredicate);
    311311
    312312        if (selectedSegment == null) {
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r2719 r3177  
    285285        int snapDistance = Main.pref.getInteger("mappaint.node.virtual-snap-distance", 8);
    286286        snapDistance *= snapDistance;
    287         OsmPrimitive osm = c.getNearestNode(p);
     287        OsmPrimitive osm = c.getNearestNode(p, OsmPrimitive.isSelectablePredicate);
    288288        virtualWays.clear();
    289289        virtualNode = null;
     
    293293        {
    294294            Collection<WaySegment> nearestWaySegs = allSegements
    295             ? c.getNearestWaySegments(p)
    296                     : Collections.singleton(c.getNearestWaySegment(p));
     295            ? c.getNearestWaySegments(p, OsmPrimitive.isSelectablePredicate)
     296                    : Collections.singleton(c.getNearestWaySegment(p, OsmPrimitive.isSelectablePredicate));
    297297
    298298            for(WaySegment nearestWS : nearestWaySegs) {
     
    435435            if (!didMove) {
    436436                selectPrims(
    437                         Main.map.mapView.getNearestCollection(e.getPoint()),
     437                        Main.map.mapView.getNearestCollection(e.getPoint(), OsmPrimitive.isSelectablePredicate),
    438438                        shift, ctrl, true, false);
    439439
     
    485485                if (ctrl) {
    486486                    Collection<Node> affectedNodes = OsmPrimitive.getFilteredSet(selection, Node.class);
    487                     Collection<Node> nn = Main.map.mapView.getNearestNodes(e.getPoint(), affectedNodes);
     487                    Collection<Node> nn = Main.map.mapView.getNearestNodes(e.getPoint(), affectedNodes, OsmPrimitive.isSelectablePredicate);
    488488                    if (nn != null) {
    489489                        Node targetNode = nn.iterator().next();
Note: See TracChangeset for help on using the changeset viewer.