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


Controlling drawing characteristics of nondynamic layers using IDynamicCacheLayerManager (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 > Using static data > Controlling drawing characteristics of nondynamic layers using IDynamicCacheLayerManager (ArcObjects .NET 10.6 SDK)

Controlling drawing characteristics of nondynamic layers using IDynamicCacheLayerManager


Summary
Layers that do not implement the IDynamicLayer interface are nondynamic layers. Dynamic display uses a tiling schema cache and upon request, rasterizes the layer as it generates its cache. This topic discusses how to control the drawing characteristics of nondynamic layers through the use of IDynamicCacheManager.

In this topic


Nondynamic layers in dynamic display

Layers that do not implement the IDynamicLayer interface are nondynamic layers. Dynamic display uses a tiling schema cache and upon request, rasterizes the layer as it generates its cache.

Tiling schema

Tiling schema is based on a discrete set of level of detail (LOD), which means that tiles pertaining to a specific LOD in the cache corresponds to a specific map scale. At a map scale, dynamic display determines the most suitable LOD of tiles and uses these tiles to render the layer on the map.
Once a nondynamic layer is created by dynamic display—according to the map's projection horizon—the first LOD is computed. The first LOD is the bounding square that bounds the map projection horizon, then on each consecutive LOD, each tile is divided into four quarters. The information about each LOD is stored by dynamic display and is used to determine the LOD to use with each map scale.
See the following illustration that shows calculating the first LOD:
See the following illustration that shows the LOD tiling schema:

Loader thread

Each nondynamic layer has a background thread that handles requests for tiles. When the thread is created, it is handed the layer. When the map switches to dynamic mode, dynamic display sets requests for tiles according to the map extent and map scale. The loader thread processes these requests and fetches the tiles from disk, or generates the tiles if they do not exist.

Drawing nondynamic layers in dynamic mode

When the map switches to dynamic mode, dynamic display, according to the map scale, determines the best LOD to use and sets requests for tiles onto the loader thread. At some point, these requests are processed and tiles are returned to the map. Dynamic display further scales these tiles to match the map's scale and renders them as requested.
Due to the existence of the background loader thread, the drawing model of nondynamic layers is asynchronous, meaning that once a request for a tile is set, there is no way to know when the tile is ready to be rendered. For that reason, dynamic display uses several techniques to give the user maximum responsiveness and enhanced drawing user experience. These include the use of coarse-grained textures that are used as the requested tiles are processed.
Sometimes it is necessary to make changes to the symbology of a static layer. If this is done programmatically, the changes may not be reflected in the cache. To force an update of the layer, make a call to IActiveView.ContentsChanged or IDynamicCacheLayerManager.Invalidate. This forces dynamic display to verify if any changes were made to the symbology of the layer, and to then invalidate and rebuild the cache.
It is recommended to avoid changing the symbology of your static layers whenever possible. 

IDynamicCacheLayerManager interface

All drawing characteristics of a nondynamic layer can be controlled by the IDynamicCacheLayerManager interface.

AlwaysDrawCoarsestLevel

AlwaysDrawCoarsestLevel determines whether to use a coarse texture if there is no data to draw. This can happen when a layer is required to draw tile information that pertains to a specific map scale. In that case, if dynamic display draws the tile and its texture is not ready, dynamic display uses a default texture instead. When the requested texture for the tile is ready, it will be used instead of the default texture.
The default texture is calculated according to the layer's area of interest (it covers the entire layer and can be used where there is missing information). The following illustration shows how the default texture calculates the coarsest level:
By default, this property is set according to the type of layer. Any layer, except point and polyline feature layers (including computer-aided design [CAD], Smart Data Compression [SDC], and coverages), sets this property to true.
For some layer types, it is difficult to determine the appropriate default value, since it may not contain polygonal vector data. For example, Internet layers, such as ArcGIS for Server or ArcIMS, can serve images of vector data (for example, highways, railways, rivers, and so on).
Since there is no way to determine the type of information served by these layers, the default is to set AlwaysDrawCoarsestLevel to true. This can lead to less effective drawing effects; therefore, by changing AlwaysDrawCoarsestLevel to false, you can modify the default behavior.
The following screen shots show the effect of having AlwaysDrawCoarsestLevel set to true with a road layer on top of a satellite image after switching to dynamic mode, then after setting AlwaysDrawCoarsestLevel to false.
In the following "before" screen shot, notice the blurred image:
The following "after" screen shot shows the image after setting AlwaysDrawCoarsestLevel to false:
 

DetailsThreshold

The DetailsThreshold is the threshold to determine the LOD to use. The cache for nondynamic layers is composed of discrete LODs. Each LOD corresponds to a specific map scale. To draw the cached tiles in the map, dynamic display has to choose an appropriate LOD and resample it further to scale it to the current map scale (can be slightly different from the one that corresponds to the LOD).
For that reason, most map scales fall within two LODs of the cache. Choosing the coarsest LOD (the one whose scale is smaller than the map scale) can result in a blurry display because of the stretching effect.
Alternatively, choosing the more detailed LOD may lead to too many tiles needed to draw in the display and eventually degrades performance. For that reason, dynamic display calculates a normalized distance, which is the normalized value of the scale difference between the map's current scale to the coarse LOD scale divided by the difference between the coarse LOD scale and the more detailed LOD scale. See the following illustration:
The threshold determines the normal value of the preferred coarse LOD over the more detailed one. For example, a threshold value set to 0.85 means that as long as the scale difference between the map and the coarse LOD is below 85 percent of the difference between the scale of the coarse LOD and the finer LOD, the coarse LOD will be chosen over the more detailed one.
Decrease the threshold to use the more detailed LOD.

MaxCacheScale

MaxCacheScale is the maximum scale that generates tiles. Setting this property to a value other than 0, sets the maximum scale to generate tiles. This property is useful with raster layers that have a specified resolution (cell size). Beyond a specific map scale, it is not necessary to generate additional tiles.

ProgressiveDrawingLevels

The ProgressiveDrawingLevels is the number of coarse level data to draw while the current LOD tiles are being processed.
For better visibility, dynamic display can use several levels of coarse textures to render while it waits for the background thread to finish processing data for the current map scale (and therefore, the appropriate LOD). The user can control the number of coarse textures by setting ProgressiveDrawingLevels and ProgressiveFetchingLevels, where ProgressiveDrawingLevels set the number of LODs dynamic display searches in memory to get a coarse texture.
ProgressiveFetchingLevels set the number of LODs in which dynamic display sets requests to fetch data on the background thread if this data was not found in memory.
When the ProgressiveDrawingLevels value is smaller than the ProgressiveFetchingLevels value, it limits the ProgressiveFetchingLevels to the value for the ProgressiveDrawingLevels.
By default, layers that use a default texture (AlwaysDrawCoarsestLevel is set to true), the value for ProgressiveDrawingLevels is set to 31. When there is a missing texture, dynamic display searches for a coarse texture starting from the LOD above the calculated LOD and continues searching until the LOD that defines the default texture for the layer is found.
For layers that do not use a default texture (point and line feature classes), the ProgressiveDrawingLevels value is set to 1. When the texture for the requested LOD is not ready, it only searches up one level in memory to find a coarse texture.

ProgressiveFetchingLevels

The ProgressiveFetchingLevels is the number of coarse level data to fetch while the current LOD tiles are being processed.
For better visibility, dynamic display can use several levels of coarse textures to render while it waits for the background thread to finish processing data for the current map scale (and therefore, the appropriate LOD). The user can control the number of coarse textures by setting ProgressiveDrawingLevels and ProgressiveFetchingLevels, where ProgressiveDrawingLevels set the number of LODs dynamic display searches in memory to get a coarse texture.
ProgressiveFetchingLevels set the number of LODs in which dynamic display sets requests to fetch data on the background thread if this data was not found in memory.
StrictOnDemandMode forces dynamic display to set requested tiles for the current map scale and logically sets ProgressiveFetchingLevels to zero.
By default, all layers are set to work when StrictOnDemandMode equals true (gives the best total drawing speed).
When this property equals false (especially with raster layers), the user experience is better; although, the total drawing time is about 30 percent longer.

StrictOnDemandMode

When set to true, StrictOnDemandMode restricts dynamic display from setting requests for tiles other than tiles for the current calculated LOD (except with the coarse level tile when it is required).
For better visibility, dynamic display can use several levels of coarse textures to render while it waits for the background thread to finish processing data for the current map scale (and therefore, the appropriate LOD). The user can control the number of coarse textures by setting ProgressiveDrawingLevels and ProgressiveFetchingLevels, where ProgressiveDrawingLevels set the number of LODs dynamic display searches in memory to get a coarse texture.
ProgressiveFetchingLevels set the number of LODs in which dynamic display sets requests to fetch data on the background thread if this data was not found in memory.
StrictOnDemandMode forces dynamic display to set requested tiles for the current map scale and logically sets ProgressiveFetchingLevels to zero.
By default, all layers are set to work when StrictOnDemandMode equals true (gives the best total drawing speed).
When this property equals false (especially with raster layers), the user experience is better, although the total drawing time is about 30 percent longer.

ConsolidatedGroupLayer

By default, dynamic display creates a separate cache for each layer on the map. At run time, each cache is translated into textures when it displays the cache in dynamic mode (each layer is rendered as a sequence of adjacent textures in the form of seamless tiles). Each of these textures eventually takes a certain amount of memory on the graphics card.
To minimize the amount of texture memory used by dynamic display, by default, any layers that pertain to a composite layer (which also includes group layers) are consolidated into one cache; therefore, regardless of the number of layers contained in the composite layer, there will only be one cache to manage and one set of textures for the entire group layer.
This solution also improves performance and resource conservation but has the following limitations:
  • If a user reorders layers or turns a layer's visibility on or off inside the group layer, dynamic display will be forced to rebuild the cache each time this action occurs.
  • For users that use group layers to bundle layers together, this may not be the preferred behavior; therefore, by setting ConsolidatedGroupLayer to false, dynamic display can be forced to separately handle the group layers' sublayers. This enables users to turn any of the sublayers' visibility on and off, and reorder layers without regenerating the cache.
  • If a group layer contains a map service, the consolidatedGroupLayer property will always be set to false. 
If the parent group layer has a sublayer that is a group layer by itself, it is consolidated by default (like any other group layer on the map).


See Also:

Dynamic display
How dynamic display works
Persisting cache information for use in dynamic display
Maximizing performance in dynamic display
Limitations for dynamic display




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