1 / 30

Application Programming using the STK Object Model

Application Programming using the STK Object Model. Sylvain Dupont & Alan Ocampo Analytical Graphics, Inc October 2005. Our goal. Make it easier for integrators to reuse AGI technology Reliance on industry standards Shorter learning curve & development cycle. History. …. 5.0. 6.0. 7.0.

Download Presentation

Application Programming using the STK Object Model

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Application Programming using the STK Object Model Sylvain Dupont & Alan OcampoAnalytical Graphics, Inc October 2005

  2. Our goal • Make it easier for integrators to reuse AGI technology • Reliance on industry standards • Shorter learning curve & development cycle

  3. History … 5.0 6.0 7.0 … 5.0 4.0 • Connect • TCP/IP socket • String based language STK Plugins COM based plugins • Application Object Model • Control STK windows • ExecuteCommand • Internal HTML Viewer • Window.external • STK Objects Library • Manipulate the STK objects • Available with STK, STK/X & 4DX • Data providers Plugin scripts Scripting languages only(perl, VBScript & matlab) • STK/X – 4DX • Map & globe controls • ExecuteCommand

  4. STK Objects Library - Technology • Based on COM (Component Object Model) • Available development environments • .Net (C#, Visual Basic .Net) • Java • C++ • Visual Basic 6 • Scripting languages

  5. Scope for STK 7 • First release covers: (~ PRO & AVO licenses) • 484 interfaces, 2019 properties, 214 methods • Coverage will increase with subsequent releases • Fall back to Connect for capabilities not yet supported

  6. Example: Target object

  7. Benefits • Better development tools support • Errors detected at compile time • Rich exception information provided at run-time • Less code to write for 3rd party developers • Avoid tedious string parsing & formatting

  8. Next… • How to perform the most common Connect tasks with the STK Object Model

  9. Agenda • Life before the API: Connect • What is the STK Object Model API? • Features • Basics of application development (using VB6) • Benefits and Limitations • Recommendations

  10. Life Before the API : Connect Revisited • What is ‘Connect’? • Connect is the ‘language’ of STK. • You can send Connect commands to STK via TCP/IP or COM • Sample code using Connect (via COM) ‘m_stkApp is an instance of an STK/X application object ‘Load a scenario m_stkApp.ExecuteCommand "Load / Scenario """ & “c:\temp\scenario.sc” & """" ‘get a string containing a list of all object paths Dim result As AgExecCmdResult Dim instanceNames As String Dim objectList() As String Set result = m_stkApp.ExecuteCommand("AllInstanceNames /") instanceNames = result.item(0)

  11. Life Before the API : Connect Revisited • Benefits • Straightforward implementation, does not require a lot of development skill or experience • Almost all of the functionality available from the STK GUI can be executed using Connect • Limitations • It is difficult to memorize the syntax of commands • Limited exception handling • Most commands with a return value need further parsing to be more useful

  12. Overview of the API • What is it? • COM type library that provides an object model that represents STK objects • Version History • Released starting with STK version 6.1.3 as the ‘STK Data Provider API’ • Renamed to ‘STK Object Model API’ in STK version 7

  13. Overview of the API • Object Model Features • Application / Scenario level interfaces • STK object-related interfaces • Data Provider-related interfaces • Object Model Diagram

  14. Using the API • Installation • System requirements same as STK • Installation procedure • Before STK 7, separate installation package • Setting up a development project • Add a reference to ‘AGI STK/Objects 7’ (AgStkObjects.dll – located in the bin folder)

  15. Using the API • Demo application • Object Initialization • The Object Root (AgStkObjectRoot) • Working with scenario objects (IAgStkObject) • Accessing Data Provider information • Multiple Threshold Crossings • Events

  16. Using the API • Object Initialization • Using with STK/X Dim m_stkApp As AgStkObjectRoot Set m_stkApp = New AgStkObjectRoot

  17. Using the API • Object Initialization (continued) • Using with STK ‘Load STK (reference AgUiApplicationLib) Dim uiApp As AgUiAppDispImpl Set uiApp = New AgUiAppDispImpl With uiApp .LoadPersonality "STK" .Visible = True .UserControl = True End With ‘get object root Dim m_stkApp As AgStkObjectRoot Set m_stkApp = uiApp.Personality2

  18. Using the API • The Object Root (AgStkObjectRoot) • Implements various interfaces • Application-level (IAgStkObjectRoot) • NewScenario, LoadScenario, CloseScenario, SaveScenario • CurrentScenario • UnitPreferences • ExecuteCommand • Animation (IAgAnimation) • PlayForward, PlayBackward • Rewind • Faster, Slower • StepBackward, StepForward • CurrentTime • Batch Update (IAgSupportBatchUpdate) • BeginUpdate • EndUpdate

  19. Using the API • Working with Scenario Objects • IAgStkObject - Interface for a generic object • InstanceName • ClassType, ClassName • Path • ShortDescription, LongDescription • Parent • Children • DataProviders • GetAccess, GetAccessToObject

  20. Using the API • Working with Scenario Objects (cont’d) • Other interfaces specific to an STK object type • Aircraft (IAgAircraft) • Area Target (IAgAreaTarget) • Facility (IAgFacility) • Ground Vehicle (IAgGroundVehicle) • Launch Vehicle (IAgLaunchVehicle) • Missile (IAgMissile) • Planet (IAgPlanet) • Satellite (IAgSatellite) • Scenario (IAgScenario) • Sensor (IAgSensor) • Ship (IAgShip) • Star (IAgStar) • Target (IAgTarget)

  21. Using the API • Data Providers • Enumerating Data Providers • In STK, the data providers available to an object are listed in the ‘Content’ properties page when creating or editing a report. There is no Connect command to retrieve the list. • In the API, the data providers can be accessed using the DataProviders property of an STK Object. • By iterating through the collection (fine grained: provides full access to data provider objects) • using the GetSchema method (coarse grained: returns an XML string)

  22. Using the API • Retrieving Data Provider Information • Commonly-used data provider types: • Fixed • Time Varying (Start Time, Stop Time) • Interval (Start Time, Stop Time, Interval) • Steps for retrieving data provider information • Get a reference to a scenario object • Retrieve the data provider from its DataProviders collection • Call Exec • Returns an IAgDrResult value

  23. Using the API • Basics of IAgDrResult • Category • eDrCatDataSetList • eDrCatIntervalList • eDrCatMessage • eDrCatSubSectionList

  24. ElementName Values Dataset Dataset Dataset Dataset Using the API • DataSets – map to the collection of columns in a report • DataSet • ElementName • ElementType • GetValues

  25. Using the API • Multiple Threshold Crossings • The API features the ability to filter a data provider result to return time intervals where dataset values cross specific ranges • For example: return time intervals where an aircraft’s altitude crosses 3, 4, and 5 (km); that is, return time intervals where: • Altitude < 3 • 3 < Altitude < 4 • 4 < Altitude < 5 • Altitude > 5

  26. Using the API • Events • OnAnimationPause • OnAnimationPlayback • OnAnimationRewind • OnAnimUpdate • OnLogMessage • OnScenarioClose • OnScenarioLoad • OnScenarioNew • OnScenarioSave • OnStkObjectAdded • OnStkObjectCollectionChanged • OnStkObjectDeleted • OnStkObjectRenamed

  27. Benefits and Limitations • Benefits • Extra features not available using Connect • Enumerate Data Providers • Multiple Threshold Crossings • Events • Rich object model results in strongly-typed code; easier to track errors at compile time • Intellisense • More robust runtime exception handling

  28. Benefits and Limitations • Limitations • Currently supports functionality available in PRO and AVO • Some Connect commands currently have no equivalent • ‘VO View’ • Batch update using wildcards in object paths (‘*’) • One Connect command does not necessarily map to one API command

  29. Recommendations • When to use • Data Provider API • Use the API as much as possible unless there is no equivalent to a Connect command • Connect • Still good for ‘one-off’ applications

  30. Summary / Conclusion • The API provides many conveniences over Connect from a development standpoint • Connect is not going away

More Related