IHeightmap
Description
- Derived from
-
IMapEntity
IHeightmapOps
IHeightmapLayers
IDisposableGeneric<IHeightmap> - Extended by
-
Heightmap abstract
IHeightmapDataset
IHeightmapProxy
IHeightmapShape
A heightmap provides raster data of a terrain, including elevation and other data.
To obtain an instance of IHeightmap, you may use one of the pre-defined factories of the Heightmap class:
Heightmap data is returned using HeightmapSample values for individual heightmaps samples, HeightmapRegion objects for rectangular heightmap sample blocks and HeightmapSamples for heightmap samples chunks with individual coordinates:
A heightmap may be mutable, in which case terrain data and meta-data may be updated. Use IMapEntity.CanUpdate to check if a heightmap is mutable. Then, use these methods to update metadata and terrain data:
-
IMapEntity.UpdateGeoref (metadata)
-
UpdateRange (metadata)
-
UpdateRegion (terrain data)
Instances of IHeightmap may be combined, in order to perform various conversions and computations at runtime, without having to modify the data that is stored on disk. Please refer to IHeightmapOps for details on the available operations.
Public / Methods
GetBlock1x4
Reads a fixed-sized block of samples from the heightmap (1 row, 4 columns).
- IOException
-
If an I/O error has occurred.
GetBlock4x1
Reads a fixed-sized block of samples from the heightmap (4 rows, 1 column).
- IOException
-
If an I/O error has occurred.
GetBlock4x4
Reads a fixed-sized block of samples from the heightmap (4 rows, 4 columns).
- IOException
-
If an I/O error has occurred.
GetRegion
Reads a block of samples from the heightmap.
The region in coordinates will be aligned to the closest multiple of the step distance. See CubemapFaceRect.StepAlign for details.
All heightmap samples that lie outside of the valid coordinate range of this heightmap have a HeightmapRegion.Coverage of 0
.
Only the heightmap layers (excluding HeightmapLayer.Coverage) present in layers opt and the IHeightmapLayers.LayerMask of this heightmap will be filled in buffer opt. The HeightmapLayer.Coverage layer will be filled if it is contained in layers opt, regardless of whether it is defined by IHeightmapLayers.LayerMask or not.
This method will not set HeightmapRegion.Horizontal or HeightmapRegion.Vertical in buffer opt resp. the returned buffer. The calling code is responsible for doing so if necessary.
- IOException
-
If an I/O error has occurred.
- See also
GetSample
Reads a single sample from the heightmap.
The returned heightmap sample will store values for each layer in IHeightmapLayers.LayerMask, all other values will have their respective default value. If the heightmap sample lies outside of the valid coordinate range of this heightmap, it will have a HeightmapSample.Coverage of 0
, even if IHeightmapLayers.LayerMask does not contain the HeightmapLayer.Coverage layer.
- IOException
-
If an I/O error has occurred.
GetSamples
Reads multiple samples from the heightmap in a bulk operation.
All heightmap samples that lie outside of the valid coordinate range of this heightmap will have a HeightmapSamples.Coverage or 0
.
Only the heightmap layers (excluding HeightmapLayer.Coverage) present in layers opt and the IHeightmapLayers.LayerMask of this heightmap will be filled in buffer in. The HeightmapLayer.Coverage layer will be filled if it is contained in layers opt, regardless of whether it is defined by IHeightmapLayers.LayerMask or not.
- IOException
-
If an I/O error has occurred.
HasRegion
Determines if this heightmap contains data in the given region.
The following semantic relaxations can be exploited by implementing methods in order to improve performance:
-
Contiguous blocks containing more than one sample must be reported. Others may be reported but can be as well be ignored.
-
Samples with partial coverage may be treated as non-existent samples.
-
Samples may be grouped in blocks up to
512x512
in size.
- IOException
-
If an I/O error has occurred.
UpdateRange
Updates the vertical range of this heightmap.
- IOException
-
If an I/O error has occurred.
- See also
UpdateRegion
Updates a region of this heightmap.
- IOException
-
If an I/O error has occurred.
- See also
Public / Attributes
OnUpdated
Event for listening to updates made to this heightmap.
This event will be fired by the thread that performs the map update.
Vertical
Returns the terrain-space range of elevation values.
The default value is VerticalRange.Default if HeightmapLayer.Elevation or HeightmapLayer.Displacement is present and VerticalRange.None otherwise.
Extensions
Augment
Augments this heightmap with constant heightmap data, filling in the given sample value for non-existent layers.
GetSample
4 overloads
Reads a single sample from the heightmap.
The returned heightmap sample will store values for each layer in IHeightmapLayers.LayerMask, all other values will have their respective default value. If the heightmap sample lies outside of the valid coordinate range of this heightmap, it will have a HeightmapSample.Coverage of 0
, even if IHeightmapLayers.LayerMask does not contain the HeightmapLayer.Coverage layer.
- IOException
-
If an I/O error has occurred.
Reads a single sample from the heightmap.
The returned heightmap sample will store values for each layer in IHeightmapLayers.LayerMask, all other values will have their respective default value. If the heightmap sample lies outside of the valid coordinate range of this heightmap, it will have a HeightmapSample.Coverage of 0
, even if IHeightmapLayers.LayerMask does not contain the HeightmapLayer.Coverage layer.
- IOException
-
If an I/O error has occurred.
Reads a single sample from the heightmap.
The returned heightmap sample will store values for each layer in IHeightmapLayers.LayerMask, all other values will have their respective default value. If the heightmap sample lies outside of the valid coordinate range of this heightmap, it will have a HeightmapSample.Coverage of 0
, even if IHeightmapLayers.LayerMask does not contain the HeightmapLayer.Coverage layer.
- IOException
-
If an I/O error has occurred.
Reads a single sample from the heightmap.
The returned heightmap sample will store values for each layer in IHeightmapLayers.LayerMask, all other values will have their respective default value. If the heightmap sample lies outside of the valid coordinate range of this heightmap, it will have a HeightmapSample.Coverage of 0
, even if IHeightmapLayers.LayerMask does not contain the HeightmapLayer.Coverage layer.
- IOException
-
If an I/O error has occurred.
ImportPixels
2 overloads
Imports pixel data into this dataset.
This method uses geo-referencing information present in image in and this dataset. The pixels of image in will be imported and written to the geo-referenced dataset region. Pixel data will not be resampled or reprojected. Only pixel values will be scaled and/or translated if necessary, i.e. raw pixel values (see PixelRange) are mapped to terrain-space elevation values (see VerticalRange).
Imports pixel data into this dataset.
This method ignores geo-referencing information present in image in and/or this dataset. The pixels of image in will be imported and written to a dataset region denoted by topLeft in and transform opt. Pixel data will not be resampled or reprojected. Only pixel values will be scaled and/or translated if necessary, i.e. raw pixel values (see PixelRange) are mapped to terrain-space elevation values (see VerticalRange).
A-------B | | input image: W x H pixels D-------C
First, the given transform opt is applied to the input image in, using the center of its map raster as the center of transformation (see MapInfo). This figure shows the transformed image for Transform.Diagonal:
A----D | | | | transformed input image: W' x H' pixels | | B----C
Then, the top-left pixel of the transformed input image (here A
) is tied to the given cubemap face coordinates (see topLeft in) and the pixels of the transformed image are imported into the cubemap face, where to X-axis resp. Y-axis of the transformed input image correspond to the cubemap face X-axis resp. Y-axis (see Cubemap).
IsSolid
Is this heightmap solid, i.e. all samples have full coverage?
- IOException
-
If an I/O error has occurred.
- See also
Material
Returns a IHeightmap that applies the given material keys to the HeightmapLayer.Texture values of this heightmap in order to produce material tokens (see HeightmapLayer.Material).
Projector
Returns an HeightmapProjector object that can be used to project heightmap samples between this heightmap and the given one.
- GeorefException
-
If projection opt is
null
and the geo-reference parameters are incomplete or invalid.
ProjectSamples
Reads samples from this dataset, projects them to the coordinate system of the target dataset and stores the projected samples in the target dataset.
Regions
3 overloads
Returns the map regions of the this heightmap.
- IOException
-
If an I/O error has occurred.
Returns the map regions of the this heightmap.
This method will output zero or more disjoint cubemap face rectangles to regions in. If ICollector.Add returns false
, the method will early-exit. This can be used to implement cancellation.
- IOException
-
If an I/O error has occurred.
Returns the map regions of the this heightmap.
This method will output zero or more disjoint cubemap face rectangles to regions in. If ICollector.Add returns false
, the method will early-exit. This can be used to implement cancellation.
- IOException
-
If an I/O error has occurred.
ToImage
2 overloads
Reads a whole cubemap face of this heightmap as an image.
The returned IImage object will never throw IOExceptions or ValidatingExceptions.
Reads a rectangular region of this heightmap as an image.
The returned IImage object will never throw IOExceptions or ValidatingExceptions.
VerticalMetre
Returns the terrain-space range of elevation values, in UnitOfMeasure.Metre.
- See also
VerticalToElevationClamp
Helper for converting vertical coordinates to elevation values.
- See also