Package org.goplanit.osm.defaults
Class OsmLaneDefaults
- java.lang.Object
-
- org.goplanit.osm.defaults.OsmLaneDefaults
-
- All Implemented Interfaces:
Cloneable
public class OsmLaneDefaults extends Object implements Cloneable
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.- 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 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 OsmLaneDefaultsclone()IntegergetDefaultDirectionalLanesByHighwayType(String osmWayValue)collect the number of lanes based on the highway type, e.g.IntegergetDefaultDirectionalLanesByWayType(String osmWayKey, String osmWayValue)collect the number of lanes based on the highway type, e.g.IntegergetDefaultDirectionalRailwayTracks()collect the default number of tracks for railways (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 default
-
-
-
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
-
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
-
getDefaultDirectionalLanesByWayType
public Integer getDefaultDirectionalLanesByWayType(String osmWayKey, 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:
osmWayKey- OSM highway keyosmWayValue- OSM highway 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
-
clone
public OsmLaneDefaults clone() throws CloneNotSupportedException
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
-