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.opentrafficsim.core.network.NetworkException;
8 import org.w3c.dom.NamedNodeMap;
9 import org.w3c.dom.Node;
10 import org.xml.sax.SAXException;
11
12
13
14
15
16
17
18
19
20
21 class SignalReferenceTag implements Serializable
22 {
23
24 private static final long serialVersionUID = 20150723L;
25
26
27 @SuppressWarnings("checkstyle:visibilitymodifier")
28 Length s = null;
29
30
31 @SuppressWarnings("checkstyle:visibilitymodifier")
32 Length t = null;
33
34
35 @SuppressWarnings("checkstyle:visibilitymodifier")
36 String id = null;
37
38
39 @SuppressWarnings("checkstyle:visibilitymodifier")
40 String orientation = null;
41
42
43
44
45
46
47
48
49
50 @SuppressWarnings("checkstyle:needbraces")
51 static SignalReferenceTag parseSignalReference(final Node node, final OpenDriveNetworkLaneParser parser)
52 throws SAXException, NetworkException
53 {
54 SignalReferenceTag signaReferencelTag = new SignalReferenceTag();
55 NamedNodeMap attributes = node.getAttributes();
56
57 Node s = attributes.getNamedItem("s");
58 if (s != null)
59 signaReferencelTag.s = new Length(Double.parseDouble(s.getNodeValue().trim()), LengthUnit.METER);
60
61 Node t = attributes.getNamedItem("t");
62 if (t != null)
63 signaReferencelTag.t = new Length(Double.parseDouble(t.getNodeValue().trim()), LengthUnit.METER);
64
65 Node id = attributes.getNamedItem("id");
66 if (id != null)
67 signaReferencelTag.id = id.getNodeValue().trim();
68
69 Node orientation = attributes.getNamedItem("orientation");
70 if (orientation != null)
71 signaReferencelTag.orientation = orientation.getNodeValue().trim();
72
73 return signaReferencelTag;
74
75 }
76
77
78 @Override
79 public final String toString()
80 {
81 return "SignalReferenceTag [s=" + this.s + ", t=" + this.t + ", id=" + this.id + ", orientation=" + this.orientation
82 + "]";
83 }
84 }