1 package org.opentrafficsim.web.test;
2
3 import org.djunits.value.vdouble.scalar.Duration;
4 import org.djunits.value.vdouble.scalar.Time;
5 import org.djutils.draw.bounds.Bounds2d;
6 import org.opentrafficsim.animation.DefaultAnimationFactory;
7 import org.opentrafficsim.animation.gtu.colorer.DefaultSwitchableGtuColorer;
8 import org.opentrafficsim.core.dsol.OtsAnimator;
9 import org.opentrafficsim.core.dsol.OtsModelInterface;
10 import org.opentrafficsim.core.dsol.OtsSimulatorInterface;
11
12 import nl.tudelft.simulation.dsol.jetty.sse.OtsWebServer;
13 import nl.tudelft.simulation.dsol.swing.gui.inputparameters.TabbedParameterDialog;
14
15
16
17
18
19
20
21
22
23 public class CircularModelWeb extends OtsWebServer
24 {
25
26
27
28
29
30
31 public CircularModelWeb(final String title, final OtsSimulatorInterface simulator, final OtsModelInterface model)
32 throws Exception
33 {
34 super(title, simulator, new Bounds2d(-200, 200, -200, 200));
35 DefaultAnimationFactory.animateNetwork(model.getNetwork(), model.getNetwork().getSimulator(),
36 new DefaultSwitchableGtuColorer());
37 }
38
39
40
41
42
43 public static void main(final String[] args) throws Exception
44 {
45 OtsAnimator simulator = new OtsAnimator("CircularModelWeb");
46 simulator.setAnimation(false);
47 CircularRoadModel model = new CircularRoadModel(simulator);
48 if (TabbedParameterDialog.process(model.getInputParameterMap()))
49 {
50 simulator.initialize(Time.ZERO, Duration.ZERO, Duration.instantiateSI(3600.0), model);
51 new CircularModelWeb("Circular Road", simulator, model);
52 }
53 }
54 }