Class PlanitNetworkWriter
- java.lang.Object
-
- org.goplanit.converter.BaseWriterImpl<T>
-
- org.goplanit.io.converter.PlanitWriterImpl<TransportLayerNetwork<?,?>>
-
- org.goplanit.io.converter.network.PlanitNetworkWriter
-
- All Implemented Interfaces:
ConverterEntity,ConverterWriter<TransportLayerNetwork<?,?>>,NetworkWriter
public class PlanitNetworkWriter extends PlanitWriterImpl<TransportLayerNetwork<?,?>> implements NetworkWriter
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 StringDEFAULT_NETWORK_FILE_NAMEdefault network file name to use-
Fields inherited from class org.goplanit.converter.BaseWriterImpl
idMapper
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPlanitNetworkWriter(String networkPath, String countryName, org.goplanit.xml.generated.XMLElementMacroscopicNetwork xmlRawNetwork)ConstructorprotectedPlanitNetworkWriter(String networkPath, org.goplanit.xml.generated.XMLElementMacroscopicNetwork xmlRawNetwork)ConstructorprotectedPlanitNetworkWriter(org.goplanit.xml.generated.XMLElementMacroscopicNetwork xmlRawNetwork)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetCountryName()the country name of the network to write (if any is set)PlanitNetworkWriterSettingsgetSettings()any settings to configure the writer can be configured by collecting these settingsprotected voidpopulateXmlConfiguration(Modes modes)Populate the link configuration for this network, i.e., the modesprotected voidpopulateXmlLayerConfiguration(org.goplanit.xml.generated.XMLElementInfrastructureLayer xmlNetworkLayer, MacroscopicLinkSegmentTypes linkSegmentTypes)Populate the layer configuration for this network, i.e., link segment typesprotected voidpopulateXmlNetworkLayer(org.goplanit.xml.generated.XMLElementInfrastructureLayers xmlInfrastructureLayers, MacroscopicNetworkLayerImpl physicalNetworkLayer)Populate the network layerprotected voidpopulateXmlNetworkLayers(MacroscopicNetwork network)Populate the available network layersvoidreset()reset the reader to allow for marking unnecessary resources for garbage collectionvoidwrite(TransportLayerNetwork<?,?> network)write a network to the writer's output format.-
Methods inherited from class org.goplanit.io.converter.PlanitWriterImpl
createGmlCoordType, createGmlDirectPositionType, createGmlLineStringType, createGmlPointType, createGmlPolygonType, extractSrsName, getConnectoidIdMapper, getDestinationCrsTransformer, getGeoUtils, getLinkIdMapper, getLinkSegmentIdMapper, getLinkSegmentTypeIdMapper, getModeIdMapper, getTransferZoneGroupIdMapper, getVertexIdMapper, getZoneIdMapper, initialiseIdMappingFunctions, persist, prepareCoordinateReferenceSystem
-
Methods inherited from class org.goplanit.converter.BaseWriterImpl
getIdMapperType, identifyDestinationCoordinateReferenceSystem, setIdMapperType
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.converter.ConverterWriter
getIdMapperType, setIdMapperType
-
Methods inherited from interface org.goplanit.converter.network.NetworkWriter
getTypeDescription
-
-
-
-
Field Detail
-
DEFAULT_NETWORK_FILE_NAME
public static final String DEFAULT_NETWORK_FILE_NAME
default network file name to use- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PlanitNetworkWriter
protected PlanitNetworkWriter(org.goplanit.xml.generated.XMLElementMacroscopicNetwork xmlRawNetwork)
Constructor- Parameters:
xmlRawNetwork- to populate with PLANit network when persisting
-
PlanitNetworkWriter
protected PlanitNetworkWriter(String networkPath, org.goplanit.xml.generated.XMLElementMacroscopicNetwork xmlRawNetwork)
Constructor- Parameters:
networkPath- to persist network onxmlRawNetwork- to populate with PLANit network when persisting
-
PlanitNetworkWriter
protected PlanitNetworkWriter(String networkPath, String countryName, org.goplanit.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.goplanit.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
-
populateXmlNetworkLayer
protected void populateXmlNetworkLayer(org.goplanit.xml.generated.XMLElementInfrastructureLayers xmlInfrastructureLayers, MacroscopicNetworkLayerImpl physicalNetworkLayer) throws PlanItExceptionPopulate the network layer- Parameters:
xmlInfrastructureLayers- to add xml layer tophysicalNetworkLayer- to populate from- Throws:
PlanItException- thrown if error
-
populateXmlNetworkLayers
protected void populateXmlNetworkLayers(MacroscopicNetwork network) throws PlanItException
Populate the available network layers- Parameters:
network- to extract layers from and populate xml- Throws:
PlanItException- thrown if error
-
write
public void write(TransportLayerNetwork<?,?> network) throws PlanItException
write a network to the writer's output format.- Specified by:
writein interfaceConverterWriter<TransportLayerNetwork<?,?>>- Parameters:
network- entity to write- Throws:
PlanItException- thrown if error
-
reset
public void reset()
reset the reader to allow for marking unnecessary resources for garbage collection- Specified by:
resetin interfaceConverterEntity
-
getSettings
public PlanitNetworkWriterSettings getSettings()
any settings to configure the writer can be configured by collecting these settings- Specified by:
getSettingsin interfaceConverterWriter<TransportLayerNetwork<?,?>>- Returns:
- the settings to configure the writer
-
getCountryName
public String getCountryName()
the country name of the network to write (if any is set)- Returns:
- countryname, null if unknown
-
-