Canvas
Description
- Derived from
-
Disposable abstract
ICanvasBlockSize
IGeorefInfo
The Canvas maps a rectangular map or a cubemap onto a contiguous pixel layer.
Putting a rectangular map or a cubemap onto a pixel layer involves these steps:
-
Unfolding of the cubemap faces faces (see below).
-
Mapping to coverage of pixel layer:
Coordinates on the rectangular map resp. cubemap always refer to infinitesimal points (see PixelCoverage.PixelIsPoint semantic). Same holds for unfolded canvas raster coordinates. The pixels in a canvas block (and thus the pixel layer) can have either PixelCoverage.PixelIsPoint or PixelCoverage.PixelIsArea semantic (see below).
Cubemaps are unfolded onto the canvas as follows:
+--------+ | | | | | | +--------+--------+--------+--------+ | | | | | | | Center | | | | | | | | +--------+--------+--------+--------+ | | | | | | +--------+
The CubemapFaceCoordsI.Face of Center depicts which cubemap face will be the Center
one (see figure). By default, the canvas X- and Y-axis correspond to the cubemap face axes. An optional simple coordinate transform for the Center
face can be specified via Transform. The other faces will be unfolded and displayed accordingly. When the map rectangular, only the Center
face (always CubemapFace.NegZ) will be displayed.
The pixel layer contents are generated lazily when a block is first requested. Generated blocks are cached with an LRU scheme. An aggregated ICanvasContent is used for creating the cached content. By providing the content object, the application can create its own representation for canvas block content, depending on the API used.
When the pixel layer has a PixelCoverage.PixelIsPoint coverage (see ICanvasBlockSize.BlockSize), blocks are mapped onto the canvas as follows:
0 4 8 12 16 20 24 28 32 .--> +---+---+---+---+---+---+---+---+ | Canvas X- and Y-axis | | | | | | | | | V +---+---oooo#oooo---ooooo---+---+ 4 | | o # o o o | | o := Block edge samples +---+---oooo#oooo---#####---+---+ 8 # := Shared edge samples | | | | | o o | | +---+---+---+---+---ooooo---+---+ ...
The block size is always a power of two plus one. Adjacent blocks have overlapping edges (one raster sample). Pixel coordinates are mapped directly to canvas raster coordinates.
When the pixel layer has a PixelCoverage.PixelIsArea coverage (see ICanvasBlockSize.BlockSize), blocks are mapped onto the canvas as follows:
0 4 8 12 16 20 24 28 32 .--> +---+---+---+---+---+---+---+---+ | Canvas X- and Y-axis | | | | | | | | | V +---+---+---+---+---+---+---+---+ 4 | | |###|###| |###| | | # := Block samples +---+---+---+---+---+---+---+---+ 8 | | | | | |###| | | +---+---+---+---+---+---+---+---+ ...
The block size is always a power of two. Adjacent blocks are disjoint. Pixel coordinates are mapped to the top-left corner of the corresponding pixel on the canvas raster.
- See also
Public / Methods
Anchor
2 overloads
Creates an anchor for the given screen location.
Creates an anchor for the given screen location.
TranslateCanvasToMap
5 overloads
Translates canvas coordinates (see CanvasSize) to map coordinates (see Center).
Translates canvas coordinates (see CanvasSize) to map coordinates (see Center).
Translates canvas coordinates (see CanvasSize) to map coordinates (see Center).
Translates canvas coordinates (see CanvasSize) to map coordinates (see Center).
Translates canvas coordinates (see CanvasSize) to map coordinates (see Center).
TranslateCanvasToPixel
4 overloads
Translates canvas coordinates (see CanvasSize) to pixel coordinates (see PixelSize).
Translates canvas coordinates (see CanvasSize) to pixel coordinates (see PixelSize).
Translates canvas coordinates (see CanvasSize) to pixel coordinates (see PixelSize).
Translates canvas coordinates (see CanvasSize) to pixel coordinates (see PixelSize).
TranslateMapToCanvas
4 overloads
Translates map coordinates (see Center) to canvas coordinates ( CanvasSize).
Translates map coordinates (see Center) to canvas coordinates (see CanvasSize).
Translates map coordinates (see Center) to canvas coordinates ( CanvasSize).
Translates map coordinates (see Center) to canvas coordinates (see CanvasSize).
TranslatePixelToCanvas
4 overloads
Translates pixel coordinates (see PixelSize) to canvas coordinates (see CanvasSize).
Translates pixel coordinates (see PixelSize) to canvas coordinates (see CanvasSize).
Translates pixel coordinates (see PixelSize) to canvas coordinates (see CanvasSize).
Translates pixel coordinates (see PixelSize) to canvas coordinates (see CanvasSize).
Update
Updates the canvas content.
All canvas blocks that have finished loading in the background will be provided to ICanvasContent.Create.
Public / Attributes
BlockCountX
The number of map blocks along the canvas X-axis that intersect the current canvas bounds.
BlockCountY
The number of map blocks along the canvas Y-axis that intersect the current canvas bounds.
CacheSize
The cache size, in blocks.
This is the same value that has been passed to ICanvasContent.Reset.
CanvasSize
The size of the virtual canvas.
For cubic heightmaps, the virtual canvas has the following layout:
Cubic heightmaps: +--------+ | | width := 4 * n + 1 | | height := 3 * n + 1 | | n := size - 1 +--------+--------+--------+--------+ | | | | | | | Center | | | | | | | | +--------+--------+--------+--------+ | | | | | | +--------+
where size
is the internal IHeightmap.Size of the current Heightmap.
For rectangular heightmaps, the virtual canvas is also rectangular and has the same dimensions as the map (see IHeightmap.Width and IHeightmap.Height).
Center
Heightmap coordinates of the center of the current canvas bounds.
For rectangular heightmaps, the CubemapFaceCoordsI.Face will be set to CubemapFace.NegZ.
Protected / Methods
DoRegionsCollect
Collects the data regions that intersect with the given bounds.
- IOException
-
If an I/O error has occurred.