Class 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
    • Constructor Detail

      • PlanitNetworkWriter

        public PlanitNetworkWriter​(String networkPath,
                                   org.planit.xml.generated.XMLElementMacroscopicNetwork xmlRawNetwork)
        Constructor
        Parameters:
        networkPath - to persist network on
        xmlRawNetwork - 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 on
        countryName - 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 to
        linkSegmentTypes - 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 to
        physicalNetworkLayer - to populate from
      • populateXmlNetworkLayers

        protected void populateXmlNetworkLayers​(MacroscopicNetwork network)
        populate the available network layers
        Parameters:
        network - to extract layers from and populate xml