VAPOR3 3.9.4
|
#include <GeoTile.h>
Public Member Functions | |
GeoTile (size_t tile_width, size_t tile_height, size_t pixelsize, double min_lon, double min_lat, double max_lon, double max_lat) | |
virtual | ~GeoTile () |
int | Insert (std::string quadkey, const unsigned char *image) |
virtual void | LatLongToPixelXY (double lon, double lat, int lod, size_t &pixelX, size_t &pixelY) const =0 |
virtual void | PixelXYToLatLon (size_t pixelX, size_t pixelY, int lod, double &lon, double &lat) const =0 |
void | PixelXYToTileXY (size_t pixelX, size_t pixelY, size_t &tileX, size_t &tileY, size_t &tilePixelX, size_t &tilePixelY) const |
void | TileXYToPixelXY (size_t tileX, size_t tileY, size_t &pixelX, size_t &pixelY) const |
const unsigned char * | GetTile (std::string quadkey) const |
const unsigned char * | GetTile (size_t tileX, size_t tileY, int lod) const |
int | GetMap (size_t pixelX0, size_t pixelY0, size_t pixelX1, size_t pixelY1, int lod, unsigned char *map_image) const |
void | MapSize (int lod, size_t &nx, size_t &ny) const |
int | MapSize (size_t pixelX0, size_t pixelY0, size_t pixelX1, size_t pixelY1, int lod, size_t &nx, size_t &ny) const |
void | GetLatLonExtents (double &minlon, double &minlat, double &maxlon, double &maxlat) const |
void | GetTileSize (size_t &w, size_t &h) const |
void | LatLongRectToPixelRect (const double geoSW[2], const double geoNE[2], int lod, size_t pixelSW[2], size_t pixelNE[2]) const |
Static Public Member Functions | |
static std::string | TileXYToQuadKey (size_t tileX, size_t tileY, int lod) |
static int | QuadKeyToTileXY (std::string quadKey, size_t &tileX, size_t &tileY, int &lod) |
Protected Member Functions | |
double | _Clip (double n, double minValue, double maxValue) const |
Protected Attributes | |
size_t | _tile_width |
size_t | _tile_height |
double | _MinLatitude |
double | _MaxLatitude |
double | _MinLongitude |
double | _MaxLongitude |
VAPoR::GeoTile::GeoTile | ( | size_t | tile_width, |
size_t | tile_height, | ||
size_t | pixelsize, | ||
double | min_lon, | ||
double | min_lat, | ||
double | max_lon, | ||
double | max_lat | ||
) |
Create a GeoTile object
[in] | tile_width | The width of a tile in pixels |
[in] | tile_height | The height of a tile in pixels |
[in] | pixelsize | The size of a pixel in bytes |
[in] | min_lon | The minimum valid longitude for the map projection |
[in] | min_lat | The minimum valid lattitude for the map projection |
[in] | max_lon | The maximum valid longitude for the map projection |
[in] | max_lat | The maximum valid lattitude for the map projection |
|
virtual |
|
protected |
|
inline |
int VAPoR::GeoTile::GetMap | ( | size_t | pixelX0, |
size_t | pixelY0, | ||
size_t | pixelX1, | ||
size_t | pixelY1, | ||
int | lod, | ||
unsigned char * | map_image | ||
) | const |
This method contructs a continuous (non-tiled) map from the tiles contained within the class.
Given a rectangular boundary described to two points (the north-west and south-east corner) in pixel coordinates, and a level of detail, this method constructs and returns a continuous map.
[in] | pixelX0 | X coordinate of north-west corner in pixel coordinates |
[in] | pixelY0 | Y coordinate of north-west corner in pixel coordinates |
[in] | pixelX0 | X coordinate of south-east corner in pixel coordinates |
[in] | pixelY0 | Y coordinate of south-east corner in pixel coordinates |
[in] | lod | Level of detail |
[out] | map_image | The constructed map is copied to the location pointed to by map_image . The memory referenced by map_image must of sufficient size to accommodate the map. |
status | A zero is returned on success. If the coordinates are invalid, or if all of the tiles needed are not present, a negative value is returned. |
|
inline |
Return a pointer to an image tile
This method returns a pointer to the image tile associated with a tile index and level of detail. If no image tile has been added to the class for combination of tile index and lod, a null pointer is returned.
[in] | tileX | X coordinate of tile |
[in] | tileY | X coordinate of tile |
[in] | lod | level of detail of tile |
tile | If the tile associated with tileX , tileY , and lod , a pointer to it is returned. If the tile does not exist (or if quadkey is not a valid key), the NULL pointer is returned |
const unsigned char * VAPoR::GeoTile::GetTile | ( | std::string | quadkey | ) | const |
Return a pointer to the image tile associated with a quadkey
This method returns a pointer to the image tile associated with the Quad Key quadkey
. If no image tile has been added to the class for quadkey
, a null pointer is returned.
[in] | quadkey | A Quad Key |
tile | If the tile associated with quadkey exists, a pointer to it is returned. If the tile does not exist (or if quadkey is not a valid key), the NULL pointer is returned |
|
inline |
int VAPoR::GeoTile::Insert | ( | std::string | quadkey, |
const unsigned char * | image | ||
) |
Insert an image tile into the class object
This method is used to add geo-referenced image tiles to the class.
[in] | quadkey | A string encoding the location (index) and level of detail of image |
[in] | image | A pointer to the image tile to be copied into the object class. The size of the image tile must be tile_width * tile_height * pixelsize |
void VAPoR::GeoTile::LatLongRectToPixelRect | ( | const double | geoSW[2], |
const double | geoNE[2], | ||
int | lod, | ||
size_t | pixelSW[2], | ||
size_t | pixelNE[2] | ||
) | const |
Map a rectanular region described by lat-lon coordinates to pixel coordinates
[in] | geoSW | A two-element array containing the longitude, and latitude coordinate, respectively, of the south-west corner of the region |
[in] | geoNE | A two-element array containing the longitude, and latitude coordinate, respectively, of the north-east corner of the region |
[in] | lod | The level of detail |
[out] | pixelSW | Returns a two-element array containing the X, and Y pixel coordinates, respectively, of the south-west corner of the region |
[out] | pixelNE | Returns a two-element array containing the X, and Y pixel coordinates, respectively, of the north-east corner of the region |
|
pure virtual |
Converts a point from latitude/longitude WGS-84 coordinates (in degrees) into pixel XY coordinates at a specified level of detail.
[in] | lon | Longitude of the point, in degrees. |
[in] | lat | Latitude of the point, in degrees. |
[in] | lod | Level of detail, from 0 (lowest detail) to 23 (highest detail). |
[out] | pixelX | Output parameter receiving the X coordinate in pixels. |
[out] | pixelY | Output parameter receiving the Y coordinate in pixels. |
Implemented in VAPoR::GeoTileEquirectangular, and VAPoR::GeoTileMercator.
void VAPoR::GeoTile::MapSize | ( | int | lod, |
size_t & | nx, | ||
size_t & | ny | ||
) | const |
Compute the size of the global map in pixels at a specified lod
This method calculates the width and height, in pixels, of the global map at a specified level of detail
[in] | lod | The level of detail |
[out] | nx | Width of the map in pixels |
[out] | ny | Height of the map in pixels |
int VAPoR::GeoTile::MapSize | ( | size_t | pixelX0, |
size_t | pixelY0, | ||
size_t | pixelX1, | ||
size_t | pixelY1, | ||
int | lod, | ||
size_t & | nx, | ||
size_t & | ny | ||
) | const |
Compute the size of a map in pixels at a specified lod and coordinates
Given a rectangular boundary described by two points (the north-west and south-east corner) in pixel coordinates, and a level of detail, this method computes the size of the map (width and height) in pixels.
[in] | pixelX0 | X coordinate of north-west corner in pixel coordinates |
[in] | pixelY0 | Y coordinate of north-west corner in pixel coordinates |
[in] | pixelX0 | X coordinate of south-east corner in pixel coordinates |
[in] | pixelY0 | Y coordinate of south-east corner in pixel coordinates |
[in] | lod | The level of detail |
[out] | nx | Width of the map in pixels |
[out] | ny | Height of the map in pixels |
|
pure virtual |
Converts a pixel from pixel XY coordinates at a specified level of detail into latitude/longitude WGS-84 coordinates (in degrees).
[in] | pixelX | X coordinate of the point, in pixels. |
[in] | pixelY | Y coordinates of the point, in pixels. |
[in] | lod | Level of detail, from 0 (lowest detail) to 23 (highest detail). |
[out] | lat | Output parameter receiving the latitude in degrees. |
[out] | lon | Output parameter receiving the longitude in degrees |
Implemented in VAPoR::GeoTileEquirectangular, and VAPoR::GeoTileMercator.
void VAPoR::GeoTile::PixelXYToTileXY | ( | size_t | pixelX, |
size_t | pixelY, | ||
size_t & | tileX, | ||
size_t & | tileY, | ||
size_t & | tilePixelX, | ||
size_t & | tilePixelY | ||
) | const |
Converts pixel XY coordinates into tile XY coordinates of the tile containing the specified pixel.
Given a map coordinate in pixels, this method returns the index of of the tile containing the pixel, as well as the pixel's location within the tile coordinate system.
[in] | pixelX | Pixel X coordinate. |
[in] | pixelY | Pixel Y coordinate. |
[in] | tileX | Output parameter receiving the tile's X coordinate. |
[in] | tileY | Output parameter receiving the tile's Y coordinate. |
[in] | tilePixelX | Output parameter receiving the pixel's X in the tile's local coordinate system. |
[in] | tilePixelY | Output parameter receiving the pixel's Y in the tile's local coordinate system. |
|
static |
Converts a QuadKey into tile XY coordinates.
[in] | quadKey | QuadKey of the tile. |
[out] | tileX | Output parameter receiving the tile X coordinate. |
[out] | tileY | Output parameter receiving the tile Y coordinate. |
[out] | lod | Output parameter receiving the level of detail. |
status | A zero is returned on success, otherwise a negative value is returned if the supplied inputs are invalid |
void VAPoR::GeoTile::TileXYToPixelXY | ( | size_t | tileX, |
size_t | tileY, | ||
size_t & | pixelX, | ||
size_t & | pixelY | ||
) | const |
Converts tile XY coordinates into pixel XY coordinates of the upper-left pixel of the specified tile.
[in] | tileX | Tile X coordinate. |
[in] | tileY | Tile Y coordinate. |
[out] | pixelX | Output parameter receiving the pixel X coordinate. |
[out] | pixelY | Output parameter receiving the pixel Y coordinate. |
|
static |
Converts tile XY coordinates into a QuadKey at a specified level of detail.
[in] | tileX | Tile X coordinate. |
[in] | tileY | Tile Y coordinate. |
[in] | lod | Level of detail, from 0 (lowest detail) to 23 (highest detail). |
quadkey | A string containing the QuadKey. |