1 package org.opentrafficsim.swing.gui;
2
3 import org.opentrafficsim.core.dsol.OTSModelInterface;
4 import org.opentrafficsim.draw.core.OTSDrawingException;
5 import org.opentrafficsim.draw.factory.DefaultAnimationFactory;
6
7
8
9
10
11
12
13
14
15
16
17
18
19 public class OTSSimulationApplication<T extends OTSModelInterface> extends OTSSwingApplication<T>
20 {
21
22
23 private static final long serialVersionUID = 20190118L;
24
25
26 private final OTSAnimationPanel animationPanel;
27
28
29
30
31
32
33 public OTSSimulationApplication(final T model, final OTSAnimationPanel panel) throws OTSDrawingException
34 {
35 super(model, panel);
36 this.animationPanel = panel;
37 animateNetwork();
38 setAnimationToggles();
39 addTabs();
40 setAppearance(getAppearance());
41 }
42
43
44
45
46
47 protected void animateNetwork() throws OTSDrawingException
48 {
49 DefaultAnimationFactory.animateNetwork(getModel().getNetwork(), getModel().getSimulator(),
50 getAnimationPanel().getGTUColorer());
51 }
52
53
54
55
56 protected void setAnimationToggles()
57 {
58 AnimationToggles.setTextAnimationTogglesStandard(getAnimationPanel());
59 }
60
61
62
63
64 protected void addTabs()
65 {
66
67 }
68
69
70
71
72
73 public OTSAnimationPanel getAnimationPanel()
74 {
75 return this.animationPanel;
76 }
77
78 }