This document is archived and information here might be outdated.  Recommended version.


Maximizing performance in dynamic display (ArcObjects .NET 10.6 SDK)
ArcObjects Help for .NET developers > Developing with ArcGIS > Learning ArcObjects > Interacting with the map display > Displaying moving objects > Dynamic display > Maximizing performance in dynamic display (ArcObjects .NET 10.6 SDK)

Maximizing performance in dynamic display


Summary
This topic shows tips and tricks to get the most out of performance when using dynamic display in the ArcGIS framework.

In this topic


Improving performance when using dynamic display

Use the following tips and tricks to improve performance when working with dynamic display. The tips are broken down into two sections, static and dynamic data. Static data are your base maps and underlying data that gets cached. Dynamic data is the data that is moving and drawn with a custom layer or in one of the dynamic draw phases.

Working with static data

Do the following to work with static data:
  • Use rasters as background layers—Rasters are considered by dynamic display to be cached datasets. Other data types, such as vectors and computer-aided design (CAD) datasets, are cached on demand. Rasters allow for changing display characteristics at run time (such as changing renderer, spatial reference, contrast, histogram stretching, and so on) without having to rebuild the cache. In addition, saving a dataset as a raster gives the option to easily distribute the cache without having to deal with a cumbersome file-based cache. Once a dataset is converted to a raster, it can be disconnected from the original dataset. For optimal performance, be sure to build pyramids on your raster datasets.
  • Use data from file or SDE geodatabases—Of all the different vector data format types, these perform the fastest in ArcGIS and will improve the performance of your cache generation. 
  • Remove unused layers—Check the table of contents (TOC) to ensure that your map document is clear of layers that are unrelated to the map's purpose. 
  • Set scale-dependent rendering for data layers—Use scale-dependent rendering to ensure that unnecessary layers do not draw when the map is zoomed out. Data intensive or detailed layers might be more appropriate only when the map is zoomed in to a larger scale.
  • Use consolidated group layers—Consolidated group layers display faster than layers that are not consolidated. Dynamic display creates a separate cache for each layer in your map. By grouping similar layers together, the cache is generated for all the layers together. This can have a significant positive impact of cache generation time and reduce the amount of memory that is required of the graphics card to display this data.
  • Use Geodatabase Annotation instead of labels—Since labels require the computer to make placement decisions, use Geodatabase Annotation instead of labels. Avoid using Map Annotation because these are stored as graphics in the map and suffer from the same limitations as graphics. 
  • Set scale-dependent rendering for layers and annotation—Some layers look the best at certain scales. By limiting the scales that a layer draws at you can improve the performance of cache generation. This is also a useful tool for working with annotation. The nice thing about labels is that they will always draw at a relative size to the screen, while annotation draws at a particular scale. To work around this, you can create multiple annotation layers that are associated specific scales and set a scale dependant rendering on these layers. This way you can emulate the effect of labels. Scale-dependent rendering is also useful if you choose to use labels with your map. When a map is zoomed out, more labels need to be drawn, which takes time. Examine your map document and determine if some labels do not need to be shown at smaller scales.
  • Do not reproject your data on-the-fly—Reprojection is a costly processes and will have an impact on the performance of your static data. All static data can be in the same coordinate system as the map.
  • Use IDynamicCacheLayerManager to control and load saved caches—When dynamic display is enabled, the static layers (all layers that do not implement IDynamicLayer, service layer, and rasters) will get cached. This is a time consuming process and is why it might take a little time to see any of the background layers.  Once this cache is generated, it is will be reused for the life of the application. Each time the application is opened, a new cache will be generated unless that cache is persisted. For more information, see Persisting cache information for use in dynamic display

    IDynamicCacheLayerManager can be used to access pre-generated caches if the cache is moved to another location on disk; otherwise, the location of the cache is stored with the layer file or map document. IDynamicCacheLayerManager can also be used to control the drawing characteristics of your static layers, to improve performance or display quality.     

Working with dynamic data 

Do the following to work with dynamic data:
  • Use the most appropriate draw phase—The dynamic display has two draw phases, compiled and immediate (esriDDPCompiled and esriDDPImmediate respectively). Use the immediate draw phase when data is highly dynamic and changes need to take place immediately. Use the compiled draw phase when data is less dynamic. To optimize the layer drawing, draw in the appropriate drawing phase for the layer. For example, if the layer is set to draw in an immediate mode, the input drawing phase should be inspected and only draw if enum esriDynamicDrawPhase is set to esriDDPImmediate; otherwise, it will draw twice in each drawing cycle.
  • Verify dynamic symbols have already been created—When loading a new glyph in the DrawDynamicLayer method, set a flag to indicate if dynamic glyphs have been created. This ensures that dynamic glyphs are created only once. See the following code example:
[C#]
public override void DrawDynamicLayer(ESRI.ArcGIS.Display.esriDynamicDrawPhase
    DynamicDrawPhase, ESRI.ArcGIS.Display.IDisplay Display,
    ESRI.ArcGIS.Display.IDynamicDisplay DynamicDisplay)..... 
//Create the dynamic symbols for the layer.
if (!m_bDynamicGlyphsCreated)
{
    this.CreateDynamicSymbols(m_dynamicGlyphFactory);

    m_bDynamicGlyphsCreated=true;
}
[VB.NET]
Public override void DrawDynamicLayer(ESRI.ArcGIS.Display.esriDynamicDrawPhase DynamicDrawPhase, ESRI.ArcGIS.Display.IDisplay Display, ESRI.ArcGIS.Display.IDynamicDisplay DynamicDisplay)
.....
'Create the dynamic symbols for the layer.
If Not m_bDynamicGlyphsCreated Then
    Me.CreateDynamicSymbols(m_dynamicGlyphFactory)
    
    m_bDynamicGlyphsCreated=True
End If

Improving performance when drawing a large number of dynamic elements

To improve performance when drawing a large number of dynamic elements, use the following tips in addition to those in the previous section:
  • Use native C++ code—Use native code to avoid the overhead of the interop.
  • Simplify symbology when zooming out—Aggregate or simplify symbology when zooming out. Drawing a large amount of full blown features with labels and complex symbology clogs the display and degrades performance.
  • Choose glyph groups—Choose glyphs groups, whether internal or external, rather than creating glyphs from symbols. Dynamic display uses one texture for all symbology instead of creating many separated textures.
  • Reuse glyphs—Use glyphs if possible. Create one white glyph, then scale it and assign it a proper color at drawing time.
  • Use simple OpenGL-based glyphs for polygons and lines—When using polygons and lines, use simple OpenGL-based glyphs (glyphs group #0). OpenGL will not need to texture the lines and polygons, which results in better performance.
  • Create an indexed data structure—Use a spatially enabled indexed data structure instead of a flat data structure. This can be as simple as a list of lists. On each draw cycle, the dynamic layer iterates through the entire collection of geometries to draw them. A spatially indexed data structure allows the layer to access only the relevant elements of the data structure that are visible by the display and therefore, speeds up the data retrieval time.


See Also:

Dynamic display
Best practices for using dynamic display
Creating a base map for dynamic display
Persisting cache information for use in dynamic display
Controlling drawing characteristics of nondynamic layers using IDynamicCacheLayerManager
Rendering dynamic map content
How to create a dynamic glyph from a marker symbol




Development licensing Deployment licensing
Engine Developer Kit Engine
ArcGIS for Desktop Basic
ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced