public abstract class AbstractSimulationScript extends Object implements EventListenerInterface
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Field and Description |
---|---|
protected OTSAnimationPanel |
animationPanel
animation panel.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractSimulationScript(String name,
String description,
String[] properties)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addAnimationToggles(OTSAnimationPanel animation)
Sets the animation toggles.
|
protected void |
addTabs(OTSSimulatorInterface sim,
OTSSwingApplication animation)
Adds tabs to the animation.
|
protected void |
animateNetwork(OTSNetwork net,
boolean xmlNetwork)
Creates animations for nodes, links and lanes.
|
boolean |
getBooleanProperty(String propertyName)
Returns the boolean value of given property.
|
double |
getDoubleProperty(String propertyName)
Returns the double value of given property.
|
Duration |
getDurationProperty(String propertyName)
Returns the Duration value of given property.
|
GTUColorer |
getGtuColorer()
Returns the GTU colorer.
|
int |
getIntegerProperty(String propertyName)
Returns the int value of given property.
|
long |
getLongProperty(String propertyName)
Returns the long value of given property.
|
OTSNetwork |
getNetwork()
Returns the network.
|
String |
getProperty(String propertyName)
Returns the String value of given property.
|
OTSSimulatorInterface |
getSimulator()
Returns the simulator.
|
Time |
getTimeProperty(String propertyName)
Returns the Time value of given property.
|
void |
notify(EventInterface event) |
protected void |
onSimulationEnd()
Method that is called when the simulation has ended.
|
protected void |
setDefaultProperties()
Sets the default properties.
|
void |
setGtuColorer(GTUColorer colorer)
Set GTU colorer.
|
void |
setProperty(String propertyName,
Object propertyValue)
Sets a property.
|
protected void |
setupDemo(OTSAnimationPanel animationPanel,
OTSNetwork net)
Method that is called when the animation has been created, to add components for a demo.
|
protected abstract OTSNetwork |
setupSimulation(OTSSimulatorInterface sim)
Sets up the simulation based on provided properties.
|
void |
start()
Starts the simulation.
|
protected OTSAnimationPanel animationPanel
public final void setProperty(String propertyName, Object propertyValue)
propertyName
- String; property namepropertyValue
- Object; property valuepublic final String getProperty(String propertyName)
propertyName
- String; property namepublic final double getDoubleProperty(String propertyName)
propertyName
- String; property namepublic final boolean getBooleanProperty(String propertyName)
propertyName
- String; property namepublic final int getIntegerProperty(String propertyName)
propertyName
- String; property namepublic final long getLongProperty(String propertyName)
propertyName
- String; property namepublic final Duration getDurationProperty(String propertyName)
propertyName
- String; property namepublic final Time getTimeProperty(String propertyName)
propertyName
- String; property namepublic final void setGtuColorer(GTUColorer colorer)
colorer
- GTUColorer; GTU colorerpublic final GTUColorer getGtuColorer()
public final void start()
public final void notify(EventInterface event) throws RemoteException
notify
in interface EventListenerInterface
RemoteException
public final OTSSimulatorInterface getSimulator()
public final OTSNetwork getNetwork()
protected void animateNetwork(OTSNetwork net, boolean xmlNetwork)
net
- OTSNetwork; networkxmlNetwork
- boolean; whether the network was loaded from xmlprotected void addTabs(OTSSimulatorInterface sim, OTSSwingApplication animation)
sim
- OTSSimulatorInterface; simulatoranimation
- OTSSwingApplication; animation to add tabs toprotected void setDefaultProperties()
setProperty()
. Default implementation does nothing.protected void onSimulationEnd()
protected void setupDemo(OTSAnimationPanel animationPanel, OTSNetwork net)
animationPanel
- OTSAnimationPanel; animation panelnet
- OTSNetwork; networkprotected void addAnimationToggles(OTSAnimationPanel animation)
animation
- OTSAnimationPanel; animation to set the toggle onprotected abstract OTSNetwork setupSimulation(OTSSimulatorInterface sim) throws Exception
getProperty()
. Setting up a
simulation should at least create a network and some demand. Additionally this may setup traffic control, sampling, etc.sim
- OTSSimulatorInterface; simulatorException
- on any exceptionCopyright © 2014–2019 Delft University of Technology. All rights reserved.