FAQ and How To

Here are some answers to commonly asked questions as well as tips on how to use the STK Esri Display Library:

Are java wrappers available for this library?
The STK Java API does not currently provide wrappers for the STKesriDisplay library. If you need to use this library from java, you can use J-Integra to generate wrappers. However you may encounter issues when mixing Java ArcObjects components in your application.

How do I add a reference to the library in Visual Studio?
In the COM tab of the Add Reference dialog, add a reference to the component named AGI STK Esri Display 10. The library will be available in the AGI.STKesriDisplay namespace.

How do I check for the required licenses? Do I need to initialize ArcObjects?
The IAgEsri3dRendererFactory interface provides an IsLicenseAvailable method. This method verifies that:

How do I open a map document in my STK Engine or STK X application?

  1. Instantiate the renderer factory for the scene in which you are interested:

    IAgEsri3dRendererFactory f= new
    AgEsri3dRendererFactory();
    IAgEsri3dRenderer renderer = f.GetRenderer(sceneID);

  2. Use the OpenMapDocument method of the IAgEsri3dRenderer interface.

    renderer.OpenMapDocument(mxdFile, mxdPassword);

How do I open a new map document?
Call the New method of the ArcObjects MapDocumentClass object. Save the file and then load it using OpenMapDocument.

How do I zoom to a layer?
Use the ZoomToLayer method of the IAgEsri3dRenderer interface:

renderer.ZoomToLayer(layer);

How do I identify features?
Use the Identify method of the IAgEsri3dRenderer in terface. For instance:

result = m_Renderer.Identify(envelope,
     AgESTKesriIdentifyType.eIdentifySingleLayer,
     m_Layers[m_ComboBox.SelectedItem.ToString()],
     null);

How do I promote GIS features to STK objects for analysis?
Use the Promote method of the IAgEsri3dRenderer interface. For instance:

m_Renderer.Promote(selectedFeature,
     stkObjectName, AgESTKesriPromoteType.ePromoteTargets);

How do I manage the GIS selection?
Use the ClearSelection, SelectFeature and SelectFeatures methods of the IAgEsri3dRenderer interface. You can also use the regular ArcObjects way of manipulating the selection, and then call the Refresh method of the same interface to force a redraw of the selection.

How do I add layers to the opened map document?
Before and after making changes to the opened map document, you need to call the StartMapEditing and StopMapEditing methods, respectively. These methods guarantee that the map content is accessed only by one thread at a time, and at a point where it is safe and will not conflict with the GIS processing. For instance:

// Begin Map Editing Session
renderer.StartMapEditing(AgESTKesriCallOptions.eEsri3dBlocking);

// Add new layers to current map
IMap map = renderer.MapDocument.ActiveView.FocusMap;
map.AddLayers(tmpMap.get_Layers(null, false), false);

// End Map Editing Session
renderer.StopMapEditing(false);

How do I remove layers from the opened map document?
Before and after making changes to the opened map document, you need to call the StartMapEditing and StopMapEditing methods, respectively. These methods guarantee that the map content is accessed only by one thread at a time, and at a point where it is safe and will not conflict with the GIS processing. For instance:

// Begin Map Editing Session
renderer.StartMapEditing(AgESTKesriCallOptions.eEsri3dBlocking);

// Delete the Layer
renderer.MapDocument.ActiveView.FocusMap.DeleteLayer(
     menuItem.Tag as ILayer);

// End Map Editing Session
renderer.StopMapEditing(false);

How do I flash GIS features on my 3D globe?
Use the FlashFeature and FlashIdentifyObj methods of the IAgEsri3dRenderer interface.

 

STK Programming Interface 11.0.1