Ignore:
Timestamp:
2017-07-06T13:01:55+02:00 (7 years ago)
Author:
giackserva
Message:

[pt_assistant] roundabout splitter splits on any type of route relation

Location:
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/actions/SplitRoundaboutAction.java

    r33418 r33427  
    123123        List<Relation> parents = getPTRouteParents(roundabout);
    124124        parents.removeIf(r -> !r.hasIncompleteMembers());
    125         if(parents.isEmpty())
     125        if(parents.isEmpty()) {
    126126            continueAfterDownload(roundabout);
     127            return;
     128        }
    127129
    128130        Future <?>future = Main.worker.submit(new DownloadRelationMemberTask(
     
    247249            parents.remove(roundabout);
    248250            for(Way parent: parents) {
    249                 if(!getPTRouteParents(parent).isEmpty()) {
     251                if(!getRouteParents(parent).isEmpty()) {
    250252                        return false;
    251253                }
     
    292294                roundabout.getReferrers(), Relation.class);
    293295        referrers.removeIf(r -> !RouteUtils.isPTRoute(r));
     296        return referrers;
     297    }
     298
     299    private List<Relation> getRouteParents(Way roundabout) {
     300        List <Relation> referrers = OsmPrimitive.getFilteredList(
     301                roundabout.getReferrers(), Relation.class);
     302        referrers.removeIf(r -> !RouteUtils.isRoute(r));
    294303        return referrers;
    295304    }
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/utils/RouteUtils.java

    r33418 r33427  
    7272    }
    7373
     74    public static boolean isRoute(Relation r) {
     75        return r.get("route") != null;
     76    }
     77
    7478    /**
    7579     * Checks if the relation member refers to a stop in a public transport
Note: See TracChangeset for help on using the changeset viewer.