public class StkApplication extends Object implements AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
static StkApplication |
attachToExisting(SimulationLogger simulationLogger)
Attach to an already running instance of STK.
|
void |
close()
This will close the STK application.
|
void |
closeScenario()
Closes the current STK scenario.
|
static StkApplication |
createFromScenario(String scenarioFilePath,
boolean isVisible,
SimulationLogger simulationLogger)
Start and attach to a new instance of the STK application and load the input scenario.
|
static StkApplication |
createFromVdf(String vdfFilePath,
boolean isVisible,
SimulationLogger simulationLogger)
Start and attach to a new instance of the STK application and load the input VDF.
|
static StkApplication |
createNewInstance(String scenarioName,
boolean isVisible,
SimulationLogger simulationLogger)
Start and attach to a new instance of the STK application and load a blank scenario.
|
static void |
deinitializeJni()
Statically de-initialize the STK JNI after all operations are complete.
|
static void |
execute(Action action,
SimulationLogger simulationLogger)
Executes the specified
action in STK using the STK Java Native Interface (JNI). |
void |
forceQuit()
This will close and exit the STK application regardless of whether this instance was created as new or attached to an existing instance.
|
StkScenario |
getCurrentScenario() |
int |
getProcessId() |
static String |
getStkBinDirectory()
Retrieves the STK 12 bin directory from the registry
|
static void |
initializeJni(SimulationLogger simulationLogger)
Statically initialize the STK JNI prior to interacting with STK.
|
void |
loadScenario(String scenarioFilePath) |
void |
newScenario(String name)
Creates a new scenario in the STK instance.
|
static void |
setJniLoadDirectory(String stkBinDirectory)
Initializes the STK JNI libraries with the path to look for their native components.
|
public static void initializeJni(SimulationLogger simulationLogger)
simulationLogger - Used for logging messages to the simulation log and simulation console.public static void deinitializeJni()
Before calling this method, any AgStkUi instances should be released. StkApplication holds onto an AgStkUi instance, so
you should close() all such instances before calling this method.
public static String getStkBinDirectory()
public static void setJniLoadDirectory(String stkBinDirectory)
This method must be called before you initialize JNI (before calling initializeJni(SimulationLogger)()}). This method should only be
called once.
stkBinDirectory - The path to the STK bin directory containing the STK jar files.@NotNull public static StkApplication createNewInstance(String scenarioName, boolean isVisible, SimulationLogger simulationLogger)
Before calling this method, you must ensure that JNI has been initialized by calling initializeJni(SimulationLogger) ()}.
scenarioName - The name for the blank scenario.isVisible - True if the new instance should be visible to the desktop user.simulationLogger - Used for logging messages to the simulation log and simulation console.@NotNull public static StkApplication createFromScenario(String scenarioFilePath, boolean isVisible, SimulationLogger simulationLogger)
Before calling this method, you must ensure that JNI has been initialized by calling initializeJni(SimulationLogger)()}.
scenarioFilePath - The file path to the *.sc file to load into the STK Application on startup.isVisible - Whether or not to display the scenario.simulationLogger - Used for logging messages to the simulation log and simulation console.@NotNull public static StkApplication createFromVdf(String vdfFilePath, boolean isVisible, SimulationLogger simulationLogger)
Before calling this method, you must ensure that JNI has been initialized by calling initializeJni(SimulationLogger) ()}.
vdfFilePath - The file path to the *.vdf file to load into the STK Application on startup.isVisible - Whether or not to display the scenario.simulationLogger - Used for logging messages to the simulation log and simulation console.@NotNull public static StkApplication attachToExisting(SimulationLogger simulationLogger)
simulationLogger - Used for logging messages to the simulation log and simulation console.public static void execute(@NotNull
Action action,
SimulationLogger simulationLogger)
throws StkNotFoundException
action in STK using the STK Java Native Interface (JNI).action - - The action to perform.simulationLogger - Used for logging messages to the simulation log and simulation console.StkNotFoundException - Exception thrown when an STK instance cannot be found.public int getProcessId()
public StkScenario getCurrentScenario()
public void close()
close in interface AutoCloseablepublic void forceQuit()
public void closeScenario()
public void newScenario(String name)
name - The name of the blank scenario to create.public void loadScenario(String scenarioFilePath)
scenarioFilePath - The path to the file of the *.sc file to load into the STK Application. This will close the current scenario if it
exists.