Class PlanitNetworkReader

    • Field Detail

      • NETWORK_XSD_FILE

        public static final String NETWORK_XSD_FILE
        Default XSD files used to validate input XML files against, TODO: move to properties file
        See Also:
        Constant Field Values
    • Constructor Detail

      • PlanitNetworkReader

        protected PlanitNetworkReader​(PlanitNetworkReaderSettings settings,
                                      IdGroupingToken idToken)
                               throws PlanItException
        Constructor where settings are directly provided such that input information can be exracted from it
        Parameters:
        settings - to use
        idToken - to use for the network to populate
        Throws:
        PlanItException - thrown if error
      • PlanitNetworkReader

        protected PlanitNetworkReader​(org.goplanit.xml.generated.XMLElementMacroscopicNetwork externalXmlRawNetwork,
                                      LayeredNetwork<?,​?> network)
                               throws PlanItException
        Constructor where file has already been parsed and we only need to convert from raw XML objects to PLANit memory model
        Parameters:
        externalXmlRawNetwork - to extract from
        network - to populate
        Throws:
        PlanItException - thrown if error
      • PlanitNetworkReader

        protected PlanitNetworkReader​(org.goplanit.xml.generated.XMLElementMacroscopicNetwork externalXmlRawNetwork,
                                      PlanitNetworkReaderSettings settings,
                                      LayeredNetwork<?,​?> network)
                               throws PlanItException
        Constructor where file has already been parsed and we only need to convert from raw XML objects to PLANit memory model
        Parameters:
        externalXmlRawNetwork - to extract from
        network - to populate
        settings - to use
        Throws:
        PlanItException - thrown if error
      • PlanitNetworkReader

        protected PlanitNetworkReader​(String networkPathDirectory,
                                      String xmlFileExtension,
                                      LayeredNetwork<?,​?> network)
                               throws PlanItException
        Constructor
        Parameters:
        networkPathDirectory - to use
        xmlFileExtension - to use
        network - to populate
        Throws:
        PlanItException - thrown if error
    • Method Detail

      • parseLinkSegmentTypes

        public void parseLinkSegmentTypes​(org.goplanit.xml.generated.XMLElementLayerConfiguration xmlLayerconfiguration,
                                          MacroscopicNetworkLayer networkLayer)
                                   throws PlanItException
        Parse the link segment types
        Parameters:
        xmlLayerconfiguration - to extract them from
        networkLayer - to register them on
        Throws:
        PlanItException - thrown if error
      • parseLinkSegmentTypeAccessProperties

        public void parseLinkSegmentTypeAccessProperties​(org.goplanit.xml.generated.XMLElementAccessGroup xmlAccessGroupProperties,
                                                         MacroscopicLinkSegmentType linkSegmentType,
                                                         Collection<Mode> defaultModes)
                                                  throws PlanItException
        parse the mode properties for given link segment type and populate the helper with them
        Parameters:
        xmlAccessGroupProperties - to extract information from on (TODO:ugly, helper should be removed)
        linkSegmentType - to register mode properties on
        defaultModes - to allow when no modes are specified
        Throws:
        PlanItException - thrown if error
      • parseNodes

        public void parseNodes​(org.goplanit.xml.generated.XMLElementInfrastructureLayer xmlLayer,
                               MacroscopicNetworkLayer networkLayer)
                        throws PlanItException
        Create and register nodes on the network
        Parameters:
        xmlLayer - to extract from
        networkLayer - to populate
        Throws:
        PlanItException - thrown if there is an error in storing the GML Point definition
      • parseLinkAndLinkSegments

        public void parseLinkAndLinkSegments​(org.goplanit.xml.generated.XMLElementInfrastructureLayer xmlLayer,
                                             MacroscopicNetworkLayer networkLayer,
                                             PlanitJtsCrsUtils jtsUtils)
                                      throws PlanItException
        parse link and link segments
        Parameters:
        xmlLayer - layer to extract them from
        networkLayer - to register them on
        jtsUtils - for length calculations based on crs
        Throws:
        PlanItException - thrown if error
      • read

        public MacroscopicNetwork read()
        parse the network based on the configuration of the implementing class to yield a PLANit network
        Returns:
        parsed network
      • getSettings

        public PlanitNetworkReaderSettings getSettings()
        any settings to configure the reader can be configured by collecting these settings
        Returns:
        the settings to configrue the reader
      • getLinkSegmentByExternalId

        public MacroscopicLinkSegment getLinkSegmentByExternalId​(MacroscopicNetwork network,
                                                                 String externalId)
        returns the first link segment for which the given external id matches. Extremely slow, because it is not indexed at the moment. Also external ids are not guaranteed to be unique so if multiple matches exist problems may arise
        Parameters:
        network - to look in
        externalId - to look for
        Returns:
        link segment