Package org.opentrafficsim.web
Class OtsWebServer
java.lang.Object
org.opentrafficsim.web.OtsWebServer
- All Implemented Interfaces:
EventListener,EventListener
- Direct Known Subclasses:
CircularModelWeb,TJunctionDemo
DSOLWebServer.java.
Copyright (c) 2003-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAnswer handles the events from the web-based user interface. -
Constructor Summary
ConstructorsConstructorDescriptionOtsWebServer(String title, OtsSimulatorInterface simulator, Bounds2d extent) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal HtmlAnimationPanelGet animation panel.final OtsSimulatorInterfaceGet simulator.final StringgetTitle()Get title.voidprotected voidsetSpeedFactor(double speedFactor) Set speed factor.protected booleanTry to start the simulator, and return whether the simulator has been started.protected booleanTry to stop the simulator, and return whether the simulator has been stopped.
-
Constructor Details
-
OtsWebServer
public OtsWebServer(String title, OtsSimulatorInterface simulator, Bounds2d extent) throws Exception Constructor.- Parameters:
title- the title for the model windowsimulator- the simulatorextent- the extent to use for the graphics (min/max coordinates)- Throws:
Exception- in case jetty crashes
-
-
Method Details
-
getTitle
Get title.- Returns:
- title
-
getSimulator
Get simulator.- Returns:
- simulator
-
getAnimationPanel
Get animation panel.- Returns:
- animationPanel
-
startSimulator
protected boolean startSimulator()Try to start the simulator, and return whether the simulator has been started.- Returns:
- whether the simulator has been started or not
-
stopSimulator
protected boolean stopSimulator()Try to stop the simulator, and return whether the simulator has been stopped.- Returns:
- whether the simulator has been stopped or not
-
setSpeedFactor
protected void setSpeedFactor(double speedFactor) Set speed factor.- Parameters:
speedFactor- the new speed factor
-
notify
- Specified by:
notifyin interfaceEventListener
-