1 package org.opentrafficsim.swing.gui;
2
3 import java.util.Map;
4
5 import org.opentrafficsim.animation.DefaultAnimationFactory;
6 import org.opentrafficsim.core.dsol.OtsModelInterface;
7 import org.opentrafficsim.core.gtu.GtuType;
8 import org.opentrafficsim.draw.gtu.DefaultCarAnimation.GtuData.GtuMarker;
9
10
11
12
13
14
15
16
17
18
19
20
21 public class OtsSimulationApplication<T extends OtsModelInterface> extends OtsSwingApplication<T>
22 {
23
24
25 private static final long serialVersionUID = 20190118L;
26
27
28 private final OtsAnimationPanel animationPanel;
29
30
31 private final Map<GtuType, GtuMarker> markers;
32
33
34
35
36
37
38 public OtsSimulationApplication(final T model, final OtsAnimationPanel panel, final Map<GtuType, GtuMarker> markers)
39 {
40 super(model, panel);
41 this.animationPanel = panel;
42 this.markers = markers;
43 setAnimationToggles();
44 animateNetwork();
45 addTabs();
46 setAppearance(getAppearance());
47 }
48
49
50
51
52 private void animateNetwork()
53 {
54 DefaultAnimationFactory.animateNetwork(getModel().getNetwork(), getModel().getNetwork().getSimulator(),
55 this.animationPanel.getColorControlPanel().getGtuColorerManager(), this.markers);
56 }
57
58
59
60
61
62 protected Map<GtuType, GtuMarker> getMarkers()
63 {
64 return this.markers;
65 }
66
67
68
69
70 protected void setAnimationToggles()
71 {
72 AnimationToggles.setTextAnimationTogglesStandard(getAnimationPanel());
73 }
74
75
76
77
78 protected void addTabs()
79 {
80
81 }
82
83
84
85
86
87 public OtsAnimationPanel getAnimationPanel()
88 {
89 return this.animationPanel;
90 }
91
92 }