Custom Application Samples

The STK Engine can be used to create custom applications.

Using the Code Samples

The code samples included in the STK install are read only. To work with any of the installed code samples:

  1. From the Start->All Programs menu, select STK 11->STK Codesamples 11 x64 or 11 x86 to access <STK install folder>/CodeSamples/CodeSamples.zip.
  2. Copy CodeSamples.zip to a folder where you have write permissions and unzip the file.
  3. Change the properties of the files to writable before compiling them.

All code samples for developing custom applications, listed below, are organized by programming language and project name in the <user-selected folder>CodeSamples/CustomApplications/<Language>/<Project> folder.

Language Project Description
C++ Events This example shows how to programmatically attach to the events of the scenario.

Note: In stkafx.h, the #import for AgSTKUtil.dll and AgStkObjects.dll needs to point to the installation directory (typically, C:\Program Files\AGI\STK 11

Tutorial C++ code tutorial.
Language Project Description
C# 3DObjectEditing This example shows how to utilize the Globe Object Editing feature within STK X Object Model.
AreaTool This exercise demonstrates how to use the Area Tool in STK X.
AzElMaskTool This exercise demonstrates how to use the AzElMask tool in STK X.
DataProviders Uses STK X and the Object Model to compute access from a satellite to a facility, and then uses data providers through the Object Model to graph the data.
DragAndDrop This exercise demonstrates the drag and drop capabilities of the STK X controls.
DrawRects This exercise demonstrates the ability to draw bounding rectangles. This capability is useful when implementing custom rubber band selection.
Events Uses the Object Model and STK X to show how to access events generated in the scenario.
GISDemo This example shows how to use the STK Engine automation interface combined with ArcObjects to display GIS data in a VO Control in an STK Engine application. In order to run this demo, the user must have an Esri map document located at <STK install folder>ArcGIS Engine Runtime installed.
  • ArcDesktop installed and licensed.
GraphicsHowTo Uses the Object Model to demonstarte the new Graphics Primitives library. Common tasks are organized in a tree. Clicking on a task immediately updates the 3D window. In addition, the code used to accomplish the task is shown in the code view for easy copy and paste.
HohmannTransfer The Hohmann Transfer example from the Astrogator exercises in the help. Can be completed using the STK Astrogator Object Model.
HohmannTransferUsingTargeter The Hohmann Transfer Using Targeter example from the Astrogator exercises in the help. Can be completed using the STK Astrogator Object Model.
MapView This example demonstrates how to manipulate the view of a Map/2D control such as by Zooming In/Out, enabling/disabling Pan Mode, etc.
MarsProbe The Mars probe example from the Astrogator exercises in the help. Can be completed using the STK Astrogator Object Model.
MoonMissionWithBPlaneTargeting The Moon Mission with B Plane Targeting example from the Astrogator exercises in the help. Can be completed using the STK Astrogator Object Model.
ObscurationTool This exercise demonstrates how to use the Obscuration tool in STK X.
OMDemo Uses the Object Model and STK X to show how to load satellites from a database and how to export data to an xml file.
OnAnimUpdate This exercise demonstrates the OnAnimUpdate event fired by STK X. This event can be used to synchronize other processes and GUI elements with the animation. In the example, the event is used to display information in the status bar.
OptimizerAndScriptingTool This examples uses the STK Object Model and the Astrogator Object Model to optimize the maneuvers involved in changing the argument of periapse 10 degrees for a highly eccentric orbit. The Design Explorer Optimizer and Scripting Tool are used in this example and the configuration is completely accomplished using the Astrogator Object Model.
PlaceFinder This example was created with C# and Visual Studio .NET 2003 and involves a Window form using the Globe control. It demonstrates:
  • how to implement an application-specific context menu
  • how to extract or pick information from the Globe control

It uses the TerraServer web service to create facilities on the Globe.

PointInPolygon This example demonstrates how to test if a point on the globe is inside a polygon on the globe using STK Graphics primitives.
PolygonDrawing This example allows the user to draw polygons using STK Graphics primitives by double clicking points on the globe.
PolylineDrawing This example allows the user to draw polylines using STK Graphics primitives by double clicking points on the globe.
RubberBandSelect This exercise demonstrates how to implement rubber-band selection and get the list of the objects selected by the user.
SISP Single Integrated Space Picture (SISP), designed to provide information on satellites and other assets of interest to the user at a glance.
SolarPanelTool This exercise demonstrates how to use the Solar Panel tool in STK X.
STKProTutorial Shows how to set up a typical STK scenario using the Object Model and STK X. Please see this link for the tutorial.
Tutorial Uses the Object Model and STK X to set up a typical STK scenario.
VGTAER Demonstrates how to compute AER values using the Vector Geometry Tool API instead of the Data Providers.
VGTTutorial Demonstrates how to construct, visualize and perform various computations using the custom vectors, angles, and axes from the Vector Geometry Tool API.
Language Project Description
Java

Note: For instructions on configuring the Java samples with the Eclipse IDE, click here. Also some code samples only build on windows.

CustomApp_AWT_STK_Astrogator_HohmannTransfer This example demonstrates how to use the STK Astrogator API to plan a Hohmann Transfer within an AWT/Swing based application.
CustomApp_AWT_STK_Astrogator_HohmannTransferUsingTargeter This example demonstrates how to use the STK Astrogator API to plan a Hohmann Transfer using a targeter within an AWT/Swing based application.
CustomApp_AWT_STK_Astrogator_MarsProbe This example demonstrates how to use the STK Astrogator API to plan a Mar Probe Mission within an AWT/Swing based application.
CustomApp_AWT_STK_Astrogator_MoonMissionWithBPlaneTargeting This example demonstrates how to use the STK Astrogator API to plan a Moon Mission utilizing BPlane Targeting within an AWT/Swing based application.
CustomApp_AWT_STK_Astrogator_OptimizerAndScriptingTool This example demonstrates how to use the STK Astrogator API's Optimizer and Scripting Tool within an AWT/Swing based application.
CustomApp_AWT_STK_Demo_Sisp This example demonstrates one possible application (Single Integrated Space Picture) that can be created with the AGI Java API within an AWT/Swing based application.
CustomApp_AWT_STK_Graphics_Globe_Common A shared project that contains reusable resources for other Custom Application AWT STK Graphics samples.
CustomApp_AWT_STK_Graphics_Globe_HowTo This example demonstrates some of the most common uses/features of the Graphics API in a 3D Globe display and the code snippets used to employ those features.
CustomApp_AWT_STK_Graphics_Globe_OverlayToolbar This example demonstrates how to create a 3D display overlay that can be used as an "embedded" widget/toolbar. In this sample the toolbar consists of common animation and view controls.
CustomApp_AWT_STK_Graphics_Globe_PolygonDrawing This example demonstrates how to create interactive polygon drawing in the 3D Globe display when instructed by user mouse interation.
CustomApp_AWT_STK_Graphics_Globe_PolylineDrawing This example demonstrates how to create interactive polyline drawing in the 3D Globe display when instructed by user mouse interation.
CustomApp_AWT_STK_Objects_Animation This example demonstrates how to manipulate the animation (i.e. play forward/backward, pause, step forward/backward, increase/descrease animation step, etc.) from an instance of the AgStkObjectRootClass object from the STK Object Model API within an AWT/Swing based application.
CustomApp_AWT_STK_Objects_DataProviders_HowTo This example demonstrates how to access specific data providers to display internal computation data in thirdparty Graphing/Charting packages such as JFreeChart. The code snippets to access this data is also displayed.
CustomApp_AWT_STK_Objects_HowTo This example demonstrates the most commonly used features within the STK Object Model within a AWT/Swing based STK Engine Custom Application.
CustomApp_AWT_STK_Objects_Root_Events This example demonstrates how to subscribe to event notification provided by an instance of the AgStkObjectRootClass object from the STK Objects API within a AWT/Swing based STK Engine Custom Application.
CustomApp_AWT_STK_Objects_Tutorial_Begin This example demonstrates the end version of the STK Object Model Tutorial AWT/Swing based STK Engine Custom Application. This is left as an exercise to the developer to complete, compile, run. The developer may use the CustomApp_AWT_STK_Objects_Tutorial_End as a reference.
CustomApp_AWT_STK_Objects_Tutorial_End This example demonstrates the end version of the STK Object Model Tutorial within a AWT/Swing based STK Engine Custom Application.
CustomApp_AWT_STK_Plugin_AccessConstraint_Config Configures and uses the "Extend_STK_Plugin_AccessConstraint_Config" Java plugin sample via STK Engine Custom Application.
CustomApp_AWT_STK_Plugin_AccessConstraint_NIIRS Configures and uses the "Extend_STK_Plugin_AccessConstraint_NIIRS" Java plugin sample via STK Engine Custom Application.
CustomApp_AWT_STK_Plugin_AccessConstraint_Range Configures and uses the "Extend_STK_Plugin_AccessConstraint_Range" Java plugin sample via STK Engine Custom Application.
CustomApp_AWT_STK_VGT_AER This example demonstrates how to utilize the Vector Geometry Tool to recieve Azimuth, Elevation, and Range data from one object to another within an AWT/Swing based STK Engine Custom Application.
CustomApp_AWT_STK_VGT_Tutorial This example demonstrates how to utilize the Vector Geometry Tool to create graphical vectors, axes, points, etc. within an AWT/Swing based STK Engine Custom Application.
CustomApp_AWT_STK_X_Animation This example demonstrates how to manipulate the animation (i.e. play forward/backward, pause, step forward/backward, increase/descrease animation step, etc.) from an instance of the AgSTKXApplicationClass object from the STK X API within an AWT/Swing based application.
CustomApp_AWT_STK_X_App_Events This example demonstrates how to subscribe to event notification provided by an instance of the AgSTKXApplicationClass object from the STK X API within an AWT/Swing based application.
CustomApp_AWT_STK_X_GfxAnalysis_AreaTool This example demonstrates how to use an instance of the AWT/Swing version of the AgUiAxGfxAnalysisCntrl object as a Area Tool.
CustomApp_AWT_STK_X_GfxAnalysis_AzElMaskTool This example demonstrates how to use an instance of the AWT/Swing version of the AgUiAxGfxAnalysisCntrl object as a AzEl Mask Tool.
CustomApp_AWT_STK_X_GfxAnalysis_ObscurationTool This example demonstrates how to use an instance of the AWT/Swing version of the AgUiAxGfxAnalysisCntrl object as a Obscuration Tool.
CustomApp_AWT_STK_X_GfxAnalysis_SolarPanelTool This example demonstrates how to use an instance of the AWT/Swing version of the AgUiAxGfxAnalysisCntrl object as a Solar Panel Tool.
CustomApp_AWT_STK_X_Globe_Basic This example demonstrates how to embed a basic 3D/Globe control object from the STK X API to an AWT/Swing based application.
CustomApp_AWT_STK_X_Globe_DisplayOptions This example demonstrates how to change the display options (i.e. splash screen logo, splash screen background color, progress image, etc.) within an instance of an AWT/Swing version of the AgGlobeCntrlClass object from the STK X API.
CustomApp_AWT_STK_X_Globe_DragAndDrop Provides detailed example code of how to respond to OLE Drag and Drop of system files event notification. In this sample, .connect files can be dragged from the folder where this sample resides onto the 3D Globe control. Within these files are Connect commands that the Java application will read and pass on to the AgStkObjectRoot.executeCommand() method.
CustomApp_AWT_STK_X_Globe_DrawRects Provides detailed example of how to draw rectangular boxes on the 3D Globe control and how to react to the drawing in order to implement specific application domain knowledge.
CustomApp_AWT_STK_X_Globe_Events This example demonstrates how to subscribe to event notifications provided by an instance of an AWT/Swing version of the AgGlobeCntrlClass object from the STK X API.
CustomApp_AWT_STK_X_Globe_ObjectEditing This example demonstrates how to allow the user to graphically (with a mouse) change the path of a vehicle over the course of the scenario animation period within an instance of an AWT/Swing version of the AgGlobeCntrlClass object from the STK X API.
CustomApp_AWT_STK_X_Globe_RubberBandSelect This example demonstrates how to allow the user to graphically use a rectangular region (i.e. RubberBand) to select a group of STK Objects within the scenario and display meta data about those objects within an instance of an AWT/Swing version of the AgGlobeCntrlClass object from the STK X API.
CustomApp_AWT_STK_X_Globe_View This example demonstrates how to allow the user to change the view (Zoom In/Out, use a Stored View, Orient North, etc.) within an instance of an AWT/Swing version of the AgGlobeCntrlClass object from the STK X API.
CustomApp_AWT_STK_X_Map_Basic This example demonstrates how to embed a basic 2D/Map control object from the STK X API to an AWT/Swing based application.
CustomApp_AWT_STK_X_Map_DisplayOptions This example demonstrates how to change the display options (i.e. splash screen logo, splash screen background color, progress image, etc.) within an instance of an AWT/Swing version of the AgMapCntrlClass object from the STK X API.
CustomApp_AWT_STK_X_Map_Events This example demonstrates how to subscribe to event notification provided by an instance of an AWT/Swing version of the AgMapCntrlClass object with in the STK X API.
CustomApp_AWT_STK_X_Map_Projections This example demonstrates how to allow a user to change the Map Projection (i.e. EquiCylindrical, Mercator, Miller, Mollweide, Sinusoidal, Perspective, etc.) within an instance of an AWT/Swing version of the AgGlobeCntrlClass object from the STK X API.
CustomApp_AWT_STK_X_Map_Projections_GrazingPoint This example demonstrates how to allow a user to get LLA information from the Map Projection (i.e. EquiCylindrical, Mercator, Miller, Mollweide, Sinusoidal, Perspective, etc.) when moving the mouse across the control within an instance of an AWT/Swing version of the AgGlobeCntrlClass object from the STK X API.
CustomApp_AWT_STK_X_Map_View This example demonstrates how to manipulate the view such as by Zooming In/Out, enabling/disabling Pan mode, etc. within an instance of an AWT/Swing version of the AgGlobeCntrlClass object from the STK X API.
CustomApp_AWT_STK_X_TabPanes This example demonstrates how to add a 2D/Map and 3D/Globe to a AWT/Swing based application using Tab Panes.
CustomApp_AWT_STK_X_Tutorial_Begin This example is to be used as an exercise for the developer to complete and fix compilation errors in order to learn the STK X API. Refer to the STK-XTutorials-Java.pdf for directions. When finished compare to the CustomApp_AWT_STK_X_Tutorial_End sample.
CustomApp_AWT_STK_X_Tutorial_End This example is a completed version of the CustomApp_AWT_STK_X_Tutorial_Begin sample. Refer to the STK-XTutorials-Java.pdf for directions.
CustomApp_Swing_JavaFX_STK A base project that adds the necessary references to the STK Java API libraries (Jars/JNI dlls) as well as JavaFX that are required for a AWT/Swing/JavaFX based STK Engine Custom Application.
CustomApp_Swing_JavaFX_STK_Objects_DataProviders_HowTo This example demonstrates how to access specific data providers to display internal computation data in JavaFX 2.0 Charting API. The code snippets to access this data is also displayed.
CustomApp_Swing_JavaFX_STK_X_Animation This example demonstrates how to manipulate the animation (i.e. play forward/backward, pause, step forward/backward, increase/descrease animation step, etc.) from an instance of the AgSTKXApplicationClass object from the STK X API within an AWT/Swing based application that uses JavaFX 2.0 for panel UIs.
CustomApp_Swing_JavaFX_STK_X_Globe_View This example demonstrates how to allow the user to change the view (Zoom In/Out, use a Stored View, Orient North, etc.) within an instance of an AWT/Swing version of the AgGlobeCntrlClass object from the STK X API using JavaFX 2.0 for panel UIs.
CustomApp_Swing_JavaFX_STK_X_Map_View This example demonstrates how to manipulate the view such as by Zooming In/Out, enabling/disabling Pan mode, etc. within an instance of an AWT/Swing version of the AgGlobeCntrlClass object from the STK X API using JavaFX 2.0 for panel UIs.
CustomApp_Swing_STK A base project that adds the necessary references to the AGI Java API libraries (Jars/JNI dlls) that are required for a AWT/Swing based STK Engine Custom Application.
CustomApp_SWT_JavaFX_STK This example demonstrates how to manipulate the animation (i.e. play forward/backward, pause, step forward/backward, increase/descrease animation step, etc.) from an instance of the AgSTKXApplicationClass object from the STK X API within an SWT based application that uses JavaFX 2.0 for panel UIs.
CustomApp_SWT_JavaFX_STK_X_Animation This example demonstrates how to manipulate the animation (i.e. play forward/backward, pause, step forward/backward, increase/descrease animation step, etc.) from an instance of the AgSTKXApplicationClass object from the STK X API within an SWT based application that uses JavaFX 2.0 for panel UIs.
CustomApp_SWT_JavaFX_STK_X_Globe_View This example demonstrates how to allow the user to change the view (Zoom In/Out, use a Stored View, Orient North, etc.) within an instance of an SWT version of the AgGlobeCntrlClass object from the STK X API using JavaFX 2.0 for panel UIs.
CustomApp_SWT_JavaFX_STK_X_Map_View This example demonstrates how to manipulate the view such as by Zooming In/Out, enabling/disabling Pan mode, etc. within an instance of an SWT version of the AgGlobeCntrlClass object from the STK X API using JavaFX 2.0 for panel UIs.
CustomApp_SWT_STK A base project that adds the necessary references to the AGI Java API libraries (Jars/JNI dlls) that are required for a SWT based STK Engine Custom Application.
CustomApp_SWT_STK_X_Animation This example demonstrates how to add an animation tool bar an SWT based application.
CustomApp_SWT_STK_X_Eclipse_Plugin This example demonstrates how to create an Eclipse Plugin SWT based application.
CustomApp_SWT_STK_X_Eclipse_RCP This example demonstrates how to create an Eclipse RCP SWT based application.
CustomApp_SWT_STK_X_Globe_Basic This example demonstrates how to embed a basic 3D/Globe control object from the STK X API to an SWT based application.
CustomApp_SWT_STK_X_Globe_Events This example demonstrates how to receive 3D/Globe control events within an SWT based application.
CustomApp_SWT_STK_X_Map_Basic This example demonstrates how to embed a basic 2D/Map control object from the STK X API to an SWT based application.
Language Project Description
MATLAB MATLAB Data Providers Example

Shows how to use data providers on a ground vehicle in MATLAB with the Object Model and STK X.

MATLAB Example Shows how to create a ground vehicle in MATLAB with the Object Model and STK X
Tutorial Uses STK X to embed STK functionality in a container application created with MATLAB.
Language Project Description
PowerPoint 3D Window Example In this example, a Globe control is embedded in PowerPoint Presentation. It demonstrates how to drive the Globe control from VBA and a PowerPoint macro.

If this example does not run correctly, it may be due to a known PowerPoint problem. if you encounter this, please use the following workaround:

  1. Start PowerPoint.
  2. Open the PowerPoint presentation.
  3. On the Tools menu, select Macro -> Security.
  4. Click Medium in the Security dialog. If it is already Medium, change it to another setting and then back to Medium.
  5. Click OK.
  6. Save the PowerPoint slide.
  7. Close the PowerPoint slide.
  8. Open that PowerPoint slide again.
Language Project Description
Visual Basic AreaTool This exercise demonstrates how to use the Area tool in STK X.
AzElMaskTool This exercise demonstrates how to use the AzElMask tool in STK X.
DragAndDrop This exercise demonstrates the drag and drop capabilites of the STK X controls.
DrawRects This exercise demonstrates the ability to draw bounding rectangles. This capability is useful when implementing custom rubber band selection.
Events This example using both the Map and Globe controls demonstrates:
  • how to connect to mouse and keyboard events with Map and Globe controls
  • how to pick information from the Globe control
  • Zoom In/Zoom Out with the Map control
  • catching application events
GraphicsHowTo Uses the Object Model to demonstarte the new Graphics Primitives library. Common tasks are organized in a tree. Clicking on a task immediately updates the 3D window. In addition, the code used to accomplish the task is shown in the code view for easy copy and paste.
HohmannTransfer The Hohmann Transfer example from the Astrogator exercises in the help. Can be completed using the STK Astrogator Object Model.
HohmannTransferUsingTargeter The Hohmann Transfer Using Targeter example from the Astrogator exercises in the help. Can be completed using the STK Astrogator Object Model.
MapView

This example demonstrates how to manipulate the view of a Map/2D control such as by Zooming In/Out, enabling/disabling Pan Mode, etc.

MarsProbe The Mars probe example from the Astrogator exercises in the help. Can be completed using the STK Astrogator Object Model.
MoonMissionWithBPlaneTargeting The Moon Mission with B Plane Targeting example from the Astrogator exercises in the help. Can be completed using the STK Astrogator Object Model.
ObscurationTool This exercise demonstrates how to use the Obscuration tool in STK X.
OnAnimUpdate This exercise demonstrates the OnAnimUpdate event fired by STK X. This event can be used to synchronize other processes and GUI elements with the animation. In the example, the event is used to display information in the status bar.
RubberBandSelect This exercise demonstrates how to implement rubber-band selection and get the list of the objects selected by the user.
SolarPanelTool This exercise demonstrates how to use the Solar Panel tool in STK X.
Tutorial STK X to embed STK functionality in a container application created with Visual Basic .NET
VGTTutorial Demonstrates how to construct, visualize and perform various computations using the custom vectors, angles, and axes from the Vector Geometry Tool API.

STK 11.2.1 Programming Interface