Rendering non-dynamic layers in dynamic map


Summary
The dynamic display uses a tiles schema to render the non-dynamic layers in a dynamic map. It rasterizes the non-dynamic layers and generates cache for the tiles that are reused. This document discusses in detail, how the non-dynamic layers are rendered as tiles in a dynamic map and the best practices to improve performance of dynamic display applications.

In this topic


About non-dynamic layers

Layers that don’t implement the interface IDynamicLayer are regarded as non-dynamic layers. The two essential concepts to understand the rendering of non-dynamic layers in dynamic mode are
The tiling schema
The dynamic display uses a tile schema to render the non-dynamic layers in a dynamic map. The figure below, illustrates a dynamic map rendering its non-dynamic layer based on its tiling schema. 
The tiles schema for non-dynamic layers is based on a discrete set of levels of details (LOD), meaning that tiles pertaining to a certain LOD corresponds to a certain map scale. At a given map scale, the dynamic display will determine the most suitable LOD of tiles and use these tiles in order to render the dynamic layers.
Once a non-dynamic layer gets created by the dynamic display, according to the map’s projection horizon, the first LOD is being computed. The first LOD is the bounding square that bounds the projection horizon. From there, on each consecutive LOD, each tile is divided into four quarters. The information about each LOD is stored by the dynamic display and is used to determine the nearest LOD to use along with each map scale.
    
                      Calculating the first LOD
Loader thread
Each non-dynamic layer has a background thread which is in charge of handling requests for tiles. As the thread gets created, the given layer is being handed to it.  As the map switches into dynamic mode, the dynamic display sets requests for tiles according to the given map extent and map scale. The loader thread processes these requests and either fetches the tiles from cache or generates the tiles on the spot, in the case where these tiles do not already exists. 

How non-dynamic layers are rendered

As the map switches into dynamic mode, the dynamic display, according to the given map scale, determines the best LOD to be used and sets requests for tiles onto the loader thread. At some point, these requests will be processed and tiles will be returned back to the map. The dynamic display then scale these tiles further in order to match the map’s scale and render them as requested.
Due to the existence of the background loader thread, the drawing model of the non-dynamic layers is asynchronous, meaning that once a request for a tile is set, there is no way to know when the actual tile is ready to be rendered. For that reason, the dynamic display uses several techniques in order to give the user maximum responsiveness as well as enhanced drawing user experience. These include the use of coarse grained textures which are used as the requested tiles are being processed. For more information on controlling the drawing characteristics of non-dynamic layers refer article….

Caching  of non-dynamic layers

By default, the dynamic display creates a separate cache for each individual layer in the map based on its tiling schema and LOD. At runtime, each cache is translated into textures by the background thread and the layer is rendered as a sequence of adjacent textures in the form of seamless tiles. The cache structure is similar to the ArcGIS Server cache structure.
In general, during navigation, if the cache is not available for that area, the background thread will try to create it, which leads to CPU usage. However, layer files and map files persist cache information when saved while in dynamic mode. Therefore, for better performance and avoid CPU usage on subsequent map navigations, enable the dynamic map first, and save the layers as layer files or save the maps as map files. This would allow the Dynamic Display framework to reuse the existing cache information on subsequent map navigations.
The cache information is not based on one map scale, but a range of map scales. Once an area in the map is accessed (zooming and roaming), the cache information is generated for that area (on a background thread). When they are saved as layer files or map files, and if you revisit the same area, dynamic display identifies where the cache is and reuses that cache for the non-dynamic layers. If you know the area and map scale you will visit during a session of your mapping application, you can precook caches by zooming in and roaming to the area of interest and save the .mxd file in dynamic mode.
To persist the cache, save the layers and maps as .lyr and .mxd file respectively with dynamic display enabled. The next time dynamic display is enabled on the same or different session, it identifies the existing cache and re-uses it.

Best Practices

The following are some of the best practices to improve performance of dynamic display:
In group layers, if a user reorders layers or turns layers visibility on or off most often, the dynamic display will be forced to rebuild the cache each time and it may affect the performance. Read the article ….. for more information.
This article summarizes the rendering of non-dynamic layers in dynamic mode. The non-dynamic layers are the layers that do not implement IDynamicLayer interface. They are rendered as tiles and managed by background threads. The tiles are cached and can also be reused for better performance. It is recommended to use raster layers and consolidated group layers as non-dynamic layers for better performance.


See Also:

Controlling drawing characteristics of non-dynamic layers




Development licensingDeployment licensing
Engine Developer KitEngine