正在显示
2 个修改的文件
包含
33 行增加
和
3 行删除
... | ... | @@ -310,14 +310,19 @@ void DmpManagerApiHandler::GetTileServiceInfo(const DmpServerApiContext &context |
310 | 310 | |
311 | 311 | boost::property_tree::read_json(stream, pt); |
312 | 312 | path= pt.get<std::string>("projectlayers.maplayer.datasource"); |
313 | - | |
313 | + path="/mnt/d/Code/tiles"; | |
314 | 314 | confcdipath=path+"/conf.cdi"; |
315 | 315 | confxmlpath=path+"/conf.xml"; |
316 | 316 | std::ifstream fread(confxmlpath, std::ifstream::binary); |
317 | 317 | if(!fread) |
318 | 318 | { |
319 | - context.response()->write("{\"status\":\"false\",\"message\":\"获取切片配置信息失败\"}"); | |
320 | - return; | |
319 | + confxmlpath=confxmlpath=path+"/Conf.xml"; | |
320 | + std::ifstream fread(confxmlpath, std::ifstream::binary); | |
321 | + if(!fread) | |
322 | + { | |
323 | + context.response()->write("{\"status\":\"false\",\"message\":\"获取切片配置信息失败\"}"); | |
324 | + return; | |
325 | + } | |
321 | 326 | } |
322 | 327 | //读取切片配置文件conf.cdi |
323 | 328 | boost::property_tree::ptree pt_confcdi; | ... | ... |
... | ... | @@ -111,16 +111,41 @@ namespace tileserver |
111 | 111 | cairo_surface_t *image = cairo_image_surface_create_from_png_stream(cairo_read_func,&pngData); |
112 | 112 | TileProviderFactory::BufferCopy(image,surface,cr,i*256,j*256); |
113 | 113 | //cairo_surface_write_to_png (surface, "./wmts.png"); |
114 | + | |
114 | 115 | } |
116 | + | |
115 | 117 | } |
118 | + | |
119 | + cairo_surface_t *newimage=cairo_image_surface_create_from_png ("/mnt/d/56.png"); | |
120 | + | |
121 | + //cairo_arc (newcr, 128.0, 128.0, 76.8, 0, 2*3.14); | |
122 | + int w,h; | |
123 | + w = cairo_image_surface_get_width (newimage); | |
124 | + h = cairo_image_surface_get_height (newimage); | |
125 | + | |
126 | + cairo_surface_t *surface0 = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, w/2, h/2); | |
127 | + cairo_t *cr0 =cairo_create (surface0); | |
128 | + cairo_clip(cr0); | |
129 | + //cairo_scale (cr0, w/2, h/2); | |
130 | + cairo_set_source_surface (cr0, newimage, 0, 0); | |
131 | + | |
132 | + | |
133 | + cairo_paint(cr0); | |
134 | + //cairo_surface_write_to_png (surface0, "./wmts.png"); | |
135 | + cairo_surface_destroy (surface0); | |
136 | + | |
137 | + | |
116 | 138 | std::string responseData; |
117 | 139 | cairo_surface_write_to_png_stream(surface, TileProviderFactory::cairo_write_func, &responseData); |
140 | + //cairo_surface_write_to_png_stream(newimage, TileProviderFactory::cairo_write_func, &responseData); | |
118 | 141 | |
119 | 142 | response.removeHeader("Content-Type"); |
120 | 143 | std::string f = (format == "jpg") ? "image/jpg" : "image/png"; |
121 | 144 | response.setHeader("Content-Type", f); |
122 | 145 | response.write(responseData); |
123 | 146 | //response.writeContent(&responseData,imageLen); |
147 | + | |
148 | + | |
124 | 149 | cairo_destroy (cr); |
125 | 150 | cairo_surface_destroy (surface); |
126 | 151 | } | ... | ... |
请
注册
或
登录
后发表评论