Package org.planit.io.network.converter
Class PlanitNetworkWriter
- java.lang.Object
-
- org.planit.network.converter.NetworkWriterImpl
-
- org.planit.io.network.converter.PlanitNetworkWriter
-
- All Implemented Interfaces:
NetworkWriter
public class PlanitNetworkWriter extends NetworkWriterImpl
Writer to persist a PLANit network to disk in the native PLANit format. By default the xml ids are used for writing out the ids in the XML.- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_NETWORK_FILE_NAME
protected PlanitNetworkWriterSettings
settings
user configurable settings for the writer-
Fields inherited from class org.planit.network.converter.NetworkWriterImpl
idMapper
-
-
Constructor Summary
Constructors Constructor Description PlanitNetworkWriter(String networkPath, String countryName, org.planit.xml.generated.XMLElementMacroscopicNetwork xmlRawNetwork)
ConstructorPlanitNetworkWriter(String networkPath, org.planit.xml.generated.XMLElementMacroscopicNetwork xmlRawNetwork)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
initialiseIdMappingFunctions()
depending on the chosen id mapping, create the mapping functions for all id carrying entities that are persistedprotected void
persist()
persist the populated XML memory model to disk using JAXbprotected void
populateXmlConfiguration(Modes modes)
populate the link configuration for this network, i.e., the modesprotected void
populateXmlLayerConfiguration(org.planit.xml.generated.XMLElementInfrastructureLayer xmlNetworkLayer, MacroscopicLinkSegmentTypes linkSegmentTypes)
populate the layer configuration for this network, i.e., link segment typesprotected void
populateXmlNetworkLayer(org.planit.xml.generated.XMLElementInfrastructureLayers xmlInfrastructureLayers, MacroscopicPhysicalNetwork physicalNetworkLayer)
populate the network layerprotected void
populateXmlNetworkLayers(MacroscopicNetwork network)
populate the available network layersprotected void
prepareCoordinateReferenceSystem(MacroscopicNetwork network)
prepare the Crs transformer (if any) based on the user configuration settingsvoid
write(InfrastructureNetwork network)
write a network to the writer's output format.-
Methods inherited from class org.planit.network.converter.NetworkWriterImpl
getIdMapperType, identifyDestinationCoordinateReferenceSystem, setIdMapperType
-
-
-
-
Field Detail
-
settings
protected final PlanitNetworkWriterSettings settings
user configurable settings for the writer
-
DEFAULT_NETWORK_FILE_NAME
public static final String DEFAULT_NETWORK_FILE_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PlanitNetworkWriter
public PlanitNetworkWriter(String networkPath, org.planit.xml.generated.XMLElementMacroscopicNetwork xmlRawNetwork)
Constructor- Parameters:
networkPath
- to persist network onxmlRawNetwork
- to populate with PLANit network when persisting
-
PlanitNetworkWriter
public PlanitNetworkWriter(String networkPath, String countryName, org.planit.xml.generated.XMLElementMacroscopicNetwork xmlRawNetwork)
Constructor- Parameters:
networkPath
- to persist network oncountryName
- to optimise projection for (if available, otherwise ignore)xmlRawNetwork
- to populate with PLANit network when persisting
-
-
Method Detail
-
populateXmlConfiguration
protected void populateXmlConfiguration(Modes modes)
populate the link configuration for this network, i.e., the modes- Parameters:
modes
- to use to populate the XML elements
-
populateXmlLayerConfiguration
protected void populateXmlLayerConfiguration(org.planit.xml.generated.XMLElementInfrastructureLayer xmlNetworkLayer, MacroscopicLinkSegmentTypes linkSegmentTypes)
populate the layer configuration for this network, i.e., link segment types- Parameters:
xmlNetworkLayer
- to add types tolinkSegmentTypes
- to use to populate the XML elements
-
initialiseIdMappingFunctions
protected void initialiseIdMappingFunctions() throws PlanItException
depending on the chosen id mapping, create the mapping functions for all id carrying entities that are persisted- Throws:
PlanItException
- thrown if error
-
persist
protected void persist() throws PlanItException
persist the populated XML memory model to disk using JAXb- Throws:
PlanItException
- thrown if error
-
prepareCoordinateReferenceSystem
protected void prepareCoordinateReferenceSystem(MacroscopicNetwork network) throws PlanItException
prepare the Crs transformer (if any) based on the user configuration settings- Parameters:
network
- the network extract current Crs if no user specific settings can be found- Throws:
PlanItException
- thrown if error
-
populateXmlNetworkLayer
protected void populateXmlNetworkLayer(org.planit.xml.generated.XMLElementInfrastructureLayers xmlInfrastructureLayers, MacroscopicPhysicalNetwork physicalNetworkLayer)
populate the network layer- Parameters:
xmlInfrastructureLayers
- to add xml layer tophysicalNetworkLayer
- to populate from
-
populateXmlNetworkLayers
protected void populateXmlNetworkLayers(MacroscopicNetwork network)
populate the available network layers- Parameters:
network
- to extract layers from and populate xml
-
write
public void write(InfrastructureNetwork network) throws PlanItException
write a network to the writer's output format.- Parameters:
network
- memory model network to write- Throws:
PlanItException
- thrown if error
-
-