package org.opentrafficsim.web.test; import org.djunits.value.vdouble.scalar.Duration; import org.djunits.value.vdouble.scalar.Time; import org.djutils.draw.bounds.Bounds2d; import org.opentrafficsim.core.animation.gtu.colorer.DefaultSwitchableGTUColorer; import org.opentrafficsim.core.dsol.OTSAnimator; import org.opentrafficsim.core.dsol.OTSModelInterface; import org.opentrafficsim.core.dsol.OTSSimulatorInterface; import org.opentrafficsim.draw.factory.DefaultAnimationFactory; import nl.tudelft.simulation.dsol.jetty.sse.OTSWebServer; /** *
* Copyright (c) 2013-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
* BSD-style license. See OpenTrafficSim License.
*
* @version $Revision$, $LastChangedDate$, by $Author$, initial version 11 dec. 2016
* @author Alexander Verbraeck
* @author Peter Knoppers
* @author Wouter Schakel
*/
public class TJunctionDemo extends OTSWebServer
{
/**
* Create a T-Junction demo.
* @param title String; the tile for the model
* @param simulator DEVSRealTimeAnimator.TimeDouble; the simulator
* @param model the model
* @throws Exception on jetty error
*/
public TJunctionDemo(final String title, final OTSSimulatorInterface simulator, final OTSModelInterface model)
throws Exception
{
super(title, simulator, new Bounds2d(-200, 200, -200, 200));
DefaultAnimationFactory.animateNetwork(model.getNetwork(), model.getNetwork().getSimulator(),
new DefaultSwitchableGTUColorer());
}
/**
* Start the demo.
* @param args args
* @throws Exception on error
*/
public static void main(final String[] args) throws Exception
{
OTSAnimator simulator = new OTSAnimator("TJunctionDemo");
simulator.setAnimation(false);
TJunctionModel junctionModel = new TJunctionModel(simulator);
simulator.initialize(Time.ZERO, Duration.ZERO, Duration.instantiateSI(3600.0), junctionModel);
new TJunctionDemo("T-Junction demo", simulator, junctionModel);
}
}