提交 a952e65705281ce24209cb2ee187b7d6cb851228

作者 qingxiongf
2 个父辈 fc26cc39 380261be
正在显示 31 个修改的文件 包含 38 行增加124 行删除
... ... @@ -34,7 +34,6 @@ class SERVER_EXPORT DmpService
34 34 virtual std::string name() const = 0;
35 35 virtual std::string version() const = 0;
36 36 virtual std::string description() const = 0;
37   - virtual bool validate(std::string &filePath) { return true; }
38 37 virtual bool allowMethod(DmpServerRequest::Method) const { return true; }
39 38 virtual void executeRequest(const DmpServerContext &context) = 0;
40 39 };
... ...
... ... @@ -66,5 +66,5 @@ namespace DmpWms
66 66
67 67
68 68 };
69   -} // namespace DmpWmts
  69 +} // namespace tileserver
70 70 #endif //__dmpwmsparameters_h__
... ...
... ... @@ -18,6 +18,7 @@ SET (TILESERVER_SRCS
18 18
19 19 SET (TILESERVER_HDRS
20 20 dmptileserver.h
  21 + wmts/dmpwmts.h
21 22 wmts/dmpwmtsparameters.h
22 23 wmts/dmptileprovider.h
23 24 wmts/dmptileproviderfactory.h
... ...
... ... @@ -19,10 +19,10 @@ namespace tileserver
19 19
20 20 DmpTileServer::DmpTileServer()
21 21 {
22   - DmpService* wmtsServer = new DmpWmts::DmpWMTSService();
  22 + DmpService* wmtsServer = new DmpWMTSService();
23 23 services_[wmtsServer->name()] = wmtsServer;
24 24
25   - DmpService* tmsServer = new DmpTms::DmpTMSService();
  25 + DmpService* tmsServer = new DmpTMSService();
26 26 services_[tmsServer->name()] = tmsServer;
27 27 }
28 28
... ... @@ -105,7 +105,7 @@ bool DmpTileServer::publish(const std::string &serviceName, const std::string &t
105 105 std::string filePath=tileLayer->getDataSource();
106 106
107 107 if(capability & DmpServiceType::WMTS) {
108   - DmpService* wmtsservice = getService("WMTSService");
  108 + DmpWMTSService* wmtsservice = dynamic_cast<DmpWMTSService*>(getService("WMTSService"));
109 109 if(!wmtsservice) {
110 110 return false;
111 111 }
... ... @@ -115,7 +115,7 @@ bool DmpTileServer::publish(const std::string &serviceName, const std::string &t
115 115 }
116 116 }
117 117 if(capability & DmpServiceType::TMS) {
118   - DmpService* tmsservice = getService("TMSService");
  118 + DmpTMSService* tmsservice = dynamic_cast<DmpTMSService*>(getService("TMSService"));
119 119 if(!tmsservice) {
120 120 return false;
121 121 }
... ... @@ -135,7 +135,7 @@ DmpService* DmpTileServer::getService(const std::string &serviceType)
135 135 ServiceMap::const_iterator iter = services_.find(serviceType);
136 136 if (iter != services_.end())
137 137 {
138   - service = iter->second;
  138 + service = dynamic_cast<DmpWMTSService*>(iter->second);
139 139 }
140 140 return service;
141 141 }
... ...
... ... @@ -24,6 +24,7 @@
24 24 #include "dmpserverutils.h"
25 25 #include "dmpserverproject.h"
26 26 #include "dmptilelayer.h"
  27 +#include "wmts/dmpwmts.h"
27 28
28 29 namespace tileserver
29 30 {
... ...
... ... @@ -17,7 +17,7 @@
17 17 #include "dmpproject.h"
18 18 #include "dmptmstileprovider.h"
19 19
20   -namespace DmpTms
  20 +namespace tileserver
21 21 {
22 22
23 23 DmpTMSService::DmpTMSService()
... ...
... ... @@ -13,7 +13,7 @@
13 13 #include "dmpservice.h"
14 14 #include <iostream>
15 15
16   -namespace DmpTms
  16 +namespace tileserver
17 17 {
18 18 class DmpTMSService : public DmpService
19 19 {
... ... @@ -23,7 +23,7 @@ namespace DmpTms
23 23 std::string name() const override { return std::string("TMSService"); }
24 24 std::string version() const override { return std::string("1.0.0"); }
25 25 std::string description() const override { return std::string("TMS瓦片服务"); }
26   - bool validate(std::string &filePath) override;
  26 + bool validate(std::string &filePath);
27 27 bool allowMethod(DmpServerRequest::Method method) const override { return method == DmpServerRequest::GET_METHOD;}
28 28 void executeRequest(const DmpServerContext &context) override;
29 29
... ...
... ... @@ -9,7 +9,8 @@
9 9 #include "dmptmstileprovider.h"
10 10 #include "dmpserverresponse.h"
11 11 #include <math.h>
12   -namespace DmpTms
  12 +#include "dmplogger.h"
  13 +namespace tileserver
13 14 {
14 15 DmpTmsTileProvider::DmpTmsTileProvider(const std::string& root_path)
15 16 {
... ...
... ... @@ -14,7 +14,7 @@
14 14 #include "dmptilelayer.h"
15 15 #include "dmpproject.h"
16 16
17   -namespace DmpTms
  17 +namespace tileserver
18 18 {
19 19 #define RAD2DEG pi/180.0
20 20 class DmpTmsTileProvider
... ...
... ... @@ -12,7 +12,7 @@
12 12 #include <string>
13 13
14 14 using namespace std;
15   -namespace DmpWmts
  15 +namespace tileserver
16 16 {
17 17 DmpAbstractEsriBundleProvider::DmpAbstractEsriBundleProvider(const std::string& rootPath)
18 18 : DmpTileProvider(rootPath)
... ...
... ... @@ -13,7 +13,7 @@
13 13 #include "dmptileprovider.h"
14 14 #include <string>
15 15
16   -namespace DmpWmts
  16 +namespace tileserver
17 17 {
18 18 class DmpAbstractEsriBundleProvider : public DmpTileProvider
19 19 {
... ...
... ... @@ -17,7 +17,7 @@
17 17
18 18
19 19 using namespace std;
20   -namespace DmpWmts
  20 +namespace tileserver
21 21 {
22 22 DmpCapabiliTilesOperation::DmpCapabiliTilesOperation()
23 23 {
... ...
... ... @@ -17,7 +17,7 @@
17 17
18 18 using namespace std;
19 19
20   -namespace DmpWmts
  20 +namespace tileserver
21 21 {
22 22 class DmpCapabiliTilesOperation:public DmpCapabiliTilesProvider
23 23 {
... ...
... ... @@ -11,7 +11,7 @@
11 11 #include <string>
12 12 #include "dmpserverresponse.h"
13 13
14   -namespace DmpWmts
  14 +namespace tileserver
15 15 {
16 16 class DmpCapabiliTilesProvider
17 17 {
... ...
... ... @@ -14,7 +14,7 @@
14 14 #include <math.h>
15 15 #include <cairo/cairo.h>
16 16
17   -namespace DmpWmts
  17 +namespace tileserver
18 18 {
19 19 DmpEsriBundleV1Provider:: DmpEsriBundleV1Provider(const std::string& rootPath)
20 20 : DmpAbstractEsriBundleProvider(rootPath)
... ...
... ... @@ -14,7 +14,7 @@
14 14 #include "dmptilelayer.h"
15 15 #include "dmppoint.h"
16 16
17   -namespace DmpWmts
  17 +namespace tileserver
18 18 {
19 19 class DmpEsriBundleV1Provider : public DmpAbstractEsriBundleProvider
20 20 {
... ...
... ... @@ -9,7 +9,7 @@
9 9 #include "dmpesribundlev2provider.h"
10 10 #include "dmpwmtsutils.h"
11 11
12   -namespace DmpWmts
  12 +namespace tileserver
13 13 {
14 14 DmpEsriBundleV2Provider::DmpEsriBundleV2Provider(const std::string& rootPath)
15 15 : DmpAbstractEsriBundleProvider(rootPath)
... ...
... ... @@ -13,7 +13,7 @@
13 13 #include "dmpabstractesribundleprovider.h"
14 14 #include "dmptilelayer.h"
15 15
16   -namespace DmpWmts
  16 +namespace tileserver
17 17 {
18 18 class DmpEsriBundleV2Provider : public DmpAbstractEsriBundleProvider
19 19 {
... ...
... ... @@ -14,7 +14,7 @@
14 14 #include "dmptilelayer.h"
15 15 #include <cairo/cairo.h>
16 16
17   -namespace DmpWmts
  17 +namespace tileserver
18 18 {
19 19 DmpEsriTileProvider::DmpEsriTileProvider(const std::string& rootPath)
20 20 : DmpTileProvider(rootPath)
... ...
... ... @@ -13,7 +13,7 @@
13 13 #include "dmptilelayer.h"
14 14
15 15
16   -namespace DmpWmts
  16 +namespace tileserver
17 17 {
18 18 class DmpEsriTileProvider : public DmpTileProvider
19 19 {
... ...
... ... @@ -14,7 +14,7 @@
14 14 #include "dmpserverresponse.h"
15 15 #include "dmptilelayer.h"
16 16
17   -namespace DmpWmts
  17 +namespace tileserver
18 18 {
19 19 class DmpTileProvider
20 20 {
... ...
... ... @@ -18,7 +18,7 @@
18 18 #include "dmpwmtsutils.h"
19 19 #include "dmptilelayer.h"
20 20
21   -namespace DmpWmts
  21 +namespace tileserver
22 22 {
23 23 TileProviderFactory::TileProviderFactory()
24 24 {
... ...
... ... @@ -21,7 +21,7 @@
21 21
22 22 //#include "dmpcapabilitiesprovider.h"
23 23
24   -namespace DmpWmts
  24 +namespace tileserver
25 25 {
26 26 enum class Vendor
27 27 {
... ...
... ... @@ -22,13 +22,12 @@
22 22 #include "dmplogger.h"
23 23 #include "dmptileproviderfactory.h"
24 24 #include "dmpserverrequest.h"
25   -#include "dmpwmtsservice.h"
26 25 #include "dmpwmts.h"
27 26 #include "dmptilelayer.h"
28 27
29 28 using namespace std;
30 29
31   -namespace DmpWmts
  30 +namespace tileserver
32 31 {
33 32
34 33 DmpWMTSService::DmpWMTSService()
... ... @@ -136,4 +135,4 @@ namespace DmpWmts
136 135
137 136 }
138 137 }
139   -} // namespace DmpWmts
\ No newline at end of file
  138 +} // namespace tileserver
\ No newline at end of file
... ...
... ... @@ -14,7 +14,7 @@
14 14 #include "dmpwmtsparameters.h"
15 15 #include "dmplogger.h"
16 16
17   -namespace DmpWmts
  17 +namespace tileserver
18 18 {
19 19 class DmpWMTSService : public DmpService
20 20 {
... ... @@ -24,7 +24,7 @@ namespace DmpWmts
24 24 std::string name() const override { return std::string("WMTSService"); }
25 25 std::string version() const override { return std::string("1.0.0"); }
26 26 std::string description() const override { return std::string("WMTS瓦片服务"); }
27   - bool validate(std::string &filePath) override;
  27 + bool validate(std::string &filePath);
28 28 bool allowMethod(DmpServerRequest::Method method) const override { return method == DmpServerRequest::GET_METHOD;}
29 29 void executeRequest(const DmpServerContext &context) override;
30 30
... ...
... ... @@ -13,7 +13,7 @@
13 13 #include <boost/algorithm/string.hpp>
14 14 #include "dmplogger.h"
15 15 #include "dmpserverutils.h"
16   -namespace DmpWmts
  16 +namespace tileserver
17 17 {
18 18 DmpWmtsParameters::DmpWmtsParameters()
19 19 : DmpServerParameters()
... ... @@ -146,4 +146,4 @@ namespace DmpWmts
146 146 }
147 147 return Format::NONE;
148 148 }
149   -} // namespace DmpWmts
\ No newline at end of file
  149 +} // namespace tileserver
\ No newline at end of file
... ...
... ... @@ -13,7 +13,7 @@
13 13
14 14 #include "dmpserverparameters.h"
15 15
16   -namespace DmpWmts
  16 +namespace tileserver
17 17 {
18 18 class DmpWmtsParameters : public DmpServerParameters
19 19 {
... ... @@ -39,5 +39,5 @@ namespace DmpWmts
39 39 int TileRow() const;
40 40 int TileCol() const;
41 41 };
42   -} // namespace DmpWmts
  42 +} // namespace tileserver
43 43 #endif //__dmpwmtsparameters_h__
... ...
1   -/**************************************************************************
2   -* file: dmpwmtsservice.cpp
3   -
4   -* Author: wanzhongping
5   -* Date: 2021-07-28 11:34:16
6   -* Email: zhongpingw@chinadci.com
7   -* copyright: 广州城市信息研究所有限公司
8   -***************************************************************************/
9   -#include "dmpwmtsservice.h"
10   -
11   -// DmpWMTSService::DmpWMTSService()
12   -// : DmpService()
13   -// {
14   -// map_type_ = MapServerType::WMTS_SERVER;
15   -// //AddProperty("tilePath","/usr/local/dmap4/gdmap/_alllayers");
16   -// //AddProperty("tilePath","/mnt/d/Code/tiles/gdmap/_alllayers");
17   -// //AddProperty("tileVersion","1");
18   -// }
19   -// DmpWMTSService::~DmpWMTSService()
20   -// {
21   -// }
22   -// bool DmpWMTSService::Read(boost::property_tree::ptree &pt_node)
23   -// {
24   -// try {
25   -// enabled_ = pt_node.get<bool>("enabled");
26   -// capabilities_ = pt_node.get<std::string>("capabilities");
27   -
28   -// //读取属性
29   -// for (auto property : pt_node.get_child("properties"))
30   -// {
31   -// std::string key = property.first;
32   -// std::string val = property.second.data();
33   -// AddProperty(key, val);
34   -// }
35   -
36   -// }
37   -// catch(std::exception ex) {
38   -// return false;
39   -// }
40   -// return true;
41   -// }
42   -// bool DmpWMTSService::Write(boost::property_tree::ptree &pt_node)
43   -// {
44   -// pt_node.put("typeName", (int)map_type_);
45   -// pt_node.put("capabilities", capabilities_);
46   -// pt_node.put("enabled", enabled_);
47   -
48   -// boost::property_tree::ptree pt_subitem;
49   -// std::map<std::string, std::string>::iterator iter = properties_.begin();
50   -// while(iter != properties_.end())
51   -// {
52   -// pt_subitem.put(iter->first, iter->second);
53   -// ++iter;
54   -// }
55   -// pt_node.put_child("properties", pt_subitem);
56   -
57   -// return true;
58   -// }
1   -/**************************************************************************
2   -* file: dmpwmtsservice.h
3   -
4   -* Author: wanzhongping
5   -* Date: 2021-07-28 11:34:06
6   -* Email: zhongpingw@chinadci.com
7   -* copyright: 广州城市信息研究所有限公司
8   -***************************************************************************/
9   -
10   -#ifndef __dmpwmtsservice_h__
11   -#define __dmpwmtsservice_h__
12   -#include "dmpservice.h"
13   -
14   -
15   -// class DmpWMTSService : public DmpService
16   -// {
17   -// public:
18   -// DmpWMTSService();
19   -// virtual ~DmpWMTSService();
20   -// virtual bool Read(boost::property_tree::ptree &pt_node) override;
21   -// virtual bool Write(boost::property_tree::ptree &pt_node) override;
22   -
23   -
24   -// protected:
25   -// std::string capabilities_;
26   -// bool enabled_;
27   -// };
28   -
29   -#endif // __dmpwmtsservice_h__
... ... @@ -10,7 +10,7 @@
10 10 #include <boost/property_tree/ptree.hpp>
11 11 #include <boost/property_tree/xml_parser.hpp>
12 12 #include <string>
13   -namespace DmpWmts
  13 +namespace tileserver
14 14 {
15 15 std::string DmpWmtsUtils::IntToFormatStr(const int num)
16 16 {
... ...
... ... @@ -13,7 +13,7 @@
13 13 #include <boost/property_tree/ptree.hpp>
14 14 #include <string>
15 15
16   -namespace DmpWmts
  16 +namespace tileserver
17 17 {
18 18 class DmpWmtsUtils
19 19 {
... ...
注册登录 后发表评论