Class PlanitServiceNetworkWriter
- java.lang.Object
-
- org.goplanit.converter.BaseWriterImpl<T>
-
- org.goplanit.converter.CrsWriterImpl<T>
-
- org.goplanit.io.converter.PlanitWriterImpl<T>
-
- org.goplanit.io.converter.network.UnTypedPlanitCrsWriterImpl<ServiceNetwork>
-
- org.goplanit.io.converter.service.PlanitServiceNetworkWriter
-
- All Implemented Interfaces:
ConverterEntity
,ConverterWriter<ServiceNetwork>
,ServiceNetworkWriter
public class PlanitServiceNetworkWriter extends UnTypedPlanitCrsWriterImpl<ServiceNetwork> implements ServiceNetworkWriter
Writer to persist a PLANit service 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 inherited from class org.goplanit.converter.BaseWriterImpl
idMapper
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PlanitServiceNetworkWriter(String networkPath, String countryName, org.goplanit.xml.generated.XMLElementServiceNetwork xmlRawServiceNetwork)
Constructorprotected
PlanitServiceNetworkWriter(String networkPath, org.goplanit.xml.generated.XMLElementServiceNetwork xmlRawServiceNetwork)
Constructorprotected
PlanitServiceNetworkWriter(org.goplanit.xml.generated.XMLElementServiceNetwork xmlRawServiceNetwork)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.goplanit.xml.generated.XMLElementServiceNetworkLayer
createAndPopulateXmlNetworkLayer(ServiceNetworkLayer serviceNetworkLayer, ServiceNetwork serviceNetwork)
Populate the network layerString
getCountryName()
the country name of the network to write (if any is set)ServiceNetworkIdMapper
getPrimaryIdMapper()
The (main) Id mapper used by this writer (only present after write has been completed)PlanitServiceNetworkWriterSettings
getSettings()
any settings to configure the writer can be configured by collecting these settingsprotected void
populateTopLevelElement(ServiceNetwork serviceNetwork)
Populate the top level XML element for the service network and include parent network reference.protected void
populateXmlServiceNetworkLayers(ServiceNetwork serviceNetwork)
Populate the available service network layersvoid
reset()
reset the reader to allow for marking unnecessary resources for garbage collectionvoid
write(ServiceNetwork serviceNetwork)
write a network to the writer's output format.-
Methods inherited from class org.goplanit.io.converter.network.UnTypedPlanitCrsWriterImpl
createGmlCoordType, createGmlDirectPositionType, createGmlLineStringType, createGmlPointType, createGmlPolygonType
-
Methods inherited from class org.goplanit.io.converter.PlanitWriterImpl
getSettingsAsXmlWriterSettings, getXmlModeReference, persist
-
Methods inherited from class org.goplanit.converter.CrsWriterImpl
createTransformedCoordinate, extractSrsName, getDestinationCoordinateReferenceSystem, getDestinationCrsTransformer, getGeoUtils, getTransformedCoordinates, prepareCoordinateReferenceSystem
-
Methods inherited from class org.goplanit.converter.BaseWriterImpl
getComponentIdMappers, getIdMapperType, setIdMapperType, setParentIdMappers
-
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.service.ServiceNetworkWriter
getTypeDescription
-
-
-
-
Constructor Detail
-
PlanitServiceNetworkWriter
protected PlanitServiceNetworkWriter(org.goplanit.xml.generated.XMLElementServiceNetwork xmlRawServiceNetwork)
Constructor- Parameters:
xmlRawServiceNetwork
- to populate with PLANit network when persisting
-
PlanitServiceNetworkWriter
protected PlanitServiceNetworkWriter(String networkPath, org.goplanit.xml.generated.XMLElementServiceNetwork xmlRawServiceNetwork)
Constructor- Parameters:
networkPath
- to persist network onxmlRawServiceNetwork
- to populate with PLANit service network when persisting
-
PlanitServiceNetworkWriter
protected PlanitServiceNetworkWriter(String networkPath, String countryName, org.goplanit.xml.generated.XMLElementServiceNetwork xmlRawServiceNetwork)
Constructor- Parameters:
networkPath
- to persist network oncountryName
- to optimise projection for (if available, otherwise ignore)xmlRawServiceNetwork
- to populate with PLANit service network when persisting
-
-
Method Detail
-
createAndPopulateXmlNetworkLayer
protected org.goplanit.xml.generated.XMLElementServiceNetworkLayer createAndPopulateXmlNetworkLayer(ServiceNetworkLayer serviceNetworkLayer, ServiceNetwork serviceNetwork)
Populate the network layer- Parameters:
serviceNetworkLayer
- to populate fromserviceNetwork
- to extract from- Returns:
- populated new instance of service network layer, may be null in case no PLANit modes are supported for example
-
populateXmlServiceNetworkLayers
protected void populateXmlServiceNetworkLayers(ServiceNetwork serviceNetwork)
Populate the available service network layers- Parameters:
serviceNetwork
- to extract layers from and populate xml
-
populateTopLevelElement
protected void populateTopLevelElement(ServiceNetwork serviceNetwork)
Populate the top level XML element for the service network and include parent network reference. In case no XML id is set, attempt to salvage with internal id's and log warnings for user verification of correctness.- Parameters:
serviceNetwork
- to use
-
getPrimaryIdMapper
public ServiceNetworkIdMapper getPrimaryIdMapper()
The (main) Id mapper used by this writer (only present after write has been completed)- Specified by:
getPrimaryIdMapper
in classBaseWriterImpl<ServiceNetwork>
- Returns:
- mapper
-
write
public void write(ServiceNetwork serviceNetwork) throws PlanItException
write a network to the writer's output format.- Specified by:
write
in interfaceConverterWriter<ServiceNetwork>
- Parameters:
serviceNetwork
- 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:
reset
in interfaceConverterEntity
-
getSettings
public PlanitServiceNetworkWriterSettings getSettings()
any settings to configure the writer can be configured by collecting these settings- Specified by:
getSettings
in interfaceConverterWriter<ServiceNetwork>
- Returns:
- the settings to configure the writer
-
getCountryName
public String getCountryName()
the country name of the network to write (if any is set)- Returns:
- country name, null if unknown
-
-