1 package org.opentrafficsim.animation.data;
2
3 import org.djutils.draw.point.Point2d;
4 import org.opentrafficsim.draw.road.PriorityAnimation.PriorityData;
5 import org.opentrafficsim.road.network.lane.CrossSectionLink;
6
7
8
9
10
11
12
13
14
15 public class AnimationPriorityData implements PriorityData
16 {
17
18
19 final private CrossSectionLink link;
20
21
22
23
24
25 public AnimationPriorityData(final CrossSectionLink link)
26 {
27 this.link = link;
28 }
29
30
31 @Override
32 public Point2d getLocation()
33 {
34 return this.link.getDesignLine().getLocationFractionExtended(0.5);
35 }
36
37
38 @Override
39 public boolean isAllStop()
40 {
41 return this.link.getPriority().isAllStop();
42 }
43
44
45 @Override
46 public boolean isBusStop()
47 {
48 return this.link.getPriority().isBusStop();
49 }
50
51
52 @Override
53 public boolean isNone()
54 {
55 return this.link.getPriority().isNone();
56 }
57
58
59 @Override
60 public boolean isPriority()
61 {
62 return this.link.getPriority().isPriority();
63 }
64
65
66 @Override
67 public boolean isStop()
68 {
69 return this.link.getPriority().isStop();
70 }
71
72
73 @Override
74 public boolean isYield()
75 {
76 return this.link.getPriority().isYield();
77 }
78
79
80 @Override
81 public String toString()
82 {
83 return "Priority " + this.link.getId();
84 }
85
86 }