正在显示
2 个修改的文件
包含
29 行增加
和
0 行删除
| @@ -82,5 +82,33 @@ namespace DmpWmts | @@ -82,5 +82,33 @@ namespace DmpWmts | ||
| 82 | response.sendError(500, "缩略图范围错误:("); | 82 | response.sendError(500, "缩略图范围错误:("); |
| 83 | return; | 83 | return; |
| 84 | } | 84 | } |
| 85 | + int heigth=abs(yMaxTile-yMinTile); | ||
| 86 | + int width=abs(xMaxTile-xMinTile); | ||
| 87 | + cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 256*(width+1), 256*(heigth+1)); | ||
| 88 | + cairo_t *cr =cairo_create (surface); | ||
| 89 | + for( int i = 0 ; i <= width ; i++ ) | ||
| 90 | + { | ||
| 91 | + for(int j=0;j<=heigth;j++) | ||
| 92 | + { | ||
| 93 | + std::string strBuff; | ||
| 94 | + GetTile(yMaxTile+j,xMinTile+i,iLevel,strBuff,buffLen); | ||
| 95 | + | ||
| 96 | + //TileProviderFactory::BufferCopy(image,surface,cr,i*256,j*256); | ||
| 97 | + //cairo_surface_write_to_png (surface, "./wmts.png"); | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + std::string responseData; | ||
| 101 | + cairo_surface_write_to_png_stream(surface, TileProviderFactory::cairo_write_func, &responseData); | ||
| 102 | + | ||
| 103 | + response.removeHeader("Content-Type"); | ||
| 104 | + std::string f = (format == "jpg") ? "image/jpg" : "image/png"; | ||
| 105 | + response.setHeader("Content-Type", f); | ||
| 106 | + response.write(responseData); | ||
| 107 | + cairo_destroy (cr); | ||
| 108 | + cairo_surface_destroy (surface); | ||
| 109 | + } | ||
| 110 | + bool DmpEsriTileProvider::GetTile(int row, int col, int level,std::string& refbuff,int& length ) | ||
| 111 | + { | ||
| 112 | + | ||
| 85 | } | 113 | } |
| 86 | } | 114 | } |
| @@ -21,6 +21,7 @@ namespace DmpWmts | @@ -21,6 +21,7 @@ namespace DmpWmts | ||
| 21 | DmpEsriTileProvider(const std::string& rootPath); | 21 | DmpEsriTileProvider(const std::string& rootPath); |
| 22 | void WriteTile(const int row, const int col, const int level, const std::string& format, DmpServerResponse& response) override; | 22 | void WriteTile(const int row, const int col, const int level, const std::string& format, DmpServerResponse& response) override; |
| 23 | void GetTileThumbnail(DmpTileLayer* dmpTileLayer,DmpServerResponse& response) override; | 23 | void GetTileThumbnail(DmpTileLayer* dmpTileLayer,DmpServerResponse& response) override; |
| 24 | + bool GetTile(const int row,const int col,const int level,std::string& rebuff,int& length); | ||
| 24 | private: | 25 | private: |
| 25 | std::string IntToHex8Str(const int num); | 26 | std::string IntToHex8Str(const int num); |
| 26 | }; | 27 | }; |
请
注册
或
登录
后发表评论