正在显示
4 个修改的文件
包含
33 行增加
和
7 行删除
... | ... | @@ -312,6 +312,12 @@ void DmpManagerApiHandler::GetTileServiceInfo(const DmpServerApiContext &context |
312 | 312 | path= pt.get<std::string>("projectlayers.maplayer.datasource"); |
313 | 313 | confcdipath=path+"/conf.cdi"; |
314 | 314 | confxmlpath=path+"/conf.xml"; |
315 | + std::ifstream fread(confxmlpath, std::ifstream::binary); | |
316 | + if(!fread) | |
317 | + { | |
318 | + context.response()->write("{\"status\":\"false\",\"message\":\"获取切片配置信息失败\"}"); | |
319 | + return; | |
320 | + } | |
315 | 321 | //读取切片配置文件conf.cdi |
316 | 322 | boost::property_tree::ptree pt_confcdi; |
317 | 323 | boost::property_tree::read_xml(confcdipath,pt_confcdi); | ... | ... |
... | ... | @@ -76,7 +76,7 @@ namespace DmpWmts |
76 | 76 | dmpTileLayer->getTileMatrixSets(tileMatrixSets); |
77 | 77 | double resolution; |
78 | 78 | DmpPoint origin; |
79 | - int iLevel,xMinTile,yMinTile, xMaxTile, yMaxTile,buffLen; | |
79 | + int iLevel,xMinTile,yMinTile, xMaxTile, yMaxTile; | |
80 | 80 | if(!TileProviderFactory::GetTileScale(dmpTileLayer,iLevel,xMinTile,yMinTile, xMaxTile, yMaxTile)) |
81 | 81 | { |
82 | 82 | response.sendError(500, "缩略图范围错误:("); |
... | ... | @@ -90,9 +90,12 @@ namespace DmpWmts |
90 | 90 | { |
91 | 91 | for(int j=0;j<=heigth;j++) |
92 | 92 | { |
93 | - std::string strBuff; | |
94 | - GetTile(yMaxTile+j,xMinTile+i,iLevel,strBuff,buffLen); | |
95 | - | |
93 | + std::string filepath; | |
94 | + if(GetTile(yMaxTile+j,xMinTile+i,iLevel,format,filepath)) | |
95 | + { | |
96 | + cairo_surface_t* image = cairo_image_surface_create_from_png( filepath.c_str()); | |
97 | + TileProviderFactory::BufferCopy(image,surface,cr,i*256,j*256); | |
98 | + } | |
96 | 99 | //TileProviderFactory::BufferCopy(image,surface,cr,i*256,j*256); |
97 | 100 | //cairo_surface_write_to_png (surface, "./wmts.png"); |
98 | 101 | } |
... | ... | @@ -107,8 +110,19 @@ namespace DmpWmts |
107 | 110 | cairo_destroy (cr); |
108 | 111 | cairo_surface_destroy (surface); |
109 | 112 | } |
110 | - bool DmpEsriTileProvider::GetTile(int row, int col, int level,std::string& refbuff,int& length ) | |
113 | + bool DmpEsriTileProvider::GetTile(const int row,const int col,const int level,const std::string& format,std::string& reTilePath) | |
111 | 114 | { |
115 | + std::string level_str = "L" + DmpWmtsUtils::IntToFormatStr(level); | |
116 | + std::string row_str = "R" + IntToHex8Str(row); | |
117 | + std::string col_str = "C" + IntToHex8Str(col); | |
118 | + | |
119 | + reTilePath = rootPath_ + level_str + "/"+ row_str+"/"+ col_str + "." + format; | |
112 | 120 | |
121 | + std::ifstream fread(reTilePath, std::ifstream::binary); | |
122 | + if(!fread) | |
123 | + { | |
124 | + return false; | |
125 | + } | |
126 | + | |
113 | 127 | } |
114 | 128 | } |
\ No newline at end of file | ... | ... |
... | ... | @@ -21,7 +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 | + bool GetTile(const int row,const int col,const int level,const std::string& format,std::string& reTilePath); | |
25 | 25 | private: |
26 | 26 | std::string IntToHex8Str(const int num); |
27 | 27 | }; | ... | ... |
... | ... | @@ -105,6 +105,12 @@ namespace DmpWmts |
105 | 105 | iLevel=id; |
106 | 106 | resolution=relus; |
107 | 107 | break; |
108 | + } | |
109 | + else if(leviter==tileLevels.cbegin()&&(heigth+1)*(width+1)>=9) | |
110 | + { | |
111 | + iLevel=id; | |
112 | + resolution=relus; | |
113 | + break; | |
108 | 114 | } |
109 | 115 | } |
110 | 116 | } |
... | ... | @@ -145,7 +151,7 @@ namespace DmpWmts |
145 | 151 | } |
146 | 152 | if(cr==NULL) |
147 | 153 | { |
148 | - cr = cairo_create (pClsCSTo); | |
154 | + cr = cairo_create (pClsCSTo); | |
149 | 155 | } |
150 | 156 | cairo_set_source_surface(cr, pClsCSFrom, x, y); |
151 | 157 | cairo_paint(cr); | ... | ... |
请
注册
或
登录
后发表评论