正在显示
11 个修改的文件
包含
257 行增加
和
257 行删除
... | ... | @@ -8,14 +8,14 @@ |
8 | 8 | |
9 | 9 | DmpPgsqlUtils::DmpPgsqlUtils() |
10 | 10 | {} |
11 | - DmpPgsqlUtils::DmpPgsqlUtils( const char* strConn_,std::string& Msg_) | |
11 | + DmpPgsqlUtils::DmpPgsqlUtils( const char* strConn,std::string& Msg) | |
12 | 12 | { |
13 | 13 | //std::string strconn_="hostaddr=172.26.99.160 prot=5432 dbname='DmapServer' user='postgres' password='chinadci'"; |
14 | - conn_=strConn_; | |
14 | + conn_=strConn; | |
15 | 15 | basepconn_=PQconnectdb(conn_); |
16 | 16 | if(PQstatus(basepconn_)!=CONNECTION_OK) |
17 | 17 | { |
18 | - Msg_= (std::string)PQerrorMessage(basepconn_); | |
18 | + Msg= (std::string)PQerrorMessage(basepconn_); | |
19 | 19 | } |
20 | 20 | } |
21 | 21 | DmpPgsqlUtils::~DmpPgsqlUtils() |
... | ... | @@ -32,9 +32,9 @@ |
32 | 32 | exit(1); |
33 | 33 | } |
34 | 34 | |
35 | - bool DmpPgsqlUtils::GetDMapServices(std::map<int,DMapService> &dmapServices_,std::string& Msg_) | |
35 | + bool DmpPgsqlUtils::GetDMapServices(std::map<int,DMapService> &dmapServices,std::string& Msg) | |
36 | 36 | { |
37 | - PGresult *res_; | |
37 | + PGresult *res; | |
38 | 38 | const char* strsql="SELECT name, title, state::character, create_time, update_time, description, node::character, overview, type, service_guid, catalog_guid FROM public.dmap_service where type='WMTS'"; |
39 | 39 | //char* conn_="hostaddr=172.26.60.100 port=5432 dbname=dmap_manager_test user=postgres password=chinadci"; |
40 | 40 | //PGconn* pconn_=PQconnectdb(conn_); |
... | ... | @@ -44,26 +44,26 @@ |
44 | 44 | PQfinish(basepconn_); |
45 | 45 | return false; |
46 | 46 | } |
47 | - res_ = PQexec(basepconn_,strsql); | |
48 | - int tuple_num=PQntuples(res_); | |
49 | - int field_num=PQnfields(res_); | |
47 | + res = PQexec(basepconn_,strsql); | |
48 | + int tuple_num=PQntuples(res); | |
49 | + int field_num=PQnfields(res); | |
50 | 50 | if(tuple_num>0) |
51 | 51 | { |
52 | 52 | for(int i=0;i<tuple_num;i++) |
53 | 53 | { |
54 | - std::string name_=PQgetvalue(res_,i,0); | |
55 | - std::string state_=PQgetvalue(res_,i,2); | |
56 | - std::string createtime_=PQgetvalue(res_,i,3); | |
57 | - std::string type_=PQgetvalue(res_,i,8); | |
58 | - std::string serviceguid_=PQgetvalue(res_,i,9); | |
54 | + std::string name=PQgetvalue(res,i,0); | |
55 | + std::string state=PQgetvalue(res,i,2); | |
56 | + std::string createtime=PQgetvalue(res,i,3); | |
57 | + std::string type=PQgetvalue(res,i,8); | |
58 | + std::string serviceguid=PQgetvalue(res,i,9); | |
59 | 59 | DMapService service{ |
60 | - .name=name_, | |
61 | - .state=state_, | |
62 | - .create_time=createtime_, | |
63 | - .type=type_, | |
64 | - .service_guid=serviceguid_ | |
60 | + .name=name, | |
61 | + .state=state, | |
62 | + .create_time=createtime, | |
63 | + .type=type, | |
64 | + .service_guid=serviceguid | |
65 | 65 | }; |
66 | - dmapServices_[i]=service; | |
66 | + dmapServices[i]=service; | |
67 | 67 | } |
68 | 68 | |
69 | 69 | } |
... | ... | @@ -71,170 +71,170 @@ |
71 | 71 | { |
72 | 72 | return false; |
73 | 73 | } |
74 | - PQclear(res_); | |
74 | + PQclear(res); | |
75 | 75 | return true; |
76 | 76 | } |
77 | - bool DmpPgsqlUtils::GetDMapService(DMapService &dmapService_,const std::string& servicename_,std::string& Msg_) | |
77 | + bool DmpPgsqlUtils::GetDMapService(DMapService &dmapService,const std::string& servicename,std::string& Msg) | |
78 | 78 | { |
79 | - PGresult *res_; | |
80 | - std::string strsql_="SELECT name, title, state::character, create_time, update_time, description, node::character, overview, type, service_guid, catalog_guid FROM public.dmap_service where name='"+servicename_+"'"; | |
81 | - const char* csql_=strsql_.c_str(); | |
79 | + PGresult *res; | |
80 | + std::string strsql="SELECT name, title, state::character, create_time, update_time, description, node::character, overview, type, service_guid, catalog_guid FROM public.dmap_service where name='"+servicename+"'"; | |
81 | + const char* csql=strsql.c_str(); | |
82 | 82 | if(PQstatus(basepconn_)!=CONNECTION_OK) |
83 | 83 | { |
84 | - std::string Msg_= (std::string)PQerrorMessage(basepconn_); | |
84 | + std::string Msg= (std::string)PQerrorMessage(basepconn_); | |
85 | 85 | PQfinish(basepconn_); |
86 | 86 | return false; |
87 | 87 | } |
88 | - res_ = PQexec(basepconn_,csql_); | |
89 | - int tuple_num=PQntuples(res_); | |
90 | - int field_num=PQnfields(res_); | |
88 | + res = PQexec(basepconn_,csql); | |
89 | + int tuple_num=PQntuples(res); | |
90 | + int field_num=PQnfields(res); | |
91 | 91 | if(tuple_num==1) |
92 | 92 | { |
93 | - std::string name_=PQgetvalue(res_,0,0); | |
94 | - std::string state_=PQgetvalue(res_,0,2); | |
95 | - std::string createtime_=PQgetvalue(res_,0,3); | |
96 | - std::string type_=PQgetvalue(res_,0,8); | |
97 | - std::string serviceguid_=PQgetvalue(res_,0,9); | |
93 | + std::string name=PQgetvalue(res,0,0); | |
94 | + std::string state=PQgetvalue(res,0,2); | |
95 | + std::string createtime=PQgetvalue(res,0,3); | |
96 | + std::string type=PQgetvalue(res,0,8); | |
97 | + std::string serviceguid=PQgetvalue(res,0,9); | |
98 | 98 | DMapService service{ |
99 | - .name=name_, | |
100 | - .state=state_, | |
101 | - .create_time=createtime_, | |
102 | - .type=type_, | |
103 | - .service_guid=serviceguid_ | |
99 | + .name=name, | |
100 | + .state=state, | |
101 | + .create_time=createtime, | |
102 | + .type=type, | |
103 | + .service_guid=serviceguid | |
104 | 104 | }; |
105 | - dmapService_=service; | |
105 | + dmapService=service; | |
106 | 106 | } |
107 | 107 | else |
108 | 108 | { |
109 | 109 | return false; |
110 | 110 | } |
111 | - PQclear(res_); | |
111 | + PQclear(res); | |
112 | 112 | return true; |
113 | 113 | } |
114 | 114 | |
115 | - bool DmpPgsqlUtils::GetDMapwmts(const std::string& serviceGuid_,DMapWmtsService& resWmts_,std::string& Msg_) | |
115 | + bool DmpPgsqlUtils::GetDMapwmts(const std::string& serviceGuid,DMapWmtsService& resWmts,std::string& Msg) | |
116 | 116 | { |
117 | 117 | //char* conn_="hostaddr=172.26.60.100 port=5432 dbname=dmap_manager_test user=postgres password=chinadci"; |
118 | - std::string strsql_="SELECT name, wmts_type, vendor, create_time::character, crs, datasource, metadata_url, scheme_guid FROM public.dmap_wmts where guid='"+serviceGuid_+"'"; | |
119 | - const char* csql_=strsql_.c_str(); | |
118 | + std::string strsql="SELECT name, wmts_type, vendor, create_time::character, crs, datasource, metadata_url, scheme_guid FROM public.dmap_wmts where guid='"+serviceGuid+"'"; | |
119 | + const char* csql=strsql.c_str(); | |
120 | 120 | |
121 | 121 | //PGconn* pconn_=PQconnectdb(conn_); |
122 | 122 | if(PQstatus(basepconn_)!=CONNECTION_OK) |
123 | 123 | { |
124 | - std::string Msg_= (std::string)PQerrorMessage(basepconn_); | |
124 | + std::string Msg= (std::string)PQerrorMessage(basepconn_); | |
125 | 125 | PQfinish(basepconn_); |
126 | 126 | return false; |
127 | 127 | } |
128 | - PGresult *res_; | |
129 | - res_ = PQexec(basepconn_,csql_); | |
130 | - int tuple_num=PQntuples(res_); | |
131 | - int field_num=PQnfields(res_); | |
128 | + PGresult *res; | |
129 | + res = PQexec(basepconn_,csql); | |
130 | + int tuple_num=PQntuples(res); | |
131 | + int field_num=PQnfields(res); | |
132 | 132 | |
133 | 133 | if(tuple_num>0) |
134 | 134 | { |
135 | - resWmts_.name=PQgetvalue(res_,0,0); | |
136 | - resWmts_.type=PQgetvalue(res_,0,1); | |
137 | - std::string v=PQgetvalue(res_,0,2); | |
138 | - resWmts_.vendor=StringToVendor(v); | |
139 | - resWmts_.create_time=PQgetvalue(res_,0,3); | |
140 | - resWmts_.crs=PQgetvalue(res_,0,4); | |
141 | - resWmts_.datasource=PQgetvalue(res_,0,5); | |
142 | - resWmts_.metadata_url=PQgetvalue(res_,0,6); | |
143 | - resWmts_.tile_id= PQgetvalue(res_,0,7); | |
135 | + resWmts.name=PQgetvalue(res,0,0); | |
136 | + resWmts.type=PQgetvalue(res,0,1); | |
137 | + std::string v=PQgetvalue(res,0,2); | |
138 | + resWmts.vendor=StringToVendor(v); | |
139 | + resWmts.create_time=PQgetvalue(res,0,3); | |
140 | + resWmts.crs=PQgetvalue(res,0,4); | |
141 | + resWmts.datasource=PQgetvalue(res,0,5); | |
142 | + resWmts.metadata_url=PQgetvalue(res,0,6); | |
143 | + resWmts.tile_id= PQgetvalue(res,0,7); | |
144 | 144 | } |
145 | 145 | else |
146 | 146 | { |
147 | 147 | return false; |
148 | 148 | } |
149 | - PQclear(res_); | |
149 | + PQclear(res); | |
150 | 150 | return true; |
151 | 151 | } |
152 | - bool DmpPgsqlUtils::GetDMapwmtsFromName(const std::string& serviceName_, DMapWmtsService& resWmts_,std::string& Msg_) | |
152 | + bool DmpPgsqlUtils::GetDMapwmtsFromName(const std::string& serviceName, DMapWmtsService& resWmts,std::string& Msg) | |
153 | 153 | { |
154 | - std::string strsql_="SELECT name, wmts_type, vendor, create_time::character, crs, datasource, metadata_url,layer_name, layer_alias, layer_title, layer_style, layer_format, layer_extent, scheme_guid FROM public.dmap_wmts where name='"+serviceName_+"'"; | |
155 | - const char* csql_=strsql_.c_str(); | |
154 | + std::string strsql="SELECT name, wmts_type, vendor, create_time::character, crs, datasource, metadata_url,layer_name, layer_alias, layer_title, layer_style, layer_format, layer_extent, scheme_guid FROM public.dmap_wmts where name='"+serviceName+"'"; | |
155 | + const char* csql=strsql.c_str(); | |
156 | 156 | |
157 | 157 | //PGconn* pconn_=PQconnectdb(conn_); |
158 | 158 | if(PQstatus(basepconn_)!=CONNECTION_OK) |
159 | 159 | { |
160 | - std::string Msg_= (std::string)PQerrorMessage(basepconn_); | |
160 | + std::string Msg= (std::string)PQerrorMessage(basepconn_); | |
161 | 161 | PQfinish(basepconn_); |
162 | 162 | return false; |
163 | 163 | } |
164 | - PGresult *res_; | |
165 | - res_ = PQexec(basepconn_,csql_); | |
166 | - int tuple_num=PQntuples(res_); | |
167 | - int field_num=PQnfields(res_); | |
164 | + PGresult *res; | |
165 | + res = PQexec(basepconn_,csql); | |
166 | + int tuple_num=PQntuples(res); | |
167 | + int field_num=PQnfields(res); | |
168 | 168 | |
169 | 169 | if(tuple_num>0) |
170 | 170 | { |
171 | - resWmts_.name=PQgetvalue(res_,0,0); | |
172 | - resWmts_.type=PQgetvalue(res_,0,1); | |
173 | - std::string v=PQgetvalue(res_,0,2); | |
174 | - resWmts_.vendor=StringToVendor(v); | |
175 | - resWmts_.create_time=PQgetvalue(res_,0,3); | |
176 | - resWmts_.crs=PQgetvalue(res_,0,4); | |
177 | - resWmts_.datasource=PQgetvalue(res_,0,5); | |
178 | - resWmts_.metadata_url=PQgetvalue(res_,0,6); | |
179 | - resWmts_.layername=PQgetvalue(res_,0,7); | |
180 | - resWmts_.layer_alias=PQgetvalue(res_,0,8); | |
181 | - resWmts_.layer_tile=PQgetvalue(res_,0,9); | |
182 | - resWmts_.layer_style=PQgetvalue(res_,0,10); | |
183 | - resWmts_.layer_format=PQgetvalue(res_,0,11); | |
184 | - resWmts_.layer_extent=PQgetvalue(res_,0,12); | |
185 | - resWmts_.tile_id= PQgetvalue(res_,0,13); | |
171 | + resWmts.name=PQgetvalue(res,0,0); | |
172 | + resWmts.type=PQgetvalue(res,0,1); | |
173 | + std::string v=PQgetvalue(res,0,2); | |
174 | + resWmts.vendor=StringToVendor(v); | |
175 | + resWmts.create_time=PQgetvalue(res,0,3); | |
176 | + resWmts.crs=PQgetvalue(res,0,4); | |
177 | + resWmts.datasource=PQgetvalue(res,0,5); | |
178 | + resWmts.metadata_url=PQgetvalue(res,0,6); | |
179 | + resWmts.layername=PQgetvalue(res,0,7); | |
180 | + resWmts.layer_alias=PQgetvalue(res,0,8); | |
181 | + resWmts.layer_tile=PQgetvalue(res,0,9); | |
182 | + resWmts.layer_style=PQgetvalue(res,0,10); | |
183 | + resWmts.layer_format=PQgetvalue(res,0,11); | |
184 | + resWmts.layer_extent=PQgetvalue(res,0,12); | |
185 | + resWmts.tile_id= PQgetvalue(res,0,13); | |
186 | 186 | } |
187 | 187 | else |
188 | 188 | { |
189 | 189 | return false; |
190 | 190 | } |
191 | - PQclear(res_); | |
191 | + PQclear(res); | |
192 | 192 | return true; |
193 | 193 | } |
194 | - bool DmpPgsqlUtils::GetTileScheme(const std::string& guid_,TileScheme& tileScheme_,std::string& Msg_) | |
194 | + bool DmpPgsqlUtils::GetTileScheme(const std::string& guid,TileScheme& tileScheme,std::string& Msg) | |
195 | 195 | { |
196 | - std::string strsql_="SELECT guid, name, alias, description, crs, crs_wkt, extent, top_left, levels, dpi::character, rows::character, cols::character, update_time, parameter FROM public.dmap_tile_scheme where guid='"+guid_+"'"; | |
197 | - const char* csql_=strsql_.c_str(); | |
196 | + std::string strsql="SELECT guid, name, alias, description, crs, crs_wkt, extent, top_left, levels, dpi::character, rows::character, cols::character, update_time, parameter FROM public.dmap_tile_scheme where guid='"+guid+"'"; | |
197 | + const char* csql=strsql.c_str(); | |
198 | 198 | |
199 | 199 | //PGconn* pconn_=PQconnectdb(conn_); |
200 | 200 | if(PQstatus(basepconn_)!=CONNECTION_OK) |
201 | 201 | { |
202 | - std::string Msg_= (std::string)PQerrorMessage(basepconn_); | |
202 | + std::string Msg= (std::string)PQerrorMessage(basepconn_); | |
203 | 203 | PQfinish(basepconn_); |
204 | 204 | return false; |
205 | 205 | } |
206 | - PGresult *res_; | |
207 | - res_ = PQexec(basepconn_,csql_); | |
208 | - int tuple_num=PQntuples(res_); | |
209 | - int field_num=PQnfields(res_); | |
206 | + PGresult *res; | |
207 | + res = PQexec(basepconn_,csql); | |
208 | + int tuple_num=PQntuples(res); | |
209 | + int field_num=PQnfields(res); | |
210 | 210 | |
211 | 211 | if(tuple_num>0) |
212 | 212 | { |
213 | - tileScheme_.guid=PQgetvalue(res_,0,0); | |
214 | - tileScheme_.name=PQgetvalue(res_,0,1); | |
215 | - tileScheme_.crs=PQgetvalue(res_,0,4); | |
216 | - tileScheme_.wkt=PQgetvalue(res_,0,5); | |
217 | - tileScheme_.layer_extent=PQgetvalue(res_,0,6); | |
218 | - tileScheme_.top_left=PQgetvalue(res_,0,7); | |
219 | - tileScheme_.levels=PQgetvalue(res_,0,8); | |
220 | - tileScheme_.dpi=PQgetvalue(res_,0,9); | |
221 | - tileScheme_.rows=PQgetvalue(res_,0,10); | |
222 | - tileScheme_.cols=PQgetvalue(res_,0,11); | |
213 | + tileScheme.guid=PQgetvalue(res,0,0); | |
214 | + tileScheme.name=PQgetvalue(res,0,1); | |
215 | + tileScheme.crs=PQgetvalue(res,0,4); | |
216 | + tileScheme.wkt=PQgetvalue(res,0,5); | |
217 | + tileScheme.layer_extent=PQgetvalue(res,0,6); | |
218 | + tileScheme.top_left=PQgetvalue(res,0,7); | |
219 | + tileScheme.levels=PQgetvalue(res,0,8); | |
220 | + tileScheme.dpi=PQgetvalue(res,0,9); | |
221 | + tileScheme.rows=PQgetvalue(res,0,10); | |
222 | + tileScheme.cols=PQgetvalue(res,0,11); | |
223 | 223 | } |
224 | 224 | else |
225 | 225 | { |
226 | 226 | return false; |
227 | 227 | } |
228 | - PQclear(res_); | |
228 | + PQclear(res); | |
229 | 229 | return true; |
230 | 230 | } |
231 | - bool DmpPgsqlUtils::CreatServerPTree(const DMapService &dmapServices_,const DMapWmtsService& resWmts_,boost::property_tree::ptree& pt_root) | |
231 | + bool DmpPgsqlUtils::CreatServerPTree(const DMapService &dmapServices,const DMapWmtsService& resWmts,boost::property_tree::ptree& pt_root) | |
232 | 232 | { |
233 | 233 | boost::property_tree::ptree pt_properties; |
234 | - pt_root.add("serviceName",dmapServices_.name); | |
235 | - pt_root.add("mapType",dmapServices_.type); | |
236 | - pt_root.add("state",dmapServices_.state); | |
237 | - pt_root.add("capabilities",dmapServices_.type+"Server"); | |
234 | + pt_root.add("serviceName",dmapServices.name); | |
235 | + pt_root.add("mapType",dmapServices.type); | |
236 | + pt_root.add("state",dmapServices.state); | |
237 | + pt_root.add("capabilities",dmapServices.type+"Server"); | |
238 | 238 | pt_root.add_child("properties",pt_properties); |
239 | 239 | pt_properties.add("filePath","postgresql"); |
240 | 240 | pt_properties.add("maxScale",""); |
... | ... | @@ -243,40 +243,40 @@ |
243 | 243 | //pt_service.add("typeName",atoi(dmpwmtsservices_.type.c_str())); |
244 | 244 | pt_service.add("typeName",0); |
245 | 245 | pt_service.add("enabled","true"); |
246 | - pt_service.add("properties.tileVersion",resWmts_.vendor); | |
247 | - pt_service.add("properties.tilePath",resWmts_.datasource); | |
246 | + pt_service.add("properties.tileVersion",resWmts.vendor); | |
247 | + pt_service.add("properties.tilePath",resWmts.datasource); | |
248 | 248 | pt_service.add("capabilities",""); |
249 | 249 | pt_services.push_back(std::make_pair("", pt_service)); |
250 | 250 | pt_root.put_child("services",pt_services); |
251 | 251 | return true; |
252 | 252 | } |
253 | - bool DmpPgsqlUtils::GetDMapServices(DMapService &dmapService_,const std::string serviceName_,std::string& Msg_) | |
253 | + bool DmpPgsqlUtils::GetDMapServices(DMapService &dmapService,const std::string serviceName,std::string& Msg) | |
254 | 254 | { |
255 | - PGresult *res_; | |
255 | + PGresult *res; | |
256 | 256 | const char* strsql="SELECT name, title, state::character, create_time, update_time, description, node::character, overview, type, service_guid, catalog_guid FROM public.dmap_service where type='WMTS'"; |
257 | 257 | //char* conn_="hostaddr=172.26.60.100 port=5432 dbname=dmap_manager_test user=postgres password=chinadci"; |
258 | 258 | //PGconn* pconn_=PQconnectdb(conn_); |
259 | 259 | if(PQstatus(basepconn_)!=CONNECTION_OK) |
260 | 260 | { |
261 | - std::string Msg_= (std::string)PQerrorMessage(basepconn_); | |
261 | + std::string Msg= (std::string)PQerrorMessage(basepconn_); | |
262 | 262 | PQfinish(basepconn_); |
263 | 263 | return false; |
264 | 264 | } |
265 | - res_ = PQexec(basepconn_,strsql); | |
266 | - int tuple_num=PQntuples(res_); | |
265 | + res = PQexec(basepconn_,strsql); | |
266 | + int tuple_num=PQntuples(res); | |
267 | 267 | if(tuple_num>0) |
268 | 268 | { |
269 | - dmapService_.name=PQgetvalue(res_,0,0); | |
270 | - dmapService_.state=PQgetvalue(res_,0,2); | |
271 | - dmapService_.create_time=PQgetvalue(res_,0,3); | |
272 | - dmapService_.type=PQgetvalue(res_,0,8); | |
273 | - dmapService_.service_guid=PQgetvalue(res_,0,9); | |
269 | + dmapService.name=PQgetvalue(res,0,0); | |
270 | + dmapService.state=PQgetvalue(res,0,2); | |
271 | + dmapService.create_time=PQgetvalue(res,0,3); | |
272 | + dmapService.type=PQgetvalue(res,0,8); | |
273 | + dmapService.service_guid=PQgetvalue(res,0,9); | |
274 | 274 | } |
275 | 275 | else |
276 | 276 | { |
277 | 277 | return false; |
278 | 278 | } |
279 | - PQclear(res_); | |
279 | + PQclear(res); | |
280 | 280 | return true; |
281 | 281 | } |
282 | 282 | ... | ... |
... | ... | @@ -68,15 +68,15 @@ |
68 | 68 | DmpPgsqlUtils(); |
69 | 69 | ~DmpPgsqlUtils(); |
70 | 70 | |
71 | - void do_exit(PGconn *conn_); | |
71 | + void do_exit(PGconn *conn); | |
72 | 72 | //bool ExecuteQuery(const std::string& sqlstr,resMap& resMap_,std::string& Msg_); |
73 | - bool GetDMapServices(std::map<int,DMapService> &dmapServices_,std::string& Msg_); | |
74 | - bool GetDMapService(DMapService &dmapService_,const std::string& servicename_,std::string& Msg_); | |
75 | - bool GetDMapwmts(const std::string& serviceGuid_, DMapWmtsService& resWmts_,std::string& Msg_); | |
76 | - bool GetDMapwmtsFromName(const std::string& serviceName_, DMapWmtsService& resWmts_,std::string& Msg_); | |
77 | - bool GetTileScheme(const std::string& guid_, TileScheme& tileScheme_,std::string& Msg_); | |
78 | - bool CreatServerPTree(const DMapService &dmapServices_,const DMapWmtsService& resWmts_,boost::property_tree::ptree& pt_root); | |
79 | - bool GetDMapServices(DMapService &dmapService_,const std::string serviceName_,std::string& Msg_); | |
73 | + bool GetDMapServices(std::map<int,DMapService> &dmapServices,std::string& Msg); | |
74 | + bool GetDMapService(DMapService &dmapService,const std::string& servicename,std::string& Msg); | |
75 | + bool GetDMapwmts(const std::string& serviceGuid, DMapWmtsService& resWmts,std::string& Msg); | |
76 | + bool GetDMapwmtsFromName(const std::string& serviceName, DMapWmtsService& resWmts,std::string& Msg); | |
77 | + bool GetTileScheme(const std::string& guid, TileScheme& tileScheme,std::string& Msg); | |
78 | + bool CreatServerPTree(const DMapService &dmapServices,const DMapWmtsService& resWmts,boost::property_tree::ptree& pt_root); | |
79 | + bool GetDMapServices(DMapService &dmapService,const std::string serviceName,std::string& Msg); | |
80 | 80 | std::string StringToVendor(const std::string str); |
81 | 81 | }; |
82 | 82 | ... | ... |
... | ... | @@ -145,11 +145,11 @@ bool DmpServerManager::stopService(const std::string &serverName, const std::str |
145 | 145 | } |
146 | 146 | bool DmpServerManager::LoadServices() |
147 | 147 | { |
148 | - boost::property_tree::ptree pt_,ptList_; | |
148 | + boost::property_tree::ptree pt,ptList; | |
149 | 149 | |
150 | - const std::string url_="http://172.26.60.100:8841/API/Service/TileService/Reload"; | |
151 | - std::string strContent_=DmpHttp::get(url_); | |
152 | - if(strContent_.length()==0) | |
150 | + const std::string url="http://172.26.60.100:8841/API/Service/TileService/Reload"; | |
151 | + std::string strContent=DmpHttp::get(url); | |
152 | + if(strContent.length()==0) | |
153 | 153 | { |
154 | 154 | return false; |
155 | 155 | } |
... | ... | @@ -162,21 +162,21 @@ bool DmpServerManager::LoadServices() |
162 | 162 | // } |
163 | 163 | //boost::property_tree::read_json("./example.txt", pt_); |
164 | 164 | |
165 | - std::stringstream ssData_; | |
166 | - ssData_<<strContent_.c_str(); | |
167 | - boost::property_tree::read_json(ssData_, pt_); | |
168 | - int iCount_ = std::atoi(pt_.get<std::string>("data.count").c_str()); | |
169 | - if(iCount_>0) | |
165 | + std::stringstream ssData; | |
166 | + ssData<<strContent.c_str(); | |
167 | + boost::property_tree::read_json(ssData, pt); | |
168 | + int iCount = std::atoi(pt.get<std::string>("data.count").c_str()); | |
169 | + if(iCount>0) | |
170 | 170 | { |
171 | - ptList_=pt_.get_child("data.list"); | |
172 | - for (auto& e : ptList_) | |
171 | + ptList=pt.get_child("data.list"); | |
172 | + for (auto& e : ptList) | |
173 | 173 | { |
174 | - std::string name_=e.second.get<std::string>("name"); | |
175 | - std::string title_ = e.second.get<std::string>("title"); | |
176 | - std::string type_ = e.second.get<std::string>("type"); | |
177 | - int capabilities_ =e.second.get<int>("capabilities"); | |
178 | - std::string project_ = e.second.get<std::string>("project"); | |
179 | - this->publish(type_,name_,capabilities_,project_); | |
174 | + std::string name = e.second.get<std::string>("name"); | |
175 | + std::string title = e.second.get<std::string>("title"); | |
176 | + std::string type = e.second.get<std::string>("type"); | |
177 | + int capabilities =e.second.get<int>("capabilities"); | |
178 | + std::string project = e.second.get<std::string>("project"); | |
179 | + this->publish(type,name,capabilities,project); | |
180 | 180 | } |
181 | 181 | } |
182 | 182 | return true; | ... | ... |
... | ... | @@ -35,38 +35,38 @@ namespace DmpTms |
35 | 35 | |
36 | 36 | if(context.request()->isRestful()) |
37 | 37 | { |
38 | - std::string path_=context.request()->path(); | |
39 | - std::vector<std::string> vec_; | |
40 | - boost::split(vec_,context.request()->path(),boost::is_any_of("/"),boost::token_compress_on); | |
41 | - int isize_=vec_.size(); | |
42 | - if(isize_<4) | |
38 | + std::string path=context.request()->path(); | |
39 | + std::vector<std::string> vec; | |
40 | + boost::split(vec,context.request()->path(),boost::is_any_of("/"),boost::token_compress_on); | |
41 | + int isize=vec.size(); | |
42 | + if(isize<4) | |
43 | 43 | { |
44 | 44 | context.response()->write("Tms,Operation is null"); |
45 | 45 | return; |
46 | 46 | } |
47 | - std::string::size_type idx0_,idx1_; | |
48 | - idx0_=vec_[isize_-1].find("png"); | |
49 | - idx1_=vec_[isize_-1].find("jpg"); | |
47 | + std::string::size_type idx0,idx1; | |
48 | + idx0=vec[isize-1].find("png"); | |
49 | + idx1=vec[isize-1].find("jpg"); | |
50 | 50 | |
51 | - if((idx0_!=std::string::npos)||(idx1_!=std::string::npos)) | |
51 | + if((idx0!=std::string::npos)||(idx1!=std::string::npos)) | |
52 | 52 | { |
53 | - std::vector<std::string> vec0_; | |
54 | - boost::split(vec0_,vec_[isize_-1],boost::is_any_of("."),boost::token_compress_on); | |
55 | - int tileCol_=atoi(vec0_[0].c_str()); | |
56 | - int tileRow_=atoi(vec_[isize_-2].c_str()); | |
57 | - int tileMatrix_=atoi(vec_[isize_-3].c_str()); | |
53 | + std::vector<std::string> vec0; | |
54 | + boost::split(vec0,vec[isize-1],boost::is_any_of("."),boost::token_compress_on); | |
55 | + int tileCol=atoi(vec0[0].c_str()); | |
56 | + int tileRow=atoi(vec[isize-2].c_str()); | |
57 | + int tileMatrix=atoi(vec[isize-3].c_str()); | |
58 | 58 | const DmpProject *project = context.project(); |
59 | - DmpTileLayer *tileLayer = static_cast<DmpTileLayer *>(project->getLayer("layer")); | |
60 | - std::string format_=vec0_[1].c_str(); | |
61 | - std::string filePath_=tileLayer->getDataSource(); | |
62 | - if(filePath_.empty()) | |
59 | + DmpTileLayer *tileLayer = static_cast<DmpTileLayer *>(project->getLayer()); | |
60 | + std::string format=vec0[1].c_str(); | |
61 | + std::string filePath=tileLayer->getDataSource(); | |
62 | + if(filePath.empty()) | |
63 | 63 | { |
64 | 64 | context.response()->write("Tms,Operation is null"); |
65 | 65 | } |
66 | 66 | else |
67 | 67 | { |
68 | - DmpTmsTileProvider provider_=DmpTmsTileProvider(filePath_); | |
69 | - provider_.WriteTile(tileRow_, tileCol_, tileMatrix_, format_, *context.response()); | |
68 | + DmpTmsTileProvider provider_=DmpTmsTileProvider(filePath); | |
69 | + provider_.WriteTile(tileRow, tileCol, tileMatrix, format, *context.response()); | |
70 | 70 | } |
71 | 71 | } |
72 | 72 | else | ... | ... |
... | ... | @@ -12,11 +12,11 @@ namespace DmpTms |
12 | 12 | { |
13 | 13 | DmpTmsTileProvider::DmpTmsTileProvider(const std::string& root_path) |
14 | 14 | { |
15 | - file_rootPath=root_path; | |
15 | + file_rootPath_=root_path; | |
16 | 16 | } |
17 | 17 | void DmpTmsTileProvider::WriteTile(const int row, const int col, const int level, const std::string& format, DmpServerResponse& response) |
18 | 18 | { |
19 | - std::string tile_path = file_rootPath+"/"+std::to_string(level)+"/"+std::to_string(row)+"/"+std::to_string(col)+"."+format; | |
19 | + std::string tile_path = file_rootPath_+"/"+std::to_string(level)+"/"+std::to_string(row)+"/"+std::to_string(col)+"."+format; | |
20 | 20 | std::ifstream fread(tile_path, std::ifstream::binary); |
21 | 21 | if(!fread) |
22 | 22 | { | ... | ... |
... | ... | @@ -21,7 +21,7 @@ namespace DmpTms |
21 | 21 | DmpTmsTileProvider(const std::string& root_path); |
22 | 22 | void WriteTile(const int row, const int col, const int level, const std::string& format, DmpServerResponse& response) ; |
23 | 23 | protected: |
24 | - std::string file_rootPath; | |
24 | + std::string file_rootPath_; | |
25 | 25 | }; |
26 | 26 | } |
27 | 27 | ... | ... |
... | ... | @@ -52,56 +52,56 @@ namespace DmpWmts |
52 | 52 | return; |
53 | 53 | } |
54 | 54 | } |
55 | - void DmpCapabiliTilesOperation::WriteCapabilities(boost::property_tree::ptree& pt_,const std::string& host_,const std::string& servicename,DmpServerResponse& response) | |
55 | + void DmpCapabiliTilesOperation::WriteCapabilities(boost::property_tree::ptree& pt,const std::string& host,const std::string& servicename,DmpServerResponse& response) | |
56 | 56 | { |
57 | 57 | //构建能力文档 |
58 | - boost::property_tree::ptree pt_root_,pt_TileMatrix_; | |
59 | - CreateGetCapabilitiesDocument(host_,servicename,pt_root_); | |
60 | - pt_root_.add("Capabilities.Contents.Layer.ows:Title",pt_.get<std::string>("Layer.ows:Title")); | |
61 | - pt_root_.add("Capabilities.Contents.Layer.ows:Abstract",pt_.get<std::string>("Layer.ows:Abstract")); | |
62 | - pt_root_.add("Capabilities.Contents.Layer.ows:Identifier",pt_.get<std::string>("Layer.ows:Identifier")); | |
58 | + boost::property_tree::ptree pt_root,pt_TileMatrix; | |
59 | + CreateGetCapabilitiesDocument(host,servicename,pt_root); | |
60 | + pt_root.add("Capabilities.Contents.Layer.ows:Title",pt.get<std::string>("Layer.ows:Title")); | |
61 | + pt_root.add("Capabilities.Contents.Layer.ows:Abstract",pt.get<std::string>("Layer.ows:Abstract")); | |
62 | + pt_root.add("Capabilities.Contents.Layer.ows:Identifier",pt.get<std::string>("Layer.ows:Identifier")); | |
63 | 63 | //pt_root_.add("Capabilities.Contents.Layer.Style.<xmlattr>.isDefault",pt_.get<std::string>("Layer.Style.<xmlattr>.isDefault")); |
64 | - pt_root_.add("Capabilities.Contents.Layer.Style",pt_.get<std::string>("Layer.Style")); | |
65 | - pt_root_.add("Capabilities.Contents.Layer.Format",pt_.get<std::string>("Layer.Format")); | |
66 | - pt_root_.add("Capabilities.Contents.Layer.TileMatrixSetLink.TileMatrixSet",pt_.get<std::string>("Layer.TileMatrixSetLink.TileMatrixSet")); | |
64 | + pt_root.add("Capabilities.Contents.Layer.Style",pt.get<std::string>("Layer.Style")); | |
65 | + pt_root.add("Capabilities.Contents.Layer.Format",pt.get<std::string>("Layer.Format")); | |
66 | + pt_root.add("Capabilities.Contents.Layer.TileMatrixSetLink.TileMatrixSet",pt.get<std::string>("Layer.TileMatrixSetLink.TileMatrixSet")); | |
67 | 67 | |
68 | - boost::property_tree::ptree pt_TileMatrixSet_; | |
69 | - pt_TileMatrixSet_.add("ows:Identifier",pt_.get<std::string>("TileMatrixSet.ows:Identifier")); | |
70 | - pt_TileMatrixSet_.add("ows:SupportedCRS",pt_.get<std::string>("TileMatrixSet.ows:SupportedCRS")); | |
71 | - pt_TileMatrixSet_.add("TileWidth",pt_.get<std::string>("TileMatrixSet.TileWidth")); | |
72 | - pt_TileMatrixSet_.add("TileHeight",pt_.get<std::string>("TileMatrixSet.TileHeight")); | |
73 | - pt_TileMatrixSet_.add("TopLeftCorner",pt_.get<std::string>("TileMatrixSet.TopLeftCorner")); | |
74 | - pt_TileMatrixSet_.add("Dpi",pt_.get<std::string>("TileMatrixSet.DPI")); | |
68 | + boost::property_tree::ptree pt_TileMatrixSet; | |
69 | + pt_TileMatrixSet.add("ows:Identifier",pt.get<std::string>("TileMatrixSet.ows:Identifier")); | |
70 | + pt_TileMatrixSet.add("ows:SupportedCRS",pt.get<std::string>("TileMatrixSet.ows:SupportedCRS")); | |
71 | + pt_TileMatrixSet.add("TileWidth",pt.get<std::string>("TileMatrixSet.TileWidth")); | |
72 | + pt_TileMatrixSet.add("TileHeight",pt.get<std::string>("TileMatrixSet.TileHeight")); | |
73 | + pt_TileMatrixSet.add("TopLeftCorner",pt.get<std::string>("TileMatrixSet.TopLeftCorner")); | |
74 | + pt_TileMatrixSet.add("Dpi",pt.get<std::string>("TileMatrixSet.DPI")); | |
75 | 75 | |
76 | 76 | //pt_TileMatrix_=pt_.get_child("TileMatrixSet.TileMatrix"); |
77 | - pt_TileMatrix_=pt_.get_child("TileMatrixSet.Levels"); | |
78 | - int i=pt_TileMatrix_.size(); | |
79 | - boost::property_tree::ptree::iterator pos_ = pt_TileMatrix_.begin(); | |
80 | - for (; pos_ != pt_TileMatrix_.end(); ++pos_ ) | |
77 | + pt_TileMatrix=pt.get_child("TileMatrixSet.Levels"); | |
78 | + int i=pt_TileMatrix.size(); | |
79 | + boost::property_tree::ptree::iterator pos = pt_TileMatrix.begin(); | |
80 | + for (; pos != pt_TileMatrix.end(); ++pos ) | |
81 | 81 | { |
82 | - boost::property_tree::ptree pt_level_; | |
83 | - boost::property_tree::ptree ptTile_ = pos_->second; | |
84 | - std::string level_=ptTile_.get<std::string>("level"); | |
85 | - std::string scale_=ptTile_.get<std::string>("scale"); | |
86 | - std::string resolution_=ptTile_.get<std::string>("resolution"); | |
87 | - pt_level_.add("ows:Identifier",level_); | |
88 | - pt_level_.add("ows:ScaleDenominator",scale_); | |
89 | - pt_level_.add("ows:Resolution",resolution_); | |
82 | + boost::property_tree::ptree pt_level; | |
83 | + boost::property_tree::ptree ptTile = pos->second; | |
84 | + std::string level=ptTile.get<std::string>("level"); | |
85 | + std::string scale=ptTile.get<std::string>("scale"); | |
86 | + std::string resolution=ptTile.get<std::string>("resolution"); | |
87 | + pt_level.add("ows:Identifier",level); | |
88 | + pt_level.add("ows:ScaleDenominator",scale); | |
89 | + pt_level.add("ows:Resolution",resolution); | |
90 | 90 | |
91 | - pt_TileMatrixSet_.add_child("TileMatrix",pt_level_); | |
91 | + pt_TileMatrixSet.add_child("TileMatrix",pt_level); | |
92 | 92 | } |
93 | - pt_root_.add_child("Capabilities.Contents.TileMatrixSet",pt_TileMatrixSet_); | |
93 | + pt_root.add_child("Capabilities.Contents.TileMatrixSet",pt_TileMatrixSet); | |
94 | 94 | //pt_root_.add("Capabilities.Contents.TileMatrixSet.TileMatrix.ows:Identifier",pt_.get<std::string>("TileMatrixSet.TileMatrix.ows:Identifier")); |
95 | 95 | //pt_root_.add("Capabilities.Contents.TileMatrixSet.TileMatrix.TopLeftCorner",pt_.get<std::string>("TileMatrixSet.TileMatrix.TopLeftCorner")); |
96 | - std::string http_cap0_="http://"+host_+"/DMap/Services/"+servicename+"/TileServer/WMTSService/1.0.0/WMTSCapabilities.xml"; | |
97 | - pt_root_.add("Capabilities.ServiceMetadataURL.<xmlattr>.xlink:href",http_cap0_); | |
96 | + std::string http_cap0="http://"+host+"/DMap/Services/"+servicename+"/TileServer/WMTSService/1.0.0/WMTSCapabilities.xml"; | |
97 | + pt_root.add("Capabilities.ServiceMetadataURL.<xmlattr>.xlink:href",http_cap0); | |
98 | 98 | |
99 | 99 | //写入流 |
100 | 100 | std::stringstream ss; |
101 | - boost::property_tree::write_xml(ss,pt_root_); | |
102 | - std::string strExtent_=ss.str(); | |
101 | + boost::property_tree::write_xml(ss,pt_root); | |
102 | + std::string strExtent=ss.str(); | |
103 | 103 | response.setHeader("Content-Type", "application/xml;charset=utf-8"); |
104 | - response.write(strExtent_); | |
104 | + response.write(strExtent); | |
105 | 105 | return; |
106 | 106 | /* |
107 | 107 | //文件流代换写入 |
... | ... | @@ -138,7 +138,7 @@ namespace DmpWmts |
138 | 138 | void DmpCapabiliTilesOperation::GetCapabilitiesDocument(DmpServerResponse& response) |
139 | 139 | { |
140 | 140 | } |
141 | - void DmpCapabiliTilesOperation::CreateGetCapabilitiesDocument(const std::string& host_,const std::string& servicename,boost::property_tree::ptree& pt) | |
141 | + void DmpCapabiliTilesOperation::CreateGetCapabilitiesDocument(const std::string& host,const std::string& servicename,boost::property_tree::ptree& pt) | |
142 | 142 | { |
143 | 143 | pt.add("Capabilities.<xmlattr>.xmlns",WMTS_NAMESPACE); |
144 | 144 | pt.add("Capabilities.<xmlattr>.xmlns:gml",GML_NAMESPACE); |
... | ... | @@ -153,7 +153,7 @@ namespace DmpWmts |
153 | 153 | pt.add_child("Capabilities.ows:ServiceIdentification",pt_Identification); |
154 | 154 | GetServiceProviderElement(pt_Provider); |
155 | 155 | pt.add_child("Capabilities.ows:ServiceProvider",pt_Provider); |
156 | - GetServiceMetadataElement(host_,servicename,pt_Metadata); | |
156 | + GetServiceMetadataElement(host,servicename,pt_Metadata); | |
157 | 157 | pt.add_child("Capabilities.ows:OperationsMetadata",pt_Metadata); |
158 | 158 | //pt.add("Capabilities.Contents.Layer",servicename); |
159 | 159 | |
... | ... | @@ -178,38 +178,38 @@ namespace DmpWmts |
178 | 178 | pt.add("ows:ServiceContact.ows:ContactInfo.ows:Phone","020-87578877"); |
179 | 179 | } |
180 | 180 | |
181 | - void DmpCapabiliTilesOperation:: GetServiceMetadataElement(const std::string& host_,const std::string& servicename,boost::property_tree::ptree& pt) | |
181 | + void DmpCapabiliTilesOperation:: GetServiceMetadataElement(const std::string& host,const std::string& servicename,boost::property_tree::ptree& pt) | |
182 | 182 | { |
183 | 183 | //localhost:8080/DMap/Services/GDWMTS/MapServer/WMTSServer?request=GetCapabilities |
184 | - std::string http_cap0_="http://"+host_+"/DMap/Services/"+servicename+"/TileServer/WMTSService/1.0.0/WMTSCapabilities.xml"; | |
185 | - std::string http_cap1_="http://"+host_+"/DMap/Services/"+servicename+"/TileServer/WMTSService?"; | |
186 | - std::string http_cap2_="http://"+host_+"/DMap/Services/"+servicename+"/TileServer/WMTSService/1.0.0/"; | |
187 | - boost::property_tree::ptree pt_child0_,pt_child1_; | |
184 | + std::string http_cap0="http://"+host+"/DMap/Services/"+servicename+"/TileServer/WMTSService/1.0.0/WMTSCapabilities.xml"; | |
185 | + std::string http_cap1="http://"+host+"/DMap/Services/"+servicename+"/TileServer/WMTSService?"; | |
186 | + std::string http_cap2="http://"+host+"/DMap/Services/"+servicename+"/TileServer/WMTSService/1.0.0/"; | |
187 | + boost::property_tree::ptree pt_child0,pt_child1; | |
188 | 188 | |
189 | - pt_child0_.add("<xmlattr>.name","GetCapabilities"); | |
190 | - boost::property_tree::ptree pt_child00_,pt_child01_; | |
191 | - pt_child00_.add("ows:HTTP.ows:Get.<xmlattr>.xlink:href",http_cap0_); | |
192 | - pt_child00_.add("ows:HTTP.ows:Get.ows:Constraint.<xmlattr>.name","GetEncoding"); | |
193 | - pt_child00_.add("ows:HTTP.ows:Get.ows:Constraint.ows:AllowedValues.ows:Value","RESTful"); | |
194 | - pt_child0_.add_child("ows:DCP",pt_child00_); | |
189 | + pt_child0.add("<xmlattr>.name","GetCapabilities"); | |
190 | + boost::property_tree::ptree pt_child00,pt_child01; | |
191 | + pt_child00.add("ows:HTTP.ows:Get.<xmlattr>.xlink:href",http_cap0); | |
192 | + pt_child00.add("ows:HTTP.ows:Get.ows:Constraint.<xmlattr>.name","GetEncoding"); | |
193 | + pt_child00.add("ows:HTTP.ows:Get.ows:Constraint.ows:AllowedValues.ows:Value","RESTful"); | |
194 | + pt_child0.add_child("ows:DCP",pt_child00); | |
195 | 195 | |
196 | - pt_child01_.add("ows:HTTP.ows:Get.<xmlattr>.xlink:href",http_cap1_); | |
197 | - pt_child01_.add("ows:HTTP.ows:Get.ows:Constraint.<xmlattr>.name","GetEncoding"); | |
198 | - pt_child01_.add("ows:HTTP.ows:Get.ows:Constraint.ows:AllowedValues.ows:Value","KVP"); | |
199 | - pt_child0_.add_child("ows:DCP",pt_child01_); | |
200 | - pt.add_child("ows:Operation",pt_child0_); | |
196 | + pt_child01.add("ows:HTTP.ows:Get.<xmlattr>.xlink:href",http_cap1); | |
197 | + pt_child01.add("ows:HTTP.ows:Get.ows:Constraint.<xmlattr>.name","GetEncoding"); | |
198 | + pt_child01.add("ows:HTTP.ows:Get.ows:Constraint.ows:AllowedValues.ows:Value","KVP"); | |
199 | + pt_child0.add_child("ows:DCP",pt_child01); | |
200 | + pt.add_child("ows:Operation",pt_child0); | |
201 | 201 | |
202 | - pt_child1_.add("<xmlattr>.name","GetTile"); | |
203 | - boost::property_tree::ptree pt_child10_,pt_child11_; | |
204 | - pt_child10_.add("ows:HTTP.ows:Get.<xmlattr>.xlink:href",http_cap2_); | |
205 | - pt_child10_.add("ows:HTTP.ows:Get.ows:Constraint.<xmlattr>.name","GetEncoding"); | |
206 | - pt_child10_.add("ows:HTTP.ows:Get.ows:Constraint.ows:AllowedValues.ows:Value","RESTful"); | |
207 | - pt_child1_.add_child("ows:DCP",pt_child10_); | |
208 | - pt_child11_.add("ows:HTTP.ows:Get.<xmlattr>.xlink:href",http_cap1_); | |
209 | - pt_child11_.add("ows:HTTP.ows:Get.ows:Constraint.<xmlattr>.name","GetEncoding"); | |
210 | - pt_child11_.add("ows:HTTP.ows:Get.ows:Constraint.ows:AllowedValues.ows:Value","KVP"); | |
211 | - pt_child1_.add_child("ows:DCP",pt_child11_); | |
212 | - pt.add_child("ows:Operation",pt_child1_); | |
202 | + pt_child1.add("<xmlattr>.name","GetTile"); | |
203 | + boost::property_tree::ptree pt_child10,pt_child11; | |
204 | + pt_child10.add("ows:HTTP.ows:Get.<xmlattr>.xlink:href",http_cap2); | |
205 | + pt_child10.add("ows:HTTP.ows:Get.ows:Constraint.<xmlattr>.name","GetEncoding"); | |
206 | + pt_child10.add("ows:HTTP.ows:Get.ows:Constraint.ows:AllowedValues.ows:Value","RESTful"); | |
207 | + pt_child1.add_child("ows:DCP",pt_child10); | |
208 | + pt_child11.add("ows:HTTP.ows:Get.<xmlattr>.xlink:href",http_cap1); | |
209 | + pt_child11.add("ows:HTTP.ows:Get.ows:Constraint.<xmlattr>.name","GetEncoding"); | |
210 | + pt_child11.add("ows:HTTP.ows:Get.ows:Constraint.ows:AllowedValues.ows:Value","KVP"); | |
211 | + pt_child1.add_child("ows:DCP",pt_child11); | |
212 | + pt.add_child("ows:Operation",pt_child1); | |
213 | 213 | } |
214 | 214 | void GetServiceTileMatrixSetElement(const std::string& servicename,boost::property_tree::ptree& pt) |
215 | 215 | { | ... | ... |
... | ... | @@ -29,22 +29,22 @@ namespace DmpWmts |
29 | 29 | std::shared_ptr<DmpTileProvider> provider; |
30 | 30 | try |
31 | 31 | { |
32 | - std::string tileVersion_= dmpTileLayer->getVector(); | |
33 | - std::string tilePath_=dmpTileLayer->getDataSource(); | |
32 | + std::string tileVersion= dmpTileLayer->getVector(); | |
33 | + std::string tilePath=dmpTileLayer->getDataSource(); | |
34 | 34 | //std::string tilePath_ = "/mnt/d/Code/tiles/gdmap/_alllayers"; |
35 | 35 | //std::string tileVersion_ = "ESRI_V1"; |
36 | - int iver_=StringToVector(tileVersion_); | |
37 | - Vector version = (Vector)boost::lexical_cast<int>(iver_); | |
36 | + int iver=StringToVector(tileVersion); | |
37 | + Vector version = (Vector)boost::lexical_cast<int>(iver); | |
38 | 38 | switch(version) |
39 | 39 | { |
40 | 40 | case Vector::ESRI_V0: |
41 | - provider = std::make_shared<DmpEsriTileProvider>(tilePath_); | |
41 | + provider = std::make_shared<DmpEsriTileProvider>(tilePath); | |
42 | 42 | break; |
43 | 43 | case Vector::ESRI_V1: |
44 | - provider = std::make_shared<DmpEsriBundleV1Provider>(tilePath_); | |
44 | + provider = std::make_shared<DmpEsriBundleV1Provider>(tilePath); | |
45 | 45 | break; |
46 | 46 | case Vector::ESRI_V2: |
47 | - provider = std::make_shared<DmpEsriBundleV2Provider>(tilePath_); | |
47 | + provider = std::make_shared<DmpEsriBundleV2Provider>(tilePath); | |
48 | 48 | break; |
49 | 49 | default: |
50 | 50 | provider = nullptr; |
... | ... | @@ -60,24 +60,24 @@ namespace DmpWmts |
60 | 60 | } |
61 | 61 | int TileProviderFactory::StringToVector(std::string& strVector) |
62 | 62 | { |
63 | - int iVector_=-1; | |
63 | + int iVector=-1; | |
64 | 64 | if(std::strcmp(strVector.c_str(),"ESRI_V0")==0) |
65 | 65 | { |
66 | - iVector_=0; | |
66 | + iVector=0; | |
67 | 67 | } |
68 | 68 | else if(std::strcmp(strVector.c_str(),"ESRI_V1")==0) |
69 | 69 | { |
70 | - iVector_=1; | |
70 | + iVector=1; | |
71 | 71 | } |
72 | 72 | else if(std::strcmp(strVector.c_str(),"ESRI_V2")==0) |
73 | 73 | { |
74 | - iVector_=2; | |
74 | + iVector=2; | |
75 | 75 | } |
76 | 76 | else |
77 | 77 | { |
78 | - iVector_=3; | |
78 | + iVector=3; | |
79 | 79 | } |
80 | - return iVector_; | |
80 | + return iVector; | |
81 | 81 | } |
82 | 82 | // CapabiliTileProviderFactory::CapabiliTileProviderFactory() |
83 | 83 | // { | ... | ... |
... | ... | @@ -82,8 +82,8 @@ namespace DmpWmts |
82 | 82 | } |
83 | 83 | else if (boost::iequals(req, "GetCapabilities")) |
84 | 84 | { |
85 | - const std::string host_=context.request()->domain()+":"+context.request()->port();; | |
86 | - const std::string servicename_=context.request()->serviceName(); | |
85 | + const std::string host=context.request()->domain()+":"+context.request()->port();; | |
86 | + const std::string servicename=context.request()->serviceName(); | |
87 | 87 | |
88 | 88 | boost::property_tree::ptree pt; |
89 | 89 | pt.add("Layer.ows:Title",tileLayer->title()); |
... | ... | @@ -100,18 +100,18 @@ namespace DmpWmts |
100 | 100 | { |
101 | 101 | pt.add("Layer.TileMatrixSetLink.TileMatrixSet",(*iter)->id()); |
102 | 102 | |
103 | - boost::property_tree::ptree ptLevels_; | |
104 | - std::vector<TileLevel*> tileLevels_=(*iter)->tileLevels(); | |
105 | - for(auto leviter=tileLevels_.cbegin();leviter!=tileLevels_.cend();leviter++) | |
103 | + boost::property_tree::ptree ptLevels; | |
104 | + std::vector<TileLevel*> tileLevels=(*iter)->tileLevels(); | |
105 | + for(auto leviter=tileLevels.cbegin();leviter!=tileLevels.cend();leviter++) | |
106 | 106 | { |
107 | - boost::property_tree::ptree pt_level_; | |
107 | + boost::property_tree::ptree pt_level; | |
108 | 108 | |
109 | - pt_level_.add("level",(*leviter)->id); | |
110 | - pt_level_.add("scale",(*leviter)->scaleDenominator); | |
111 | - pt_level_.add("resolution",(*leviter)->resolution); | |
112 | - ptLevels_.add_child("TileMatrix",pt_level_); | |
109 | + pt_level.add("level",(*leviter)->id); | |
110 | + pt_level.add("scale",(*leviter)->scaleDenominator); | |
111 | + pt_level.add("resolution",(*leviter)->resolution); | |
112 | + ptLevels.add_child("TileMatrix",pt_level); | |
113 | 113 | } |
114 | - pt.add_child("TileMatrixSet.Levels",ptLevels_); | |
114 | + pt.add_child("TileMatrixSet.Levels",ptLevels); | |
115 | 115 | pt.add("TileMatrixSet.ows:Identifier",(*iter)->id()); |
116 | 116 | pt.add("TileMatrixSet.ows:SupportedCRS",(*iter)->crs()); |
117 | 117 | pt.add("TileMatrixSet.TileWidth",(*iter)->tileCols()); |
... | ... | @@ -122,7 +122,7 @@ namespace DmpWmts |
122 | 122 | //boost::property_tree::write_json("/mnt/d/json.txt",pt); |
123 | 123 | |
124 | 124 | DmpCapabiliTilesOperation capOper; |
125 | - capOper.WriteCapabilities(pt,host_,servicename_,*context.response()); | |
125 | + capOper.WriteCapabilities(pt,host,servicename,*context.response()); | |
126 | 126 | |
127 | 127 | } |
128 | 128 | } | ... | ... |
test.txt
deleted
100644 → 0
请
注册
或
登录
后发表评论