Package org.opentrafficsim.web
Class OtsWebModel
java.lang.Object
org.opentrafficsim.web.OtsWebModel
- All Implemented Interfaces:
EventListener,EventListener
OtsWebModel.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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal HtmlAnimationPanelReturn animation panel.final OtsSimulatorInterfaceReturn simulator.final StringgetTitle()Return title.booleanhandle(org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response, org.eclipse.jetty.util.Callback callback) Delegate handle method from the main web server for this particular model.final booleanisKilled()Return killed.voidfinal voidsetKilled(boolean killed) Set killed.protected 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
-
OtsWebModel
Constructor.- Parameters:
title- the title for the model windowsimulator- the simulator- Throws:
Exception- in case jetty crashes
-
-
Method Details
-
getTitle
Return title.- Returns:
- title
-
getSimulator
Return simulator.- Returns:
- simulator
-
getAnimationPanel
Return animation panel.- Returns:
- animationPanel
-
isKilled
public final boolean isKilled()Return killed.- Returns:
- killed
-
setKilled
public final void setKilled(boolean killed) Set killed.- Parameters:
killed- set killed
-
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
-
handle
public boolean handle(org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response, org.eclipse.jetty.util.Callback callback) throws Exception Delegate handle method from the main web server for this particular model.- Parameters:
request- the HTTP request to handleresponse- the HTTP response to handlecallback- the callback to complete when the handling is complete- Returns:
- whether the request was handled
- Throws:
Exception- exception
-