You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.1 KiB
67 lines
1.1 KiB
#ifndef GOOGLE_TILE_H
|
|
#define GOOGLE_TILE_H
|
|
|
|
#include <opencv2/opencv.hpp>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
using std::vector;
|
|
using std::string;
|
|
|
|
struct TileIndex
|
|
{
|
|
int x;
|
|
int y;
|
|
int z;
|
|
};
|
|
|
|
struct TileBox
|
|
{
|
|
double north;
|
|
double south;
|
|
double east;
|
|
double west;
|
|
};
|
|
|
|
struct TileInfo
|
|
{
|
|
TileIndex ind;
|
|
std::string tileName;
|
|
std::string href;//相对路径
|
|
TileBox box;
|
|
};
|
|
|
|
const int TILE_SIZE = 256;
|
|
|
|
class googleTile
|
|
{
|
|
public:
|
|
googleTile();
|
|
~googleTile();
|
|
|
|
public:
|
|
// 输出kml png
|
|
void ExportGeoPng(cv::Mat _pan, TileInfo info, std::string dir);
|
|
|
|
// 输出tile
|
|
void ExportTile(cv::Mat _pan, TileInfo info, std::string dir, std::string fileString);
|
|
|
|
// 计算给定分辨率最接近的瓦片等级,mp单位 米/像素
|
|
int getZoomLevel(float mp);
|
|
|
|
|
|
private:
|
|
TileIndex LatLonToTile(double latitude, double longitude, int zoomLevel);
|
|
// 瓦片编号对应的信息
|
|
TileBox GetTileBox(TileIndex ind);
|
|
|
|
|
|
void WriteKml(vector<TileInfo> tiles,string filePath);
|
|
|
|
int zoom_;
|
|
|
|
|
|
};
|
|
|
|
#endif // GOOGLE_TILE_H
|