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