Class GtfsConverterReaderHelper


  • public class GtfsConverterReaderHelper
    extends Object
    Convenience methods usable across various GTFS converter readers
    • Constructor Detail

      • GtfsConverterReaderHelper

        public GtfsConverterReaderHelper()
    • Method Detail

      • createCombinedActivatedPlanitModes

        public static HashMap<RouteType,​List<Mode>> createCombinedActivatedPlanitModes​(GtfsConverterReaderSettingsWithModeMapping settings,
                                                                                             Modes allAvailablePlanitModes)
        Based on the settings which define both custom and predefined mappings, we construct the instance mappings from Gtfs mode to PLANit mode, e.g., when a predefined mode type is configured, it results in an instance of that type on a network, this instance should be available in the passed in #allAvailablePlanitMdes, we then combine these mappings with the custom mode mappings on the settings to create a single consolidated set which can be used during parsing without the need of checking whether a mode is predefined or not.
        Parameters:
        settings - the settings to obtain the activated two types od mode mappings from
        allAvailablePlanitModes - the mode instances used that should be a superset of the activated mode mappings on the reader
        Returns:
        consolidated set of both custom and predefined modes sourced from the allAvailablePlanitModes
      • addToModeExternalId

        public static void addToModeExternalId​(Mode planitMode,
                                               RouteType gtfsMode)
        add GTFS type Id to PLANit mode external id (in case multiple GTFS modes are mapped to the same PLANit mode)
        Parameters:
        planitMode - to update external id for
        gtfsMode - to use
      • syncActivatedPlanitPredefinedModesBeforeParsing

        public static void syncActivatedPlanitPredefinedModesBeforeParsing​(GtfsServicesReaderSettings settings,
                                                                           MacroscopicNetwork network)
        Use when it is the time to make sure that the mapped predefined PLANit modes exist as actual mode instances, so supplement the provides modes container where needed based on the configuration.

        Also check based on the type of mode (track type, e.g., water/rail,road) that we only do so, if at least one mode exists of the same track type. If not log a warning. For example, if we have activate tram, but no rail based mode layers exist in the network, there is no point in activating, instead log a warning and deactivate on the GTFS settings instead

        Parameters:
        settings - to base modes configuration on
        network - to adjust modes for