Package org.goplanit.matsim.converter
Class MatsimNetworkWriterSettings
- java.lang.Object
-
- org.goplanit.converter.FileBasedConverterWriterSettings
-
- org.goplanit.converter.SingleFileBasedConverterWriterSettings
-
- org.goplanit.matsim.util.PlanitMatsimWriterSettings
-
- org.goplanit.matsim.util.PlanitMatsimWriterModeMappingSettings
-
- org.goplanit.matsim.converter.MatsimNetworkWriterSettings
-
- All Implemented Interfaces:
ConverterWriterSettings
public class MatsimNetworkWriterSettings extends PlanitMatsimWriterModeMappingSettings implements ConverterWriterSettings
Settings for the MATSIM writer By default the MATSIM writer will activate all available predefined PLANit modes for writing. In case the user wants to include custom modes as well, then they must be added manually via the class' available functionality. In case the user wants to exclude certain modes that are available in the network that is provided, they must be removed manually here as well. The CRS used for the writer is based on the CRS defined in the settings, if this is not set, we utilise the CRS corresponding to the provided country, if no country is provided, it will retain the CRS of the network provided. If the network has no CRS an exception will be thrown- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description static Boolean
DEFAULT_GENERATE_DETAILED_LINK_GEOMETRY
Default setting for generating detailed link geometry file is falsestatic 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 boolean
generateDetailedLinkGeometryFile
when set to true, a separate detailed geometry file is generated that provides the detailed geometry of each link it can be used in the VIA viewer to enhance the look of the network which otherwise only depicts the end and start node, default is falseprotected Function<MacroscopicLinkSegment,String>
linkNtCategoryfunction
optional function used to populate the MATSIM link's nt_category field if setprotected Function<MacroscopicLinkSegment,String>
linkNtTypefunction
optional function used to populate the MATSIM link's nt_type field if setprotected Function<MacroscopicLinkSegment,String>
linkTypefunction
optional function used to populate the MATSIM link's type field if setprotected boolean
restrictLinkSpeedBySupportedModes
Flag that indicates if a link's physical speed limit is to be reduced in case only modes with a lower top speed than the speed limit are included on this link.-
Fields inherited from class org.goplanit.matsim.util.PlanitMatsimWriterModeMappingSettings
activatedPlanitModes, DEFAULT_ACTIVATED_MODES, DEFAULT_PLANIT2MATSIM_MODE_MAPPING, planit2MatsimModeMapping
-
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 Constructor Description MatsimNetworkWriterSettings(String countryName)
constructorMatsimNetworkWriterSettings(String outputDirectory, String countryName)
constructorMatsimNetworkWriterSettings(String outputDirectory, String outputFileName, String countryName)
constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isGenerateDetailedLinkGeometryFile()
Check if a detailed geometry file is generatedboolean
isRestrictLinkSpeedBySupportedModes()
Check if link speed is to be restricted by the supported modes' max speed (if more restrictive)void
logSettings(MacroscopicNetwork macroscopicNetwork)
Convenience method to log all the current settingsvoid
reset()
Reset contentvoid
setGenerateDetailedLinkGeometryFile(boolean generateDetailedLinkGeometryFile)
Set the choice for whether a detailed geometry file for each link is created.void
setNtCategoryFunction(Function<MacroscopicLinkSegment,String> linkNtCategoryfunction)
Allow the user to provide their own function on how to populate the nt_category field of a MATSIM link based on the link segment that is provided to itvoid
setNtTypeFunction(Function<MacroscopicLinkSegment,String> linkNtTypefunction)
Allow the user to provide their own function on how to populate the nt_type field of a MATSIM link based on the link segment that is provided to itvoid
setRestrictLinkSpeedBySupportedModes(boolean restrictLinkSpeedBySupportedModes)
Set if link speed is to be restricted by the supported modes' max speed (if more restrictive)void
setTypeFunction(Function<MacroscopicLinkSegment,String> linkTypeFunction)
Allow the user to provide their own function on how to populate the type field of a MATSIM link based on the link segment that is provided to it-
Methods inherited from class org.goplanit.matsim.util.PlanitMatsimWriterModeMappingSettings
activatePredefinedMode, collectActivatedPlanitModeToMatsimModeMapping, createDefaultActivatedPlanitModes, createDefaultPredefinedModeMappings, deactivateAllModes, deactivatePredefinedMode, getDefaultPredefinedModeMappings, updatePredefinedModeMapping
-
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
-
linkNtCategoryfunction
protected Function<MacroscopicLinkSegment,String> linkNtCategoryfunction
optional function used to populate the MATSIM link's nt_category field if set
-
linkNtTypefunction
protected Function<MacroscopicLinkSegment,String> linkNtTypefunction
optional function used to populate the MATSIM link's nt_type field if set
-
linkTypefunction
protected Function<MacroscopicLinkSegment,String> linkTypefunction
optional function used to populate the MATSIM link's type field if set
-
generateDetailedLinkGeometryFile
protected boolean generateDetailedLinkGeometryFile
when set to true, a separate detailed geometry file is generated that provides the detailed geometry of each link it can be used in the VIA viewer to enhance the look of the network which otherwise only depicts the end and start node, default is false
-
restrictLinkSpeedBySupportedModes
protected boolean restrictLinkSpeedBySupportedModes
Flag that indicates if a link's physical speed limit is to be reduced in case only modes with a lower top speed than the speed limit are included on this link. for example when a bus only network is generated, the bus max speed might be lower than the link speed limit. when set to true the speed limit is the minimum of the physical and mode speed limit. When false the physical speed limit it used.
-
DEFAULT_GENERATE_DETAILED_LINK_GEOMETRY
public static final Boolean DEFAULT_GENERATE_DETAILED_LINK_GEOMETRY
Default setting for generating detailed link geometry file is false
-
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
-
MatsimNetworkWriterSettings
public MatsimNetworkWriterSettings(String countryName)
constructor- Parameters:
countryName
- to use
-
MatsimNetworkWriterSettings
public MatsimNetworkWriterSettings(String outputDirectory, String countryName)
constructor- Parameters:
outputDirectory
- to usecountryName
- to use
-
-
Method Detail
-
logSettings
public void logSettings(MacroscopicNetwork macroscopicNetwork)
Convenience method to log all the current settings- Overrides:
logSettings
in classPlanitMatsimWriterModeMappingSettings
- Parameters:
macroscopicNetwork
- provided for reference
-
setNtCategoryFunction
public void setNtCategoryFunction(Function<MacroscopicLinkSegment,String> linkNtCategoryfunction)
Allow the user to provide their own function on how to populate the nt_category field of a MATSIM link based on the link segment that is provided to it- Parameters:
linkNtCategoryfunction
- to apply
-
setNtTypeFunction
public void setNtTypeFunction(Function<MacroscopicLinkSegment,String> linkNtTypefunction)
Allow the user to provide their own function on how to populate the nt_type field of a MATSIM link based on the link segment that is provided to it- Parameters:
linkNtTypefunction
- to apply
-
setTypeFunction
public void setTypeFunction(Function<MacroscopicLinkSegment,String> linkTypeFunction)
Allow the user to provide their own function on how to populate the type field of a MATSIM link based on the link segment that is provided to it- Parameters:
linkTypeFunction
- to apply
-
isGenerateDetailedLinkGeometryFile
public boolean isGenerateDetailedLinkGeometryFile()
Check if a detailed geometry file is generated- Returns:
- true when active, false otherwise
-
setGenerateDetailedLinkGeometryFile
public void setGenerateDetailedLinkGeometryFile(boolean generateDetailedLinkGeometryFile)
Set the choice for whether a detailed geometry file for each link is created. This geometry is extracted from the PLANit link geometry.- Parameters:
generateDetailedLinkGeometryFile
- flag indicating to generate geometry file or not
-
isRestrictLinkSpeedBySupportedModes
public boolean isRestrictLinkSpeedBySupportedModes()
Check if link speed is to be restricted by the supported modes' max speed (if more restrictive)- Returns:
- true when active, false otherwise
-
setRestrictLinkSpeedBySupportedModes
public void setRestrictLinkSpeedBySupportedModes(boolean restrictLinkSpeedBySupportedModes)
Set if link speed is to be restricted by the supported modes' max speed (if more restrictive)- Parameters:
restrictLinkSpeedBySupportedModes
- flag to set
-
reset
public void reset()
Reset content- Specified by:
reset
in interfaceConverterWriterSettings
- Overrides:
reset
in classPlanitMatsimWriterModeMappingSettings
-
-