TileLayer Class
A layer that significantly increases update performance, by asynchronously reading and caching data in tiles.
NuGet/Assembly: Carmenta.Engine.5.16.2.nupkg (in the CECore assembly)
Syntax
public class TileLayer : LayerSet
Remarks
A TileLayer divides the view area into smaller rectangular areas, or tiles. Presentation data for each tile is then loaded by one or more, depending on the selected TileLoadingPolicy, background threads. Tiles and their loaded data are cached in memory for as long as the tile remains within the view area.
During an update, the GUI thread collects all available tiles and draws them in the view. It does not wait until all tiles are loaded (unless the Asynchronous property is False). This means that updates are generally very fast, and you can achieve a good and steady frame rate. This makes TileLayer very suitable for use in moving map applications.
The OpenGL and DirectX drawable backends are specifically optimized for use with TileLayer and will yield significantly better frame rate then the other backends, so always try to use a drawable with Drawable.Renderer set to OpenGL or DirectX.
You can add a TileLayer as a child layer under a LabelOrganizingLayer but the reverse does not work. Also, TileLayer will not work correctly with some other layer types. Specifically, you should not add a AggregatingLayer, BitmapLayer, PlotLayer or ScreenLayer as a child layer under a TileLayer, or vice versa. It also doesn't make sense to put a TileLayer inside another TileLayer.
The task based scheduler will fall back and use a single background thread to load tiles if the TileLayer contains a CustomOperatorProxy with a custom operator implementation.
The size of the tiles is changed dynamically depending of the current view scale. The tiles are doubled in size each time the map scale is doubled. Data for each tile is read at the corresponding LOD (level of detail) level, so it is recommended that you use LevelOfDetailOperator and/or the MinScale and MaxScale properties on the child layers.
The scale (inverse scale) that is used at a certain level can be determined by evaluating:
scale = 2 ^ level * 10000
where level is an integer representing the LOD level. The view scale interval, for which a specific LOD level is used, can be determined by evaluating:
minimumScale = 2 ^ (level - 0.5) * 10000
maximumScale = 2 ^ (level + 0.5) * 10000
To improve performance, TileLayer usually clips all features along the tile boundaries. There is no need to explicitly add a RectangleClipOperator in the child layers. This feature can be turned off by setting AutoClip to False. In addition, all line and polygon features are also thinned; points that are so close to each other are removed as long as it does not visually change the appearance of the line or polygon on screen. This feature can be turned off by setting AutoThin to False.
TileLayer also supports generating bitmaps from the presentation data as a tile is loaded, and then using these bitmaps for drawing to the screen. The bitmaps may also be cached persistently on disk. This feature can greatly improve both drawing performance (frame rate) and tile load time. See CacheAsBitmaps and CachePath for details.
A TileLayer automatically detects when sub-layers are being added or removed, turned on or off or flushed, or the MinScale or MaxScale properties of a sub-layer are changed. It will then start reloading tiles as needed.
It is often better to call FlushCache on a sub-layer than on the TileLayer directly, since FlushCache on the TileLayer will first unload all tiles, and temporarily expose the window background.
Inheritance Hierarchy
System.Object (not available in C#)
EngineObject
Layer
LayerSet
TileLayer
Platforms
Windows, Linux, Android
TileLayer Members
The TileLayer type has the following members.
Constructors
Name | Description |
---|---|
TileLayer | Initializes a new instance of the TileLayer class. |
Properties
Name | Description |
---|---|
Asynchronous | Gets or sets a flag indicating if data is read asynchronously by a background thread or not. |
AutoClip | Gets or sets a flag indicating if features are automatically clipped at the tile borders. |
AutoDownsample | Gets or sets a flag indicating if rasters should be downsampled automatically to match the scale they are displayed in. |
AutoThin | Gets or sets a flag indicating if line and polygon features should be thinned automatically. |
AutoUpdate | Gets or sets a flag indicating if DataReady events are sent to the view/map control when new tiles have been read, so that the map control can update the view with the new data. |
BlendMode | Gets or sets the blend mode that determines how the layer is combined with previously rendered layers. Inherited from Layer |
CacheAsBitmaps | Gets or sets a flag indicating if the TileLayer rasterizes each tile to a bitmap, and uses that bitmap to draw the tile. |
CachePath | Gets or sets a directory on disk where tile bitmaps are cached. |
CacheSize | Gets or sets the maximum amount of disk space used by the disk cache. |
Condition | Gets or sets the Condition that determines whether the TileLayer is drawn or not. Inherited from Layer |
CoverageHint | Gets or sets a value that can assert that the visualization is fully opaque within the data extent. Inherited from Layer |
Description | Gets or sets a short description of the layer. Inherited from Layer |
DisableOnError | Gets or sets a value specifying if an error within the layer should automatically disable the layer, or throw an exception. Inherited from Layer |
DisplayName | Gets or sets a display name for the layer. Inherited from Layer |
Effects | List of effects Inherited from Layer |
Enabled | Determines whether the TileLayer is enabled or not. Inherited from Layer |
EnabledDuringQuickUpdates | Determines whether the TileLayer is temporarily turned off during mouse interactions. Inherited from Layer |
IsDisposed | Gets a value that tells whether the current TileLayer has been disposed. Inherited from EngineObject |
IsoMetadataDocument | Gets or sets the path or URL to an ISO 19139 metadata document for the layer. Inherited from Layer |
Layers | Gets the child layers of this TileLayer. Inherited from LayerSet |
Legend | Gets or sets a map legend associated with this layer. Inherited from Layer |
MaxScale | Gets or sets the highest inverted nominal scale in a 2D view, or the furthest distance in a 3D globe view, at which objects from this TileLayer should be drawn. Inherited from Layer |
MinScale | Gets or sets the lowest inverted nominal scale this TileLayer should be drawn at. Inherited from Layer |
Name | Gets or sets the name of the layer. Inherited from Layer |
NamedStyles | Gets the list of named styles that can be enabled for the layer. Inherited from Layer |
NativeHandle | Gets the native Carmenta Engine kernel object the current TileLayer represents. Inherited from EngineObject |
Opacity | Gets or sets a value that specifies the opacity of the layer. Inherited from Layer |
PreloadArea | Gets or sets a value increasing the area for which the TileLayer preloads tiles. |
PreloadBehavior | Gets or sets a value that determines how tiles should be preloaded. |
Selectable | Gets or sets a value that determines whether features in this TileLayer can be selected. Inherited from Layer |
TileLoadingPolicy | Gets or sets a value that determines whether tiles are loaded in parallel or one by one. |
TileOrigin | Gets or sets the origin of the first base tile. |
TileSize | Gets or sets the size of the tiles. |
TilingScheme | Gets or sets the tiling scheme to use. |
IUserProperties.UserProperties | Gets the AttributeSet that contains the user properties. Inherited from IUserProperties |
Methods
Name | Description |
---|---|
Clone | Creates a copy of an object. Inherited from EngineObject |
Dispose | Releases the reference to the native Carmenta Engine kernel instance the EngineObject represents. Inherited from EngineObject |
EnableStyle | Enables or disables a named style for the layer. Inherited from Layer |
Equals | Determines whether this instance is equal to another. Inherited from EngineObject |
FindChildObject | Overloaded. Finds the child object with the specified name. Inherited from Layer |
FlushBitmapCache | Removes all bitmaps cached on disk. |
FlushCache | Marks the layer as flushed which will release cached resources during the next update. Inherited from Layer |
GetChildObjects | Overloaded. Gets the child objects of the current object. Inherited from Layer |
GetDataBounds | Calculates the bounds of all dataset coverages in the layer. Inherited from Layer |
GetFeatureAttributes | Gets information about all attributes that may be present on features in this layer. Inherited from Layer |
GetFeatures | Overloaded. Gets features from the layer and any child layers. Inherited from Layer |
GetLastError | Gets the error message for the last error that occurred within the layer. Inherited from Layer |
GetLocalizedDescription | Gets a localized version of the layer description in a specific language. Inherited from Layer |
GetLocalizedDisplayName | Gets a localized version of the layer display name in a specific language. Inherited from Layer |
GetLocalizedIsoMetadataDocument | Gets the path to an ISO 19139 metadata document for a specific language. Inherited from Layer |
HasLocalizedDescription | Checks if a localized version of the layer description is available in a specific language. Inherited from Layer |
HasLocalizedDisplayName | Checks if a localized version of the layer display name is available in a specific language. Inherited from Layer |
HasLocalizedIsoMetadataDocument | Checks if an ISO 19139 metadata document is available for a specific language. Inherited from Layer |
IsStyleEnabled | Checks if a certain style is enabled for the layer or not. Inherited from Layer |
MoveLayer | Moves a child layer to a new position. Inherited from LayerSet |
SetLocalizedDescription | Sets a layer description in a specific language. Inherited from Layer |
SetLocalizedDisplayName | Sets a layer display name in a specific language. Inherited from Layer |
SetLocalizedIsoMetadataDocument | Sets the path to an ISO 19139 metadata document for the layer, for a specific language. Inherited from Layer |
Events
Name | Description |
---|---|
EnabledChanged | Occurs when the value of the Enabled property has changed. Inherited from Layer |