Package com.anylogic.engine.gui
- Nested Class Summary
- Nested classes/interfaces inherited from interface com.anylogic.engine.gui.IExperimentHost
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- setPresentable
- generateNewUsdId
- getPresentable
- getExperiment
- has3D
- setHas3D
- navigateHome
- navigateTo
- zoomIn
- zoomOut
- setCenter
- setZoomAndPanningEnabled
- isZoomAndPanningEnabled
- setDeveloperPanelEnabled
- setDeveloperPanelVisibleOnStart
- setRunControlEnabled
- isRunControlEnabled
- setSpeedControlEnabled
- isSpeedControlEnabled
- addInspect
- removeInspect
- showAllInspectionWindows
- hideAllInspectionWindows
- showMessageDialog
- showErrorDialog
- showErrorInModelDialog
- openWebSite
- copyToClipboard
- saveSnapshot
- loadSnapshot
- close
- launch
- getConfiguration
- getUpdate
- getOmniUpdate
- getOmniParams
- getOmniPassword
- isOmniverseAnimtaion
- getNextFrameNumber
- executeUserAction
- executeCommand
- getExperimentState
- setValue
- getValue
- callFunction
- getProgress
- setSpeed
- setMaxFPS
- setSendConsoleItems
- postExperimentSettings
- onAgentDestroyed_xjal
- getCurrentNavigationPoint
- getFrameProducer
- getOmniFrameCollector
- getFrameFlag
- setFrameFlag
- getDependencyModelFolders
- java.lang.Object
- com.anylogic.engine.gui.ExperimentHost
- All Implemented Interfaces:
IExperimentHost
@AnyLogicInternalAPI public class ExperimentHost extends Object implements IExperimentHost
This class is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
- Author:
- AnyLogic North America, LLC https://anylogic.com
| Constructor | Description |
|---|---|
ExperimentHost | |
ExperimentHost |
Deprecated.
|
| Modifier and Type | Method | Description |
|---|---|---|
void | addInspect |
Creates an inspect window at a particular location for an element of a
Presentable object.
|
Object | callFunction | |
void | close() |
This method returns immediately and performs
the following actions in a separate thread:
stops experiment if it is not stopped,
destroys the model and
closes experiment window (only if model is started in the application mode)
|
void | copyToClipboard |
Copies the given text to the system clipboard
Due to the security policy of the browser, the actual copying may be preceded by a prompt. |
void | executeCommand | |
void | executeUserAction | |
long | generateNewUsdId() | |
LaunchConfiguration | getConfiguration() | |
INavigationPoint | getCurrentNavigationPoint() | |
Map<String, | getDependencyModelFolders() | |
Experiment<?> | getExperiment() |
Returns the experiment associated with this host.
|
Experiment.State | getExperimentState() | |
com.anylogic.engine.internal.presentation.FrameFlag | getFrameFlag() | |
SVGFrameProducer | getFrameProducer() | |
long | getNextFrameNumber() | |
OmniFrameCollector | getOmniFrameCollector() | |
OmniverseSyncParameters.OmniSessionParams | getOmniParams() | |
String | getOmniPassword() | |
OmniFrame | getOmniUpdate | |
Presentable | getPresentable() |
Returns the current top-level object (Agent or Experiment), whose
presentation is displayed.
|
double | getProgress() | |
AnimationPacket | getUpdate | |
Object | getValue | |
boolean | has3D() | |
void | hideAllInspectionWindows() |
Hide all currently visible inspection windows and prevent new inspection windows to be displayed
|
boolean | isOmniverseAnimtaion() | |
boolean | isRunControlEnabled() |
Tests if Run, Pause, and Stop buttons on the model toolbar are enabled.
|
boolean | isSpeedControlEnabled() |
Tests if the model execution speed control buttons on the model toolbar are enabled.
|
boolean | isZoomAndPanningEnabled() |
Tests if zoom & panning from the GUI is enabled.
|
void | launch |
Creates and optionally runs experiment, starts frame collection
|
void | loadSnapshot |
Stops experiment and loads snapshot (in its 'not
running' state), doesn't resume simulation of loaded snapshot.
On any error throws nothing, silently rollbacks to the current experiment and resumes it if it was running. When snapshot is loaded, presentation forgets everything about the model which was running before (including the engine, experiment and agents), therefore, it is recommended not to keep references to model objects after this method call Usage example: |
void | navigateHome() |
Navigates presentation home, i.e.
|
void | navigateTo |
Shows the given view area in the model animation panel
|
void | onAgentDestroyed_xjal |
A callback called by the engine when an agent is being
destroyed.
|
void | openWebSite |
Opens web page with the given URL in the browser
|
void | postExperimentSettings() | |
void | removeInspect |
Removes the inspect window for the given element
|
void | saveSnapshot |
Pauses experiment if it is currently running, saves snapshot
and then resumes experiment if it was running
On any error throws nothing. Usage example: |
void | setCenter |
Centers the animation view to the given x and y (in the model coordinates)
|
void | setDeveloperPanelEnabled |
Enables or disables the developer panel.
|
void | setDeveloperPanelVisibleOnStart |
Shows (if enabled) the developer panel when the
model window is shown.
|
void | setFrameFlag | |
void | setHas3D | |
void | setMaxFPS |
Sets the new maximum FPS to be used by the SVGFrameCollector.
|
void | setPresentable |
Sets a new top-level object (Agent or Experiment) to be displayed
and navigates to its home point.
|
void | setRunControlEnabled |
Enables or disables Run, Pause, and Stop buttons on the model toolbar
(but not in the developer panel), and sets the corresponding tooltips.
|
void | setSendConsoleItems | |
void | setSpeed | |
void | setSpeedControlEnabled |
Enables or disables the model execution speed control buttons on the model toolbar
(but not in the developer panel), and sets the corresponding tooltips.
|
void | setValue | |
void | setZoomAndPanningEnabled |
Enables or disables zoom & panning initiated from the GUI (button.
|
void | showAllInspectionWindows() |
Allow inspection windows to be displayed and display all visible inspection windows if they were hidden
by call of IExperimentHost.hideAllInspectionWindows()
|
void | showErrorDialog |
Shows a standard error dialog box with the given text.
|
void | showErrorInModelDialog |
Shows a standard 'error in model logic' dialog box with the given text.
|
void | showMessageDialog |
Shows a standard message dialog box with the given text.
|
void | zoomIn |
Zooms in the animation view by the given amount
|
void | zoomOut |
Zooms out the animation view by the given amount
|
@AnyLogicInternalAPI public ExperimentHost(Experiment<?> experiment)
@Deprecated @AnyLogicInternalAPI public ExperimentHost(String experimentClassName)
Deprecated.
public void setPresentable(Presentable presentable)
Description copied from interface:
IExperimentHostSets a new top-level object (Agent or Experiment) to be displayed
and navigates to its home point.
- Specified by:
setPresentablein interfaceIExperimentHost- Parameters:
presentable- the new top-level object to be displayed
@AnyLogicInternalAPI public long generateNewUsdId()
public Presentable getPresentable()
Description copied from interface:
IExperimentHostReturns the current top-level object (Agent or Experiment), whose
presentation is displayed.
- Specified by:
getPresentablein interfaceIExperimentHost- Returns:
- the current top-level object being displayed, or null
public Experiment<?> getExperiment()
Description copied from interface:
IExperimentHostReturns the experiment associated with this host.
- Specified by:
getExperimentin interfaceIExperimentHost- Returns:
- the experiment associated with this host
public boolean has3D()
- Specified by:
has3Din interfaceIExperimentHost
public void setHas3D(boolean has3DWindow)
public void zoomIn(double coefficient)
Description copied from interface:
IExperimentHostZooms in the animation view by the given amount
- Specified by:
zoomInin interfaceIExperimentHost- Parameters:
coefficient- how much to zoom in, positive number. E.g. 2.0 will result in 2x scaling compared to the current view
public void zoomOut(double coefficient)
Description copied from interface:
IExperimentHostZooms out the animation view by the given amount
- Specified by:
zoomOutin interfaceIExperimentHost- Parameters:
coefficient- how much to zoom out, positive number. E.g. 2.0 will result in 0.5x scaling compared to the current view
public void setCenter(double centerx, double centery)
Description copied from interface:
IExperimentHostCenters the animation view to the given x and y (in the model coordinates)
- Specified by:
setCenterin interfaceIExperimentHost- Parameters:
centerx- the x to be centeredcentery- the y to be centered
public void setZoomAndPanningEnabled(boolean yes)
Description copied from interface:
IExperimentHostEnables or disables zoom & panning initiated from the GUI (button. mouse, or keyboard).
- Specified by:
setZoomAndPanningEnabledin interfaceIExperimentHost- Parameters:
yes- iftrue, zoom & panning should be enabled, iffalse- disabled
public boolean isZoomAndPanningEnabled()
Description copied from interface:
IExperimentHostTests if zoom & panning from the GUI is enabled.
- Specified by:
isZoomAndPanningEnabledin interfaceIExperimentHost- Returns:
trueif zoom & panning are enabled,falseif not.
public void setDeveloperPanelEnabled(boolean debugPanelEnabled)
Description copied from interface:
IExperimentHostEnables or disables the developer panel.
- Specified by:
setDeveloperPanelEnabledin interfaceIExperimentHost- Parameters:
debugPanelEnabled- iffalse, there will be no button to show the developer panel
public void setDeveloperPanelVisibleOnStart(boolean debugPanelVisibleOnStart)
Description copied from interface:
IExperimentHostShows (if enabled) the developer panel when the
model window is shown.
- Specified by:
setDeveloperPanelVisibleOnStartin interfaceIExperimentHost- Parameters:
debugPanelVisibleOnStart- iftrue, the panel will be visible from the beginning, and may be later hidden by pressing the special button.
public void setRunControlEnabled(boolean runControlEnabled)
Description copied from interface:
IExperimentHostEnables or disables Run, Pause, and Stop buttons on the model toolbar
(but not in the developer panel), and sets the corresponding tooltips.
- Specified by:
setRunControlEnabledin interfaceIExperimentHost- Parameters:
runControlEnabled- iffalse, those buttons will be disabled
public boolean isRunControlEnabled()
Description copied from interface:
IExperimentHostTests if Run, Pause, and Stop buttons on the model toolbar are enabled.
- Specified by:
isRunControlEnabledin interfaceIExperimentHost- Returns:
trueif they are enabled,falseif not.
public void setSpeedControlEnabled(boolean speedControlEnabled)
Description copied from interface:
IExperimentHostEnables or disables the model execution speed control buttons on the model toolbar
(but not in the developer panel), and sets the corresponding tooltips.
- Specified by:
setSpeedControlEnabledin interfaceIExperimentHost- Parameters:
speedControlEnabled- iffalse, those buttons will be disabled
public boolean isSpeedControlEnabled()
Description copied from interface:
IExperimentHostTests if the model execution speed control buttons on the model toolbar are enabled.
- Specified by:
isSpeedControlEnabledin interfaceIExperimentHost- Returns:
trueif they are enabled,falseif not.
public void addInspect(double x, double y, Presentable p, String name)
Description copied from interface:
IExperimentHostCreates an inspect window at a particular location for an element of a
Presentable object. If there is another inspect with the same Presentable
and same element name, it is brought to front and a new inspect is not created.
The initial size of the window is adjusted to fit the initial contents.
- Specified by:
addInspectin interfaceIExperimentHost- Parameters:
x- the x coordinate in the presentable object systemy- the y coordinate in the presentable object systemp- the Presentable object whose element is being inspectedname- the name of the element being inspected
public void removeInspect(Presentable p, String name)
Description copied from interface:
IExperimentHostRemoves the inspect window for the given element
- Specified by:
removeInspectin interfaceIExperimentHost- Parameters:
p- the Presentable object whose element is being inspectedname- the name of the element being inspected
public void showAllInspectionWindows()
Description copied from interface:
IExperimentHostAllow inspection windows to be displayed and display all visible inspection windows if they were hidden
by call of IExperimentHost.hideAllInspectionWindows()
- Specified by:
showAllInspectionWindowsin interfaceIExperimentHost
public void hideAllInspectionWindows()
Description copied from interface:
IExperimentHostHide all currently visible inspection windows and prevent new inspection windows to be displayed
- Specified by:
hideAllInspectionWindowsin interfaceIExperimentHost
public void showMessageDialog(String text)
Description copied from interface:
IExperimentHostShows a standard message dialog box with the given text. This method
usually returns immediately - it doesn't wait for the dialog to
be closed (except the cases when called from UI thread)
- Specified by:
showMessageDialogin interfaceIExperimentHost- Parameters:
text- the text to display
public void showErrorDialog(String text, String title)
Description copied from interface:
IExperimentHostShows a standard error dialog box with the given text. This method
usually returns immediately - it doesn't wait for the dialog to
be closed (except the cases when called from UI thread)
- Specified by:
showErrorDialogin interfaceIExperimentHost- Parameters:
text- the text to displaytitle- title of the dialog window
public void showErrorInModelDialog(String text, String title)
Description copied from interface:
IExperimentHostShows a standard 'error in model logic' dialog box with the given text. This method
usually returns immediately - it doesn't wait for the dialog to
be closed (except the cases when called from UI thread)
- Specified by:
showErrorInModelDialogin interfaceIExperimentHost- Parameters:
text- the text to displaytitle- title of the dialog window
public void openWebSite(String url)
Description copied from interface:
IExperimentHostOpens web page with the given URL in the browser
- Specified by:
openWebSitein interfaceIExperimentHost- Parameters:
url- the url to open
public void copyToClipboard(String text)
Description copied from interface:
IExperimentHostCopies the given text to the system clipboard
Due to the security policy of the browser, the actual copying may be preceded by a prompt.
Due to the security policy of the browser, the actual copying may be preceded by a prompt.
- Specified by:
copyToClipboardin interfaceIExperimentHost- Parameters:
text- the text to copy
public void saveSnapshot(String fileName, Runnable successfulCallback, Consumer<Throwable> errorCallback)
Description copied from interface:
IExperimentHostPauses experiment if it is currently running, saves snapshot
and then resumes experiment if it was running
On any error throws nothing.
Usage example:
This method is only available in the AnyLogic Professional
On any error throws nothing.
Usage example:
getExperimentHost().saveSnapshot(
"file.als",
() -> traceln("Saved!"),
e -> {
traceln("Error!");
e.printStackTrace();
}
);
This method is only available in the AnyLogic Professional
- Specified by:
saveSnapshotin interfaceIExperimentHost- Parameters:
fileName- the name of snapshot filesuccessfulCallback- called when snapshot is successfully savederrorCallback- called in case of any error
public void loadSnapshot(String fileName, Runnable successfulCallback, Consumer<Throwable> errorCallback)
Description copied from interface:
IExperimentHostStops experiment and loads snapshot (in its 'not
running' state), doesn't resume simulation of loaded snapshot.
On any error throws nothing, silently rollbacks to the current experiment and resumes it if it was running.
When snapshot is loaded, presentation forgets everything about the model which was running before (including the engine, experiment and agents), therefore, it is recommended not to keep references to model objects after this method call
Usage example:
This method is only available in the AnyLogic Professional
On any error throws nothing, silently rollbacks to the current experiment and resumes it if it was running.
When snapshot is loaded, presentation forgets everything about the model which was running before (including the engine, experiment and agents), therefore, it is recommended not to keep references to model objects after this method call
Usage example:
getExperimentHost().loadSnapshot(
"file.als",
() -> {
traceln("Loaded!");
getExperimentHost().setPresentable(
getExperiment().getEngine().getRoot()
);
getExperiment().run();
},
e -> {
traceln("Error!");
e.printStackTrace();
}
);
This method is only available in the AnyLogic Professional
- Specified by:
loadSnapshotin interfaceIExperimentHost- Parameters:
fileName- the name of snapshot file
public void close()
Description copied from interface:
IExperimentHostThis method returns immediately and performs
the following actions in a separate thread:
- stops experiment if it is not stopped,
- destroys the model and
- closes experiment window (only if model is started in the application mode)
- Specified by:
closein interfaceIExperimentHost
@AnyLogicInternalAPI public void launch(boolean startServer, boolean startExperiment)
Description copied from interface:
IExperimentHostCreates and optionally runs experiment, starts frame collection
- Specified by:
launchin interfaceIExperimentHost- Parameters:
startServer- TODO
@AnyLogicInternalAPI public LaunchConfiguration getConfiguration()
- Specified by:
getConfigurationin interfaceIExperimentHost
@AnyLogicInternalAPI public AnimationPacket getUpdate(boolean fullFrame)
- Specified by:
getUpdatein interfaceIExperimentHost
public OmniFrame getOmniUpdate(boolean fullFrame)
@AnyLogicInternalAPI public OmniverseSyncParameters.OmniSessionParams getOmniParams()
@AnyLogicInternalAPI public String getOmniPassword()
@AnyLogicInternalAPI public boolean isOmniverseAnimtaion()
- Specified by:
isOmniverseAnimtaionin interfaceIExperimentHost
@AnyLogicInternalAPI public long getNextFrameNumber()
- Specified by:
getNextFrameNumberin interfaceIExperimentHost
@AnyLogicInternalAPI public void executeUserAction(long svgId, String value)
- Specified by:
executeUserActionin interfaceIExperimentHost
@AnyLogicInternalAPI public void executeCommand(String cmd, String parameters)
- Specified by:
executeCommandin interfaceIExperimentHost
@AnyLogicInternalAPI public Experiment.State getExperimentState()
- Specified by:
getExperimentStatein interfaceIExperimentHost
@AnyLogicInternalAPI public void setValue(String pathtofield, IExperimentHost.IValue value)
- Specified by:
setValuein interfaceIExperimentHost
@AnyLogicInternalAPI public Object getValue(String pathtofield)
- Specified by:
getValuein interfaceIExperimentHost
public Object callFunction(String pathtofunction, IExperimentHost.IValue... args)
- Specified by:
callFunctionin interfaceIExperimentHost
@AnyLogicInternalAPI public double getProgress()
- Specified by:
getProgressin interfaceIExperimentHost
@AnyLogicInternalAPI public void setSpeed(double speed)
- Specified by:
setSpeedin interfaceIExperimentHost
@AnyLogicInternalAPI public void setMaxFPS(double maxFPS)
Sets the new maximum FPS to be used by the SVGFrameCollector. The actual FPS of the
packets sent can be lower than that, as the SVGFrameCollector may adjust FPS to
keep the number of frames per packet in certain bounds, see SVGFrameCollector.adjustFPS().
- Specified by:
setMaxFPSin interfaceIExperimentHost- Parameters:
maxFPS- the new FPS suggested by the frontend
@AnyLogicInternalAPI public void setSendConsoleItems(boolean yes)
- Specified by:
setSendConsoleItemsin interfaceIExperimentHost
@AnyLogicInternalAPI public void postExperimentSettings()
- Specified by:
postExperimentSettingsin interfaceIExperimentHost
@AnyLogicInternalAPI public void onAgentDestroyed_xjal(Agent ao)
Description copied from interface:
IExperimentHostA callback called by the engine when an agent is being
destroyed. If that agent is currently displayed by the
presentation, display experiment.
- Specified by:
onAgentDestroyed_xjalin interfaceIExperimentHost- Parameters:
ao- the agent being destroyed
public SVGFrameProducer getFrameProducer()
- Specified by:
getFrameProducerin interfaceIExperimentHost
public OmniFrameCollector getOmniFrameCollector()
public com.anylogic.engine.internal.presentation.FrameFlag getFrameFlag()
- Specified by:
getFrameFlagin interfaceIExperimentHost- Returns:
- flag object, which updated on each frame generation start. Used to validate cached result in shapes visibility calculation. Internal use only!
public void setFrameFlag(com.anylogic.engine.internal.presentation.FrameFlag frameFlag)
- Specified by:
setFrameFlagin interfaceIExperimentHost
@AnyLogicInternalAPI public Map<String,String> getDependencyModelFolders()
- Specified by:
getDependencyModelFoldersin interfaceIExperimentHost