Changeset 33727 in osm


Ignore:
Timestamp:
2017-10-22T16:05:56+02:00 (7 years ago)
Author:
polyglot
Message:

Add method to check oneway exceptions for bicycles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/utils/RouteUtils.java

    r33513 r33727  
    1414 * Utils class for routes
    1515 *
    16  * @author darya
     16 * @author darya, giacomo, polyglot
    1717 *
    1818 */
     
    144144
    145145    /**
     146     * Checks if the given way has tags that make it oneway for bicycles
     147     * The test does not check whether the way violates those
     148     * restrictions.
     149     *
     150     * @return 0 if the way is not oneway for bicycles, 1 if the way is
     151     *         oneway for bicycles, -1 if the way is reversely oneway
     152     *         for bicycles
     153     */
     154    public static int isOnewayForBicycles(Way way) {
     155
     156        if (OsmUtils.isTrue(way.get("oneway"))
     157                || OsmUtils.isReversed(way.get("oneway"))
     158                || way.hasTag("junction", "roundabout")) {
     159
     160            if (!way.hasTag("busway", "lane")
     161                    && !way.hasTag("cycleway", "opposite_lane")
     162                    && !way.hasTag("cycleway:left", "lane")
     163                    && !way.hasTag("cycleway:right", "lane")
     164                    && !way.hasTag("oneway:bicycle", "no")) {
     165
     166                if (OsmUtils.isReversed(way.get("oneway"))) {
     167                    return -1;
     168                }
     169                return 1;
     170            }
     171        }
     172        return 0;
     173    }
     174
     175
     176    /**
    146177     * Checks if the ways have a common node
    147178     *
Note: See TracChangeset for help on using the changeset viewer.