Changeset 10716 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2016-08-03T15:30:04+02:00 (8 years ago)
Author:
simon04
Message:

see #11390, see #12890 - Deprecate predicates in OsmPrimitive class

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

Legend:

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

    r10619 r10716  
    9494        for (Node node : selectedNodes) {
    9595            List<WaySegment> wss = Main.map.mapView.getNearestWaySegments(
    96                     Main.map.mapView.getPoint(node), OsmPrimitive.isSelectablePredicate);
     96                    Main.map.mapView.getPoint(node), OsmPrimitive::isSelectable);
    9797
    9898            MultiMap<Way, Integer> insertPoints = new MultiMap<>();
  • trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java

    r10552 r10716  
    7373        if (selectedNodes.size() == 1) {
    7474            List<Node> nearestNodes = Main.map.mapView.getNearestNodes(
    75                     Main.map.mapView.getPoint(selectedNodes.get(0)), selectedNodes, OsmPrimitive.isUsablePredicate);
     75                    Main.map.mapView.getPoint(selectedNodes.get(0)), selectedNodes, OsmPrimitive::isUsable);
    7676            if (nearestNodes.isEmpty()) {
    7777                new Notification(
  • trunk/src/org/openstreetmap/josm/actions/ReverseWayAction.java

    r10657 r10716  
    134134    @Override
    135135    protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
    136         setEnabled(selection.stream().anyMatch(OsmPrimitive.wayPredicate));
     136        setEnabled(selection.stream().anyMatch(Way.class::isInstance));
    137137    }
    138138}
  • trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java

    r10657 r10716  
    255255        private static boolean isUsedInRelations(final Collection<Node> existingNodes) {
    256256            return existingNodes.stream().anyMatch(
    257                     selectedNode -> selectedNode.getReferrers().stream().anyMatch(OsmPrimitive.relationPredicate));
     257                    selectedNode -> selectedNode.getReferrers().stream().anyMatch(Relation.class::isInstance));
    258258        }
    259259
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java

    r10467 r10716  
    362362        DeleteParameters result = new DeleteParameters();
    363363
    364         result.nearestNode = Main.map.mapView.getNearestNode(e.getPoint(), OsmPrimitive.isSelectablePredicate);
     364        result.nearestNode = Main.map.mapView.getNearestNode(e.getPoint(), OsmPrimitive::isSelectable);
    365365        if (result.nearestNode == null) {
    366             result.nearestSegment = Main.map.mapView.getNearestWaySegment(e.getPoint(), OsmPrimitive.isSelectablePredicate);
     366            result.nearestSegment = Main.map.mapView.getNearestWaySegment(e.getPoint(), OsmPrimitive::isSelectable);
    367367            if (result.nearestSegment != null) {
    368368                if (shift) {
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r10678 r10716  
    399399
    400400        boolean newNode = false;
    401         Node n = Main.map.mapView.getNearestNode(mousePos, OsmPrimitive.isSelectablePredicate);
     401        Node n = Main.map.mapView.getNearestNode(mousePos, OsmPrimitive::isSelectable);
    402402        if (ctrl) {
    403403            Iterator<Way> it = ds.getSelectedWays().iterator();
     
    469469                // Insert the node into all the nearby way segments
    470470                List<WaySegment> wss = Main.map.mapView.getNearestWaySegments(
    471                         Main.map.mapView.getPoint(n), OsmPrimitive.isSelectablePredicate);
     471                        Main.map.mapView.getPoint(n), OsmPrimitive::isSelectable);
    472472                if (snapHelper.isActive()) {
    473473                    tryToMoveNodeOnIntersection(wss, n);
     
    761761     */
    762762    private void tryToSetBaseSegmentForAngleSnap() {
    763         WaySegment seg = Main.map.mapView.getNearestWaySegment(mousePos, OsmPrimitive.isSelectablePredicate);
     763        WaySegment seg = Main.map.mapView.getNearestWaySegment(mousePos, OsmPrimitive::isSelectable);
    764764        if (seg != null) {
    765765            snapHelper.setBaseSegment(seg);
     
    790790
    791791        if (!ctrl && mousePos != null) {
    792             currentMouseNode = mv.getNearestNode(mousePos, OsmPrimitive.isSelectablePredicate);
     792            currentMouseNode = mv.getNearestNode(mousePos, OsmPrimitive::isSelectable);
    793793        }
    794794
     
    796796        // *and* there is no node nearby (because nodes beat ways when re-using)
    797797        if (!ctrl && currentMouseNode == null) {
    798             List<WaySegment> wss = mv.getNearestWaySegments(mousePos, OsmPrimitive.isSelectablePredicate);
     798            List<WaySegment> wss = mv.getNearestWaySegments(mousePos, OsmPrimitive::isSelectable);
    799799            for (WaySegment ws : wss) {
    800800                mouseOnExistingWays.add(ws.way);
     
    10881088        // This happens when nothing is selected, but we still want to highlight the "target node"
    10891089        if (mouseOnExistingNode == null && getLayerManager().getEditDataSet().selectionEmpty() && mousePos != null) {
    1090             mouseOnExistingNode = Main.map.mapView.getNearestNode(mousePos, OsmPrimitive.isSelectablePredicate);
     1090            mouseOnExistingNode = Main.map.mapView.getNearestNode(mousePos, OsmPrimitive::isSelectable);
    10911091        }
    10921092
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java

    r10463 r10716  
    391391        updateKeyModifiers(e);
    392392
    393         selectedNode = Main.map.mapView.getNearestNode(e.getPoint(), OsmPrimitive.isSelectablePredicate);
    394         selectedSegment = Main.map.mapView.getNearestWaySegment(e.getPoint(), OsmPrimitive.isSelectablePredicate);
     393        selectedNode = Main.map.mapView.getNearestNode(e.getPoint(), OsmPrimitive::isSelectable);
     394        selectedSegment = Main.map.mapView.getNearestWaySegment(e.getPoint(), OsmPrimitive::isSelectable);
    395395
    396396        // If nothing gets caught, stay in select mode
     
    570570    private static void addNewNode(MouseEvent e) {
    571571        // Should maybe do the same as in DrawAction and fetch all nearby segments?
    572         WaySegment ws = Main.map.mapView.getNearestWaySegment(e.getPoint(), OsmPrimitive.isSelectablePredicate);
     572        WaySegment ws = Main.map.mapView.getNearestWaySegment(e.getPoint(), OsmPrimitive::isSelectable);
    573573        if (ws != null) {
    574574            Node n = new Node(Main.map.mapView.getLatLon(e.getX(), e.getY()));
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyHelper.java

    r8590 r10716  
    4141        }
    4242
    43         Node node = mv.getNearestNode(p, OsmPrimitive.isSelectablePredicate);
     43        Node node = mv.getNearestNode(p, OsmPrimitive::isSelectable);
    4444        Way candidate = null;
    4545
     
    5757        }
    5858
    59         return Main.map.mapView.getNearestWay(p, OsmPrimitive.isSelectablePredicate);
     59        return Main.map.mapView.getNearestWay(p, OsmPrimitive::isSelectable);
    6060    }
    6161
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java

    r10463 r10716  
    321321        if (!mouseHasBeenDragged) {
    322322            // use point from press or click event? (or are these always the same)
    323             Way nearestWay = mv.getNearestWay(e.getPoint(), OsmPrimitive.isSelectablePredicate);
     323            Way nearestWay = mv.getNearestWay(e.getPoint(), OsmPrimitive::isSelectable);
    324324            if (nearestWay == null) {
    325325                if (matchesCurrentModifiers(setSelectedModifierCombo)) {
     
    522522    // TODO: rename
    523523    private boolean initParallelWays(Point p, boolean copyTags) {
    524         referenceSegment = mv.getNearestWaySegment(p, Way.isUsablePredicate, true);
     524        referenceSegment = mv.getNearestWaySegment(p, OsmPrimitive::isUsable, true);
    525525        if (referenceSegment == null)
    526526            return false;
  • trunk/src/org/openstreetmap/josm/actions/relation/AbstractRelationAction.java

    r9971 r10716  
    2727            // Diamond operator does not work with Java 9 here
    2828            return new SubclassFilteredCollection<OsmPrimitive, Relation>(
    29                     primitives, OsmPrimitive.relationPredicate);
     29                    primitives, Relation.class::isInstance);
    3030        }
    3131    }
  • trunk/src/org/openstreetmap/josm/corrector/ReverseWayNoTagCorrector.java

    r10657 r10716  
    1111
    1212import org.openstreetmap.josm.Main;
    13 import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1413import org.openstreetmap.josm.data.osm.Tag;
    1514import org.openstreetmap.josm.data.osm.TagCollection;
     
    5554        for (Map.Entry<String, String> entry : way.getKeys().entrySet()) {
    5655            final Tag tag = new Tag(entry.getKey(), entry.getValue());
    57             final boolean isDirectional = directionalTags.contains(tag) || OsmPrimitive.directionalKeyPredicate.test(tag);
     56            final boolean isDirectional = directionalTags.contains(tag) || tag.isDirectionKey();
    5857            if (isDirectional) {
    5958                final boolean cannotBeCorrected = ReverseWayTagCorrector.getTagCorrections(tag).isEmpty();
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r10715 r10716  
    329329     */
    330330    public Collection<Node> getNodes() {
    331         return getPrimitives(OsmPrimitive.nodePredicate);
     331        return getPrimitives(Node.class::isInstance);
    332332    }
    333333
     
    371371     */
    372372    public Collection<Way> getWays() {
    373         return getPrimitives(OsmPrimitive.wayPredicate);
     373        return getPrimitives(Way.class::isInstance);
    374374    }
    375375
     
    411411     */
    412412    public Collection<Relation> getRelations() {
    413         return getPrimitives(OsmPrimitive.relationPredicate);
     413        return getPrimitives(Relation.class::isInstance);
    414414    }
    415415
     
    466466     */
    467467    public Collection<OsmPrimitive> allNonDeletedPrimitives() {
    468         return getPrimitives(OsmPrimitive.nonDeletedPredicate);
     468        return getPrimitives(p -> !p.isDeleted());
    469469    }
    470470
     
    476476     */
    477477    public Collection<OsmPrimitive> allNonDeletedCompletePrimitives() {
    478         return getPrimitives(OsmPrimitive.nonDeletedCompletePredicate);
     478        return getPrimitives(primitive -> !primitive.isDeleted() && !primitive.isIncomplete());
    479479    }
    480480
     
    486486     */
    487487    public Collection<OsmPrimitive> allNonDeletedPhysicalPrimitives() {
    488         return getPrimitives(OsmPrimitive.nonDeletedPhysicalPredicate);
     488        return getPrimitives(primitive -> !primitive.isDeleted() && !primitive.isIncomplete() && !(primitive instanceof Relation));
    489489    }
    490490
     
    495495     */
    496496    public Collection<OsmPrimitive> allModifiedPrimitives() {
    497         return getPrimitives(OsmPrimitive.modifiedPredicate);
     497        return getPrimitives(OsmPrimitive::isModified);
    498498    }
    499499
     
    643643     */
    644644    public Collection<OsmPrimitive> getSelected() {
    645         return new SubclassFilteredCollection<>(getAllSelected(), OsmPrimitive.nonDeletedPredicate);
     645        return new SubclassFilteredCollection<>(getAllSelected(), p -> !p.isDeleted());
    646646    }
    647647
     
    668668     */
    669669    public Collection<Node> getSelectedNodes() {
    670         return new SubclassFilteredCollection<>(getSelected(), OsmPrimitive.nodePredicate);
     670        return new SubclassFilteredCollection<>(getSelected(), Node.class::isInstance);
    671671    }
    672672
     
    676676     */
    677677    public Collection<Way> getSelectedWays() {
    678         return new SubclassFilteredCollection<>(getSelected(), OsmPrimitive.wayPredicate);
     678        return new SubclassFilteredCollection<>(getSelected(), Way.class::isInstance);
    679679    }
    680680
     
    684684     */
    685685    public Collection<Relation> getSelectedRelations() {
    686         return new SubclassFilteredCollection<>(getSelected(), OsmPrimitive.relationPredicate);
     686        return new SubclassFilteredCollection<>(getSelected(), Relation.class::isInstance);
    687687    }
    688688
  • trunk/src/org/openstreetmap/josm/data/osm/FilterMatcher.java

    r9348 r10716  
    207207        boolean isExplicit = false;
    208208        for (Relation r : new SubclassFilteredCollection<OsmPrimitive, Relation>(
    209                 primitive.getReferrers(), OsmPrimitive.multipolygonPredicate)) {
     209                primitive.getReferrers(), OsmPrimitive::isMultipolygon)) {
    210210            if (!isFiltered(r, hidden))
    211211                return false;
     
    217217    private static boolean oneParentMultipolygonNotFiltered(OsmPrimitive primitive, boolean hidden) {
    218218        for (Relation r : new SubclassFilteredCollection<OsmPrimitive, Relation>(
    219                 primitive.getReferrers(), OsmPrimitive.multipolygonPredicate)) {
     219                primitive.getReferrers(), OsmPrimitive::isMultipolygon)) {
    220220            if (!isFiltered(r, hidden))
    221221                return true;
  • trunk/src/org/openstreetmap/josm/data/osm/FilterWorker.java

    r10657 r10716  
    3232        boolean changed;
    3333        // first relations, then ways and nodes last; this is required to resolve dependencies
    34         changed = doExecuteFilters(SubclassFilteredCollection.filter(all, OsmPrimitive.relationPredicate), filterMatcher);
    35         changed |= doExecuteFilters(SubclassFilteredCollection.filter(all, OsmPrimitive.wayPredicate), filterMatcher);
    36         changed |= doExecuteFilters(SubclassFilteredCollection.filter(all, OsmPrimitive.nodePredicate), filterMatcher);
     34        changed = doExecuteFilters(SubclassFilteredCollection.filter(all, Relation.class::isInstance), filterMatcher);
     35        changed |= doExecuteFilters(SubclassFilteredCollection.filter(all, Way.class::isInstance), filterMatcher);
     36        changed |= doExecuteFilters(SubclassFilteredCollection.filter(all, Node.class::isInstance), filterMatcher);
    3737        return changed;
    3838    }
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r10715 r10716  
    113113     * @see #FLAG_HAS_DIRECTIONS
    114114     */
    115     private static volatile Match directionKeys;
     115    static volatile Match directionKeys;
    116116
    117117    /**
     
    200200     * A predicate that filters primitives that are usable.
    201201     * @see OsmPrimitive#isUsable()
    202      */
    203     public static final Predicate<OsmPrimitive> isUsablePredicate = primitive -> primitive.isUsable();
     202     * @deprecated Use {@code OsmPrimitive::isUsable} instead
     203     */
     204    @Deprecated
     205    public static final Predicate<OsmPrimitive> isUsablePredicate = OsmPrimitive::isUsable;
    204206
    205207    /**
    206208     * A predicate filtering primitives that are selectable.
    207      */
    208     public static final Predicate<OsmPrimitive> isSelectablePredicate = primitive -> primitive.isSelectable();
     209     * @deprecated Use {@code OsmPrimitive::isSelectable} instead
     210     */
     211    @Deprecated
     212    public static final Predicate<OsmPrimitive> isSelectablePredicate = OsmPrimitive::isSelectable;
    209213
    210214    /**
    211215     * A predicate filtering primitives that are not deleted.
    212      */
    213     public static final Predicate<OsmPrimitive> nonDeletedPredicate = primitive -> !primitive.isDeleted();
     216     * @deprecated Use {@code p -> !p.isDeleted()} instead
     217     */
     218    @Deprecated
     219    public static final Predicate<OsmPrimitive> nonDeletedPredicate = p -> !p.isDeleted();
    214220
    215221    /**
    216222     * A predicate filtering primitives that are not deleted and not incomplete.
    217223     */
     224    @Deprecated
    218225    public static final Predicate<OsmPrimitive> nonDeletedCompletePredicate =
    219226            primitive -> !primitive.isDeleted() && !primitive.isIncomplete();
     
    222229     * A predicate filtering primitives that are not deleted and not incomplete and that are not a relation.
    223230     */
     231    @Deprecated
    224232    public static final Predicate<OsmPrimitive> nonDeletedPhysicalPredicate =
    225233            primitive -> !primitive.isDeleted() && !primitive.isIncomplete() && !(primitive instanceof Relation);
     
    227235    /**
    228236     * A predicate filtering primitives that are modified
    229      */
    230     public static final Predicate<OsmPrimitive> modifiedPredicate = primitive -> primitive.isModified();
     237     * @deprecated Use {@code OsmPrimitive::isModified} instead
     238     */
     239    @Deprecated
     240    public static final Predicate<OsmPrimitive> modifiedPredicate = OsmPrimitive::isModified;
    231241
    232242    /**
    233243     * A predicate filtering nodes.
    234      */
     244     * @deprecated Use {@code Node.class::isInstance} instead
     245     */
     246    @Deprecated
    235247    public static final Predicate<OsmPrimitive> nodePredicate = Node.class::isInstance;
    236248
    237249    /**
    238250     * A predicate filtering ways.
    239      */
     251     * @deprecated Use {@code Way.class::isInstance} instead
     252     */
     253    @Deprecated
    240254    public static final Predicate<OsmPrimitive> wayPredicate = Way.class::isInstance;
    241255
    242256    /**
    243257     * A predicate filtering relations.
    244      */
     258     * @deprecated Use {@code Relation.class::isInstance} instead
     259     */
     260    @Deprecated
    245261    public static final Predicate<OsmPrimitive> relationPredicate = Relation.class::isInstance;
    246262
    247263    /**
    248264     * A predicate filtering multipolygon relations.
    249      */
    250     public static final Predicate<OsmPrimitive> multipolygonPredicate =
    251             primitive -> primitive.getClass() == Relation.class && ((Relation) primitive).isMultipolygon();
     265     * @deprecated Use {@code OsmPrimitive::isMultipolygon} instead
     266     */
     267    @Deprecated
     268    public static final Predicate<OsmPrimitive> multipolygonPredicate = OsmPrimitive::isMultipolygon;
    252269
    253270    /**
     
    256273     * @see #FLAG_HAS_DIRECTIONS
    257274     */
     275    @Deprecated
    258276    public static final Predicate<Tag> directionalKeyPredicate = directionKeys::match;
    259277
     
    14521470     */
    14531471    public abstract boolean isOutsideDownloadArea();
     1472
     1473    /**
     1474     * Determines if this object is a relation and behaves as a multipolygon.
     1475     * @return {@code true} if it is a real mutlipolygon or a boundary relation
     1476     * @since 10716
     1477     */
     1478    public boolean isMultipolygon() {
     1479        return false;
     1480    }
    14541481}
  • trunk/src/org/openstreetmap/josm/data/osm/Relation.java

    r10689 r10716  
    422422    }
    423423
    424     /**
    425      * Determines if this relation behaves as a multipolygon.
    426      * @return {@code true} if it's a real mutlipolygon or a boundary relation
    427      */
     424    @Override
    428425    public boolean isMultipolygon() {
    429426        return "multipolygon".equals(get("type")) || isBoundary();
  • trunk/src/org/openstreetmap/josm/data/osm/Tag.java

    r9678 r10716  
    209209        throw new UnsupportedOperationException();
    210210    }
     211
     212    /**
     213     * true if this is a direction dependent tag (e.g. oneway)
     214     *
     215     * @return {@code true} if this is is a direction dependent tag
     216     * @since 10716
     217     */
     218    public boolean isDirectionKey() {
     219        return OsmPrimitive.directionKeys.match(this);
     220    }
     221
    211222}
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r10657 r10716  
    22package org.openstreetmap.josm.gui;
    33
    4 import static org.openstreetmap.josm.data.osm.OsmPrimitive.isSelectablePredicate;
    5 import static org.openstreetmap.josm.data.osm.OsmPrimitive.isUsablePredicate;
    64import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
    75import static org.openstreetmap.josm.tools.I18n.marktr;
     
    293291                    // display them if the middle mouse button is pressed and keep them until the mouse is moved
    294292                    if (middleMouseDown || isAtOldPosition) {
    295                         Collection<OsmPrimitive> osms = mv.getAllNearest(ms.mousePos,
    296                                 o -> isUsablePredicate.test(o) && isSelectablePredicate.test(o));
     293                        Collection<OsmPrimitive> osms = mv.getAllNearest(ms.mousePos, OsmPrimitive::isSelectable);
    297294
    298295                        final JPanel c = new JPanel(new GridBagLayout());
     
    441438         */
    442439        private void statusBarElementUpdate(MouseState ms) {
    443             final OsmPrimitive osmNearest = mv.getNearestNodeOrWay(ms.mousePos, isUsablePredicate, false);
     440            final OsmPrimitive osmNearest = mv.getNearestNodeOrWay(ms.mousePos, OsmPrimitive::isUsable, false);
    444441            if (osmNearest != null) {
    445442                nameText.setText(osmNearest.getDisplayName(DefaultNameFormatter.getInstance()));
  • trunk/src/org/openstreetmap/josm/gui/SelectionManager.java

    r10661 r10716  
    387387        if (clicked) {
    388388            Point center = new Point(selectionResult.xpoints[0], selectionResult.ypoints[0]);
    389             OsmPrimitive osm = nc.getNearestNodeOrWay(center, OsmPrimitive.isSelectablePredicate, false);
     389            OsmPrimitive osm = nc.getNearestNodeOrWay(center, OsmPrimitive::isSelectable, false);
    390390            if (osm != null) {
    391391                selection.add(osm);
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolverModel.java

    r10657 r10716  
    2020import org.openstreetmap.josm.command.ChangeCommand;
    2121import org.openstreetmap.josm.command.Command;
     22import org.openstreetmap.josm.data.osm.Node;
    2223import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2324import org.openstreetmap.josm.data.osm.Relation;
     
    199200    public void prepareDefaultRelationDecisions() {
    200201
    201         if (primitives.stream().allMatch(OsmPrimitive.nodePredicate)) {
     202        if (primitives.stream().allMatch(Node.class::isInstance)) {
    202203            final Collection<OsmPrimitive> primitivesInDecisions = new HashSet<>();
    203204            for (final RelationMemberConflictDecision i : decisions) {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r10619 r10716  
    628628                        }
    629629                        Main.map.statusLine.setDist(
    630                                 new SubclassFilteredCollection<OsmPrimitive, Way>(selection, OsmPrimitive.wayPredicate));
     630                                new SubclassFilteredCollection<OsmPrimitive, Way>(selection, Way.class::isInstance));
    631631                    }
    632632                }
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r10626 r10716  
    425425
    426426    @Override public String getToolTipText() {
    427         int nodes = new FilteredCollection<>(data.getNodes(), OsmPrimitive.nonDeletedPredicate).size();
    428         int ways = new FilteredCollection<>(data.getWays(), OsmPrimitive.nonDeletedPredicate).size();
    429         int rels = new FilteredCollection<>(data.getRelations(), OsmPrimitive.nonDeletedPredicate).size();
     427        int nodes = new FilteredCollection<>(data.getNodes(), p -> !p.isDeleted()).size();
     428        int ways = new FilteredCollection<>(data.getWays(), p -> !p.isDeleted()).size();
     429        int rels = new FilteredCollection<>(data.getRelations(), p -> !p.isDeleted()).size();
    430430
    431431        String tool = trn("{0} node", "{0} nodes", nodes, nodes)+", ";
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java

    r10615 r10716  
    8686        if (Main.isDisplayingMapView()) {
    8787            Point p = Main.map.mapView.getPoint(ll);
    88             node = Main.map.mapView.getNearestNode(p, OsmPrimitive.isUsablePredicate);
     88            node = Main.map.mapView.getNearestNode(p, OsmPrimitive::isUsable);
    8989            if (node != null && node.getCoor().greatCircleDistance(ll) > Main.pref.getDouble("remotecontrol.tolerance", 0.1)) {
    9090                node = null; // node is too far
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java

    r10615 r10716  
    127127        if (Main.isDisplayingMapView()) {
    128128            Point p = Main.map.mapView.getPoint(ll);
    129             nd = Main.map.mapView.getNearestNode(p, OsmPrimitive.isUsablePredicate);
     129            nd = Main.map.mapView.getNearestNode(p, OsmPrimitive::isUsable);
    130130            if (nd != null && nd.getCoor().greatCircleDistance(ll) > Main.pref.getDouble("remote.tolerance", 0.1)) {
    131131                nd = null; // node is too far
Note: See TracChangeset for help on using the changeset viewer.