Class XmlMacroscopicNetworkLayerHelper


  • public class XmlMacroscopicNetworkLayerHelper
    extends Object
    Process the Infrastructure object populated with data from the XML file
    Author:
    gman6028, markr
    • Constructor Detail

      • XmlMacroscopicNetworkLayerHelper

        public XmlMacroscopicNetworkLayerHelper()
    • Method Detail

      • parseLengthElementFromLink

        protected static Double parseLengthElementFromLink​(org.planit.xml.generated.XMLElementLinks.Link generatedLink)
        Get the link length from the length element in the XML file, if this has been set
        Parameters:
        generatedLink - object storing link data from XML file
        Returns:
        final length value
      • parseLengthFromLineString

        protected static Double parseLengthFromLineString​(org.planit.xml.generated.XMLElementLinks.Link generatedLink,
                                                          PlanitJtsUtils jtsUtils)
                                                   throws PlanItException
        Get the link length from the gml:LineString element in the XML file, if this has been set
        Parameters:
        generatedLink - object storing link data from XML file
        jtsUtils - to compute length from geometry
        Returns:
        final length value
        Throws:
        PlanItException - thown if error
      • parseLinkGeometry

        protected static org.locationtech.jts.geom.LineString parseLinkGeometry​(org.planit.xml.generated.XMLElementLinks.Link generatedLink)
                                                                         throws PlanItException
        parse the geometry from the xml link
        Parameters:
        generatedLink - xml link
        Returns:
        created LineString if any, null if not present
        Throws:
        PlanItException - thrown if error
      • parseLength

        protected static double parseLength​(org.planit.xml.generated.XMLElementLinks.Link xmlLink,
                                            PlanitJtsUtils jtsUtils)
                                     throws PlanItException
        parse the length of an xmlLink based on geometry or length attribute
        Parameters:
        xmlLink - to extract length from
        jtsUtils - to compute length from geometry
        Returns:
        length (in km)
        Throws:
        PlanItException - thrown if error
      • parseLinkSegmentTypeModeProperties

        protected static void parseLinkSegmentTypeModeProperties​(org.planit.xml.generated.Accessmode xmlMode,
                                                                 MacroscopicLinkSegmentType linkSegmentType,
                                                                 Map<String,​Mode> modesByXmlId)
                                                          throws PlanItException
        parse the mode properties for given link segment type and populate the helper with them
        Parameters:
        xmlMode - to extract information from on (TODO:ugly, helper should be removed)
        linkSegmentType - to register mode properties on
        modesByXmlId - to collect referenced planit mode from
        Throws:
        PlanItException - thrown if error
      • injectDefaultLinkSegmentType

        protected static void injectDefaultLinkSegmentType​(org.planit.xml.generated.XMLElementLayerConfiguration xmlLayerConfiguration)
        in case no link segment types are defined on the layer, we inject a default link segment type
        Parameters:
        xmlLayerConfiguration - to inject xml entry into
      • parseNodes

        public static Map<String,​Node> parseNodes​(org.planit.xml.generated.XMLElementInfrastructureLayer xmlLayer,
                                                        MacroscopicPhysicalNetwork networkLayer,
                                                        PlanitNetworkReaderSettings settings)
                                                 throws PlanItException
        Create and register nodes on the network return nodesByExternalIdToPopulate map for reference
        Parameters:
        xmlLayer - to extract from
        settings - to base configuration on
        networkLayer - to populate
        Returns:
        parsed nodes
        Throws:
        PlanItException - thrown if there is an error in storing the GML Point definition