正在显示
6 个修改的文件
包含
37 行增加
和
34 行删除
@@ -31,7 +31,7 @@ namespace DmpWmts | @@ -31,7 +31,7 @@ namespace DmpWmts | ||
31 | } | 31 | } |
32 | } | 32 | } |
33 | l = "L" + l; | 33 | l = "L" + l; |
34 | - string r = IntToHexStr(rGroup); | 34 | + string r = DmpWmtsUtils::IntToHexStr(rGroup); |
35 | 35 | ||
36 | int rLength = r.length(); | 36 | int rLength = r.length(); |
37 | if (rLength < 4) | 37 | if (rLength < 4) |
@@ -43,7 +43,7 @@ namespace DmpWmts | @@ -43,7 +43,7 @@ namespace DmpWmts | ||
43 | } | 43 | } |
44 | r = "R" + r; | 44 | r = "R" + r; |
45 | 45 | ||
46 | - string c = IntToHexStr(cGroup); | 46 | + string c = DmpWmtsUtils::IntToHexStr(cGroup); |
47 | int cLength = c.length(); | 47 | int cLength = c.length(); |
48 | if (cLength < 4) | 48 | if (cLength < 4) |
49 | { | 49 | { |
@@ -28,7 +28,7 @@ namespace DmpWmts | @@ -28,7 +28,7 @@ namespace DmpWmts | ||
28 | } | 28 | } |
29 | void DmpEsriTileProvider::WriteTile(const int row, const int col, const int level, const std::string& format, DmpServerResponse& response) | 29 | void DmpEsriTileProvider::WriteTile(const int row, const int col, const int level, const std::string& format, DmpServerResponse& response) |
30 | { | 30 | { |
31 | - std::string level_str = "L" + IntToFormatStr(level); | 31 | + std::string level_str = "L" + DmpWmtsUtils::IntToFormatStr(level); |
32 | std::string row_str = "R" + IntToHex8Str(row); | 32 | std::string row_str = "R" + IntToHex8Str(row); |
33 | std::string col_str = "C" + IntToHex8Str(col); | 33 | std::string col_str = "C" + IntToHex8Str(col); |
34 | 34 |
@@ -33,7 +33,7 @@ namespace DmpWmts | @@ -33,7 +33,7 @@ namespace DmpWmts | ||
33 | std::string tilePath_=dmpTileLayer->getDataSource(); | 33 | std::string tilePath_=dmpTileLayer->getDataSource(); |
34 | //std::string tilePath_ = "/mnt/d/Code/tiles/gdmap/_alllayers"; | 34 | //std::string tilePath_ = "/mnt/d/Code/tiles/gdmap/_alllayers"; |
35 | //std::string tileVersion_ = "ESRI_V1"; | 35 | //std::string tileVersion_ = "ESRI_V1"; |
36 | - int iver_=StringToVector(tileVersion_); | 36 | + int iver_=StringToVector(tileVersion_); |
37 | Vector version = (Vector)boost::lexical_cast<int>(iver_); | 37 | Vector version = (Vector)boost::lexical_cast<int>(iver_); |
38 | switch(version) | 38 | switch(version) |
39 | { | 39 | { |
@@ -58,7 +58,27 @@ namespace DmpWmts | @@ -58,7 +58,27 @@ namespace DmpWmts | ||
58 | 58 | ||
59 | return provider; | 59 | return provider; |
60 | } | 60 | } |
61 | - | 61 | + int TileProviderFactory::StringToVector(std::string& strVector) |
62 | + { | ||
63 | + int iVector_=-1; | ||
64 | + if(std::strcmp(strVector.c_str(),"ESRI_V0")==0) | ||
65 | + { | ||
66 | + iVector_=0; | ||
67 | + } | ||
68 | + else if(std::strcmp(strVector.c_str(),"ESRI_V1")==0) | ||
69 | + { | ||
70 | + iVector_=1; | ||
71 | + } | ||
72 | + else if(std::strcmp(strVector.c_str(),"ESRI_V2")==0) | ||
73 | + { | ||
74 | + iVector_=2; | ||
75 | + } | ||
76 | + else | ||
77 | + { | ||
78 | + iVector_=3; | ||
79 | + } | ||
80 | + return iVector_; | ||
81 | + } | ||
62 | // CapabiliTileProviderFactory::CapabiliTileProviderFactory() | 82 | // CapabiliTileProviderFactory::CapabiliTileProviderFactory() |
63 | // { | 83 | // { |
64 | // } | 84 | // } |
@@ -31,7 +31,8 @@ namespace DmpWmts | @@ -31,7 +31,8 @@ namespace DmpWmts | ||
31 | class TileProviderFactory | 31 | class TileProviderFactory |
32 | { | 32 | { |
33 | public: | 33 | public: |
34 | - static std::shared_ptr<DmpTileProvider> GetProvider( DmpTileLayer* dmpTileLayer); | 34 | + static std::shared_ptr<DmpTileProvider> GetProvider( DmpTileLayer* dmpTileLayer); |
35 | + static int StringToVector(std::string& strVector); | ||
35 | private: | 36 | private: |
36 | TileProviderFactory(); | 37 | TileProviderFactory(); |
37 | }; | 38 | }; |
@@ -11,9 +11,8 @@ | @@ -11,9 +11,8 @@ | ||
11 | #include <boost/property_tree/xml_parser.hpp> | 11 | #include <boost/property_tree/xml_parser.hpp> |
12 | #include <string> | 12 | #include <string> |
13 | namespace DmpWmts | 13 | namespace DmpWmts |
14 | -{ | ||
15 | - | ||
16 | - std::string IntToFormatStr(const int num) | 14 | +{ |
15 | + std::string DmpWmtsUtils::IntToFormatStr(const int num) | ||
17 | { | 16 | { |
18 | std::string str = std::to_string(num); | 17 | std::string str = std::to_string(num); |
19 | if(num>=0 && num<10) | 18 | if(num>=0 && num<10) |
@@ -23,7 +22,7 @@ namespace DmpWmts | @@ -23,7 +22,7 @@ namespace DmpWmts | ||
23 | return str; | 22 | return str; |
24 | } | 23 | } |
25 | 24 | ||
26 | - std::string IntToHexStr(const int num) | 25 | + std::string DmpWmtsUtils::IntToHexStr(const int num) |
27 | { | 26 | { |
28 | char* buffer = new char[8]; | 27 | char* buffer = new char[8]; |
29 | sprintf(buffer,"%x",num); | 28 | sprintf(buffer,"%x",num); |
@@ -31,26 +30,5 @@ namespace DmpWmts | @@ -31,26 +30,5 @@ namespace DmpWmts | ||
31 | delete[] buffer; | 30 | delete[] buffer; |
32 | return str; | 31 | return str; |
33 | } | 32 | } |
34 | - int StringToVector(std::string& strVector) | ||
35 | - { | ||
36 | - int iVector_=-1; | ||
37 | - if(std::strcmp(strVector.c_str(),"ESRI_V0")==0) | ||
38 | - { | ||
39 | - iVector_=0; | ||
40 | - } | ||
41 | - else if(std::strcmp(strVector.c_str(),"ESRI_V1")==0) | ||
42 | - { | ||
43 | - iVector_=1; | ||
44 | - } | ||
45 | - else if(std::strcmp(strVector.c_str(),"ESRI_V2")==0) | ||
46 | - { | ||
47 | - iVector_=2; | ||
48 | - } | ||
49 | - else | ||
50 | - { | ||
51 | - iVector_=3; | ||
52 | - } | ||
53 | - return iVector_; | ||
54 | - } | ||
55 | 33 | ||
56 | } | 34 | } |
@@ -15,9 +15,13 @@ | @@ -15,9 +15,13 @@ | ||
15 | 15 | ||
16 | namespace DmpWmts | 16 | namespace DmpWmts |
17 | { | 17 | { |
18 | - std::string IntToFormatStr(const int num); | ||
19 | - std::string IntToHexStr(const int num); | ||
20 | - int StringToVector(std::string& strVector); | 18 | + class DmpWmtsUtils |
19 | + { | ||
20 | + public: | ||
21 | + static std::string IntToFormatStr(const int num); | ||
22 | + static std::string IntToHexStr(const int num); | ||
23 | + | ||
24 | + }; | ||
21 | } | 25 | } |
22 | 26 | ||
23 | #endif //__dmpwmtsutils_h__ | 27 | #endif //__dmpwmtsutils_h__ |
请
注册
或
登录
后发表评论