STK Java API - STK Automation
Description
Typically this approach is used when you want to utilize STK's analysis engine but do not want to embed its visualization within your application. As opposed to the pre-existing Connect Command and TCP/IP automation, this automation approach provides an Object Oriented API through remote proxy inter-process communications between your Java application process and the STK GUI Application process.
This type of application is only supported on Windows Operating Systems.
What's included in this API?
The API to develop/run/deploy an STK Automation Application based on the STK Java API includes the following lists of libraries/packages/javadocs include:JAR libraries:
- agi.core.jar
- agi.core.swing.jar
- agi.stkutil.jar
- agi.stkobjects.jar
- agi.stkobjects.astrogator.jar
- agi.stkobjects.aviator.jar
- agi.stkvgt.jar
- agi.stkgraphics.jar
- agi.stk.ui.jar
- agi.ui.core.jar
- agi.ui.application.jar
JNI native libraries:
- AgJNICore.dll
- AgJNIStkUtil.dll
- AgJNIStkObjects.dll
- AgJNIStkGator.dll
- AgJNIStkAvtr.dll
- AgJNIStkVGT.dll
- AgJNIStkGraphics.dll
- AgJNIUiCore.dll
- AgJNIUiApplication.dll
Packages:
- agi.*
- agi.core.*
- agi.core.awt.*
- agi.stkutil.*
- agi.stkobjects.*
- agi.stkobjects.astrogator.*
- agi.stkobjects.aviator.*
- agi.stkvgt.*
- agi.stkgraphics.*
- agi.stk.ui.*
- agi.stk.ui.core.*
- agi.stk.ui.application.*
Documentation
Documentation for including Javadocs in Eclipse IDE
STK Automation samples are provided within the STK and STK Engine install. To configure/run these samples can be found on the Eclipse samples configuration page.
To use these samples:
- Build these samples in Eclipse by referring to the Eclipse samples configuration page.
- Right click on the Java file that contains a main method within any sample Eclipse project and choose Run as -> Java Application.
Development/Runtime Configuration
Use the above listed JAR and JNI native libraries as input to the following development environment configurations:
Standalone environment - Instructions to configure a non-gui development environment for developing the Java Automation Application.
Eclipse IDE - Instructions to configure an Eclipse Java application development project.
Use the samples listed above as reference for implementing an AWT/Swing Custom Application.
Deployment instructions for a STK Automation Application.
- Follow the appropriate deployment instructions for an STK product application.
-
Locate the "JavaDevKit" directory in the STK 13 or STK Engine 13's installation area, for instance:
<Install_Dir>\bin\JavaDevKit
- Add the jar files located in the "JavaDevKit" directory to your Java application's runtime environment's CLASSPATH environment variable or the Java Virtual Machine's (java.exe) classpath input argument.
- Add the "JavaDevKit" directory to your Java application's runtime environment's PATH environment variable or the Java Virtual Machine's (java.exe) equivalent native library path setting such that the AGI jar files can load the native AgJNI*.dlls that are in that directory.
FAQ
A set of frequently asked questions/issues and their answers/solutions.
Topics- How do I improve the performance of my STK Automation Application?
- How do I init/uninit my console application to use STK Automation?
- How do I init/uninit my AWT Based GUI application to use STK Automation?
- How do I init/uninit my SWT Based GUI application to use STK Automation?
- How do I init/uninit my application to use STK Automation without the Astrogator API?
- How do I init/uninit my application to use STK Automation without the Vector Geometry Tool API?
How do I improve the performance of my STK Automation Application?
In the Java API, event proxies are created automatically upon creation of AgStkObjectRoot and other objects. As a result, even though the client application does not register for events, all event notifications are being forwarded to the Java process. This marshaling between the STK process and the automation application process causes undesirable slowdown in response in the STK application, especially during animation.
To address this issue, the NotificationFilter property has been exposed on IAgStkObjectRoot interface. This allows users to filter which automation events shall be raised. The notification filtering is applied to all root objects in the application, except for roots that have been isolated. For isolated roots, the event notification must be configured individually.
Using the NotificationFilter can significantly improve the performance and responsiveness of your Automation Application. It must be noted, however, that use of the eNotificationFilterMaskAnimationEvents flag may negatively affect performance.
Example code can be found in <Install_Dir>\CodeSamples\CustomApplications\Java\Swing_STK\src\agi\customapplications\swing\EventsFilterJPanel.java.
How do I init/uninit my console application to use STK Automation?
Typically, console applications do not utilize GUI functionality as are provided by frameworks such as AWT and SWT. However, at this time the STK Java API does not provide an initialization/uninitialization strategy for non-GUI applications. As such, one must initialize/uninitialize their console applications that use the STK Java API with one of the window framework initialization/uninitialization strategies, ergo AWT or SWT. This is a known issue that will be resolved in a future release. The AWT window framework initialization/uninitialization strategy is recommended in this case, an example of which follows:
This initialization/uninitialization strategy may require further configuration of the Java Runtime's CLASSPATH setting to add dependencies on either the AWT or SWT window framework JAR libraries depending on the runtime configuration of running context of the GUI-less application.
- Initialization:
agi.core.awt.AgAwt_JNI.initialize_AwtDelegate();
agi.stk.ui.AgStkAutomation_JNI.initialize(true);
agi.core.awt.AgAwt_JNI.initialize_AwtComponents(); - Uninitialization:
This is the reverse order of the preceding initialize.
agi.core.awt.AgAwt_JNI.uninitialize_AwtComponents();
agi.stk.ui.AgStkAutomation_JNI.uninitialize();
agi.core.awt.AgAwt_JNI.uninitialize_AwtDelegate();
How do I init/uninit my AWT Based GUI application to use STK Automation?
- Initialization:
agi.core.awt.AgAwt_JNI.initialize_AwtDelegate();
agi.stk.ui.AgStkAutomation_JNI.initialize(true);
agi.core.awt.AgAwt_JNI.initialize_AwtComponents(); - Uninitialization:
This is the reverse order of the preceding initialize.
agi.core.awt.AgAwt_JNI.uninitialize_AwtComponents();
agi.stk.ui.AgStkAutomation_JNI.uninitialize();
agi.core.awt.AgAwt_JNI.uninitialize_AwtDelegate();
How do I init/uninit my SWT Based GUI application to use STK Automation?
- Initialization:
agi.core.swt.AgSwt_JNI.initialize_SwtDelegate();
agi.stk.ui.AgStkAutomation_JNI.initialize(true);
agi.core.swt.AgSwt_JNI.initialize_SwtComponents(); - Uninitialization:
This is the reverse order of the preceding initialize.
agi.core.swt.AgSwt_JNI.uninitialize_SwtComponents();
agi.stk.ui.AgStkAutomation_JNI.uninitialize();
agi.core.swt.AgSwt_JNI.uninitialize_SwtDelegate();
How do I init/uninit my application to use STK Automation without the Astrogator API?
Initializing/Uninitializing with the following techniques will allow you to exclude the agi.stkobjects.astrogator.jar
and AgJNIStkGator.dll/libagjnistkgator.so
from your configuration settings.
- Initialization:
agi.core.awt.AgAwt_JNI.initialize_AwtDelegate();
agi.core.AgCore_JNI.initialize();
agi.stkutil.AgStkutil_JNI.initialize();
agi.stkobjects.AgStkobjects_JNI.initialize();
//agi.stkobjects.astrogator.AgStkgator_JNI.initialize();
agi.stkobjects.aviator.AgStkobjectsAviator_JNI.initialize();
agi.stkvgt.AgCrdn_JNI.initialize();
agi.stkgraphics.AgStkGraphics_JNI.initialize();
agi.stk.ui.core.AgUiCore_JNI.initialize();
agi.stk.ui.application.AgUiApplication_JNI.initialize();
agi.core.awt.AgAwt_JNI.initialize_AwtComponents(); - Uninitialization:
This is the reverse order of the preceding initialize.
agi.core.awt.AgAwt_JNI.uninitialize_AwtComponents();
agi.stk.ui.application.AgUiApplication_JNI.uninitialize();
agi.stk.ui.core.AgUiCore_JNI.uninitialize();
agi.stkgraphics.AgStkGraphics_JNI.uninitialize();
agi.stkvgt.AgCrdn_JNI.uninitialize();
agi.stkobjects.aviator.AgStkobjectsAviator_JNI.uninitialize();
//agi.stkobjects.astrogator.AgStkgator_JNI.uninitialize();
agi.stkobjects.AgStkobjects_JNI.uninitialize();
agi.stkutil.AgStkutil_JNI.uninitialize();
agi.core.AgCore_JNI.uninitialize();
agi.core.awt.AgAwt_JNI.uninitialize_AwtDelegate();
How do I init/uninit my application to use STK Automation without the Vector Geometry Tool API?
Initializing/Uninitializing with the following techniques will allow you to exclude the agi.stkvgt.jar
and AgJNIStkVGT.dll/libagjnistkvgt.so
from your configuration settings.
- Initialization:
agi.core.awt.AgAwt_JNI.initialize_AwtDelegate();
agi.core.AgCore_JNI.initialize();
agi.stkutil.AgStkutil_JNI.initialize();
agi.stkobjects.AgStkobjects_JNI.initialize();
agi.stkobjects.astrogator.AgStkgator_JNI.initialize();
agi.stkobjects.aviator.AgStkobjectsAviator_JNI.initialize();
//agi.stkvgt.AgCrdn_JNI.initialize();
agi.stkgraphics.AgStkGraphics_JNI.initialize();
agi.stk.ui.core.AgUiCore_JNI.initialize();
agi.stk.ui.application.AgUiApplication_JNI.initialize();
agi.core.awt.AgAwt_JNI.initialize_AwtComponents(); - Uninitialization:
This is the reverse order of the preceding initialize.
agi.core.awt.AgAwt_JNI.uninitialize_AwtComponents();
agi.stk.ui.application.AgUiApplication_JNI.uninitialize();
agi.stk.ui.core.AgUiCore_JNI.uninitialize();
agi.stkgraphics.AgStkGraphics_JNI.uninitialize();
//agi.stkvgt.AgCrdn_JNI.uninitialize();
agi.stkobjects.aviator.AgStkobjectsAviator_JNI.uninitialize();
agi.stkobjects.astrogator.AgStkgator_JNI.uninitialize();
agi.stkobjects.AgStkobjects_JNI.uninitialize();
agi.stkutil.AgStkutil_JNI.uninitialize();
agi.core.AgCore_JNI.uninitialize();
agi.core.awt.AgAwt_JNI.uninitialize_AwtDelegate();