View Javadoc
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   * Test4DCrossing.java. <br>
18   * <br>
19   * Copyright (c) 2003-2018 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
20   * for project information <a href="https://www.simulation.tudelft.nl/" target="_blank">www.simulation.tudelft.nl</a>. The
21   * source code and binary code of this software is proprietary information of Delft University of Technology.
22   * @author <a href="https://www.tudelft.nl/averbraeck" target="_blank">Alexander Verbraeck</a>
23   */
24  public class CircularModelWeb extends OTSWebServer
25  {
26      /**
27       * @param title String; the tile for the model
28       * @param simulator DEVSRealTimeClock.TimeDouble; the simulator
29       * @param model the model
30       * @throws Exception on jetty error
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       * @param args String[]; arguments, expected to be empty
40       * @throws Exception on error
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  }