Package org.goplanit.matsim.util
Class PlanitMatsimWriterModeMappingSettings
- java.lang.Object
-
- org.goplanit.converter.FileBasedConverterWriterSettings
-
- org.goplanit.converter.SingleFileBasedConverterWriterSettings
-
- org.goplanit.matsim.util.PlanitMatsimWriterSettings
-
- org.goplanit.matsim.util.PlanitMatsimWriterModeMappingSettings
-
- All Implemented Interfaces:
ConverterWriterSettings
- Direct Known Subclasses:
MatsimNetworkWriterSettings
,MatsimPtServicesWriterSettings
public abstract class PlanitMatsimWriterModeMappingSettings extends PlanitMatsimWriterSettings implements ConverterWriterSettings
Base writer settings class to be used by all available matsim writer settings classes. Contains the output directory and destination country name used- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<PredefinedModeType>
activatedPlanitModes
track the PLANit modes that we include in the network to writeprotected static Set<PredefinedModeType>
DEFAULT_ACTIVATED_MODES
track the PLANit modes that we include in the network to writeprotected static Map<PredefinedModeType,String>
DEFAULT_PLANIT2MATSIM_MODE_MAPPING
provides the default mapping from planit modes ((predefined) mode name) to MATSIM mode (string)static String
DEFAULT_PRIVATE_TRANSPORT_MODE
default mode for all private transport modes in Matsim is car, so that is what we use for initial mappingstatic String
DEFAULT_PUBLIC_TRANSPORT_MODE
default mode for all public transport modes in Matsim is pt, so that is what we use for initial mappingstatic Boolean
DEFAULT_RESTRICT_SPEED_LIMIT_BY_SUPPORTED_MODE
Default setting for restricting a link's max speed by its supported mode max speeds if more restrictingprotected Map<PredefinedModeType,String>
planit2MatsimModeMapping
provides the mapping from PLANit modes ((predefined) mode name) to MATSIM mode (string)-
Fields inherited from class org.goplanit.matsim.util.PlanitMatsimWriterSettings
decimalFormat, DEFAULT_NETWORK_FILE_NAME, DEFAULT_TRANSIT_SCHEDULE_FILE_NAME
-
Fields inherited from class org.goplanit.converter.FileBasedConverterWriterSettings
DEFAULT_COUNTRY, destinationCoordinateReferenceSystem
-
-
Constructor Summary
Constructors Modifier Constructor Description PlanitMatsimWriterModeMappingSettings(String countryName)
constructorPlanitMatsimWriterModeMappingSettings(String outputDirectory, String countryName)
constructorPlanitMatsimWriterModeMappingSettings(String outputDirectory, String outputFileName, String countryName)
constructorPlanitMatsimWriterModeMappingSettings(String outputDirectory, String outputFileName, String countryName, Map<PredefinedModeType,String> planit2MatsimModeMapping, Set<PredefinedModeType> activatedPlanitModes)
constructorprotected
PlanitMatsimWriterModeMappingSettings(PlanitMatsimWriterModeMappingSettings other)
Shallow copy constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activatePredefinedMode(PredefinedModeType planitModeType)
Activate the provided predefined mode from the activated modes listed for inclusion in the MATSIM network (in mapped form).Map<Mode,String>
collectActivatedPlanitModeToMatsimModeMapping(MacroscopicNetworkLayerImpl networkLayer)
Creating a mapping from actual PLANit modes in the network to the MATSIM mode mapping as per the configuration in this class instanceprotected static Set<PredefinedModeType>
createDefaultActivatedPlanitModes()
Create the default activate PLANit modes that the MATSIM write will include when writing the network (if they are available).protected static Map<PredefinedModeType,String>
createDefaultPredefinedModeMappings()
Initialise the predefined PLANit modes to MATSIM mode mapping, based on the (predefined) mode names.void
deactivateAllModes()
Deactivate all currently activated modesvoid
deactivatePredefinedMode(PredefinedModeType planitModeType)
Remove the provided predefined mode from the activated modes listed for inclusion in the MATSIM network (in mapped form)protected static String
getDefaultPredefinedModeMappings(PredefinedModeType modeType)
Collect the default mapping from PLANit predefined mode to MATSim modeprotected void
logSettings(MacroscopicNetwork macroscopicNetwork)
Convenience method to log all the current settingsvoid
reset()
Reset contentvoid
updatePredefinedModeMapping(PredefinedModeType planitModeType, String matsimMode)
Overwrite a mapping from a predefined PLANit mode to a particular MATSim mode-
Methods inherited from class org.goplanit.matsim.util.PlanitMatsimWriterSettings
getDecimalFormat, setDecimalFormat
-
Methods inherited from class org.goplanit.converter.SingleFileBasedConverterWriterSettings
getFileName, logSettings, setFileName, validate
-
Methods inherited from class org.goplanit.converter.FileBasedConverterWriterSettings
getCountry, getDestinationCoordinateReferenceSystem, getOutputDirectory, setCountry, setDestinationCoordinateReferenceSystem, setOutputDirectory
-
-
-
-
Field Detail
-
DEFAULT_PLANIT2MATSIM_MODE_MAPPING
protected static final Map<PredefinedModeType,String> DEFAULT_PLANIT2MATSIM_MODE_MAPPING
provides the default mapping from planit modes ((predefined) mode name) to MATSIM mode (string)
-
DEFAULT_ACTIVATED_MODES
protected static final Set<PredefinedModeType> DEFAULT_ACTIVATED_MODES
track the PLANit modes that we include in the network to write
-
planit2MatsimModeMapping
protected final Map<PredefinedModeType,String> planit2MatsimModeMapping
provides the mapping from PLANit modes ((predefined) mode name) to MATSIM mode (string)
-
activatedPlanitModes
protected final Set<PredefinedModeType> activatedPlanitModes
track the PLANit modes that we include in the network to write
-
DEFAULT_RESTRICT_SPEED_LIMIT_BY_SUPPORTED_MODE
public static final Boolean DEFAULT_RESTRICT_SPEED_LIMIT_BY_SUPPORTED_MODE
Default setting for restricting a link's max speed by its supported mode max speeds if more restricting
-
DEFAULT_PUBLIC_TRANSPORT_MODE
public static final String DEFAULT_PUBLIC_TRANSPORT_MODE
default mode for all public transport modes in Matsim is pt, so that is what we use for initial mapping- See Also:
- Constant Field Values
-
DEFAULT_PRIVATE_TRANSPORT_MODE
public static final String DEFAULT_PRIVATE_TRANSPORT_MODE
default mode for all private transport modes in Matsim is car, so that is what we use for initial mapping- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PlanitMatsimWriterModeMappingSettings
protected PlanitMatsimWriterModeMappingSettings(PlanitMatsimWriterModeMappingSettings other)
Shallow copy constructor. Can be sued when mode mappings requires syncing across various settings classes that are used simulatneously- Parameters:
other
- to create shallow copy (with respect to mode mappings)
-
PlanitMatsimWriterModeMappingSettings
public PlanitMatsimWriterModeMappingSettings(String countryName)
constructor- Parameters:
countryName
- to use
-
PlanitMatsimWriterModeMappingSettings
public PlanitMatsimWriterModeMappingSettings(String outputDirectory, String countryName)
constructor- Parameters:
outputDirectory
- to usecountryName
- to use
-
PlanitMatsimWriterModeMappingSettings
public PlanitMatsimWriterModeMappingSettings(String outputDirectory, String outputFileName, String countryName)
constructor- Parameters:
outputDirectory
- to useoutputFileName
- to usecountryName
- to use
-
PlanitMatsimWriterModeMappingSettings
public PlanitMatsimWriterModeMappingSettings(String outputDirectory, String outputFileName, String countryName, Map<PredefinedModeType,String> planit2MatsimModeMapping, Set<PredefinedModeType> activatedPlanitModes)
constructor- Parameters:
outputDirectory
- to useoutputFileName
- to usecountryName
- to useplanit2MatsimModeMapping
- instead of using an internally created instance based on defaults, use the provided mapping as a starting pointactivatedPlanitModes
- instead of using an internally created instance based on defaults, use the provided activated modes as a starting point
-
-
Method Detail
-
createDefaultPredefinedModeMappings
protected static Map<PredefinedModeType,String> createDefaultPredefinedModeMappings()
Initialise the predefined PLANit modes to MATSIM mode mapping, based on the (predefined) mode names. MATSIM seems not to have any predefined modes, so any name can be given to them. We therefore apply the PLANit's name attribute as the id for the mapping to MATSIM mode- Returns:
- default mode mapping based on predefined modes
-
getDefaultPredefinedModeMappings
protected static String getDefaultPredefinedModeMappings(PredefinedModeType modeType)
Collect the default mapping from PLANit predefined mode to MATSim mode- Parameters:
modeType
- to get MATSim default mapping for- Returns:
- default mapping found
-
createDefaultActivatedPlanitModes
protected static Set<PredefinedModeType> createDefaultActivatedPlanitModes()
Create the default activate PLANit modes that the MATSIM write will include when writing the network (if they are available). By default, all predefined PLANit modes that could be reasonably mapped to motorised private mode car (car) or public transport (pt) are activated.- Returns:
- default activate PLANit modes (by name)
-
logSettings
protected void logSettings(MacroscopicNetwork macroscopicNetwork)
Convenience method to log all the current settings- Parameters:
macroscopicNetwork
- provided for reference
-
updatePredefinedModeMapping
public void updatePredefinedModeMapping(PredefinedModeType planitModeType, String matsimMode)
Overwrite a mapping from a predefined PLANit mode to a particular MATSim mode- Parameters:
planitModeType
- PLANit modematsimMode
- the new MATSim mode string to use
-
deactivatePredefinedMode
public void deactivatePredefinedMode(PredefinedModeType planitModeType)
Remove the provided predefined mode from the activated modes listed for inclusion in the MATSIM network (in mapped form)- Parameters:
planitModeType
- to deactivate
-
deactivateAllModes
public void deactivateAllModes()
Deactivate all currently activated modes
-
activatePredefinedMode
public void activatePredefinedMode(PredefinedModeType planitModeType)
Activate the provided predefined mode from the activated modes listed for inclusion in the MATSIM network (in mapped form). By default all PLANit modes are active, so this is only needed when a mode has been deactivated earlier- Parameters:
planitModeType
- to activate
-
collectActivatedPlanitModeToMatsimModeMapping
public Map<Mode,String> collectActivatedPlanitModeToMatsimModeMapping(MacroscopicNetworkLayerImpl networkLayer)
Creating a mapping from actual PLANit modes in the network to the MATSIM mode mapping as per the configuration in this class instance- Parameters:
networkLayer
- the networkLayer- Returns:
- the mapped PLANit mode instances to MATSIM modes (string)
-
reset
public void reset()
Reset content- Specified by:
reset
in interfaceConverterWriterSettings
- Overrides:
reset
in classSingleFileBasedConverterWriterSettings
-
-