Color Map Layers: Difference between revisions
No edit summary |
No edit summary |
||
Line 24: | Line 24: | ||
/// </summary> | /// </summary> | ||
/// <param name="name">Name for the new layer.</param> | /// <param name="name">Name for the new layer.</param> | ||
/// <param name="provider">Data provider. </param> | /// <param name="provider">Data provider. Should be of type ElevationColorMapProvider.</param> | ||
/// <param name ="paletteId">ID of the palette to be used. This palette name must be available in the given data provider.</param> | /// <param name ="paletteId">ID of the palette to be used. This palette name must be available in the given data provider.</param> | ||
/// <param name="smoothInterpolation">Enable smooth interpolation of the map colors.</param> | /// <param name="smoothInterpolation">Enable smooth interpolation of the map colors.</param> | ||
Line 47: | Line 47: | ||
</source> | </source> | ||
The default implementation of this interface is typically '''TPG.GeoFramework.MapLayer.NativeMapLayerViewModel'''. | The smoothInterpolation parameter controls wether or not the output should be smoothed, i.e if the colors should be interpolated between neighboring points. This should be combined with the InterpolationMethod property of the ElevationColorMapProvider used to produce the actual data (see below). | ||
== Data Provider == | |||
The default implementation of this interface is typically '''TPG.GeoFramework.MapLayer.NativeMapLayerViewModel'''. In order to fill this layer with input data, you need an IMapDataProvider, more specifically an ElevationColorMapProvider. Note that the "Elevation" part of this type name is more for historical reasons. The input data need not be elevation, but it should be single channel. | |||
This data provider needs to bes set up with two things: | |||
* A color palette with an ID matching the color palette in the color map layer. | |||
* An IElevationData with at least one map data signature. | |||
== Color Palette == |
Revision as of 11:59, 31 May 2021
General
Color map layers, or paletted data layers are single channel data layers, for example elevation data, which can be colored according to a user definable palette. Values in the map data are matched with colors in the palette, and the neighboring values may be interpolated over the span of colors in the palette.
Colors may be mapped directly to data values, or there may be a calculation involved. For example we have the possibility to assign colors based on slope or aspect of elevation data sets.
Low Level API
The main API for creating elevation color map layers is through the IMapLayerViewModel interface with the following methods
namespace TPG.GeoFramework.MapLayer.Contracts
{
public interface IMapLayerViewModel : IExportableLayer
{
...
/// <summary>
/// Create a named color map layer with the given data provider.
/// </summary>
/// <param name="name">Name for the new layer.</param>
/// <param name="provider">Data provider. Should be of type ElevationColorMapProvider.</param>
/// <param name ="paletteId">ID of the palette to be used. This palette name must be available in the given data provider.</param>
/// <param name="smoothInterpolation">Enable smooth interpolation of the map colors.</param>
/// <returns>A new raster layer with the given properties.</returns>
IMapServiceRasterLayerData AddColorMapLayer(string name, IMapDataProvider provider, string paletteId, bool smoothInterpolation = true);
/// <summary>
/// Return raster layer for elevation color map (if any).
/// </summary>
/// <returns></returns>
IRasterLayerData GetColorMapLayer(string name);
/// <summary>
/// Remove the given color map layer from the layer list.
/// </summary>
/// <param name="layer"></param>
void RemoveColorMapLayer(IMapServiceRasterLayerData layer);
}
}
The smoothInterpolation parameter controls wether or not the output should be smoothed, i.e if the colors should be interpolated between neighboring points. This should be combined with the InterpolationMethod property of the ElevationColorMapProvider used to produce the actual data (see below).
Data Provider
The default implementation of this interface is typically TPG.GeoFramework.MapLayer.NativeMapLayerViewModel. In order to fill this layer with input data, you need an IMapDataProvider, more specifically an ElevationColorMapProvider. Note that the "Elevation" part of this type name is more for historical reasons. The input data need not be elevation, but it should be single channel.
This data provider needs to bes set up with two things:
- A color palette with an ID matching the color palette in the color map layer.
- An IElevationData with at least one map data signature.