提交 8cc1832429e37917df01d530ef59b2d39f768598

作者 LJH 李佳桓
1 个父辈 39118fa3

ljh

... ... @@ -82,5 +82,33 @@ namespace DmpWmts
82 82 response.sendError(500, "缩略图范围错误:(");
83 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 }
\ No newline at end of file
... ...
... ... @@ -21,6 +21,7 @@ namespace DmpWmts
21 21 DmpEsriTileProvider(const std::string& rootPath);
22 22 void WriteTile(const int row, const int col, const int level, const std::string& format, DmpServerResponse& response) override;
23 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 25 private:
25 26 std::string IntToHex8Str(const int num);
26 27 };
... ...
注册登录 后发表评论