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

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

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
10 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    }
Note: See TracChangeset for help on using the changeset viewer.