1 package org.opentrafficsim.road.network.factory.opendrive;
2
3 import java.io.Serializable;
4
5 import org.djunits.unit.LengthUnit;
6 import org.djunits.value.vdouble.scalar.Length;
7 import org.w3c.dom.NamedNodeMap;
8 import org.w3c.dom.Node;
9 import org.w3c.dom.NodeList;
10 import org.xml.sax.SAXException;
11
12
13
14
15
16
17
18
19
20
21 class ArcTag implements Serializable
22 {
23
24 private static final long serialVersionUID = 20150723L;
25
26
27 @SuppressWarnings("checkstyle:visibilitymodifier")
28 Length curvature = null;
29
30
31
32
33
34
35
36
37 @SuppressWarnings("checkstyle:needbraces")
38 static void parseArc(final NodeList nodeList, final OpenDriveNetworkLaneParser parser, final GeometryTag geometryTag)
39 throws SAXException
40 {
41 int typeCount = 0;
42 for (Node node : XMLParser.getNodes(nodeList, "arc"))
43 {
44 typeCount++;
45 ArcTag arcTag = new ArcTag();
46 NamedNodeMap attributes = node.getAttributes();
47
48 Node curvature = attributes.getNamedItem("curvature");
49 if (curvature != null)
50 arcTag.curvature = new Length(Double.parseDouble(curvature.getNodeValue().trim()), LengthUnit.SI);
51
52 geometryTag.arcTag = arcTag;
53 }
54
55 if (typeCount > 1)
56 throw new SAXException("ROAD: more than one arc tag!");
57 }
58
59
60 @Override
61 public final String toString()
62 {
63 return "ArcTag [curvature=" + this.curvature + "]";
64 }
65 }