1 package org.opentrafficsim.animation.data;
2
3 import org.djutils.draw.bounds.Bounds2d;
4 import org.djutils.draw.line.Polygon2d;
5 import org.djutils.draw.point.OrientedPoint2d;
6 import org.opentrafficsim.core.gtu.GtuGenerator.GtuGeneratorPosition;
7 import org.opentrafficsim.draw.road.GtuGeneratorPositionAnimation.GtuGeneratorPositionData;
8
9
10
11
12
13
14
15
16
17 public class AnimationGtuGeneratorPositionData implements GtuGeneratorPositionData
18 {
19
20
21 private final GtuGeneratorPosition position;
22
23
24
25
26
27 public AnimationGtuGeneratorPositionData(final GtuGeneratorPosition position)
28 {
29 this.position = position;
30 }
31
32 @Override
33 public OrientedPoint2d getLocation()
34 {
35 return this.position.getLocation();
36 }
37
38 @Override
39 public Bounds2d getBounds()
40 {
41
42 return new Bounds2d(0.0, 4.75, -1.0, 1.0);
43 }
44
45 @Override
46 public Polygon2d getContour()
47 {
48 throw new UnsupportedOperationException("GtuGeneratorPosition does not have a contour.");
49 }
50
51 @Override
52 public int getQueueCount()
53 {
54 return this.position.getQueueCount();
55 }
56
57
58
59
60
61 public GtuGeneratorPosition getGeneratorPosition()
62 {
63 return this.position;
64 }
65
66 @Override
67 public String toString()
68 {
69 return "Generator position " + this.position.getId();
70 }
71
72 }