提交 1616309c94ff6b984c9f97e2ef9976faa7ae63dd

作者 WZP 万忠平
1 个父辈 ebe9b47c

wan

@@ -135,6 +135,9 @@ std::map<std::string, DmpMapLayer*> DmpProject::mapLayers() const @@ -135,6 +135,9 @@ std::map<std::string, DmpMapLayer*> DmpProject::mapLayers() const
135 135
136 DmpMapLayer *DmpProject::getLayer(const std::string &layerName) const 136 DmpMapLayer *DmpProject::getLayer(const std::string &layerName) const
137 { 137 {
  138 + if(layerName.empty()){
  139 + return getLayer();
  140 + }
138 std::string name = boost::to_upper_copy(layerName); 141 std::string name = boost::to_upper_copy(layerName);
139 std::map<std::string, DmpMapLayer*>::const_iterator iter = mapLayers_.find(name); 142 std::map<std::string, DmpMapLayer*>::const_iterator iter = mapLayers_.find(name);
140 if (iter != mapLayers_.end()) 143 if (iter != mapLayers_.end())
@@ -145,4 +148,17 @@ DmpMapLayer *DmpProject::getLayer(const std::string &layerName) const @@ -145,4 +148,17 @@ DmpMapLayer *DmpProject::getLayer(const std::string &layerName) const
145 { 148 {
146 return nullptr; 149 return nullptr;
147 } 150 }
  151 +}
  152 +
  153 +DmpMapLayer *DmpProject::getLayer() const
  154 +{
  155 + std::map<std::string, DmpMapLayer*>::const_iterator iter = mapLayers_.begin();
  156 + if (iter != mapLayers_.end())
  157 + {
  158 + return iter->second;
  159 + }
  160 + else
  161 + {
  162 + return nullptr;
  163 + }
148 } 164 }
@@ -29,6 +29,7 @@ class CORE_EXPORT DmpProject @@ -29,6 +29,7 @@ class CORE_EXPORT DmpProject
29 DmpCoordinateReferenceSystem crs() const; 29 DmpCoordinateReferenceSystem crs() const;
30 std::map<std::string, DmpMapLayer*> mapLayers() const; 30 std::map<std::string, DmpMapLayer*> mapLayers() const;
31 DmpMapLayer* getLayer(const std::string &layerName) const; 31 DmpMapLayer* getLayer(const std::string &layerName) const;
  32 + DmpMapLayer* getLayer()const;
32 private: 33 private:
33 static DmpProject *project_; 34 static DmpProject *project_;
34 std::string projectName_; 35 std::string projectName_;
@@ -18,7 +18,7 @@ DmpApacheServerRequest::DmpApacheServerRequest(FCGX_ParamArray& evnp,FCGX_Stream @@ -18,7 +18,7 @@ DmpApacheServerRequest::DmpApacheServerRequest(FCGX_ParamArray& evnp,FCGX_Stream
18 { 18 {
19 if (strcmp(med,"POST") == 0) 19 if (strcmp(med,"POST") == 0)
20 { 20 {
21 - set_method(POST_METHOD); 21 + setMethod(POST_METHOD);
22 //获取请求中URL携带的参数 22 //获取请求中URL携带的参数
23 query_ = FCGX_GetParam("QUERY_STRING", evnp); 23 query_ = FCGX_GetParam("QUERY_STRING", evnp);
24 //获取POST请求携带的参数长度 24 //获取POST请求携带的参数长度
@@ -44,18 +44,18 @@ DmpApacheServerRequest::DmpApacheServerRequest(FCGX_ParamArray& evnp,FCGX_Stream @@ -44,18 +44,18 @@ DmpApacheServerRequest::DmpApacheServerRequest(FCGX_ParamArray& evnp,FCGX_Stream
44 { 44 {
45 //Get请求方式 45 //Get请求方式
46 query_ = FCGX_GetParam("QUERY_STRING", evnp); 46 query_ = FCGX_GetParam("QUERY_STRING", evnp);
47 - set_method(GET_METHOD); 47 + setMethod(GET_METHOD);
48 } 48 }
49 - set_query(query_);  
50 - set_path(uri); 49 + setQuery(query_);
  50 + setPath(uri);
51 //添加请求头 51 //添加请求头
52 - SetParameter("Accept", FCGX_GetParam("HTTP_ACCEPT", evnp));  
53 - SetParameter("Accept-Encoding", FCGX_GetParam("HTTP_ACCEPT_ENCODING", evnp));  
54 - SetParameter("Accept-Language", FCGX_GetParam("HTTP_ACCEPT_LANGUAGE", evnp)); 52 + setParameter("Accept", FCGX_GetParam("HTTP_ACCEPT", evnp));
  53 + setParameter("Accept-Encoding", FCGX_GetParam("HTTP_ACCEPT_ENCODING", evnp));
  54 + setParameter("Accept-Language", FCGX_GetParam("HTTP_ACCEPT_LANGUAGE", evnp));
55 //SetParameter("Cache-Control", FCGX_GetParam("HTTP_CACHE_CONTROL", evnp)); 55 //SetParameter("Cache-Control", FCGX_GetParam("HTTP_CACHE_CONTROL", evnp));
56 - SetParameter("Connection", FCGX_GetParam("HTTP_CONNECTION", evnp));  
57 - SetParameter("Host", FCGX_GetParam("HTTP_HOST", evnp));  
58 - SetParameter("User-Agent", FCGX_GetParam("HTTP_USER_AGENT", evnp)); 56 + setParameter("Connection", FCGX_GetParam("HTTP_CONNECTION", evnp));
  57 + setParameter("Host", FCGX_GetParam("HTTP_HOST", evnp));
  58 + setParameter("User-Agent", FCGX_GetParam("HTTP_USER_AGENT", evnp));
59 59
60 } 60 }
61 61
@@ -69,7 +69,7 @@ DmpApacheServerRequest::DmpApacheServerRequest(CgiENV &env) @@ -69,7 +69,7 @@ DmpApacheServerRequest::DmpApacheServerRequest(CgiENV &env)
69 { 69 {
70 if (strcmp(med,"POST") == 0) 70 if (strcmp(med,"POST") == 0)
71 { 71 {
72 - set_method(POST_METHOD); 72 + setMethod(POST_METHOD);
73 //获取请求中URL携带的参数 73 //获取请求中URL携带的参数
74 query_ = env.QUERY_STRING; 74 query_ = env.QUERY_STRING;
75 //获取POST请求携带的参数长度 75 //获取POST请求携带的参数长度
@@ -97,18 +97,18 @@ DmpApacheServerRequest::DmpApacheServerRequest(CgiENV &env) @@ -97,18 +97,18 @@ DmpApacheServerRequest::DmpApacheServerRequest(CgiENV &env)
97 { 97 {
98 //Get请求方式 98 //Get请求方式
99 query_ = env.QUERY_STRING; 99 query_ = env.QUERY_STRING;
100 - set_method(GET_METHOD); 100 + setMethod(GET_METHOD);
101 } 101 }
102 } 102 }
103 - set_query(query_);  
104 - set_path(env.REQUEST_URI); 103 + setQuery(query_);
  104 + setPath(env.REQUEST_URI);
105 //添加请求头 105 //添加请求头
106 - SetParameter("Accept", env.HTTP_ACCEPT);  
107 - SetParameter("Accept-Encoding", env.HTTP_ACCEPT_ENCODING); 106 + setParameter("Accept", env.HTTP_ACCEPT);
  107 + setParameter("Accept-Encoding", env.HTTP_ACCEPT_ENCODING);
108 //SetParameter("Accept-Language", env.HTTP_ACCEPT_LANGUAGE); 108 //SetParameter("Accept-Language", env.HTTP_ACCEPT_LANGUAGE);
109 //SetParameter("Connection", env.HTTP_CONNECTION); 109 //SetParameter("Connection", env.HTTP_CONNECTION);
110 - SetParameter("Host", env.HTTP_HOST);  
111 - SetParameter("User-Agent", env.HTTP_USER_AGENT); 110 + setParameter("Host", env.HTTP_HOST);
  111 + setParameter("User-Agent", env.HTTP_USER_AGENT);
112 112
113 113
114 } 114 }
@@ -50,7 +50,7 @@ bool DmpMainServer::Init() @@ -50,7 +50,7 @@ bool DmpMainServer::Init()
50 serverManager_->init(module_path_); 50 serverManager_->init(module_path_);
51 51
52 #ifdef HAVE_SERVER_PYTHON_PLUGINS 52 #ifdef HAVE_SERVER_PYTHON_PLUGINS
53 - InitPython(); 53 + InitPython();
54 #endif 54 #endif
55 55
56 initialized_ = true; 56 initialized_ = true;
@@ -60,7 +60,7 @@ bool DmpMainServer::Init() @@ -60,7 +60,7 @@ bool DmpMainServer::Init()
60 60
61 void DmpMainServer::HandleRequest(DmpServerRequest &request, DmpServerResponse &response) 61 void DmpMainServer::HandleRequest(DmpServerRequest &request, DmpServerResponse &response)
62 { 62 {
63 - LOGGER_DEBUG("DmpMainServer: HandleRequest"); 63 + LOGGER_DEBUG("DmpMainServer: HandleRequest");
64 DmpFilterResponseDecorator responseDecorator(server_interface_->Filters(), response); 64 DmpFilterResponseDecorator responseDecorator(server_interface_->Filters(), response);
65 DmpRequestHandler requestHandler(request, response); 65 DmpRequestHandler requestHandler(request, response);
66 try 66 try
@@ -69,7 +69,7 @@ void DmpMainServer::HandleRequest(DmpServerRequest &request, DmpServerResponse & @@ -69,7 +69,7 @@ void DmpMainServer::HandleRequest(DmpServerRequest &request, DmpServerResponse &
69 } 69 }
70 catch (std::exception &ex) 70 catch (std::exception &ex)
71 { 71 {
72 - LOGGER_ERROR("Parse input exception: "); 72 + LOGGER_ERROR("Parse input exception: ");
73 } 73 }
74 74
75 // Set the request handler into the interface for plugins to manipulate it 75 // Set the request handler into the interface for plugins to manipulate it
@@ -84,38 +84,49 @@ void DmpMainServer::HandleRequest(DmpServerRequest &request, DmpServerResponse & @@ -84,38 +84,49 @@ void DmpMainServer::HandleRequest(DmpServerRequest &request, DmpServerResponse &
84 response.sendError(500, "Internal Server Error"); 84 response.sendError(500, "Internal Server Error");
85 LOGGER_ERROR(ex.what()); 85 LOGGER_ERROR(ex.what());
86 } 86 }
87 - const DmpServerParameters params = request.ServerParameters(); 87 + // const DmpServerParameters params = request.serverParameters();
88 std::shared_ptr<DmpServerApi> api = nullptr; 88 std::shared_ptr<DmpServerApi> api = nullptr;
89 - if ( params.Service().empty()) 89 + // if (params.Service().empty())
  90 + // {
  91 + // if (api = serverManager_->apiForRequest(request))
  92 + // {
  93 + // DmpServerApiContext context{&request, &responseDecorator, serverManager_};
  94 + // api->executeRequest(context);
  95 + // }
  96 + // else
  97 + // {
  98 + // LOGGER_DEBUG("DmpMainServer: getCapabilities");
  99 + // std::string capsJson = serverManager_->getCapabilities();
  100 + // response.writeJson(capsJson);
  101 + // }
  102 + // }
  103 +
  104 + std::shared_ptr<DmpServer> server = serverManager_->serverForRequest(request);
  105 + if (server)
90 { 106 {
91 - if(api = serverManager_->apiForRequest(request)) {  
92 - DmpServerApiContext context {&request, &responseDecorator, serverManager_};  
93 - api->executeRequest(context); 107 + try
  108 + {
  109 + server->executeRequest(request, responseDecorator);
94 } 110 }
95 - else {  
96 - LOGGER_DEBUG("DmpMainServer: getCapabilities");  
97 - std::string capsJson = serverManager_->getCapabilities();  
98 - response.writeJson(capsJson); 111 + catch (std::exception ex)
  112 + {
  113 +
  114 + response.sendError(500, "Internal Server Error");
  115 + LOGGER_ERROR(ex.what());
99 } 116 }
100 } 117 }
101 - else 118 + else if (api = serverManager_->apiForRequest(request))
102 { 119 {
103 - std::shared_ptr<DmpServer> server = serverManager_->serverForRequest(request);  
104 - if (server) {  
105 - try {  
106 - server->executeRequest(request,responseDecorator);  
107 - }  
108 - catch (std::exception ex) {  
109 -  
110 - response.sendError(500, "Internal Server Error");  
111 - LOGGER_ERROR(ex.what());  
112 - }  
113 - }  
114 - else {  
115 - std::string capsJson = serverManager_->getCapabilities();  
116 - response.writeJson(capsJson);  
117 - } 120 + DmpServerApiContext context{&request, &responseDecorator, serverManager_};
  121 + api->executeRequest(context);
118 } 122 }
  123 + else
  124 + {
  125 + LOGGER_DEBUG("DmpMainServer: getCapabilities");
  126 + std::string capsJson = serverManager_->getCapabilities();
  127 + response.writeJson(capsJson);
  128 + }
  129 +
119 130
120 try 131 try
121 { 132 {
@@ -32,7 +32,7 @@ void DmpRequestHandler::ParseInput() @@ -32,7 +32,7 @@ void DmpRequestHandler::ParseInput()
32 ParameterMap DmpRequestHandler::Parameters() const 32 ParameterMap DmpRequestHandler::Parameters() const
33 { 33 {
34 ParameterMap params; 34 ParameterMap params;
35 - for (auto &item : request_.ServerParameters().Parameters()) { 35 + for (auto &item : request_.serverParameters().parameters()) {
36 std::map<std::string, std::string>::iterator iter; 36 std::map<std::string, std::string>::iterator iter;
37 params[item.first] = item.second; 37 params[item.first] = item.second;
38 } 38 }
@@ -41,7 +41,7 @@ ParameterMap DmpRequestHandler::Parameters() const @@ -41,7 +41,7 @@ ParameterMap DmpRequestHandler::Parameters() const
41 41
42 void DmpRequestHandler::SetParameter(const std::string &name, const std::string &value) 42 void DmpRequestHandler::SetParameter(const std::string &name, const std::string &value)
43 { 43 {
44 - request_.SetParameter(name, value); 44 + request_.setParameter(name, value);
45 } 45 }
46 46
47 ParameterMap DmpRequestHandler::RequestHeaders() const 47 ParameterMap DmpRequestHandler::RequestHeaders() const
@@ -26,7 +26,7 @@ public: @@ -26,7 +26,7 @@ public:
26 virtual std::string path() const = 0; 26 virtual std::string path() const = 0;
27 virtual std::string capability() const = 0; 27 virtual std::string capability() const = 0;
28 virtual bool accept(const std::string &url); 28 virtual bool accept(const std::string &url);
29 - virtual void executeRequest(const DmpServerRequest &request, DmpServerResponse &response) = 0; 29 + virtual void executeRequest(DmpServerRequest &request, DmpServerResponse &response) = 0;
30 30
31 virtual bool publish(const std::string &serviceName, unsigned int capability, const DmpProject &project); 31 virtual bool publish(const std::string &serviceName, unsigned int capability, const DmpProject &project);
32 virtual bool remove(const std::string &serviceName); 32 virtual bool remove(const std::string &serviceName);
@@ -15,17 +15,17 @@ DmpServerParameters::DmpServerParameters() @@ -15,17 +15,17 @@ DmpServerParameters::DmpServerParameters()
15 { 15 {
16 } 16 }
17 17
18 -DmpServerParameters::DmpServerParameters(const std::string &query_string) 18 +DmpServerParameters::DmpServerParameters(const std::string &queryString)
19 { 19 {
20 - SetQueryString(query_string); 20 + setQueryString(queryString);
21 } 21 }
22 22
23 -void DmpServerParameters::SetQueryString(const std::string &query_string) 23 +void DmpServerParameters::setQueryString(const std::string &queryString)
24 { 24 {
25 - params_ = QueryString::parse(query_string); 25 + params_ = QueryString::parse(queryString);
26 } 26 }
27 27
28 -std::string DmpServerParameters::Service() const 28 +std::string DmpServerParameters::service() const
29 { 29 {
30 std::map<std::string, std::string>::const_iterator iter = params_.find("Service"); 30 std::map<std::string, std::string>::const_iterator iter = params_.find("Service");
31 if (iter != params_.end()) { 31 if (iter != params_.end()) {
@@ -35,7 +35,7 @@ std::string DmpServerParameters::Service() const @@ -35,7 +35,7 @@ std::string DmpServerParameters::Service() const
35 } 35 }
36 } 36 }
37 37
38 -std::string DmpServerParameters::Request() const 38 +std::string DmpServerParameters::request() const
39 { 39 {
40 std::map<std::string, std::string>::const_iterator iter = params_.find("request"); 40 std::map<std::string, std::string>::const_iterator iter = params_.find("request");
41 if (iter != params_.end()) { 41 if (iter != params_.end()) {
@@ -46,7 +46,7 @@ std::string DmpServerParameters::Request() const @@ -46,7 +46,7 @@ std::string DmpServerParameters::Request() const
46 } 46 }
47 } 47 }
48 48
49 -std::string DmpServerParameters::Version() const 49 +std::string DmpServerParameters::version() const
50 { 50 {
51 std::map<std::string, std::string>::const_iterator iter = params_.find("version"); 51 std::map<std::string, std::string>::const_iterator iter = params_.find("version");
52 if (iter != params_.end()) { 52 if (iter != params_.end()) {
@@ -57,17 +57,17 @@ std::string DmpServerParameters::Version() const @@ -57,17 +57,17 @@ std::string DmpServerParameters::Version() const
57 } 57 }
58 } 58 }
59 59
60 -void DmpServerParameters::Clear() 60 +void DmpServerParameters::clear()
61 { 61 {
62 params_.clear(); 62 params_.clear();
63 } 63 }
64 64
65 -void DmpServerParameters::Add(const std::string &key, const std::string &value) 65 +void DmpServerParameters::add(const std::string &key, const std::string &value)
66 { 66 {
67 params_[key] = value; 67 params_[key] = value;
68 } 68 }
69 69
70 -void DmpServerParameters::Remove(const std::string &key) 70 +void DmpServerParameters::remove(const std::string &key)
71 { 71 {
72 std::map<std::string, std::string>::iterator iter; 72 std::map<std::string, std::string>::iterator iter;
73 iter = params_.find(key); 73 iter = params_.find(key);
@@ -76,7 +76,7 @@ void DmpServerParameters::Remove(const std::string &key) @@ -76,7 +76,7 @@ void DmpServerParameters::Remove(const std::string &key)
76 } 76 }
77 } 77 }
78 78
79 -void DmpServerParameters::GetValue(const std::string &key, std::string &value) 79 +void DmpServerParameters::getValue(const std::string &key, std::string &value)
80 { 80 {
81 std::map<std::string, std::string>::iterator iter; 81 std::map<std::string, std::string>::iterator iter;
82 iter = params_.find(key); 82 iter = params_.find(key);
@@ -29,20 +29,20 @@ class SERVER_EXPORT DmpServerParameters @@ -29,20 +29,20 @@ class SERVER_EXPORT DmpServerParameters
29 { 29 {
30 public: 30 public:
31 DmpServerParameters(); 31 DmpServerParameters();
32 - DmpServerParameters(const std::string &query_string); 32 + DmpServerParameters(const std::string &queryString);
33 virtual ~DmpServerParameters() {}; 33 virtual ~DmpServerParameters() {};
34 34
35 - void Add(const std::string &key, const std::string &value);  
36 - void Remove(const std::string &key);  
37 - void GetValue(const std::string &key, std::string &value);  
38 - void Clear(); 35 + void add(const std::string &key, const std::string &value);
  36 + void remove(const std::string &key);
  37 + void getValue(const std::string &key, std::string &value);
  38 + void clear();
39 39
40 - CIMap Parameters() const { return params_ ;}  
41 - void SetQueryString(const std::string &query_string); 40 + CIMap parameters() const { return params_ ;}
  41 + void setQueryString(const std::string &queryString);
42 42
43 - std::string Service() const;  
44 - std::string Request() const;  
45 - std::string Version() const; 43 + std::string service() const;
  44 + std::string request() const;
  45 + std::string version() const;
46 46
47 protected: 47 protected:
48 CIMap params_; 48 CIMap params_;
@@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
18 18
19 DmpServerRequest::DmpServerRequest() 19 DmpServerRequest::DmpServerRequest()
20 { 20 {
  21 + isRestful_ = false;
21 } 22 }
22 23
23 DmpServerRequest::DmpServerRequest(const std::string &url, Method method, const Headers &headers) 24 DmpServerRequest::DmpServerRequest(const std::string &url, Method method, const Headers &headers)
@@ -25,40 +26,43 @@ DmpServerRequest::DmpServerRequest(const std::string &url, Method method, const @@ -25,40 +26,43 @@ DmpServerRequest::DmpServerRequest(const std::string &url, Method method, const
25 ,method_(method) 26 ,method_(method)
26 ,headers_(headers) 27 ,headers_(headers)
27 { 28 {
  29 + isRestful_ = false;
28 } 30 }
29 31
30 -void DmpServerRequest::set_url(const std::string &url) 32 +void DmpServerRequest::setUrl(const std::string &url)
31 { 33 {
32 url_ = url; 34 url_ = url;
33 - if (!ParseUrl(url_,protocol_,domain_,port_,path_,query_)) { 35 + if (!parseUrl(url_,protocol_,domain_,port_,path_,query_)) {
34 LOGGER_ERROR("非法的URL!"); 36 LOGGER_ERROR("非法的URL!");
35 return; 37 return;
36 } 38 }
37 - set_query(query_); 39 + setQuery(query_);
38 } 40 }
39 41
40 -void DmpServerRequest::set_query(const std::string &query_string) 42 +void DmpServerRequest::setQuery(const std::string &queryString)
41 { 43 {
42 - query_ = query_string;  
43 - params_.SetQueryString(query_); 44 + query_ = queryString;
  45 + if(!isRestful()) {
  46 + params_.setQueryString(query_);
  47 + }
44 } 48 }
45 49
46 -void DmpServerRequest::set_method(Method method) 50 +void DmpServerRequest::setMethod(Method method)
47 { 51 {
48 method_ = method; 52 method_ = method;
49 } 53 }
50 54
51 -void DmpServerRequest::SetParameter(const std::string &name, const std::string &value) 55 +void DmpServerRequest::setParameter(const std::string &name, const std::string &value)
52 { 56 {
53 - params_.Add(name, value); 57 + params_.add(name, value);
54 } 58 }
55 59
56 -bool DmpServerRequest::ParseUrl(const std::string& url, 60 +bool DmpServerRequest::parseUrl(const std::string& url,
57 std::string &protocol, 61 std::string &protocol,
58 std::string &domain, 62 std::string &domain,
59 std::string &port, 63 std::string &port,
60 std::string &path, 64 std::string &path,
61 - std::string &query_string) 65 + std::string &queryString)
62 { 66 {
63 if (url.empty()) { 67 if (url.empty()) {
64 return false; 68 return false;
@@ -71,13 +75,13 @@ bool DmpServerRequest::ParseUrl(const std::string& url, @@ -71,13 +75,13 @@ bool DmpServerRequest::ParseUrl(const std::string& url,
71 domain = what[2].str(); 75 domain = what[2].str();
72 port = what[3].str(); 76 port = what[3].str();
73 path = what[4].str(); 77 path = what[4].str();
74 - query_string = what[5].str(); 78 + queryString = what[5].str();
75 return true; 79 return true;
76 } 80 }
77 return false; 81 return false;
78 } 82 }
79 83
80 -void DmpServerRequest::set_header(const std::string &name, const std::string &value) 84 +void DmpServerRequest::setHeader(const std::string &name, const std::string &value)
81 { 85 {
82 headers_[name] = value; 86 headers_[name] = value;
83 } 87 }
@@ -36,22 +36,23 @@ public: @@ -36,22 +36,23 @@ public:
36 DmpServerRequest(const std::string &url, DmpServerRequest::Method method = DmpServerRequest::GET_METHOD, const DmpServerRequest::Headers &headers = DmpServerRequest::Headers()); 36 DmpServerRequest(const std::string &url, DmpServerRequest::Method method = DmpServerRequest::GET_METHOD, const DmpServerRequest::Headers &headers = DmpServerRequest::Headers());
37 37
38 std::string url() const { return url_; } 38 std::string url() const { return url_; }
39 - void set_url(const std::string &url); 39 + void setUrl(const std::string &url);
40 Method method() const { return method_; } 40 Method method() const { return method_; }
41 - void set_method(DmpServerRequest::Method method); 41 + void setMethod(DmpServerRequest::Method method);
42 std::string protocol() const { return protocol_; } 42 std::string protocol() const { return protocol_; }
43 std::string domain() const { return domain_; } 43 std::string domain() const { return domain_; }
44 std::string port() const { return port_; } 44 std::string port() const { return port_; }
45 std::string path() const { return path_; } 45 std::string path() const { return path_; }
46 - void set_path(const std::string &path) { path_ = path;} 46 + void setPath(const std::string &path) { path_ = path;}
47 std::string query() const { return query_; } 47 std::string query() const { return query_; }
48 - void set_query(const std::string &query_string); 48 + void setQuery(const std::string &queryString);
49 std::string header( const std::string &name ) const; 49 std::string header( const std::string &name ) const;
50 - void set_header(const std::string &name, const std::string &value); 50 + void setHeader(const std::string &name, const std::string &value);
51 Headers headers() const { return headers_; } 51 Headers headers() const { return headers_; }
  52 + bool isRestful() const { return isRestful_; }
52 53
53 - DmpServerParameters ServerParameters() const { return params_; }  
54 - void SetParameter(const std::string &name, const std::string &value); 54 + DmpServerParameters serverParameters() const { return params_; }
  55 + void setParameter(const std::string &name, const std::string &value);
55 56
56 //post的数据 57 //post的数据
57 virtual const void * GetData() const; 58 virtual const void * GetData() const;
@@ -67,9 +68,10 @@ protected: @@ -67,9 +68,10 @@ protected:
67 std::string port_; 68 std::string port_;
68 std::string path_; 69 std::string path_;
69 std::string query_; 70 std::string query_;
  71 + bool isRestful_;
70 72
71 private: 73 private:
72 - bool ParseUrl(const std::string& url, 74 + bool parseUrl(const std::string& url,
73 std::string &protocol, 75 std::string &protocol,
74 std::string &domain, 76 std::string &domain,
75 std::string &port, 77 std::string &port,
@@ -28,13 +28,13 @@ DmpSpServerRequest::DmpSpServerRequest(SP_HttpRequest* request) @@ -28,13 +28,13 @@ DmpSpServerRequest::DmpSpServerRequest(SP_HttpRequest* request)
28 { 28 {
29 if (strcmp(med,"POST") == 0) 29 if (strcmp(med,"POST") == 0)
30 { 30 {
31 - set_method(POST_METHOD); 31 + setMethod(POST_METHOD);
32 data_ = request->getContent(); 32 data_ = request->getContent();
33 - data_len_ = request->getContentLength(); 33 + dataLen_ = request->getContentLength();
34 } 34 }
35 else 35 else
36 { 36 {
37 - set_method(GET_METHOD); 37 + setMethod(GET_METHOD);
38 } 38 }
39 } 39 }
40 40
@@ -44,13 +44,14 @@ DmpSpServerRequest::DmpSpServerRequest(SP_HttpRequest* request) @@ -44,13 +44,14 @@ DmpSpServerRequest::DmpSpServerRequest(SP_HttpRequest* request)
44 std::string::size_type pos = url.find("?"); 44 std::string::size_type pos = url.find("?");
45 if (pos != std::string::npos) { 45 if (pos != std::string::npos) {
46 std::string path = url.substr(0, pos); 46 std::string path = url.substr(0, pos);
47 - set_path(path);  
48 - std::string query_string;  
49 - query_string = url.substr(pos+1,url.length());  
50 - set_query(query_string); 47 + setPath(path);
  48 + std::string queryString;
  49 + queryString = url.substr(pos+1,url.length());
  50 + setQuery(queryString);
51 } 51 }
52 else { 52 else {
53 - set_path(url); 53 + isRestful_ = true;
  54 + setPath(url);
54 } 55 }
55 56
56 // for(int i=0; i< request->getParamCount(); i++) { 57 // for(int i=0; i< request->getParamCount(); i++) {
@@ -59,7 +60,7 @@ DmpSpServerRequest::DmpSpServerRequest(SP_HttpRequest* request) @@ -59,7 +60,7 @@ DmpSpServerRequest::DmpSpServerRequest(SP_HttpRequest* request)
59 60
60 //添加请求头信息 61 //添加请求头信息
61 for(int i=0; i< request->getHeaderCount(); i++) { 62 for(int i=0; i< request->getHeaderCount(); i++) {
62 - set_header(request->getHeaderName(i),request->getHeaderValue(i)); 63 + setHeader(request->getHeaderName(i),request->getHeaderValue(i));
63 } 64 }
64 } 65 }
65 66
@@ -69,5 +70,5 @@ const void * DmpSpServerRequest::GetData() const @@ -69,5 +70,5 @@ const void * DmpSpServerRequest::GetData() const
69 } 70 }
70 int DmpSpServerRequest::GetDataLength() const 71 int DmpSpServerRequest::GetDataLength() const
71 { 72 {
72 - return data_len_; 73 + return dataLen_;
73 } 74 }
@@ -25,7 +25,7 @@ public: @@ -25,7 +25,7 @@ public:
25 int GetDataLength() const override; 25 int GetDataLength() const override;
26 private: 26 private:
27 const void* data_; 27 const void* data_;
28 - int data_len_; 28 + int dataLen_;
29 }; 29 };
30 30
31 #endif 31 #endif
@@ -149,11 +149,11 @@ void DmpManagerApiHandler::startService(const DmpServerApiContext &context) cons @@ -149,11 +149,11 @@ void DmpManagerApiHandler::startService(const DmpServerApiContext &context) cons
149 { 149 {
150 case DmpServerRequest::Method::GET_METHOD: 150 case DmpServerRequest::Method::GET_METHOD:
151 { 151 {
152 - DmpServerParameters params = context.request()->ServerParameters(); 152 + DmpServerParameters params = context.request()->serverParameters();
153 std::string serverName; 153 std::string serverName;
154 - params.GetValue("servername", serverName); 154 + params.getValue("servername", serverName);
155 std::string serviceName; 155 std::string serviceName;
156 - params.GetValue("servicename",serviceName); 156 + params.getValue("servicename",serviceName);
157 context.manager()->startService(serverName, serviceName); 157 context.manager()->startService(serverName, serviceName);
158 break; 158 break;
159 } 159 }
@@ -174,11 +174,11 @@ void DmpManagerApiHandler::stopService(const DmpServerApiContext &context) const @@ -174,11 +174,11 @@ void DmpManagerApiHandler::stopService(const DmpServerApiContext &context) const
174 { 174 {
175 case DmpServerRequest::Method::GET_METHOD: 175 case DmpServerRequest::Method::GET_METHOD:
176 { 176 {
177 - DmpServerParameters params = context.request()->ServerParameters(); 177 + DmpServerParameters params = context.request()->serverParameters();
178 std::string serverName; 178 std::string serverName;
179 - params.GetValue("servername", serverName); 179 + params.getValue("servername", serverName);
180 std::string serviceName; 180 std::string serviceName;
181 - params.GetValue("servicename",serviceName); 181 + params.getValue("servicename",serviceName);
182 context.manager()->stopService(serverName, serviceName); 182 context.manager()->stopService(serverName, serviceName);
183 break; 183 break;
184 } 184 }
@@ -248,11 +248,11 @@ void DmpManagerApiHandler::deleteService(const DmpServerApiContext &context) con @@ -248,11 +248,11 @@ void DmpManagerApiHandler::deleteService(const DmpServerApiContext &context) con
248 { 248 {
249 case DmpServerRequest::Method::GET_METHOD: 249 case DmpServerRequest::Method::GET_METHOD:
250 { 250 {
251 - DmpServerParameters params = context.request()->ServerParameters(); 251 + DmpServerParameters params = context.request()->serverParameters();
252 std::string serverName; 252 std::string serverName;
253 - params.GetValue("servername", serverName); 253 + params.getValue("servername", serverName);
254 std::string serviceName; 254 std::string serviceName;
255 - params.GetValue("servicename",serviceName); 255 + params.getValue("servicename",serviceName);
256 if(context.manager()->deleteService(serverName, serviceName)) { 256 if(context.manager()->deleteService(serverName, serviceName)) {
257 context.response()->write("{\"status\":\"true\",\"message\":\"删除服务成功\"}"); 257 context.response()->write("{\"status\":\"true\",\"message\":\"删除服务成功\"}");
258 }else{ 258 }else{
@@ -406,8 +406,8 @@ void DmpManagerApiHandler::UpdateCache(const DmpServerApiContext &context)const @@ -406,8 +406,8 @@ void DmpManagerApiHandler::UpdateCache(const DmpServerApiContext &context)const
406 case DmpServerRequest::Method::GET_METHOD: 406 case DmpServerRequest::Method::GET_METHOD:
407 { 407 {
408 std::string serviceName_; 408 std::string serviceName_;
409 - const DmpServerParameters params_ (context.request()->ServerParameters());  
410 - CIMap paramsMap=params_.Parameters(); 409 + const DmpServerParameters params_ (context.request()->serverParameters());
  410 + CIMap paramsMap=params_.parameters();
411 std::map<std::string, std::string>::const_iterator iter; 411 std::map<std::string, std::string>::const_iterator iter;
412 iter =paramsMap.find("SERVICENAME"); 412 iter =paramsMap.find("SERVICENAME");
413 if (iter != paramsMap.end()) 413 if (iter != paramsMap.end())
@@ -453,8 +453,8 @@ void DmpManagerApiHandler::DeleteCache(const DmpServerApiContext &context)const @@ -453,8 +453,8 @@ void DmpManagerApiHandler::DeleteCache(const DmpServerApiContext &context)const
453 case DmpServerRequest::Method::GET_METHOD: 453 case DmpServerRequest::Method::GET_METHOD:
454 { 454 {
455 std::string serviceName_; 455 std::string serviceName_;
456 - const DmpServerParameters params_ (context.request()->ServerParameters());  
457 - CIMap paramsMap=params_.Parameters(); 456 + const DmpServerParameters params_ (context.request()->serverParameters());
  457 + CIMap paramsMap=params_.parameters();
458 std::map<std::string, std::string>::const_iterator iter; 458 std::map<std::string, std::string>::const_iterator iter;
459 iter =paramsMap.find("SERVICENAME"); 459 iter =paramsMap.find("SERVICENAME");
460 if (iter != paramsMap.end()) 460 if (iter != paramsMap.end())
@@ -49,7 +49,7 @@ std::string DmpMapServer::capability() const @@ -49,7 +49,7 @@ std::string DmpMapServer::capability() const
49 return caps; 49 return caps;
50 } 50 }
51 51
52 -void DmpMapServer::executeRequest(const DmpServerRequest &request, DmpServerResponse &response) 52 +void DmpMapServer::executeRequest(DmpServerRequest &request, DmpServerResponse &response)
53 { 53 {
54 std::string service_name; 54 std::string service_name;
55 boost::cmatch what; 55 boost::cmatch what;
@@ -36,7 +36,7 @@ public: @@ -36,7 +36,7 @@ public:
36 std::string alias() const override { return std::string("矢量地图服务");} 36 std::string alias() const override { return std::string("矢量地图服务");}
37 std::string path() const override { return std::string("^/DMap/Services/?([\\w./]*)/MapServer/([\\w]+)"); } 37 std::string path() const override { return std::string("^/DMap/Services/?([\\w./]*)/MapServer/([\\w]+)"); }
38 std::string capability() const override; 38 std::string capability() const override;
39 - void executeRequest(const DmpServerRequest &request, DmpServerResponse &response) override; 39 + void executeRequest(DmpServerRequest &request, DmpServerResponse &response) override;
40 bool publish(const std::string &serviceName, unsigned int capability, const DmpProject &project) override; 40 bool publish(const std::string &serviceName, unsigned int capability, const DmpProject &project) override;
41 bool remove(const std::string &serviceName) override; 41 bool remove(const std::string &serviceName) override;
42 bool start(const std::string &serviceName) override; 42 bool start(const std::string &serviceName) override;
@@ -53,7 +53,7 @@ std::string DmpTileServer::capability() const @@ -53,7 +53,7 @@ std::string DmpTileServer::capability() const
53 return caps; 53 return caps;
54 } 54 }
55 55
56 -void DmpTileServer::executeRequest(const DmpServerRequest &request, DmpServerResponse &response) 56 +void DmpTileServer::executeRequest(DmpServerRequest &request, DmpServerResponse &response)
57 { 57 {
58 std::string service_name; 58 std::string service_name;
59 boost::cmatch what; 59 boost::cmatch what;
@@ -62,9 +62,14 @@ void DmpTileServer::executeRequest(const DmpServerRequest &request, DmpServerRes @@ -62,9 +62,14 @@ void DmpTileServer::executeRequest(const DmpServerRequest &request, DmpServerRes
62 std::string htmlstr = "<html><head><title>Welcome to DMap Server</title></head><body><p>"; 62 std::string htmlstr = "<html><head><title>Welcome to DMap Server</title></head><body><p>";
63 if(boost::regex_match(requestPath.c_str(), what, reg)) 63 if(boost::regex_match(requestPath.c_str(), what, reg))
64 { 64 {
65 - if(what.size() == 3) { 65 + if(what.size() == 4) {
66 std::string serviceName = what[1].str(); 66 std::string serviceName = what[1].str();
67 std::string serverType = what[2].str(); 67 std::string serverType = what[2].str();
  68 + if(request.isRestful()) {
  69 + std::string queryString = what[3].str();
  70 + request.setQuery(queryString);
  71 + }
  72 + std::string queryString = what[3].str();
68 DmpService *service = services_[serverType]; 73 DmpService *service = services_[serverType];
69 if(service) { 74 if(service) {
70 DmpServerProject * serverProj = getServerProject(serviceName); 75 DmpServerProject * serverProj = getServerProject(serviceName);
@@ -34,9 +34,9 @@ public: @@ -34,9 +34,9 @@ public:
34 ~DmpTileServer(); 34 ~DmpTileServer();
35 std::string name() const override { return std::string("TileServer");} 35 std::string name() const override { return std::string("TileServer");}
36 std::string alias() const override { return std::string("瓦片服务");} 36 std::string alias() const override { return std::string("瓦片服务");}
37 - std::string path() const override { return std::string("^/DMap/Services/?([\\w./]*)/TileServer/([\\w]+)"); } 37 + std::string path() const override { return std::string("^/DMap/Services/?([\\w./]*)/TileServer/([\\w.]+)([\\w./]*)"); }
38 std::string capability() const override; 38 std::string capability() const override;
39 - void executeRequest(const DmpServerRequest &request, DmpServerResponse &response) override; 39 + void executeRequest(DmpServerRequest &request, DmpServerResponse &response) override;
40 bool publish(const std::string &serviceName, unsigned int capability, const DmpProject &project) override; 40 bool publish(const std::string &serviceName, unsigned int capability, const DmpProject &project) override;
41 bool remove(const std::string &serviceName) override; 41 bool remove(const std::string &serviceName) override;
42 bool start(const std::string &serviceName) override; 42 bool start(const std::string &serviceName) override;
@@ -41,51 +41,62 @@ namespace DmpWmts @@ -41,51 +41,62 @@ namespace DmpWmts
41 LOGGER_DEBUG("Destructing WmtsService"); 41 LOGGER_DEBUG("Destructing WmtsService");
42 } 42 }
43 43
44 - void DmpWMTSService::executeRequest(const DmpServerContext &context) 44 + void DmpWMTSService::executeRequest(const DmpServerContext &context)
45 { 45 {
46 - const DmpWmtsParameters params(context.request()->ServerParameters());  
47 - const std::string layerName = params.Layer();  
48 - const DmpProject* project = context.project();  
49 - DmpTileLayer* tileLayer = static_cast<DmpTileLayer*>(project->getLayer(layerName));  
50 - //context.response()->writeHtml("hello,wmts");  
51 -  
52 - //const DmpWmtsParameters params(context.request()->ServerParameters());  
53 - int tile_col = params.TileCol();  
54 - int tile_row = params.TileRow();  
55 - int tile_matrix = params.TileMatrix();  
56 - string req = params.Request();  
57 - DmpWmtsParameters::Format format = params.ImageFormat();  
58 - if (req.empty())  
59 - {  
60 - context.response()->writeHtml("wmts,Operation is null");  
61 - }  
62 - if (boost::iequals(req, "GetTile"))  
63 - {  
64 - string f = (format == DmpWmtsParameters::Format::JPG) ? "jpg" : "png";  
65 - std::shared_ptr<DmpTileProvider> provider = TileProviderFactory::GetProvider(tileLayer);  
66 - provider->WriteTile(tile_row, tile_col, tile_matrix, f, *context.response());  
67 - }  
68 - else if (boost::iequals(req, "GetCapabilities"))  
69 - {  
70 -  
71 - } 46 + DmpWmtsParameters *params = nullptr;
  47 + if (context.request()->isRestful()){
  48 + params = new DmpWmtsParameters(context.request()->query());
  49 + }
  50 + else {
  51 + params = new DmpWmtsParameters(context.request()->serverParameters());
  52 + }
  53 + std::string layerName = params->Layer();
  54 + int tileCol = params->TileCol();
  55 + int tileRow = params->TileRow();
  56 + int tileMatrix = params->TileMatrix();
  57 + std::string req = params->request();
  58 + DmpWmtsParameters::Format format = params->ImageFormat();
  59 + if(params){
  60 + delete params;
  61 + params = nullptr;
  62 + }
  63 +
  64 + const DmpProject *project = context.project();
  65 + DmpTileLayer *tileLayer = static_cast<DmpTileLayer *>(project->getLayer(layerName));
  66 + //context.response()->writeHtml("hello,wmts");
72 67
  68 + //const DmpWmtsParameters params(context.request()->serverParameters());
73 69
74 -  
75 - //std::string Msg_,connMsg_;  
76 - //std::string strsql_="SELECT \"Id\", \"Name\" FROM public.\"TileMapItem\";";  
77 - //PgsqlUtils *pg_=new PgsqlUtils(connMsg_);  
78 - //pg_->ExecuteQuery(strsql_,Msg_);  
79 - //  
80 -  
81 - //获取服务的实例  
82 - // std::string service_name = GetServiceName(context.request()->path());  
83 - // DmpService* service_ = GetService(service_name);  
84 - // if(!service_) {  
85 - // context.response()->write("找不到服务:" + service_name + "请确保服务已发布!");  
86 - // }  
87 - //判断RESTful、Kvp请求方式  
88 - /* 70 +
  71 +
  72 + if (req.empty())
  73 + {
  74 + context.response()->writeHtml("wmts,Operation is null");
  75 + }
  76 + if (boost::iequals(req, "GetTile"))
  77 + {
  78 + string f = (format == DmpWmtsParameters::Format::JPG) ? "jpg" : "png";
  79 + std::shared_ptr<DmpTileProvider> provider = TileProviderFactory::GetProvider(tileLayer);
  80 + provider->WriteTile(tileRow, tileCol, tileMatrix, f, *context.response());
  81 + }
  82 + else if (boost::iequals(req, "GetCapabilities"))
  83 + {
  84 + }
  85 +
  86 + //std::string Msg_,connMsg_;
  87 + //std::string strsql_="SELECT \"Id\", \"Name\" FROM public.\"TileMapItem\";";
  88 + //PgsqlUtils *pg_=new PgsqlUtils(connMsg_);
  89 + //pg_->ExecuteQuery(strsql_,Msg_);
  90 + //
  91 +
  92 + //获取服务的实例
  93 + // std::string service_name = GetServiceName(context.request()->path());
  94 + // DmpService* service_ = GetService(service_name);
  95 + // if(!service_) {
  96 + // context.response()->write("找不到服务:" + service_name + "请确保服务已发布!");
  97 + // }
  98 + //判断RESTful、Kvp请求方式
  99 + /*
89 std::string path_= context.request()->path(); 100 std::string path_= context.request()->path();
90 if(strstr(path_.c_str(), "?") == NULL) 101 if(strstr(path_.c_str(), "?") == NULL)
91 { 102 {
@@ -116,49 +127,49 @@ namespace DmpWmts @@ -116,49 +127,49 @@ namespace DmpWmts
116 127
117 } 128 }
118 */ 129 */
119 - // const DmpWmtsParameters params(context.request()->ServerParameters()); 130 + // const DmpWmtsParameters params(context.request()->serverParameters());
120 // int tile_col = params.TileCol(); 131 // int tile_col = params.TileCol();
121 // int tile_row = params.TileRow(); 132 // int tile_row = params.TileRow();
122 // int tile_matrix = params.TileMatrix(); 133 // int tile_matrix = params.TileMatrix();
123 // string req = params.Request(); 134 // string req = params.Request();
124 // DmpWmtsParameters::Format format = params.ImageFormat(); 135 // DmpWmtsParameters::Format format = params.ImageFormat();
125 - // if (req.empty())  
126 - // {  
127 - // context.response()->write("wmts,Operation is null");  
128 - // }  
129 - // if (boost::iequals(req, "GetTile"))  
130 - // {  
131 - // string f = (format == DmpWmtsParameters::Format::JPG) ? "jpg" : "png";  
132 - // std::shared_ptr<DmpTileProvider> provider = TileProviderFactory::GetProvider(service_);  
133 - // provider->WriteTile(tile_row, tile_col, tile_matrix, f, *context.response());  
134 - // }  
135 - // else if (boost::iequals(req, "GetCapabilities"))  
136 - // {  
137 - //std::shared_ptr<DmpCapabiliTilesProvider> provider = CapabiliTileProviderFactory::GetProvider();  
138 - //provider->WriteCapabilities(*context.response());  
139 -  
140 - // std::string host_=context.request()->domain()+":"+context.request()->port();  
141 -  
142 - // std::shared_ptr<DmpCapabiliTilesProvider> provider = CapabiliTileProviderFactory::GetProvider();  
143 - // boost::property_tree::ptree pt_;  
144 - // if(context.manager()->GetTilePTree(service_name,pt_))  
145 - // {  
146 - // //provider->WriteCapabilities(pt_,host_,service_name,*context.response());  
147 - // provider->WriteCapabilities(*context.response());  
148 - // }  
149 - // else  
150 - // {  
151 - // context.response()->write("GetTileInfo false");  
152 - // }  
153 -  
154 - // }  
155 - // else if (boost::iequals(req, "GetFeatureInfo"))  
156 - // {  
157 - // context.response()->write("wmts, GetFeatureInfo");  
158 - // }  
159 - // else  
160 - // {  
161 - // context.response()->write("wmts,Operation not supported");  
162 - // } 136 + // if (req.empty())
  137 + // {
  138 + // context.response()->write("wmts,Operation is null");
  139 + // }
  140 + // if (boost::iequals(req, "GetTile"))
  141 + // {
  142 + // string f = (format == DmpWmtsParameters::Format::JPG) ? "jpg" : "png";
  143 + // std::shared_ptr<DmpTileProvider> provider = TileProviderFactory::GetProvider(service_);
  144 + // provider->WriteTile(tile_row, tile_col, tile_matrix, f, *context.response());
  145 + // }
  146 + // else if (boost::iequals(req, "GetCapabilities"))
  147 + // {
  148 + //std::shared_ptr<DmpCapabiliTilesProvider> provider = CapabiliTileProviderFactory::GetProvider();
  149 + //provider->WriteCapabilities(*context.response());
  150 +
  151 + // std::string host_=context.request()->domain()+":"+context.request()->port();
  152 +
  153 + // std::shared_ptr<DmpCapabiliTilesProvider> provider = CapabiliTileProviderFactory::GetProvider();
  154 + // boost::property_tree::ptree pt_;
  155 + // if(context.manager()->GetTilePTree(service_name,pt_))
  156 + // {
  157 + // //provider->WriteCapabilities(pt_,host_,service_name,*context.response());
  158 + // provider->WriteCapabilities(*context.response());
  159 + // }
  160 + // else
  161 + // {
  162 + // context.response()->write("GetTileInfo false");
  163 + // }
  164 +
  165 + // }
  166 + // else if (boost::iequals(req, "GetFeatureInfo"))
  167 + // {
  168 + // context.response()->write("wmts, GetFeatureInfo");
  169 + // }
  170 + // else
  171 + // {
  172 + // context.response()->write("wmts,Operation not supported");
  173 + // }
163 } 174 }
164 } // namespace DmpWmts 175 } // namespace DmpWmts
@@ -22,9 +22,33 @@ namespace DmpWmts @@ -22,9 +22,33 @@ namespace DmpWmts
22 22
23 DmpWmtsParameters::DmpWmtsParameters(const DmpServerParameters &params) 23 DmpWmtsParameters::DmpWmtsParameters(const DmpServerParameters &params)
24 { 24 {
25 - params_ = params.Parameters(); 25 + params_ = params.parameters();
26 } 26 }
27 27
  28 + //restful风格的path,例如:/10/12/13.png;/1.0.0/WMTSCapabilities.xml
  29 + DmpWmtsParameters::DmpWmtsParameters(const std::string &path)
  30 + {
  31 + // params_ = params.parameters();
  32 + std::vector<std::string> vec;
  33 + boost::split(vec, path, boost::is_any_of("/"), boost::token_compress_on);
  34 + std::string last = vec.back();
  35 + if (boost::iequals(last, "WMTSCapabilities.xml")) {
  36 + add("REQUEST", "GetCapabilities");
  37 + }
  38 + else if(vec.size() == 4) {
  39 + add("REQUEST", "GetTile");
  40 + add("TILEMATRIX", vec[1]);
  41 + add("TILEROW", vec[2]);
  42 + std::vector<std::string> vec2;
  43 + boost::split(vec2, last, boost::is_any_of("."), boost::token_compress_on);
  44 + if(vec2.size() == 2) {
  45 + add("TILECOL", vec2[0]);
  46 + add("FORMAT", vec2[1]);
  47 + }
  48 + }
  49 +
  50 + }
  51 +
28 int DmpWmtsParameters::TileMatrix() const 52 int DmpWmtsParameters::TileMatrix() const
29 { 53 {
30 std::map<std::string, std::string>::const_iterator iter; 54 std::map<std::string, std::string>::const_iterator iter;
@@ -28,8 +28,9 @@ namespace DmpWmts @@ -28,8 +28,9 @@ namespace DmpWmts
28 HTML, 28 HTML,
29 GML 29 GML
30 }; 30 };
31 - DmpWmtsParameters(const DmpServerParameters &parameters);  
32 DmpWmtsParameters(); 31 DmpWmtsParameters();
  32 + DmpWmtsParameters(const DmpServerParameters &parameters);
  33 + DmpWmtsParameters(const std::string &path);//restful
33 virtual ~DmpWmtsParameters() = default; 34 virtual ~DmpWmtsParameters() = default;
34 std::string Layer() const; 35 std::string Layer() const;
35 Format ImageFormat() const; 36 Format ImageFormat() const;
注册登录 后发表评论