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;
import nl.tudelft.simulation.dsol.swing.gui.inputparameters.TabbedParameterDialog;
/**
* Test4DCrossing.java.
*
* Copyright (c) 2003-2022 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
* for project information www.simulation.tudelft.nl. The
* source code and binary code of this software is proprietary information of Delft University of Technology.
* @author Alexander Verbraeck
*/
public class CircularModelWeb extends OTSWebServer
{
/**
* @param title String; the tile for the model
* @param simulator DEVSRealTimeAnimator.TimeDouble; the simulator
* @param model the model
* @throws Exception on jetty error
*/
public CircularModelWeb(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());
}
/**
* @param args String[]; arguments, expected to be empty
* @throws Exception on error
*/
public static void main(final String[] args) throws Exception
{
OTSAnimator simulator = new OTSAnimator("CircularModelWeb");
simulator.setAnimation(false);
CircularRoadModel model = new CircularRoadModel(simulator);
if (TabbedParameterDialog.process(model.getInputParameterMap()))
{
simulator.initialize(Time.ZERO, Duration.ZERO, Duration.instantiateSI(3600.0), model);
new CircularModelWeb("Circular Road", simulator, model);
}
}
}