MSFHillshadeRasterTileLayer
Objective-C
@interface MSFHillshadeRasterTileLayer : MSFCustomRasterTileLayer
Swift
class MSFHillshadeRasterTileLayer : MSFCustomRasterTileLayer
A tile layer that displays an overlay hillshading. Should be used together with corresponding data source that encodes height in RGBA image. The shading is based on the direction of the main light source, which can be configured using Options class. Note: this class is experimental and may change or even be removed in future SDK versions.
-
Constructs a HillshadeRasterTileLayer object from a data source.
Declaration
Objective-C
- (id)initWithDataSource:(MSFTileDataSource *)dataSource elevationDecoder:(MSFElevationDecoder *)elevationDecoder;Swift
init!(dataSource: MSFTileDataSource!, elevationDecoder: MSFElevationDecoder!)Parameters
dataSourceThe data source from which this layer loads data.
-
Undocumented
Declaration
Objective-C
- (id)initWithDataSource:(MSFTileDataSource *)dataSource;Swift
init!(dataSource: MSFTileDataSource!) -
Returns the contrast of the hillshade overlay. This is the equivalent of MapLibre’s ‘hillshade-exaggeration’ paint property: it controls the slope response curve and the overall strength of the shading, not the relief itself.
Declaration
Objective-C
- (float)getContrast;Swift
func getContrast() -> FloatReturn Value
The contrast value (between 0..1). Default is 0.5.
-
Sets the contrast of the hillshade overlay. Equivalent to MapLibre’s ‘hillshade-exaggeration’; 0.5 is the neutral value.
Declaration
Objective-C
- (void)setContrast:(float)contrast;Swift
func setContrast(_ contrast: Float)Parameters
contrastThe contrast value (between 0..1).
-
Returns the height scale of the hillshade overlay.
Declaration
Objective-C
- (float)getHeightScale;Swift
func getHeightScale() -> FloatReturn Value
The relative height scale. Default is 0.05.
-
Sets the height scale of the hillshade overlay. Baked into the normal map at decode time, so changing it reloads the tiles. See setLegacyHeightScaleEnabled for the old default.
Declaration
Objective-C
- (void)setHeightScale:(float)heightScale;Swift
func setHeightScale(_ heightScale: Float)Parameters
heightScaleThe relative height scale. Actual height is multiplied by this values.
-
Returns the per-frame relief exaggeration factor, i.e. the vertical exaggeration of the slope. Unlike height scale this is a shader uniform applied at render time (no tile re-decode), so it can be animated smoothly.
Declaration
Objective-C
- (float)getExaggeration;Swift
func getExaggeration() -> FloatReturn Value
The exaggeration factor. Default is 1.0.
-
Sets the per-frame relief exaggeration factor. Multiplies the hillshade slope in the shader without re-decoding tiles, so it can change smoothly (e.g. with zoom). 1.0 leaves the appearance unchanged.
Declaration
Objective-C
- (void)setExaggeration:(float)exaggeration;Swift
func setExaggeration(_ exaggeration: Float)Parameters
exaggerationThe exaggeration factor.
-
Undocumented
Declaration
Objective-C
-(NSString*)getNormalMapLightingShader;Swift
func getNormalMapLightingShader() -> String! -
Sets a custom normalmap lighting shader.
Declaration
Objective-C
- (void)setNormalMapLightingShader:(NSString *)shader;Swift
func setNormalMapLightingShader(_ shader: String!)Parameters
shaderThe custom shader.
-
Sets the illumination direction: (sin(azimuth), cos(azimuth), -sin(altitude)), azimuth 0 = north, clockwise, towards the light. The default is MapLibre’s 335 degrees at a 45 degree altitude: (-0.4226, 0.9063, -0.7071).
Declaration
Objective-C
- (void)setIlluminationDirection:(MSFMapVec *)direction;Swift
func setIlluminationDirection(_ direction: MSFMapVec!)Parameters
directionThe new direction vector, normalized. (0,0,-1) means straight down. Note that the MULTIDIRECTIONAL method ignores the azimuth and uses only the altitude.
-
Returns whether the illumination direction should change with the map rotation.
Declaration
Objective-C
- (BOOL)getIlluminationMapRotationEnabled;Swift
func getIlluminationMapRotationEnabled() -> BoolReturn Value
enabled
-
Sets whether the illumination direction should change with the map rotation.
Declaration
Objective-C
- (void)setIlluminationMapRotationEnabled:(BOOL)enabled;Swift
func setIlluminationMapRotationEnabled(_ enabled: Bool)Parameters
enabledwhether to enable or not.
-
Returns the normal vector tile should be exagerated based on the zoom level.
Declaration
Objective-C
- (BOOL)getExagerateHeightScaleEnabled;Swift
func getExagerateHeightScaleEnabled() -> BoolReturn Value
enabled
-
Sets whether the normal vector tile should be exagerated based on the zoom level.
Declaration
Objective-C
- (void)setExagerateHeightScaleEnabled:(BOOL)enabled;Swift
func setExagerateHeightScaleEnabled(_ enabled: Bool)Parameters
enabledwhether to enable or not.
-
Returns whether the legacy (pre-MapLibre-parity) height scale formula is used.
Declaration
Objective-C
- (BOOL)isLegacyHeightScaleEnabled;Swift
func isLegacyHeightScaleEnabled() -> BoolReturn Value
True if the legacy formula is used. Default is false.
-
Sets whether to use the legacy height scale formula, which damps the relief by the absolute zoom (flattening it as the camera zooms in); the default follows MapLibre: the true slope from zoom 15 up, boosted below it. Styles tuned against the legacy formula should also call setHeightScale(0.09f), the old default.
Declaration
Objective-C
- (void)setLegacyHeightScaleEnabled:(BOOL)enabled;Swift
func setLegacyHeightScaleEnabled(_ enabled: Bool)Parameters
enabledWhether to use the legacy formula.
-
Returns the hillshade rendering method.
Declaration
Objective-C
- (enum MSFHillshadeMethod)getHillshadeMethod;Swift
func getHillshadeMethod() -> MSFHillshadeMethodReturn Value
The hillshade method. Default is IGOR.
-
Sets the hillshade rendering method.
Declaration
Objective-C
- (void)setHillshadeMethod:(enum MSFHillshadeMethod)method;Swift
func setHillshadeMethod(_ method: MSFHillshadeMethod)Parameters
methodThe hillshade method to use.
-
Returns whether the normal map encodes absolute elevation (so a custom normal-map lighting shader can call getElevation()).
Declaration
Objective-C
- (BOOL)isElevationEncodingEnabled;Swift
func isElevationEncodingEnabled() -> BoolReturn Value
True if elevation encoding is enabled. Default is false.
-
Sets whether the normal map encodes absolute elevation in addition to the surface normal. Required for a custom normal-map lighting shader that reads getElevation()/getMapZoom() (e.g. to draw its own per-zoom contour lines). Enabling contour lines turns this on implicitly.
Declaration
Objective-C
- (void)setElevationEncodingEnabled:(BOOL)enabled;Swift
func setElevationEncodingEnabled(_ enabled: Bool)Parameters
enabledTrue to encode elevation into the normal map.
-
Returns whether GPU contour lines are drawn over the hillshade.
Declaration
Objective-C
- (BOOL)isContourEnabled;Swift
func isContourEnabled() -> BoolReturn Value
True if contour lines are enabled. Default is false.
-
Sets whether to draw anti-aliased contour lines over the hillshade, computed in the shader from the elevation data. Enabling this makes the normal map encode absolute elevation (which is also available to a custom normal-map lighting shader). Note: this class is experimental.
Declaration
Objective-C
- (void)setContourEnabled:(BOOL)enabled;Swift
func setContourEnabled(_ enabled: Bool)Parameters
enabledTrue to draw contour lines.
-
Returns the spacing between contour lines in meters.
Declaration
Objective-C
- (float)getContourInterval;Swift
func getContourInterval() -> FloatReturn Value
The contour interval in meters. Default is 100.
-
Sets the spacing between contour lines in meters.
Declaration
Objective-C
- (void)setContourInterval:(float)interval;Swift
func setContourInterval(_ interval: Float)Parameters
intervalThe contour interval in meters.
-
Returns the contour line half-width in screen pixels.
Declaration
Objective-C
- (float)getContourWidth;Swift
func getContourWidth() -> FloatReturn Value
The contour line width. Default is 0.75.
-
Sets the contour line half-width in screen pixels.
Declaration
Objective-C
- (void)setContourWidth:(float)width;Swift
func setContourWidth(_ width: Float)Parameters
widthThe contour line width in pixels.
-
Returns whether the layer may shade the 3D terrain’s own elevation texture instead of loading a DEM tile set of its own.
Declaration
Objective-C
- (BOOL)isTerrainPaintEnabled;Swift
func isTerrainPaintEnabled() -> BoolReturn Value
True if terrain paint mode is allowed. Default is true.
-
Sets whether the layer may shade the shared 3D terrain elevation texture instead of loading a DEM tile set of its own. Applies only to 3D terrain with draped fills from the same data source and without the built-in contour lines. The shading then follows the terrain’s elevation grid, not this layer’s zoom level bias.
Declaration
Objective-C
- (void)setTerrainPaintEnabled:(BOOL)enabled;Swift
func setTerrainPaintEnabled(_ enabled: Bool)Parameters
enabledTrue to allow terrain paint mode.
-
Returns whether the terrain paint shades from the elevation source’s own maximum zoom.
Declaration
Objective-C
- (BOOL)isTerrainPaintFullDetailEnabled;Swift
func isTerrainPaintFullDetailEnabled() -> BoolReturn Value
True if full DEM detail is used. Default is true.
-
Sets whether the terrain paint shades from the elevation source’s own maximum zoom instead of the coarser level the terrain mesh needs (two zoom levels less relief). Turning it off reuses the terrain’s textures and is faster.
Declaration
Objective-C
- (void)setTerrainPaintFullDetailEnabled:(BOOL)enabled;Swift
func setTerrainPaintFullDetailEnabled(_ enabled: Bool)Parameters
enabledTrue to shade from the DEM’s own maximum zoom.
-
Undocumented
Declaration
Objective-C
-(MSFDoubleVector*)getElevations: (MSFMapPosVector*)poses;Swift
func getElevations(_ poses: MSFMapPosVector!) -> MSFDoubleVector! -
Undocumented
Declaration
Objective-C
-(void)dealloc;Swift
func dealloc()