View Javadoc
1   package org.opentrafficsim.road.network.factory.opendrive;
2   
3   import java.io.Serializable;
4   import java.util.ArrayList;
5   import java.util.List;
6   
7   import org.opentrafficsim.core.network.NetworkException;
8   import org.w3c.dom.Node;
9   import org.w3c.dom.NodeList;
10  import org.xml.sax.SAXException;
11  
12  /**
13   * <p>
14   * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
15   * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
16   * <p>
17   * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
18   * initial version Jul 23, 2015 <br>
19   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
20   */
21  class ObjectsTag implements Serializable
22  {
23  
24      /** */
25      private static final long serialVersionUID = 20150723L;
26  
27      /** The objectTags */
28      @SuppressWarnings("checkstyle:visibilitymodifier")
29      List<ObjectTag> objectTags = new ArrayList<ObjectTag>();
30  
31      /**
32       * Parse the attributes of the road tag. The sub-elements are parsed in separate classes.
33       * @param nodeList NodeList; the list of subnodes of the road node
34       * @param parser OpenDriveNetworkLaneParser; the parser with the lists of information
35       * @param roadTag RoadTag; the RoadTag to which this element belongs
36       * @throws SAXException when parsing of the tag fails
37       * @throws NetworkException when parsing of the tag fails
38       */
39      @SuppressWarnings("checkstyle:needbraces")
40      static void parseObjects(final NodeList nodeList, final OpenDriveNetworkLaneParser parser, final RoadTag roadTag)
41              throws SAXException, NetworkException
42      {
43          ObjectsTag objectsTag = new ObjectsTag();
44          for (Node node0 : XMLParser.getNodes(nodeList, "objects"))
45              for (Node node : XMLParser.getNodes(node0.getChildNodes(), "object"))
46              {
47                  ObjectTag objectTag = ObjectTag.parseObject(node, parser);
48                  objectsTag.objectTags.add(objectTag);
49              }
50          roadTag.objectsTag = objectsTag;
51  
52      }
53  
54      /** {@inheritDoc} */
55      @Override
56      public final String toString()
57      {
58          return "ObjectsTag [objectTags=" + this.objectTags + "]";
59      }
60  }