Pyramid SDK Reference
Core Classes๐
The following are the core classes of the SDK, and source code is provided for
all of them. They are encapsulated in the Sdk.Core
project.
Class | Description |
---|---|
Boundary | Defines a bounding rectangle. |
Constants | Defines a range of global constants. |
DataColorMap | Implements IColorMap, to generate color pixels corresponding to latitude and longitude from the source grid. |
DataGrid | Implements IGrid, providing a two dimensional array of data. |
DemPlateFileGenerator | Implements IDemPlateFileGenerator, to produce a single file containing all the DEM data tiles. |
DemTileSerializer | Implements IDemTileSerializer to save and load DEM tiles on the file system. |
Enums | Defines the global enumerations. |
EquirectangularGridMap | Implements IProjectionGridMap, using equirectangular projection. |
Helper | Defines a few utility methods related to unit conversions. |
ImageColorMap | Implements IColorMap, and references IProjectionGridMap. |
ImageGrid | Implements IGrid, providing a two dimensional array of image data. |
ImageTileSerializer | Implements IImageTileSerializer to save and load image tiles on file system. |
MercatorDemTileCreator | Implements ITileCreator to create Mercator DEM tiles. |
MercatorTileCreator | Implements ITileCreator to create Mercator image tiles. |
MultipleDemPlateFileGenerator | Implements IDemPlateFileGenerator, to produce multiple DEM plate files containing DEM data tiles. |
MercatorPlateFileDetails | Used to calculate and store the details of multiple plate files. |
MultiplePlateFileGenerator | Implements IPlateFileGenerator to produce multiple plate files containing image tiles. |
MultiTileCreator | Implements ITileCreator for different tile creator instances. |
OctTileMap | Defines an octahedral tile map. |
PlateFile | Defines utility methods for plate file operations. |
PlateFileGenerator | Implements IPlateFileGenerator, used to create plate files. |
PlateFileHelper | Defines a range of utility methods for plate files. |
Tile | Simple class holding tile coordinates. |
TileChopper | Implements ITileCreator to create image tiles without changing the projection. |
TileCreatorFactory | Creates an image or DEM tile creator instance for the specified projection type. |
TileGenerator | This class contains the main control/workflow code for the tile generation process. |
TileHelper | Defines a range of utility methods for tiles and bitmaps. |
ToastDemTileCreator | Implements ITileCreator to create Toast DEM tiles. |
ToastHelper | Helper class, in particular working with Toast coordinates. |
ToastTileCreator | Implements ITileCreator to create Toast image tiles. |
WtmlCollection | Defines a new Wtml collection, a WorldWide Telescope data file. |
Interfaces๐
The Tile Pyramid SDK requires that the following interfaces are implemented.
Interface | Description |
---|---|
IColorMap | Used to retrieve color data. |
IDemPlateFileGenerator | Used to generate plate files for DEM tiles (plate files are single files containing all or part of a tile pyramid for easy copying, sharing and backup). |
IDemTileSerializer | Used to serialize and deserialize (save and load) DEM data. |
IElevationMap | Used to retrieve elevation data. |
IGrid | Used to read source data into a source grid which can be accessed using UV or XY co-ordinates. |
IImageTileSerializer | Used to serialize and deserialize (save and load) image data. |
IPlateFileGenerator | Used to generate plate files for image tiles (plate files are single files containing all or part of a tile pyramid for easy copying, sharing and backup). |
IProjectionGridMap | Used to query the data grid based on the projection. |
ITileCreator | Used to build the tile pyramids. |
IColorMap Interface๐
The IColorMap
interface is used to retrieve color data, and exposes the
following methods. It does not inherit from another interface.
Method | Description |
---|---|
GetColor | Retrieves the color corresponding to a longitude and latitude. |
Implemented in Classes๐
IColorMap.GetColor๐
The GetColor
method retrieves the color corresponding to a longitude and latitude.
Syntax๐
Color GetColor(
double longitude,
double latitude
);
Parameters๐
longitude
โ Specifies longitude in decimal degrees.latitude
โ Specifies latitude in decimal degrees.
Return Values๐
The method returns a Color
object, containing the color of the pixel at the given latitude and longitude.
Remarks๐
Typically the color returned comes from the source image. Note the order of the parameters, longitude first.
IDemPlateFileGenerator Interface๐
The IDemPlateFileGenerator
interface is used to generate plate files for DEM
tiles (plate files are single files containing all or part of a tile pyramid
for easy copying, sharing and backup). It does not inherit from another
interface.
Method | Description |
---|---|
CreateFromDemTile | Used to create a plate file from a DEM tile pyramid. |
Property | Type | Get/Set | Description |
---|---|---|---|
TilesProcessed | long | Get only. | Number of tiles for the level that have been processed. |
Implemented in Classes๐
- DemPlateFileGenerator
MultipleDemPlateFileGenerator
IDemPlateFileGenerator.CreateFromDemTile๐
The CreateFromDemTile
method is used to create a plate file from a DEM tile pyramid.
Syntax๐
void CreateFromDemTile(
IDemTileSerializer serializer
);
Parameters๐
serializer
โ Specifies the IDemTileSerializer object.
Return Values๐
The method does not return a value.
Remarks๐
None.
IDemTileSerializer Interface๐
The IDemTileSerializer
interface is used to serialize and deserialize (save
and load) DEM data, and exposes the following methods. It does not inherit
from another interface.
Method | Description |
---|---|
Deserialize | Deserializes a binary object from the file system. |
Serialize | Serializes the binary file to the file system. |
Implemented in Class๐
IDemTileSerializer.Deserialize๐
The Deserialize
method deserializes (loads) a DEM tile from the file system.
Syntax๐
short[] Deserialize(
int level,
int tileX,
int tileY
);
Parameters๐
level
โ Specifies the tile level, from zero to the maximum level for the data.tileX
โ Specifies the X index of the tile in the tile pyramid.tileY
โ Specifies the Y index of the tile in the tile pyramid.
Return Values๐
The method returns an array of short
values, containing the binary data.
Remarks๐
The size of a DEM tile is fixed depending on the projection, refer to the remarks for Serialize.
IDemTileSerializer.Serialize๐
The Serialize
method serializes (saves) the DEM tile to the file system.
Syntax๐
void Serialize(
short[] tile,
int level,
int tileX,
int tileY
);
Parameters๐
tile
โ Specifies the array of values that make up the DEM tile.level
โ Specifies the tile level, from zero to the maximum level for the data.tileX
โ Specifies the X index of the tile in the tile pyramid.tileY
โ Specifies the Y index of the tile in the tile pyramid.4
Return Values๐
The method does not return a value.
Remarks๐
The size of a DEM tile is fixed depending on the projection, for Mercator it
is 1089 values (33 rows of 33), organized by rows. Refer to the
MercatorDemTileCreator
class. For TOAST it is 513 values, these values are
not in a perfect grid. Refer to the static tables listed first in the
ToastDemTileCreator
class.
IElevationMap Interface๐
The IElevationMap
interface is used to retrieve elevation data, and exposes
the following methods. It does not inherit from another interface.
Method | Description |
---|---|
GetElevation | Retrieves the elevation corresponding to the longitude and latitude. |
Implemented in Class๐
This interface is implemented in the ShadedReliefColorMap
class in the
SpecificRegionDataSet sample.
IElevationMap.GetElevation๐
The GetElevation
method retrieves the elevation corresponding to the
longitude and latitude.
Syntax๐
short GetElevation(
double longitude,
double latitude
);
Parameters๐
longitude
โ Specifies longitude in decimal degrees.latitude
โ Specifies latitude in decimal degrees.
Return Values๐
The method returns a short
, containing the elevation value.
Remarks๐
Note the order of the parameters, longitude first.
IGrid Interface๐
The IGrid
interface is used to read source data into a source grid which can
be accessed using UV or XY co-ordinates. It does not inherit from another
interface.
Method | Description |
---|---|
GetValue | Retrieves the value contained at the specified coordinate. |
GetValueAt | Retrieves the value contained at the specified pixel location. |
GetXIndex | Retrieves the X pixel index for the given coordinate. |
GetYIndex | Retrieves the Y pixel index for the given coordinate. |
Property | Type | Get/Set | Description |
---|---|---|---|
Height | int | Get/Set | Height of the grid. |
Width | int | Get only | Width of the grid. |
Implemented in Classes๐
IGrid.GetValue๐
The GetValue
method retrieves the value contained at the specified
coordinate.
Syntax๐
double GetValue(
double u,
double v
);
Parameters๐
u
โ Specifies u coordinate.v
โ Specifies v coordinate.
Return Values๐
The method returns a double
, containing the value for the given coordinate.
Remarks๐
UV coordinates are floating point in the range 0 to 1. The top left hand corner of the map is 0,0.
IGrid.GetValueAt๐
The GetValueAt
method retrieves the value contained at the specified pixel
location.
Syntax๐
double GetValueAt(
int i,
int j
);
Parameters๐
i
โ Specifies X index.j
โ Specifies Y index.
Return Values๐
The method returns a double
, containing the value.
Remarks๐
These coordinates are in pixels, from 0 to the full width or height of the map. The top left hand corner of the map is 0,0.
IGrid.GetXIndex๐
The GetXIndex
method retrieves the X pixel index for the given u
coordinate.
Syntax๐
int GetXIndex(
double u
);
Parameters๐
u
โ Specifies u coordinate in decimal degrees.
Return Values๐
The method returns an int
, containing the X pixel value for the given
coordinate.
Remarks๐
The U coordinate is in the range 0 to 1.
IGrid.GetYIndex๐
The GetYIndex
method retrieves the Y pixel index for the given V coordinate.
Syntax๐
int GetYIndex(
double v
);
Parameters๐
v
โ Specifies v coordinate in decimal degrees.
Return Values๐
The method returns an int
, containing the Y pixel value for the given
coordinate.
Remarks๐
The V coordinate is in the range 0 to 1.
IImageTileSerializer Interface๐
The IImageTileSerializer
interface is used to serialize and deserialize
(save and load) image data, and exposes the following methods.
Method | Description |
---|---|
Deserialize | Deserializes an image from the file system. |
Serialize | Serializes the image to the file system. |
Implemented in Class๐
IImageTileSerializer.Deserialize๐
The Deserialize
method deserializes (loads) an image from the file system.
Syntax๐
Bitmap Deserialize(
int level,
int tileX,
int tileY
);
Parameters๐
level
โ Specifies the tile level, from zero to the maximum level for the data.tileX
โ Specifies the X index of the tile in the tile pyramid.tileY
โ Specifies the Y index of the tile in the tile pyramid.
Return Values๐
The method returns a Bitmap
, containing the binary image.
Remarks๐
Indexes of the tile pyramid are zero based. The size of an image tile is fixed at 256ร256 pixels.
IImageTileSerializer.Serialize๐
The Serialize
method serializes (saves) the tile image to the file system.
Syntax๐
void Serialize(
Bitmap tile,
int level,
int tileX,
int tileY
);
Parameters๐
tile
โ Specifies the Bitmap for the tile.level
โ Specifies the tile level, from zero to the maximum level for the data.tileX
โ Specifies the X index of the tile in the tile pyramid.tileY
โ Specifies the Y index of the tile in the tile pyramid.
Return Values๐
The method does not return a value.
Remarks๐
Indexes of the tile pyramid are zero based. The size of an image tile is fixed at 256 x 256 pixels.
IPlateFileGenerator Interface๐
The IPlateFileGenerator
interface is used to generate plate files for image
tiles (plate files are single files containing all or part of a tile pyramid
for easy copying, sharing and backup). It does not inherit from another
interface.
Method | Description |
---|---|
CreateFromImageTile | Used to create a plate file from an image tile pyramid. |
Properties๐
Property | Type | Get/Set | Description |
---|---|---|---|
TilesProcessed | long | Get only. | Number of tiles for the level that have been processed. |
Implemented in Classes๐
IPlateFileGenerator.CreateFromImageTile๐
The CreateFromImageTile
method is used to create a plate file from an image
tile pyramid.
Syntax๐
void CreateFromImageTile(
IImageTileSerializer serializer
);
Parameters๐
serializer
โ Specifies the IImageTileSerializer object.
Return Values๐
The method does not returns a value.
Remarks๐
The image pyramid must be created before a plate file can be generated. Plate files are single files that make it easier to send or archive the tile pyramid.
IProjectionGridMap Interface๐
The IProjectionGridMap
interface is used to query the data grid based on the
projection. It does not inherit from another interface.
Method | Description |
---|---|
GetValue | Retrieves the value contained at the specified coordinate. |
GetXIndex | Retrieves the X pixel index for the given coordinate. |
GetYIndex | Retrieves the Y pixel index for the given coordinate. |
IsInRange | Retrieves a Boolean indicating whether a given coordinate falls within the scope of the map. |
Properties๐
Property | Type | Get/Set | Description |
---|---|---|---|
InputBoundary | Boundary | Get only | Bounding box of the map. |
InputGrid | IGrid | Get only | The source grid for the map. |
Implemented in Class๐
IProjectionGridMap.GetValue๐
The GetValue
method retrieves the value contained at the specified
coordinate.
Syntax๐
double GetValue(
double longitude,
double latitude
);
Parameters๐
longitude
โ Specifies longitude in decimal degrees.latitude
โ Specifies latitude in decimal degrees.
Return Values๐
The method returns a double
, containing the value for the given coordinate,
depending on the projection.
Remarks๐
Note the order of the parameters, longitude first.
IProjectionGridMap.GetXIndex๐
The GetXIndex
method retrieves the X pixel index for the given longitude.
Syntax๐
int GetXIndex(
double longitude
);
Parameters๐
longitude
โ Specifies longitude in decimal degrees.
Return Values๐
The method returns an int
, containing the X pixel value for the given
longitude, depending on the projection.
Remarks๐
None.
IProjectionGridMap.GetYIndex๐
The GetYIndex
method retrieves the Y pixel index for the given latitude.
Syntax๐
int GetYIndex(
double latitude
);
Parameters๐
latitude
โ Specifies latitude in decimal degrees.
Return Values๐
The method returns an int
, containing the Y pixel value for the given
latitude, depending on the projection.
Remarks๐
None.
IProjectionGridMap.IsInRange๐
The IsInRange
method retrieves a Boolean indicating whether a given
coordinate falls within the scope of the map.
SySyntax๐
bool IsInRange(
double longitude,
double latitude
);
Parameters๐
longitude
โ Specifies longitude in decimal degrees.latitude
โ Specifies latitude in decimal degrees.
Return Values๐
The method returns a bool
.
Remarks๐
Note the order of the parameters, longitude first.
ITileCreator Interface๐
The ITileCreator
interface is used to build the tile pyramids, and exposes
the following methods. It does not inherit from another interface.
Method | Description |
---|---|
Create | Creates tiles of the pyramid at the specified level. |
CreateParent | Create tiles of the pyramid at the parent of the specified level. |
Properties๐
Property | Type | Get/Set | Description |
---|---|---|---|
ProjectionType | ProjectionTypes | Get only. | Specifies or retrieves the projection type, one of: Toast, Mercator |
Implemented in Classes๐
- ToastTileCreator
- MercatorTileCreator
- ToastDemTileCreator
- MercatorDemTileCreator
- MultiTileCreator
- TileChopper
ITileCreator.Create๐
The Create
method creates tiles of the pyramid at the specified level.
Syntax๐
void Create(
int level,
int tileX,
int tileY
);
Parameters๐
level
โ Specifies the tile level, from zero to the maximum level for the data.tileX
โ Specifies the X index of the tile in the tile pyramid.tileY
โ Specifies the Y index of the tile in the tile pyramid.
Return Values๐
This method does not return a value.
Remarks๐
If the input to this method was Create(N,X,Y)
, the output would be the tile
with coordinates (X,Y) at level N.
ITileCreator.CreateParent๐
The CreateParent
method creates tiles for the parent of the specified level.
Syntax๐
void CreateParent(
int level,
int tileX,
int tileY
);
Parameters๐
level
โ Specifies the tile level, from zero to the maximum level for the data.tileX
โ Specifies the X index of the tile in the tile pyramid.tileY
โ Specifies the Y index of the tile in the tile pyramid.
Return Values๐
This method does not return a value.
Remarks๐
If the input to this method was CreateParent(N,X,Y)
, the output would be the
tile with coordinates (X/2,Y/2) at level N-1.