1   package org.opentrafficsim.web.test;
2   
3   import java.awt.geom.Rectangle2D;
4   
5   import org.djunits.value.vdouble.scalar.Duration;
6   import org.djunits.value.vdouble.scalar.Time;
7   import org.opentrafficsim.core.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  import org.opentrafficsim.draw.factory.DefaultAnimationFactory;
12  
13  import nl.tudelft.simulation.dsol.jetty.sse.OTSWebServer;
14  import nl.tudelft.simulation.dsol.swing.gui.inputparameters.TabbedParameterDialog;
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  public class CircularModelWeb extends OTSWebServer
25  {
26      
27  
28  
29  
30  
31  
32      public CircularModelWeb(final String title, final OTSSimulatorInterface simulator, final OTSModelInterface model) throws Exception
33      {
34          super(title, simulator, new Rectangle2D.Double(-200, -200, 400, 400));
35          DefaultAnimationFactory.animateNetwork(model.getNetwork(), simulator, new DefaultSwitchableGTUColorer());
36      }
37  
38      
39  
40  
41  
42      public static void main(final String[] args) throws Exception
43      {
44          OTSAnimator simulator = new OTSAnimator();
45          simulator.setAnimation(false);
46          CircularRoadModeladModel.html#CircularRoadModel">CircularRoadModel model = new CircularRoadModel(simulator);
47          if (TabbedParameterDialog.process(model.getInputParameterMap()))
48          {
49              simulator.initialize(Time.ZERO, Duration.ZERO, Duration.instantiateSI(3600.0), model);
50              new CircularModelWeb("Circular Road", simulator, model);
51          }
52      }
53  }