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
14
15
16
17
18
19
20
21
22
23 public class TJunctionDemo extends OtsWebServer
24 {
25
26
27
28
29
30
31
32 public TJunctionDemo(final String title, final OtsSimulatorInterface simulator, final OtsModelInterface model)
33 throws Exception
34 {
35 super(title, simulator, new Bounds2d(-200, 200, -200, 200));
36 DefaultAnimationFactory.animateNetwork(model.getNetwork(), model.getNetwork().getSimulator(),
37 new DefaultSwitchableGtuColorer());
38 }
39
40
41
42
43
44
45 public static void main(final String[] args) throws Exception
46 {
47 OtsAnimator simulator = new OtsAnimator("TJunctionDemo");
48 simulator.setAnimation(false);
49 TJunctionModel junctionModel = new TJunctionModel(simulator);
50 simulator.initialize(Time.ZERO, Duration.ZERO, Duration.instantiateSI(3600.0), junctionModel);
51 new TJunctionDemo("T-Junction demo", simulator, junctionModel);
52 }
53 }