Package org.goplanit.osm.defaults
Class OsmLaneDefaults
- java.lang.Object
-
- org.goplanit.osm.defaults.OsmLaneDefaults
-
public class OsmLaneDefaults extends Object
Configure and retrieve the default configuration for the number of lanes for various osm way types (these are the total lanes on a link covering both directions. The "default" defaults for highway tags originate from https://wiki.openstreetmap.org/wiki/Key:lanes, while the "default" defaults for railways, i.e., the number of tracks is based on https://wiki.openstreetmap.org/wiki/Key:railway#Tracks. Waterways are given a single lane equivalent.- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_LANES_PER_DIRECTION_IF_UNSPECIFIEDin case no mapping between highway type and number of lanes is present, use this.static intDEFAULT_TRACKS_PER_DIRECTION_IF_UNSPECIFIEDstore the rail default.protected static Map<String,Integer>defaultRoadLanesPerDirectionstore the road based defaultsprotected Map<String,Integer>lanesPerDirectionstore the defaults for class instanceprotected intlanesPerDirectionIfUnspecifiedlanes per direction if not configuredstatic intMINIMUM_LANES_PER_DIRECTIONminimum number of lanes per direction, default is 1protected inttracksPerDirectionIfUnspecifiedrailway tracks per direction if not configuredprotected intwaterwayLanesPerDirectionIfUnspecifiedwater way lanes per direction if not configured
-
Constructor Summary
Constructors Constructor Description OsmLaneDefaults()ConstructorOsmLaneDefaults(OsmLaneDefaults osmLaneDefaults)Copy constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IntegergetDefaultDirectionalLanesByHighwayType(String osmWayValue)collect the number of lanes based on the highway type, e.g.IntegergetDefaultDirectionalLanesByWayType(String osmKey, String osmValue)collect the number of lanes based on the highway type, e.g.IntegergetDefaultDirectionalRailwayTracks()Collect the default number of tracks for railways (in one direction)IntegergetDefaultDirectionalWaterwayLanes()Collect the default number of water way lanes for water ways (in one direction)IntegergetDefaultTotalLanesByHighwayType(String type)collect the number of lanes based on the highway type, e.g.protected static voidpopulateDefaultLanesPerDirection()Initialise the defaults to use based on "common sense" as outlined in https://wiki.openstreetmap.org/wiki/Key:lanesIntegersetDefaultDirectionalLanesByHighwayType(String type, Integer defaultNumberOfLanesPerDirection)Overwrite current defaultvoidsetDefaultDirectionalRailwayTracks(Integer defaultNumberOfTracksPerDirection)Overwrite current defaultOsmLaneDefaultsshallowClone()Shallow copy
-
-
-
Field Detail
-
defaultRoadLanesPerDirection
protected static Map<String,Integer> defaultRoadLanesPerDirection
store the road based defaults
-
lanesPerDirection
protected Map<String,Integer> lanesPerDirection
store the defaults for class instance
-
lanesPerDirectionIfUnspecified
protected int lanesPerDirectionIfUnspecified
lanes per direction if not configured
-
tracksPerDirectionIfUnspecified
protected int tracksPerDirectionIfUnspecified
railway tracks per direction if not configured
-
waterwayLanesPerDirectionIfUnspecified
protected int waterwayLanesPerDirectionIfUnspecified
water way lanes per direction if not configured
-
MINIMUM_LANES_PER_DIRECTION
public static final int MINIMUM_LANES_PER_DIRECTION
minimum number of lanes per direction, default is 1- See Also:
- Constant Field Values
-
DEFAULT_LANES_PER_DIRECTION_IF_UNSPECIFIED
public static final int DEFAULT_LANES_PER_DIRECTION_IF_UNSPECIFIED
in case no mapping between highway type and number of lanes is present, use this. Default set toMINIMUM_LANES_PER_DIRECTION- See Also:
- Constant Field Values
-
DEFAULT_TRACKS_PER_DIRECTION_IF_UNSPECIFIED
public static final int DEFAULT_TRACKS_PER_DIRECTION_IF_UNSPECIFIED
store the rail default. Default set toMINIMUM_LANES_PER_DIRECTION- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OsmLaneDefaults
public OsmLaneDefaults()
Constructor
-
OsmLaneDefaults
public OsmLaneDefaults(OsmLaneDefaults osmLaneDefaults)
Copy constructor- Parameters:
osmLaneDefaults- to copy
-
-
Method Detail
-
populateDefaultLanesPerDirection
protected static void populateDefaultLanesPerDirection()
Initialise the defaults to use based on "common sense" as outlined in https://wiki.openstreetmap.org/wiki/Key:lanes
-
setDefaultDirectionalLanesByHighwayType
public Integer setDefaultDirectionalLanesByHighwayType(String type, Integer defaultNumberOfLanesPerDirection)
Overwrite current default- Parameters:
type- highway typedefaultNumberOfLanesPerDirection- the new default- Returns:
- old value if any, null if not present
-
getDefaultDirectionalLanesByHighwayType
public Integer getDefaultDirectionalLanesByHighwayType(String osmWayValue)
collect the number of lanes based on the highway type, e.g. highway=type, for any direction (not total). In case no number of lanes is specified for the type, we revert to the missing default- Parameters:
osmWayValue- highway type value- Returns:
- number of lanes for this type (if any), otherwise null is returned
-
setDefaultDirectionalRailwayTracks
public void setDefaultDirectionalRailwayTracks(Integer defaultNumberOfTracksPerDirection)
Overwrite current default- Parameters:
defaultNumberOfTracksPerDirection- the new default
-
getDefaultDirectionalRailwayTracks
public Integer getDefaultDirectionalRailwayTracks()
Collect the default number of tracks for railways (in one direction)- Returns:
- defaultNumberOfTracksPerDirection in case not explicitly specified
-
getDefaultDirectionalWaterwayLanes
public Integer getDefaultDirectionalWaterwayLanes()
Collect the default number of water way lanes for water ways (in one direction)- Returns:
- waterwayLanesPerDirectionIfUnspecified in case not explicitly specified
-
getDefaultDirectionalLanesByWayType
public Integer getDefaultDirectionalLanesByWayType(String osmKey, String osmValue)
collect the number of lanes based on the highway type, e.g. highway=type, for any direction (not total). In case no number of lanes is specified for the type, we revert to the missing default- Parameters:
osmKey- OSM key to identify the way type (highway, rail way, or water way)osmValue- OSM key's value- Returns:
- number of lanes for this type (if any), otherwise null is returned
-
getDefaultTotalLanesByHighwayType
public Integer getDefaultTotalLanesByHighwayType(String type)
collect the number of lanes based on the highway type, e.g. highway=type, in total (both directions)- Parameters:
type- highway type value- Returns:
- number of lanes for this type (if any), otherwise null is returned
-
shallowClone
public OsmLaneDefaults shallowClone()
Shallow copy- Returns:
- shallow copy
-
-