Class 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 Detail

      • infrastructureLayersByXmlId

        protected final Set<String> infrastructureLayersByXmlId
        track unique proposed layers
      • modeToLayerXmlId

        protected final Map<Mode,​String> modeToLayerXmlId
        track mode to layer mapping
      • ON_STREET_LAYER_XML_ID

        public static final String ON_STREET_LAYER_XML_ID
        proposed on_street layer id
        See Also:
        Constant Field Values
    • Constructor Detail

      • InfrastructureLayersConfigurator

        public InfrastructureLayersConfigurator()
    • 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
        Note that by default tram and lightrail are marked as on on-street because we cannot assume they are always separate from road modes. We only idetnify modes on separate layers when these layers are truly separate pieces of infrastructure.
        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 add
        layerXmlId - 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 verify
        layerXmlId - to check
        Returns:
        true when mapped, false otherwise
      • removeMode

        public String removeMode​(Mode mode)
        remove mode from any layer
        Parameters:
        mode - to remove
        Returns:
        layer the mode was mapped to, null otherwise