1 package org.opentrafficsim.road.network.factory.xml;
2
3 import java.io.Serializable;
4
5 import org.djunits.value.vdouble.scalar.Length;
6 import org.opentrafficsim.core.geometry.OTSPoint3D;
7 import org.opentrafficsim.core.network.NetworkException;
8 import org.opentrafficsim.core.network.factory.xml.units.Coordinates;
9 import org.opentrafficsim.core.network.factory.xml.units.LengthUnits;
10 import org.w3c.dom.NamedNodeMap;
11 import org.w3c.dom.Node;
12 import org.xml.sax.SAXException;
13
14
15
16
17
18
19
20
21
22
23 class PolyLineTag implements Serializable
24 {
25
26 private static final long serialVersionUID = 20150724L;
27
28
29 @SuppressWarnings("checkstyle:visibilitymodifier")
30 Length length = null;
31
32 OTSPoint3D[] coordinates = null;
33
34
35
36
37
38
39
40
41
42 @SuppressWarnings("checkstyle:needbraces")
43 static void parsePolyLine(final Node polyLine, final XmlNetworkLaneParser parser, final LinkTag linkTag)
44 throws SAXException, NetworkException
45 {
46 NamedNodeMap polyLineAttributes = polyLine.getAttributes();
47 linkTag.polyLineTag = new PolyLineTag();
48
49 if (polyLineAttributes.getNamedItem("INTERMEDIATEPOINTS") != null)
50 linkTag.polyLineTag.coordinates =
51 Coordinates.parseCoordinates(polyLineAttributes.getNamedItem("INTERMEDIATEPOINTS").getNodeValue());
52 if (polyLineAttributes.getNamedItem("LENGTH") != null)
53 linkTag.polyLineTag.length = LengthUnits.parseLength(polyLineAttributes.getNamedItem("LENGTH").getNodeValue());
54
55 }
56
57
58 @Override
59 public final String toString()
60 {
61 return "PolyLineTag [length=" + this.length + "]";
62 }
63 }