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.OTSReplication; 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-2021 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. * BSD-style license. See OpenTrafficSim License. *

* @author Alexander Verbraeck */ public class CircularModelWeb extends OTSWebServer { /** * @param title String; the tile for the model * @param simulator OTSSimulatorInterface; the simulator * @param model OTSModelInterface; 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())) { OTSReplication replication = new OTSReplication("rep", Time.ZERO, Duration.ZERO, Duration.instantiateSI(3600)); simulator.initialize(model, replication); new CircularModelWeb("Circular Road", simulator, model); } } }