1 package org.opentrafficsim.animation.data;
2
3 import org.djunits.value.vdouble.scalar.Length;
4 import org.djutils.draw.line.PolyLine2d;
5 import org.djutils.draw.point.OrientedPoint2d;
6 import org.opentrafficsim.draw.road.StripeAnimation.StripeData;
7 import org.opentrafficsim.road.network.lane.Stripe;
8
9
10
11
12
13
14
15
16
17 public class AnimationStripeData extends AnimationCrossSectionElementData<Stripe> implements StripeData
18 {
19
20
21
22
23
24 public AnimationStripeData(final Stripe stripe)
25 {
26 super(stripe);
27 }
28
29
30 @Override
31 public PolyLine2d getCenterLine()
32 {
33 return getElement().getCenterLine().getLine2d();
34 }
35
36
37 @Override
38 public Type getType()
39 {
40 return Type.valueOf(getElement().getType().name());
41 }
42
43
44 @Override
45 public OrientedPoint2d getLocation()
46 {
47 return getElement().getLocation();
48 }
49
50
51 @Override
52 public Length getWidth()
53 {
54 return getElement().getWidth(0.5);
55 }
56
57
58 @Override
59 public String toString()
60 {
61 return "Stripe " + getElement().getLink().getId() + " " + getElement().getOffsetAtBegin();
62 }
63
64 }