Class NetworkParser


  • public final class NetworkParser
    extends Object
    NetworkParser parses the NETWORK tag of the OTS network.

    Copyright (c) 2003-2020 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. BSD-style license. See OpenTrafficSim License.

    Author:
    Alexander Verbraeck
    • Method Detail

      • parseNodes

        public static void parseNodes​(OTSRoadNetwork otsNetwork,
                                      NETWORK network,
                                      Map<String,​Direction> nodeDirections)
                               throws NetworkException
        Parse the Nodes.
        Parameters:
        otsNetwork - OTSRoadNetwork; the network to insert the parsed objects in
        network - NETWORK; the NETWORK tag
        nodeDirections - Map<String,Direction>; a map of the node ids and their default directions
        Throws:
        NetworkException - when the objects cannot be inserted into the network due to inconsistencies
      • calculateNodeAngles

        public static Map<String,​Direction> calculateNodeAngles​(OTSRoadNetwork otsNetwork,
                                                                      NETWORK network)
        Calculate the default angles of the Nodes, in case they have not been set. This is based on the STRAIGHT LINK elements in the XML file.
        Parameters:
        otsNetwork - OTSRoadNetwork; the network to insert the parsed objects in
        network - NETWORK; the NETWORK tag
        Returns:
        a map of nodes and their default direction