1 package org.opentrafficsim.animation.data;
2
3 import org.djutils.draw.line.PolyLine2d;
4 import org.djutils.draw.line.Polygon2d;
5 import org.djutils.draw.point.Point2d;
6 import org.opentrafficsim.base.geometry.OtsShape;
7 import org.opentrafficsim.draw.road.CrossSectionElementAnimation.CrossSectionElementData;
8 import org.opentrafficsim.road.network.lane.CrossSectionElement;
9
10
11
12
13
14
15
16
17
18
19 public class AnimationCrossSectionElementData<T extends CrossSectionElement> implements CrossSectionElementData
20 {
21
22
23 private final T element;
24
25
26
27
28
29 public AnimationCrossSectionElementData(final T element)
30 {
31 this.element = element;
32 }
33
34 @Override
35 public Polygon2d getContour()
36 {
37 return this.element.getContour();
38 }
39
40 @Override
41 public OtsShape getShape()
42 {
43 return this.element.getShape();
44 }
45
46 @Override
47 public PolyLine2d getCenterLine()
48 {
49 return this.element.getCenterLine();
50 }
51
52 @Override
53 public String getLinkId()
54 {
55 return this.element.getId();
56 }
57
58 @Override
59 public Point2d getLocation()
60 {
61 return this.element.getLocation();
62 }
63
64
65
66
67
68 public T getElement()
69 {
70 return this.element;
71 }
72
73 @Override
74 public String toString()
75 {
76 return "Cross section element " + getElement().getId();
77 }
78
79 }