VAPOR3 3.9.4
GeoTile.h
Go to the documentation of this file.
1#ifndef GeoTile_h_
2#define GeoTile_h_
3
4#include <string>
5#include <map>
6#ifdef _WINDOWS
7 #pragma warning(disable : 4251)
8#endif
9//
42#include <vapor/common.h>
43#ifdef WINDOWS
44 #pragma warning(disable : 4251)
45#endif
46namespace VAPoR {
48public:
59 GeoTile(size_t tile_width, size_t tile_height, size_t pixelsize, double min_lon, double min_lat, double max_lon, double max_lat);
60 virtual ~GeoTile();
61
73 //
74 int Insert(std::string quadkey, const unsigned char *image);
75
87 //
88 virtual void LatLongToPixelXY(double lon, double lat, int lod, size_t &pixelX, size_t &pixelY) const = 0;
89
102 virtual void PixelXYToLatLon(size_t pixelX, size_t pixelY, int lod, double &lon, double &lat) const = 0;
103
120 void PixelXYToTileXY(size_t pixelX, size_t pixelY, size_t &tileX, size_t &tileY, size_t &tilePixelX, size_t &tilePixelY) const;
121
130 void TileXYToPixelXY(size_t tileX, size_t tileY, size_t &pixelX, size_t &pixelY) const;
131
144 //
145 const unsigned char *GetTile(std::string quadkey) const;
146
163 //
164 const unsigned char *GetTile(size_t tileX, size_t tileY, int lod) const
165 {
166 std::string quadkey = TileXYToQuadKey(tileX, tileY, lod);
167 return (GetTile(quadkey));
168 }
169
191 //
192 int GetMap(size_t pixelX0, size_t pixelY0, size_t pixelX1, size_t pixelY1, int lod, unsigned char *map_image) const;
193
202 //
203 static std::string TileXYToQuadKey(size_t tileX, size_t tileY, int lod);
204
215 static int QuadKeyToTileXY(std::string quadKey, size_t &tileX, size_t &tileY, int &lod);
216
225 //
226 void MapSize(int lod, size_t &nx, size_t &ny) const;
227
241 //
242 int MapSize(size_t pixelX0, size_t pixelY0, size_t pixelX1, size_t pixelY1, int lod, size_t &nx, size_t &ny) const;
243
244 void GetLatLonExtents(double &minlon, double &minlat, double &maxlon, double &maxlat) const
245 {
246 minlon = _MinLongitude;
247 minlat = _MinLatitude;
248 maxlon = _MaxLongitude;
249 maxlat = _MaxLatitude;
250 }
251
252 void GetTileSize(size_t &w, size_t &h) const
253 {
254 w = _tile_width;
255 h = _tile_height;
256 }
257
270 //
271 void LatLongRectToPixelRect(const double geoSW[2], const double geoNE[2], int lod, size_t pixelSW[2], size_t pixelNE[2]) const;
272
273private:
274 size_t _pixel_size;
275 std::map<std::string, unsigned char *> _tiles;
276
277 void _CopyTileToMap(const unsigned char *tile, size_t tilePixelX0, size_t tilePixelY0, size_t tilePixelX1, size_t tilePixelY1, unsigned char *map, size_t pixelX0, size_t pixelX1, size_t nx,
278 size_t ny) const;
279
280protected:
283
288
289 double _Clip(double n, double minValue, double maxValue) const;
290};
291}; // namespace VAPoR
292#endif
static int QuadKeyToTileXY(std::string quadKey, size_t &tileX, size_t &tileY, int &lod)
virtual ~GeoTile()
void GetLatLonExtents(double &minlon, double &minlat, double &maxlon, double &maxlat) const
Definition: GeoTile.h:244
int GetMap(size_t pixelX0, size_t pixelY0, size_t pixelX1, size_t pixelY1, int lod, unsigned char *map_image) const
virtual void LatLongToPixelXY(double lon, double lat, int lod, size_t &pixelX, size_t &pixelY) const =0
double _MaxLongitude
Definition: GeoTile.h:287
double _Clip(double n, double minValue, double maxValue) const
GeoTile(size_t tile_width, size_t tile_height, size_t pixelsize, double min_lon, double min_lat, double max_lon, double max_lat)
void TileXYToPixelXY(size_t tileX, size_t tileY, size_t &pixelX, size_t &pixelY) const
void PixelXYToTileXY(size_t pixelX, size_t pixelY, size_t &tileX, size_t &tileY, size_t &tilePixelX, size_t &tilePixelY) const
double _MinLongitude
Definition: GeoTile.h:286
void LatLongRectToPixelRect(const double geoSW[2], const double geoNE[2], int lod, size_t pixelSW[2], size_t pixelNE[2]) const
int Insert(std::string quadkey, const unsigned char *image)
void GetTileSize(size_t &w, size_t &h) const
Definition: GeoTile.h:252
static std::string TileXYToQuadKey(size_t tileX, size_t tileY, int lod)
size_t _tile_height
Definition: GeoTile.h:282
double _MinLatitude
Definition: GeoTile.h:284
virtual void PixelXYToLatLon(size_t pixelX, size_t pixelY, int lod, double &lon, double &lat) const =0
double _MaxLatitude
Definition: GeoTile.h:285
const unsigned char * GetTile(std::string quadkey) const
size_t _tile_width
Definition: GeoTile.h:281
int MapSize(size_t pixelX0, size_t pixelY0, size_t pixelX1, size_t pixelY1, int lod, size_t &nx, size_t &ny) const
void MapSize(int lod, size_t &nx, size_t &ny) const
const unsigned char * GetTile(size_t tileX, size_t tileY, int lod) const
Definition: GeoTile.h:164
#define RENDER_API
Definition: common.h:78