Package org.planit.network
Class InfrastructureLayersConfigurator
- java.lang.Object
-
- org.planit.network.InfrastructureLayersConfigurator
-
public class InfrastructureLayersConfigurator extends Object
Configurator class that allows one to create and modify a setup for the mapping of modes and infrastucture layers without actually creating them yet. The final result can be used to instantiate the infrastructure layers on the actual infrastructure network when the time is right. We also provide some default suggestions for quick setups avoiding complicated manual configurations.- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description static String
ACTIVE_LAYER_XML_ID
proposed active layer idstatic String
ALL_IN_ONE_LAYER_ID
proposed all-in-one layer idprotected Set<String>
infrastructureLayersByXmlId
track unique proposed layersprotected Map<Mode,String>
modeToLayerXmlId
track mode to layer mappingstatic String
ON_STREET_LAYER_XML_ID
proposed on_street layer idstatic String
RAIL_LAYER_ID
proposed rail layer id
-
Constructor Summary
Constructors Constructor Description InfrastructureLayersConfigurator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addLayer(String layerXmlId)
add a proposed layerstatic InfrastructureLayersConfigurator
createAllInOneConfiguration(Modes modes)
create a configuration that maps all passed in modes to a single proposed all-in-one layerstatic InfrastructureLayersConfigurator
createMultiLayerConfiguration(Collection<PredefinedMode> predefinedModes)
create a multi-layer configuration that maps all passed in modes to either a rail, active, or on-street layer.boolean
isModeMappedToLayer(Mode mode, String layerXmlId)
verify if mode is assigned to the layerboolean
removeLayer(String layerXmlId)
remove a proposed layer, this means that all modes mapped to this layer are no longer mapped at allString
removeMode(Mode mode)
remove mode from any layerString
setModeToLayer(Mode mode, String layerXmlId)
set mode to a layer
-
-
-
Field Detail
-
infrastructureLayersByXmlId
protected final Set<String> infrastructureLayersByXmlId
track unique proposed layers
-
ON_STREET_LAYER_XML_ID
public static final String ON_STREET_LAYER_XML_ID
proposed on_street layer id- See Also:
- Constant Field Values
-
ACTIVE_LAYER_XML_ID
public static final String ACTIVE_LAYER_XML_ID
proposed active layer id- See Also:
- Constant Field Values
-
RAIL_LAYER_ID
public static final String RAIL_LAYER_ID
proposed rail layer id- See Also:
- Constant Field Values
-
ALL_IN_ONE_LAYER_ID
public static final String ALL_IN_ONE_LAYER_ID
proposed all-in-one layer id- See Also:
- Constant Field Values
-
-
Method Detail
-
createAllInOneConfiguration
public static InfrastructureLayersConfigurator createAllInOneConfiguration(Modes modes)
create a configuration that maps all passed in modes to a single proposed all-in-one layer- Parameters:
modes
- to use for all in one layer configuration- Returns:
- configuration reflective of all-in-one approach
-
createMultiLayerConfiguration
public static InfrastructureLayersConfigurator createMultiLayerConfiguration(Collection<PredefinedMode> predefinedModes)
create a multi-layer configuration that maps all passed in modes to either a rail, active, or on-street layer. Note that only predefined PLANit modes are automatically mapped. Custom modes must be manually mapped afterwards to the appropriate layer. The mapping works as follows: on-street layer:- bus
- car HOV
- car
- car share
- goods
- heavy goods
- large heavy goods
- light rail
- motor bike
- tram
active layer:
- bicycle
- pedestrian
rail layer:
- subway
- train
- Parameters:
predefinedModes
- for multi-layer configuration- Returns:
- configuration reflective of all-in-one approach
-
addLayer
public boolean addLayer(String layerXmlId)
add a proposed layer- Parameters:
layerXmlId
- to add- Returns:
- true if not already present, false otherwise
-
removeLayer
public boolean removeLayer(String layerXmlId) throws PlanItException
remove a proposed layer, this means that all modes mapped to this layer are no longer mapped at all- Parameters:
layerXmlId
- to remove- Returns:
- true if removed, false otherwise
- Throws:
PlanItException
- thrown if error
-
setModeToLayer
public String setModeToLayer(Mode mode, String layerXmlId)
set mode to a layer- Parameters:
mode
- to addlayerXmlId
- to use- Returns:
- previous layer the mode was added to (if any)
-
isModeMappedToLayer
public boolean isModeMappedToLayer(Mode mode, String layerXmlId)
verify if mode is assigned to the layer- Parameters:
mode
- to verifylayerXmlId
- to check- Returns:
- true when mapped, false otherwise
-
-