Package org.planit.io.xml.network
Class XmlMacroscopicNetworkLayerHelper
- java.lang.Object
-
- org.planit.io.xml.network.XmlMacroscopicNetworkLayerHelper
-
public class XmlMacroscopicNetworkLayerHelper extends Object
Process the Infrastructure object populated with data from the XML file- Author:
- gman6028, markr
-
-
Constructor Summary
Constructors Constructor Description XmlMacroscopicNetworkLayerHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static voidinjectDefaultLinkSegmentType(org.planit.xml.generated.XMLElementLayerConfiguration xmlLayerConfiguration)in case no link segment types are defined on the layer, we inject a default link segment typeprotected static doubleparseLength(org.planit.xml.generated.XMLElementLinks.Link xmlLink, PlanitJtsUtils jtsUtils)parse the length of an xmlLink based on geometry or length attributeprotected static DoubleparseLengthElementFromLink(org.planit.xml.generated.XMLElementLinks.Link generatedLink)Get the link length from the length element in the XML file, if this has been setprotected static DoubleparseLengthFromLineString(org.planit.xml.generated.XMLElementLinks.Link generatedLink, PlanitJtsUtils jtsUtils)Get the link length from the gml:LineString element in the XML file, if this has been setstatic voidparseLinkAndLinkSegments(org.planit.xml.generated.XMLElementInfrastructureLayer xmlLayer, MacroscopicPhysicalNetwork networkLayer, PlanitNetworkReaderSettings settings, Map<String,Node> nodesByXmlId, Map<String,MacroscopicLinkSegmentType> linkSegmentTypesByXmlId, PlanitJtsUtils jtsUtils)parse link and link segmentsprotected static org.locationtech.jts.geom.LineStringparseLinkGeometry(org.planit.xml.generated.XMLElementLinks.Link generatedLink)parse the geometry from the xml linkprotected static voidparseLinkSegmentTypeModeProperties(org.planit.xml.generated.Accessmode xmlMode, MacroscopicLinkSegmentType linkSegmentType, Map<String,Mode> modesByXmlId)parse the mode properties for given link segment type and populate the helper with themstatic Map<String,MacroscopicLinkSegmentType>parseLinkSegmentTypes(org.planit.xml.generated.XMLElementLayerConfiguration xmlLayerconfiguration, MacroscopicPhysicalNetwork networkLayer, PlanitNetworkReaderSettings settings, Map<String,Mode> modesByXmlId)parse the link segment typesstatic Map<String,Node>parseNodes(org.planit.xml.generated.XMLElementInfrastructureLayer xmlLayer, MacroscopicPhysicalNetwork networkLayer, PlanitNetworkReaderSettings settings)Create and register nodes on the network return nodesByExternalIdToPopulate map for reference
-
-
-
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 filejtsUtils- 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 PlanItExceptionparse 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 PlanItExceptionparse the length of an xmlLink based on geometry or length attribute- Parameters:
xmlLink- to extract length fromjtsUtils- 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 PlanItExceptionparse 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 onmodesByXmlId- 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
-
parseLinkSegmentTypes
public static Map<String,MacroscopicLinkSegmentType> parseLinkSegmentTypes(org.planit.xml.generated.XMLElementLayerConfiguration xmlLayerconfiguration, MacroscopicPhysicalNetwork networkLayer, PlanitNetworkReaderSettings settings, Map<String,Mode> modesByXmlId) throws PlanItException
parse the link segment types- Parameters:
xmlLayerconfiguration- to extract them fromnetworkLayer- to register them onsettings- to draw configruation frommodesByXmlId- modes indexed by their xml id- Returns:
- parsed types
- Throws:
PlanItException- thrown if error
-
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 fromsettings- to base configuration onnetworkLayer- to populate- Returns:
- parsed nodes
- Throws:
PlanItException- thrown if there is an error in storing the GML Point definition
-
parseLinkAndLinkSegments
public static void parseLinkAndLinkSegments(org.planit.xml.generated.XMLElementInfrastructureLayer xmlLayer, MacroscopicPhysicalNetwork networkLayer, PlanitNetworkReaderSettings settings, Map<String,Node> nodesByXmlId, Map<String,MacroscopicLinkSegmentType> linkSegmentTypesByXmlId, PlanitJtsUtils jtsUtils) throws PlanItExceptionparse link and link segments- Parameters:
xmlLayer- layer to extract them fromnetworkLayer- to register them onsettings- to take configuration fromnodesByXmlId- parsed nodes indexed by xml idlinkSegmentTypesByXmlId- parsed link segment types by xml idjtsUtils- for length calculations absed on crs- Throws:
PlanItException- thrown if error
-
-