Class OsmWaterwaySettings


  • public class OsmWaterwaySettings
    extends OsmWaySettings
    Settings specific to waterways when parsing OSM files and converting them to a PLANit memory model
    Author:
    markr
    • Field Detail

      • DEFAULT_WATERWAYS_PARSER_ACTIVE

        public static boolean DEFAULT_WATERWAYS_PARSER_ACTIVE
        by default the ferry parser is deactivated
    • Constructor Detail

      • OsmWaterwaySettings

        public OsmWaterwaySettings​(OsmSpeedLimitDefaultsCategory waterwaySpeedLimitDefaults,
                                   OsmModeAccessDefaultsCategory osmModeAccessWaterwayDefaults)
        Constructor
        Parameters:
        waterwaySpeedLimitDefaults - as they are initially provided
        osmModeAccessWaterwayDefaults - configuration
    • Method Detail

      • initialiseDefaultMappingFromOsmWaterModes2PlanitModes

        protected void initialiseDefaultMappingFromOsmWaterModes2PlanitModes()
        each OSM water based mode is mapped (or not) to a PLANit mode by default so that the memory model's modes are user configurable yet linked to the original format. Note that when the reader is used i.c.w. a network writer to convert one network to the other. It is paramount that the PLANit modes that are mapped here are also mapped by the writer to the output format to ensure a correct I/O mapping of modes The default mapping is provided below. In contrast to road modes, rail modes do not have specific restrictions. Hence, we can map more exotic OSM rail modes to more common PLANit rail modes, without imposing its restrictions on this common mode.
        • FERRY to FerryMode
      • isOsmWaterwayTypeDeactivated

        public boolean isOsmWaterwayTypeDeactivated​(String osmWaterWayValue)
        Verify if the passed in OSM waterway type is explicitly deactivated. Deactivated route types will be ignored when processing ways.
        Parameters:
        osmWaterWayValue - , e.g. ferry (waterways are directly linked to modes) or a highway type (Assuming the key was ferry, e.g. ferry=_a_highway_type_
        Returns:
        true when unSupported, false if not (which means it is either supported, or not registered)
      • isOsmWaterwayTypeActivated

        public boolean isOsmWaterwayTypeActivated​(String osmWayValue)
        Verify if the passed in OSM waterway type is explicitly activated. Activated types will be processed and converted into link(segments).
        Parameters:
        osmWayValue - , e.g. ferry (waterways are directly linked to modes) or a highway type (Assuming the key was ferry, e.g. ferry=_a_highway_type_
        Returns:
        true when supported, false if not (which means it is unsupported, or not registered)
      • deactivateOsmWaterwayType

        public void deactivateOsmWaterwayType​(String osmWayValue)
        Choose to not parse the given waterway type, e.g. ferry=primary.
        Parameters:
        osmWayValue - to use
      • deactivateAllOsmWaterwayTypesExcept

        public void deactivateAllOsmWaterwayTypesExcept​(String... osmWaterwayTypes)
        deactivate all types for railway except the ones provides
        Parameters:
        osmWaterwayTypes - to not deactivate
      • deactivateAllOsmWaterwayTypesExcept

        public void deactivateAllOsmWaterwayTypesExcept​(List<String> osmWaterwayTypes)
        deactivate all types for waterway except the ones provides
        Parameters:
        osmWaterwayTypes - to not deactivate
      • activateOsmWaterwayType

        public void activateOsmWaterwayType​(String osmWayValue)
        Choose to add given waterway type to parsed types on top of the defaults, e.g. ferry=primary.
        Parameters:
        osmWayValue - to use
      • activateOsmWaterwayTypes

        public void activateOsmWaterwayTypes​(String... osmWaterwayValueTypes)
        activate all passed in waterway types
        Parameters:
        osmWaterwayValueTypes - to activate
      • activateOsmWaterwayTypes

        public void activateOsmWaterwayTypes​(List<String> osmWaterwayValueTypes)
        activate all passed in waterway types
        Parameters:
        osmWaterwayValueTypes - to activate
      • activateAllOsmWaterwayTypes

        public void activateAllOsmWaterwayTypes()
        activate all known OSM waterway types
      • deactivateAllOsmWaterwayTypes

        public void deactivateAllOsmWaterwayTypes()
        deactivate all types for waterways
      • logUnsupportedOsmWaterwayTypes

        public void logUnsupportedOsmWaterwayTypes()
        Log all de-activated OSM waterway types
      • overwriteCapacityMaxDensityDefaults

        public void overwriteCapacityMaxDensityDefaults​(String osmWaterwayType,
                                                        Number capacityPcuPerLanePerHour,
                                                        Number maxDensityPcuPerLane)
        Choose to overwrite the given waterway route type defaults with the given values
        Parameters:
        osmWaterwayType - the type to set these values for
        capacityPcuPerLanePerHour - new value in pcu/lane/h
        maxDensityPcuPerLane - new value pcu/km/lane
      • isDefaultCapacityOrMaxDensityOverwrittenByOsmWaterwayRouteType

        public boolean isDefaultCapacityOrMaxDensityOverwrittenByOsmWaterwayRouteType​(String osmWayType)
        check if defaults should be overwritten
        Parameters:
        osmWayType - to check
        Returns:
        true when new defaults are provided, false otherwise
      • getOverwrittenCapacityMaxDensityByOsmWaterwayRouteType

        public final Pair<Double,​Double> getOverwrittenCapacityMaxDensityByOsmWaterwayRouteType​(String osmWayRouteType)
        Collect the overwritten type values that should be used
        Parameters:
        osmWayRouteType - to collect overwrite values for
        Returns:
        the new values capacity (pcu/lane/h) and maxDensity (pcu/km/lane)
      • getDefaultSpeedLimitByOsmWaterwayType

        public Double getDefaultSpeedLimitByOsmWaterwayType​(String waterwayValue)
        Collect the default speed limit for waterways
        Parameters:
        waterwayValue - value to use
        Returns:
        speedLimit in km/h
      • activateOsmWaterMode

        public void activateOsmWaterMode​(String osmWaterMode)
        activate an OSM water way mode based on its (default) mapping to a PLANit mode. This means that the osmMode will be added to the PLANit network
        Parameters:
        osmWaterMode - to activate
      • deactivateOsmWaterMode

        public void deactivateOsmWaterMode​(String osmWaterMode)
        Remove a mapping from OSM water mode to PLANit mode. This means that the osmMode will not be added to the PLANit network You can only remove a mode when it is already added, either manually or through the default mapping
        Parameters:
        osmWaterMode - to remove
      • deactivateOsmWaterModes

        public void deactivateOsmWaterModes​(List<String> osmWaterModes)
        remove a mapping from OSM water modes to PLANit modes. This means that the osmModes will not be added to the PLANit network You can only remove modes when they are already added, either manually or through the default mapping
        Parameters:
        osmWaterModes - to remove
      • deactivateOsmWaterModes

        public void deactivateOsmWaterModes​(String... osmWaterModes)
        deactivate provided water modes
        Parameters:
        osmWaterModes - to explicitly deactivate
      • deactivateAllOsmWaterModes

        public void deactivateAllOsmWaterModes()
        remove all water modes from mapping
      • deactivateAllOsmWaterModesExcept

        public void deactivateAllOsmWaterModesExcept​(String... remainingOsmWaterModes)
        remove all water modes from mapping except for the passed in ones
        Parameters:
        remainingOsmWaterModes - to explicitly keep if present
      • deactivateAllOsmWaterModesExcept

        public void deactivateAllOsmWaterModesExcept​(List<String> remainingOsmWaterModes)
        remove all water modes from mapping except for the passed in ones
        Parameters:
        remainingOsmWaterModes - to explicitly keep if present
      • getMappedPlanitWaterMode

        public PredefinedModeType getMappedPlanitWaterMode​(String osmMode)
        convenience method that collects the currently mapped PLANit mode for the given OSM mode
        Parameters:
        osmMode - to collect mapped mode type for (if any)
        Returns:
        mapped PLANit mode, if not available null is returned
      • getMappedOsmWaterModes

        public final Collection<String> getMappedOsmWaterModes​(PredefinedModeType planitModeType)
        Convenience method that collects the currently mapped OSM water modes for the given PLANit mode
        Parameters:
        planitModeType - to collect mapped mode for (if any)
        Returns:
        mapped OSM modes, if not available empty collection is returned
      • collectAllowedOsmWaterwayModes

        public Collection<String> collectAllowedOsmWaterwayModes​(String osmWaterwayType)
        Collect all OSM modes that are allowed for the given OSM waterway type as configured by the user. Note we allow tagging values related to the key route=_mode_, e.g., ferry, as well as the de-factor standard where the 'ferry' is used as keyword and the way type reflects the equivalent of highway options, e.g., trunk, as in ferry=trunk.
        Parameters:
        osmWaterwayType - to use
        Returns:
        allowed OsmModes found, empty if none
      • logSettings

        public void logSettings()
        log way specific settings for derived classes
        Specified by:
        logSettings in class OsmWaySettings