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