正在显示
25 个修改的文件
包含
258 行增加
和
140 行删除
1 | /************************************************************************** | 1 | /************************************************************************** |
2 | -* file: dmpgeometry.cpp | 2 | +* file: DmpGeometry.cpp |
3 | 3 | ||
4 | * Author: qingxiongf | 4 | * Author: qingxiongf |
5 | * Date: 2022-02-22 10:13:27 | 5 | * Date: 2022-02-22 10:13:27 |
6 | * Email: qingxiongf@chinadci.com | 6 | * Email: qingxiongf@chinadci.com |
7 | * copyright: 广州城市信息研究所有限公司 | 7 | * copyright: 广州城市信息研究所有限公司 |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | -#include "dmpgeometry.h" | 9 | +#include "DmpGeometry.h" |
10 | #include <iostream> | 10 | #include <iostream> |
11 | #include <string.h> | 11 | #include <string.h> |
12 | #include <sstream> | 12 | #include <sstream> |
13 | 13 | ||
14 | namespace mapserver | 14 | namespace mapserver |
15 | { | 15 | { |
16 | - std::string Dmpgeometry::geoJsonfromWKB(const char* wkb) | 16 | + std::string DmpGeometry::geoJsonfromWKB(const char* wkb) |
17 | { | 17 | { |
18 | unsigned char* pwkb = (unsigned char*)wkb; | 18 | unsigned char* pwkb = (unsigned char*)wkb; |
19 | unsigned char hasZorSrsid = ((unsigned char *)(pwkb + 4))[0] / 16; | 19 | unsigned char hasZorSrsid = ((unsigned char *)(pwkb + 4))[0] / 16; |
@@ -123,7 +123,7 @@ namespace mapserver | @@ -123,7 +123,7 @@ namespace mapserver | ||
123 | return sstream.str();; | 123 | return sstream.str();; |
124 | } | 124 | } |
125 | 125 | ||
126 | - bool Dmpgeometry::readPointfromWKB(unsigned char*& pwkb, stringstream& sstream ) | 126 | + bool DmpGeometry::readPointfromWKB(unsigned char*& pwkb, stringstream& sstream ) |
127 | { | 127 | { |
128 | double xx = this->ReadDouble(pwkb,notbig_); | 128 | double xx = this->ReadDouble(pwkb,notbig_); |
129 | double yy = this->ReadDouble(pwkb,notbig_); | 129 | double yy = this->ReadDouble(pwkb,notbig_); |
@@ -139,7 +139,7 @@ namespace mapserver | @@ -139,7 +139,7 @@ namespace mapserver | ||
139 | return true; | 139 | return true; |
140 | } | 140 | } |
141 | 141 | ||
142 | - char* Dmpgeometry::ToDoubleStr(double value) | 142 | + char* DmpGeometry::ToDoubleStr(double value) |
143 | { | 143 | { |
144 | int len = sprintf(buff, "%.6f" ,value); | 144 | int len = sprintf(buff, "%.6f" ,value); |
145 | for ( len --; len >0; len--) | 145 | for ( len --; len >0; len--) |
@@ -163,7 +163,7 @@ namespace mapserver | @@ -163,7 +163,7 @@ namespace mapserver | ||
163 | 163 | ||
164 | } | 164 | } |
165 | 165 | ||
166 | - bool Dmpgeometry::readLinefromWKB(unsigned char*& pwkb, stringstream& sstream) | 166 | + bool DmpGeometry::readLinefromWKB(unsigned char*& pwkb, stringstream& sstream) |
167 | { | 167 | { |
168 | int nPoint = this->ReadInt(pwkb, notbig_); | 168 | int nPoint = this->ReadInt(pwkb, notbig_); |
169 | sstream << "["; | 169 | sstream << "["; |
@@ -177,7 +177,7 @@ namespace mapserver | @@ -177,7 +177,7 @@ namespace mapserver | ||
177 | return true; | 177 | return true; |
178 | } | 178 | } |
179 | 179 | ||
180 | - bool Dmpgeometry::readPolygonfromWKB(unsigned char*& pwkb, stringstream& sstream) | 180 | + bool DmpGeometry::readPolygonfromWKB(unsigned char*& pwkb, stringstream& sstream) |
181 | { | 181 | { |
182 | int nline = this->ReadInt(pwkb, notbig_); | 182 | int nline = this->ReadInt(pwkb, notbig_); |
183 | sstream << "["; | 183 | sstream << "["; |
@@ -193,7 +193,7 @@ namespace mapserver | @@ -193,7 +193,7 @@ namespace mapserver | ||
193 | 193 | ||
194 | 194 | ||
195 | 195 | ||
196 | -int Dmpgeometry::ReadInt(unsigned char*& here, int not_big1) | 196 | +int DmpGeometry::ReadInt(unsigned char*& here, int not_big1) |
197 | { | 197 | { |
198 | unsigned char * mem = (unsigned char *)malloc(4); | 198 | unsigned char * mem = (unsigned char *)malloc(4); |
199 | memcpy(mem, here, 4); | 199 | memcpy(mem, here, 4); |
@@ -204,14 +204,14 @@ int Dmpgeometry::ReadInt(unsigned char*& here, int not_big1) | @@ -204,14 +204,14 @@ int Dmpgeometry::ReadInt(unsigned char*& here, int not_big1) | ||
204 | here += 4; | 204 | here += 4; |
205 | return num; | 205 | return num; |
206 | } | 206 | } |
207 | -int Dmpgeometry::ReadByte(unsigned char*& here) | 207 | +int DmpGeometry::ReadByte(unsigned char*& here) |
208 | { | 208 | { |
209 | int num = ((char*)here)[0]; | 209 | int num = ((char*)here)[0]; |
210 | here++; | 210 | here++; |
211 | return num; | 211 | return num; |
212 | } | 212 | } |
213 | 213 | ||
214 | -double Dmpgeometry::ReadDouble(unsigned char*& here, int not_big) | 214 | +double DmpGeometry::ReadDouble(unsigned char*& here, int not_big) |
215 | { | 215 | { |
216 | //DmapCore_30::clsMalloc clsM(8); | 216 | //DmapCore_30::clsMalloc clsM(8); |
217 | unsigned char * mem = (unsigned char *)malloc(8); | 217 | unsigned char * mem = (unsigned char *)malloc(8); |
@@ -224,7 +224,7 @@ double Dmpgeometry::ReadDouble(unsigned char*& here, int not_big) | @@ -224,7 +224,7 @@ double Dmpgeometry::ReadDouble(unsigned char*& here, int not_big) | ||
224 | return num; | 224 | return num; |
225 | } | 225 | } |
226 | 226 | ||
227 | -bool Dmpgeometry::Exchange4(unsigned char * here) | 227 | +bool DmpGeometry::Exchange4(unsigned char * here) |
228 | { | 228 | { |
229 | unsigned char temp; | 229 | unsigned char temp; |
230 | for (int i = 0; i < 2; i++) | 230 | for (int i = 0; i < 2; i++) |
@@ -236,7 +236,7 @@ bool Dmpgeometry::Exchange4(unsigned char * here) | @@ -236,7 +236,7 @@ bool Dmpgeometry::Exchange4(unsigned char * here) | ||
236 | return true; | 236 | return true; |
237 | } | 237 | } |
238 | 238 | ||
239 | -bool Dmpgeometry::Exchange8(unsigned char * here) | 239 | +bool DmpGeometry::Exchange8(unsigned char * here) |
240 | { | 240 | { |
241 | unsigned char temp; | 241 | unsigned char temp; |
242 | for (int i = 0; i < 4; i++) | 242 | for (int i = 0; i < 4; i++) |
1 | /************************************************************************** | 1 | /************************************************************************** |
2 | -* file: dmpgeometry.h | 2 | +* file: DmpGeometry.h |
3 | 3 | ||
4 | * Author: qingxiongf | 4 | * Author: qingxiongf |
5 | * Date: 2022-02-22 10:07:04 | 5 | * Date: 2022-02-22 10:07:04 |
@@ -7,21 +7,21 @@ | @@ -7,21 +7,21 @@ | ||
7 | * copyright: 广州城市信息研究所有限公司 | 7 | * copyright: 广州城市信息研究所有限公司 |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | 9 | ||
10 | -#ifndef __dmpgeometry_h__ | ||
11 | -#define __dmpgeometry_h__ | 10 | +#ifndef __DmpGeometry_h__ |
11 | +#define __DmpGeometry_h__ | ||
12 | #include <geometry/dmpwkbtypes.h> | 12 | #include <geometry/dmpwkbtypes.h> |
13 | #include <string> | 13 | #include <string> |
14 | using namespace std; | 14 | using namespace std; |
15 | namespace mapserver | 15 | namespace mapserver |
16 | { | 16 | { |
17 | - class Dmpgeometry | 17 | + class DmpGeometry |
18 | { | 18 | { |
19 | /* data */ | 19 | /* data */ |
20 | public: | 20 | public: |
21 | - // Dmpgeometry(/* args */); | ||
22 | - // ~Dmpgeometry(); | 21 | + // DmpGeometry(/* args */); |
22 | + // ~DmpGeometry(); | ||
23 | 23 | ||
24 | - // static Dmpgeometry geometryfromWKT(const char* wkt); | 24 | + // static DmpGeometry geometryfromWKT(const char* wkt); |
25 | 25 | ||
26 | std::string geoJsonfromWKB(const char* wkb); | 26 | std::string geoJsonfromWKB(const char* wkb); |
27 | 27 | ||
@@ -51,4 +51,4 @@ namespace mapserver | @@ -51,4 +51,4 @@ namespace mapserver | ||
51 | 51 | ||
52 | } | 52 | } |
53 | 53 | ||
54 | -#endif // __dmpgeometry_h__ | 54 | +#endif // __DmpGeometry_h__ |
@@ -86,8 +86,6 @@ namespace mapserver | @@ -86,8 +86,6 @@ namespace mapserver | ||
86 | responseData.append(buff); | 86 | responseData.append(buff); |
87 | } | 87 | } |
88 | } | 88 | } |
89 | - //tickAA=GetTickCount(); | ||
90 | - | ||
91 | sprintf(buff, "</gims:%s>\r", layerName.c_str()); | 89 | sprintf(buff, "</gims:%s>\r", layerName.c_str()); |
92 | responseData.append(buff); | 90 | responseData.append(buff); |
93 | responseData.append("</gims:featureMember>"); | 91 | responseData.append("</gims:featureMember>"); |
@@ -97,17 +95,11 @@ namespace mapserver | @@ -97,17 +95,11 @@ namespace mapserver | ||
97 | 95 | ||
98 | if (pointCountTemp > 2000) | 96 | if (pointCountTemp > 2000) |
99 | break; | 97 | break; |
100 | - //Sleep(5000); | ||
101 | - // break; | ||
102 | } | 98 | } |
103 | } | 99 | } |
104 | catch (...) | 100 | catch (...) |
105 | { | 101 | { |
106 | } | 102 | } |
107 | - | ||
108 | - //sprintf(buff, "numberMatched=\"%ld\" numberReturned=\"%ld\" ", count, count); | ||
109 | - //responseData.append(insertBuf, sql, strlen(sql)); | ||
110 | - | ||
111 | responseData.append("</wfs:FeatureCollection>"); | 103 | responseData.append("</wfs:FeatureCollection>"); |
112 | 104 | ||
113 | return; | 105 | return; |
@@ -157,16 +149,17 @@ namespace mapserver | @@ -157,16 +149,17 @@ namespace mapserver | ||
157 | geometry = pPgsqlConn->getString(i); | 149 | geometry = pPgsqlConn->getString(i); |
158 | continue; | 150 | continue; |
159 | } | 151 | } |
160 | - else if(strFieldName == "geometry_as_wkt") | 152 | + else if(strFieldName == "geometry_as_wkb") |
161 | { | 153 | { |
162 | - Dmpgeometry dmpgeometry; | 154 | + DmpGeometry dmpgeometry; |
163 | geometry = dmpgeometry.geoJsonfromWKB(pPgsqlConn->getString(i)); | 155 | geometry = dmpgeometry.geoJsonfromWKB(pPgsqlConn->getString(i)); |
164 | continue; | 156 | continue; |
165 | } | 157 | } |
166 | else | 158 | else |
167 | { | 159 | { |
168 | - const char *v = pPgsqlConn->getString(i); | ||
169 | - std::sprintf(buff, R"(,"%s":"%s")", sfieldName, v); | 160 | + string value = pPgsqlConn->getString(i); |
161 | + DmpMapServerUtil::toJsonString(value); | ||
162 | + std::sprintf(buff, R"(,"%s":"%s")", sfieldName, value.c_str()); | ||
170 | properties += buff; | 163 | properties += buff; |
171 | } | 164 | } |
172 | } | 165 | } |
@@ -311,7 +311,7 @@ namespace DmpWfs | @@ -311,7 +311,7 @@ namespace DmpWfs | ||
311 | typeInt = PGFieldType::ShapeFieldType; | 311 | typeInt = PGFieldType::ShapeFieldType; |
312 | if (format == DmpWfsParameters::Format::GeoJson) | 312 | if (format == DmpWfsParameters::Format::GeoJson) |
313 | { | 313 | { |
314 | - fields_str += " st_asgeojson(\"" + (fieldname) + "\") as geometry_as_geojson"; | 314 | + fields_str += " \"" + (fieldname) + "\" as geometry_as_wkb"; |
315 | } | 315 | } |
316 | else | 316 | else |
317 | { | 317 | { |
@@ -29,8 +29,9 @@ namespace DmpWms | @@ -29,8 +29,9 @@ namespace DmpWms | ||
29 | std::string title = context.serverProject()->title(); | 29 | std::string title = context.serverProject()->title(); |
30 | std::string boxx = params.BBox(); | 30 | std::string boxx = params.BBox(); |
31 | std::string printTemp = params.printTemp(); | 31 | std::string printTemp = params.printTemp(); |
32 | + std::string printPara = params.printPara(); | ||
32 | 33 | ||
33 | - if(mapPrint.getPrintTempFile(responseData,project,printTemp.c_str(),boxx.c_str())) | 34 | + if(mapPrint.getPrintTempFile(responseData,project,printTemp.c_str(),boxx.c_str(),printPara.c_str())) |
34 | { | 35 | { |
35 | if(outformat == DmpWmsParameters::Format::PDF) | 36 | if(outformat == DmpWmsParameters::Format::PDF) |
36 | { | 37 | { |
@@ -52,4 +53,11 @@ namespace DmpWms | @@ -52,4 +53,11 @@ namespace DmpWms | ||
52 | 53 | ||
53 | context.response()->write(responseData); | 54 | context.response()->write(responseData); |
54 | } | 55 | } |
56 | + | ||
57 | + void writeGetPrintParaList(const DmpServerContext &context,const DmpWmsParameters& params, | ||
58 | + const DmpProject* project, | ||
59 | + bool projectSettings) | ||
60 | + { | ||
61 | + | ||
62 | + } | ||
55 | } | 63 | } |
@@ -176,6 +176,13 @@ namespace DmpWms | @@ -176,6 +176,13 @@ namespace DmpWms | ||
176 | return value; | 176 | return value; |
177 | } | 177 | } |
178 | 178 | ||
179 | + std::string DmpWmsParameters::printPara() const | ||
180 | + { | ||
181 | + std::string value = ""; | ||
182 | + GetStringParameter("PRINTPARA",value); | ||
183 | + return value; | ||
184 | + } | ||
185 | + | ||
179 | DmpWmsParameters::Format DmpWmsParameters::InfoFormat() const | 186 | DmpWmsParameters::Format DmpWmsParameters::InfoFormat() const |
180 | { | 187 | { |
181 | std::string value = ""; | 188 | std::string value = ""; |
@@ -63,6 +63,8 @@ namespace DmpWms | @@ -63,6 +63,8 @@ namespace DmpWms | ||
63 | DmpWmsParameters::Format ResFormat() const; //GetMap URL为Format GetFeatureInfo url为:info_format | 63 | DmpWmsParameters::Format ResFormat() const; //GetMap URL为Format GetFeatureInfo url为:info_format |
64 | 64 | ||
65 | std::string printTemp() const; | 65 | std::string printTemp() const; |
66 | + | ||
67 | + std::string printPara() const; | ||
66 | private: | 68 | private: |
67 | bool GetStringParameter(const char* key, std::string &value) const; | 69 | bool GetStringParameter(const char* key, std::string &value) const; |
68 | bool GetIntParameter(const char* key, int& value) const; | 70 | bool GetIntParameter(const char* key, int& value) const; |
@@ -537,8 +537,7 @@ ST_GeometryFromText('POLYGON((%f %f, %f %f, %f %f, %f %f, %f %f))',%s),\ | @@ -537,8 +537,7 @@ ST_GeometryFromText('POLYGON((%f %f, %f %f, %f %f, %f %f, %f %f))',%s),\ | ||
537 | { | 537 | { |
538 | typeString = "geometry"; | 538 | typeString = "geometry"; |
539 | typeInt = PGFieldType::ShapeFieldType; | 539 | typeInt = PGFieldType::ShapeFieldType; |
540 | - fields_str += " \"" + (fieldname) + "\" as geometry_as_wkt "; | ||
541 | - //fields_str += " st_asgeojson(\"" + (fieldname) + "\") as geometry_as_geojson"; | 540 | + fields_str += " \"" + (fieldname) + "\" as geometry_as_wkb "; |
542 | } | 541 | } |
543 | else if (typeString == "integer") | 542 | else if (typeString == "integer") |
544 | { | 543 | { |
@@ -622,7 +621,6 @@ ST_GeometryFromText('POLYGON((%f %f, %f %f, %f %f, %f %f, %f %f))',%s),\ | @@ -622,7 +621,6 @@ ST_GeometryFromText('POLYGON((%f %f, %f %f, %f %f, %f %f, %f %f))',%s),\ | ||
622 | double start = clock(); | 621 | double start = clock(); |
623 | double cost, cost2; | 622 | double cost, cost2; |
624 | 623 | ||
625 | - | ||
626 | try | 624 | try |
627 | { | 625 | { |
628 | shared_ptr<DmpPgsql> pPgsqlConn = DmpPgsqlSourcePools::get_instance()->GetPgsqlConn(layer->source()); | 626 | shared_ptr<DmpPgsql> pPgsqlConn = DmpPgsqlSourcePools::get_instance()->GetPgsqlConn(layer->source()); |
@@ -632,7 +630,6 @@ ST_GeometryFromText('POLYGON((%f %f, %f %f, %f %f, %f %f, %f %f))',%s),\ | @@ -632,7 +630,6 @@ ST_GeometryFromText('POLYGON((%f %f, %f %f, %f %f, %f %f, %f %f))',%s),\ | ||
632 | string sql = this->GetFeatureInfoSQL(layer, x0, y0, dis, feature_count); //sql语句中使用 ::box | 630 | string sql = this->GetFeatureInfoSQL(layer, x0, y0, dis, feature_count); //sql语句中使用 ::box |
633 | if (sql == "") continue; | 631 | if (sql == "") continue; |
634 | string layerName = layer->name(); | 632 | string layerName = layer->name(); |
635 | - printf("%s\r\n",sql.c_str()); | ||
636 | if (pPgsqlConn->ExecWaitBinary(sql)) | 633 | if (pPgsqlConn->ExecWaitBinary(sql)) |
637 | { | 634 | { |
638 | if(pPgsqlConn->GetRowCount()>0 || i==0) | 635 | if(pPgsqlConn->GetRowCount()>0 || i==0) |
@@ -188,7 +188,8 @@ namespace DmpWms | @@ -188,7 +188,8 @@ namespace DmpWms | ||
188 | return true; | 188 | return true; |
189 | } | 189 | } |
190 | 190 | ||
191 | - bool DmpMapPrint::getPrintTempFile(string &responseData,const DmpProject *project, const char *tempName, const char *bbox) | 191 | + bool DmpMapPrint::getPrintTempFile(string &responseData,const DmpProject *project, const char *tempName, const char *bbox, |
192 | + const char *paras) | ||
192 | { | 193 | { |
193 | string path = "../template/"; | 194 | string path = "../template/"; |
194 | path += tempName; | 195 | path += tempName; |
@@ -205,11 +206,11 @@ namespace DmpWms | @@ -205,11 +206,11 @@ namespace DmpWms | ||
205 | buffer << fin.rdbuf(); | 206 | buffer << fin.rdbuf(); |
206 | string content(buffer.str()); | 207 | string content(buffer.str()); |
207 | fin.close(); | 208 | fin.close(); |
208 | - return getPrintLayout(responseData, project, content.c_str(), bbox); | 209 | + return getPrintLayout(responseData, project, content.c_str(), bbox, paras); |
209 | // return true; | 210 | // return true; |
210 | } | 211 | } |
211 | 212 | ||
212 | - bool DmpMapPrint::getPrintLayout(string &responseData,const DmpProject *project, const char *xml, const char *bbox) | 213 | + bool DmpMapPrint::getPrintLayout(string &responseData,const DmpProject *project, const char *xml, const char *bbox,const char *paras) |
213 | { | 214 | { |
214 | string result_msg; | 215 | string result_msg; |
215 | if (xml == nullptr || bbox == nullptr) | 216 | if (xml == nullptr || bbox == nullptr) |
@@ -218,9 +219,24 @@ namespace DmpWms | @@ -218,9 +219,24 @@ namespace DmpWms | ||
218 | m_height = 1122; | 219 | m_height = 1122; |
219 | m_width = 793; | 220 | m_width = 793; |
220 | 221 | ||
221 | - | ||
222 | try | 222 | try |
223 | { | 223 | { |
224 | + map<string,string> mapParas; | ||
225 | + map<string,string> mapParasList; | ||
226 | + if(paras) | ||
227 | + { | ||
228 | + std::stringstream streampara(paras); | ||
229 | + boost::property_tree::ptree ptreepara; | ||
230 | + boost::property_tree::read_json(streampara, ptreepara); | ||
231 | + | ||
232 | + for (boost::property_tree::ptree::iterator pos = ptreepara.begin(); pos != ptreepara.end(); ++pos) | ||
233 | + { | ||
234 | + std::string name = pos->first; | ||
235 | + std::string value = pos->second.get_value<std::string>(); | ||
236 | + mapParas[name] = value; | ||
237 | + } | ||
238 | + } | ||
239 | + | ||
224 | std::stringstream stream(xml); | 240 | std::stringstream stream(xml); |
225 | boost::property_tree::ptree ptree; | 241 | boost::property_tree::ptree ptree; |
226 | boost::property_tree::read_xml(stream, ptree); | 242 | boost::property_tree::read_xml(stream, ptree); |
@@ -246,7 +262,7 @@ namespace DmpWms | @@ -246,7 +262,7 @@ namespace DmpWms | ||
246 | 262 | ||
247 | shared_ptr<DmpPrintLayout> printLayout(new DmpPrintLayout()); | 263 | shared_ptr<DmpPrintLayout> printLayout(new DmpPrintLayout()); |
248 | boost::property_tree::ptree ptreelayout = ptree.get_child("printlayout"); | 264 | boost::property_tree::ptree ptreelayout = ptree.get_child("printlayout"); |
249 | - if (printLayout->ReadXML(ptreelayout, pDmpPrintParameter, result_msg)) | 265 | + if (printLayout->ReadXML(ptreelayout, pDmpPrintParameter, result_msg,mapParas,mapParasList)) |
250 | { | 266 | { |
251 | this->vector_DmpPrintLayout.push_back(printLayout); | 267 | this->vector_DmpPrintLayout.push_back(printLayout); |
252 | ToPrint(responseData); | 268 | ToPrint(responseData); |
@@ -21,6 +21,7 @@ | @@ -21,6 +21,7 @@ | ||
21 | #include "clsUtil.h" | 21 | #include "clsUtil.h" |
22 | #include <boost/property_tree/ptree.hpp> | 22 | #include <boost/property_tree/ptree.hpp> |
23 | #include <boost/property_tree/xml_parser.hpp> | 23 | #include <boost/property_tree/xml_parser.hpp> |
24 | +#include <boost/property_tree/json_parser.hpp> | ||
24 | #include <boost/typeof/typeof.hpp> | 25 | #include <boost/typeof/typeof.hpp> |
25 | #include "dmpprintlayout.h" | 26 | #include "dmpprintlayout.h" |
26 | #include "dmpprintparameter.h" | 27 | #include "dmpprintparameter.h" |
@@ -63,12 +64,14 @@ namespace DmpWms | @@ -63,12 +64,14 @@ namespace DmpWms | ||
63 | bool getPrintLayout(std::string &responseData, | 64 | bool getPrintLayout(std::string &responseData, |
64 | const DmpProject* project, | 65 | const DmpProject* project, |
65 | const char *xml, | 66 | const char *xml, |
66 | - const char *bbox); | 67 | + const char *bbox, |
68 | + const char *paras); | ||
67 | 69 | ||
68 | bool getPrintTempFile(std::string &responseData, | 70 | bool getPrintTempFile(std::string &responseData, |
69 | const DmpProject* project, | 71 | const DmpProject* project, |
70 | const char *tempName, | 72 | const char *tempName, |
71 | - const char *bbox); | 73 | + const char *bbox, |
74 | + const char *paras); | ||
72 | 75 | ||
73 | // bool Test(std::string &responseData, DmpProject* project, string servername); | 76 | // bool Test(std::string &responseData, DmpProject* project, string servername); |
74 | 77 |
@@ -16,14 +16,15 @@ namespace DmpWms | @@ -16,14 +16,15 @@ namespace DmpWms | ||
16 | return false; | 16 | return false; |
17 | } | 17 | } |
18 | 18 | ||
19 | - bool DmpPrintCompass::ReadXML(boost::property_tree::ptree &pt,shared_ptr<DmpPrintParameter> pPrintParameter, string& errorstr) | 19 | + bool DmpPrintCompass::ReadXML(boost::property_tree::ptree &pt,shared_ptr<DmpPrintParameter> pPrintParameter, |
20 | + string& errorstr, map<string,string>& para, map<string,string>& paraList) | ||
20 | { | 21 | { |
21 | - this->ReadXmlAttribute(pt,localtionX_,"localtion_x"); | ||
22 | - this->ReadXmlAttribute(pt,localtionY_,"localtion_y"); | 22 | + this->ReadXmlAttribute(pt,localtionX_,"localtion_x", para, paraList); |
23 | + this->ReadXmlAttribute(pt,localtionY_,"localtion_y", para, paraList); | ||
23 | //this->ReadXmlAttribute(pt,type,"type"); | 24 | //this->ReadXmlAttribute(pt,type,"type"); |
24 | 25 | ||
25 | - this->ReadXmlAttribute(pt, boundSize_, "bound_size"); | ||
26 | - this->ReadXmlAttribute(pt, showbound_, "showBound"); | 26 | + this->ReadXmlAttribute(pt, boundSize_, "bound_size", para, paraList); |
27 | + this->ReadXmlAttribute(pt, showbound_, "showBound", para, paraList); | ||
27 | 28 | ||
28 | this->pPrintParameter_ = pPrintParameter; | 29 | this->pPrintParameter_ = pPrintParameter; |
29 | 30 |
@@ -24,7 +24,8 @@ namespace DmpWms | @@ -24,7 +24,8 @@ namespace DmpWms | ||
24 | public: | 24 | public: |
25 | //bool DrawImage(); | 25 | //bool DrawImage(); |
26 | bool DrawData(clsCrSurf* pClsCS,DmpWmsParameters::Format format); | 26 | bool DrawData(clsCrSurf* pClsCS,DmpWmsParameters::Format format); |
27 | - bool ReadXML(boost::property_tree::ptree &pt,shared_ptr<DmpPrintParameter> pPrintParameter, string& errorstr); | 27 | + bool ReadXML(boost::property_tree::ptree &pt,shared_ptr<DmpPrintParameter> pPrintParameter, string& errorstr, |
28 | + map<string,string>& para, map<string,string>& paraList); | ||
28 | }; | 29 | }; |
29 | } | 30 | } |
30 | 31 |
@@ -52,14 +52,40 @@ namespace DmpWms | @@ -52,14 +52,40 @@ namespace DmpWms | ||
52 | return mClsSurfDC; | 52 | return mClsSurfDC; |
53 | } | 53 | } |
54 | 54 | ||
55 | - bool DmpPrintLayer::ReadXmlAttribute(boost::property_tree::ptree &pt,double& v, const char* key) | 55 | + std::string DmpPrintLayer::replace(std::string strsrc, std::string strfind, std::string strrep) |
56 | + { | ||
57 | + for (std::string::size_type pos(0); pos != std::string::npos; pos += strrep.length()) | ||
58 | + { | ||
59 | + if ((pos = strsrc.find(strfind, pos)) != std::string::npos) | ||
60 | + strsrc.replace(pos, strfind.length(), strrep); | ||
61 | + else | ||
62 | + break; | ||
63 | + } | ||
64 | + return strsrc; | ||
65 | + } | ||
66 | + | ||
67 | + bool DmpPrintLayer::ReadXmlAttribute(boost::property_tree::ptree &pt,double& v, const char* key, | ||
68 | + map<string,string>& para, map<string,string>& paraList) | ||
56 | { | 69 | { |
57 | try | 70 | try |
58 | { | 71 | { |
59 | string xmlattrkey = "<xmlattr>."; | 72 | string xmlattrkey = "<xmlattr>."; |
60 | xmlattrkey += key; | 73 | xmlattrkey += key; |
61 | string value = pt.get<std::string>(xmlattrkey,"0"); | 74 | string value = pt.get<std::string>(xmlattrkey,"0"); |
62 | - v = atof(value.c_str()); | 75 | + if(value.find_first_of('#') ==0 && value.find_last_of('#') == value.length()-1) |
76 | + { | ||
77 | + value = replace(value, "#", ""); | ||
78 | + if(para.size() ==0) | ||
79 | + { | ||
80 | + paraList[value] = "double"; | ||
81 | + } | ||
82 | + else | ||
83 | + { | ||
84 | + value = para[value] ; | ||
85 | + } | ||
86 | + } | ||
87 | + v = atof(value.c_str()); | ||
88 | + | ||
63 | return true; | 89 | return true; |
64 | } | 90 | } |
65 | catch(...) | 91 | catch(...) |
@@ -68,14 +94,31 @@ namespace DmpWms | @@ -68,14 +94,31 @@ namespace DmpWms | ||
68 | } | 94 | } |
69 | } | 95 | } |
70 | 96 | ||
71 | - bool DmpPrintLayer::ReadXmlAttribute(boost::property_tree::ptree &pt,int& v, const char* key) | 97 | + bool DmpPrintLayer::ReadXmlAttribute(boost::property_tree::ptree &pt,int& v, const char* key, |
98 | + map<string,string>& para, map<string,string>& paraList) | ||
72 | { | 99 | { |
73 | try | 100 | try |
74 | { | 101 | { |
75 | string xmlattrkey = "<xmlattr>."; | 102 | string xmlattrkey = "<xmlattr>."; |
76 | xmlattrkey += key; | 103 | xmlattrkey += key; |
104 | + //string value = pt.get<std::string>(xmlattrkey,"0"); | ||
105 | + // v = atoi(value.c_str()); | ||
106 | + | ||
77 | string value = pt.get<std::string>(xmlattrkey,"0"); | 107 | string value = pt.get<std::string>(xmlattrkey,"0"); |
78 | - v = atoi(value.c_str()); | 108 | + if(value.find_first_of('#') ==0 && value.find_last_of('#') == value.length()-1) |
109 | + { | ||
110 | + value = replace(value, "#", ""); | ||
111 | + if(para.size() ==0) | ||
112 | + { | ||
113 | + paraList[value] = "int"; | ||
114 | + } | ||
115 | + else | ||
116 | + { | ||
117 | + value = para[value] ; | ||
118 | + } | ||
119 | + } | ||
120 | + | ||
121 | + v = atof(value.c_str()); | ||
79 | return true; | 122 | return true; |
80 | } | 123 | } |
81 | catch(...) | 124 | catch(...) |
@@ -84,13 +127,28 @@ namespace DmpWms | @@ -84,13 +127,28 @@ namespace DmpWms | ||
84 | } | 127 | } |
85 | } | 128 | } |
86 | 129 | ||
87 | - bool DmpPrintLayer::ReadXmlAttribute(boost::property_tree::ptree &pt,bool& v, const char* key) | 130 | + bool DmpPrintLayer::ReadXmlAttribute(boost::property_tree::ptree &pt,bool& v, const char* key, |
131 | + map<string,string>& para, map<string,string>& paraList) | ||
88 | { | 132 | { |
89 | try | 133 | try |
90 | { | 134 | { |
91 | string xmlattrkey = "<xmlattr>."; | 135 | string xmlattrkey = "<xmlattr>."; |
92 | xmlattrkey += key; | 136 | xmlattrkey += key; |
93 | string value = pt.get<std::string>(xmlattrkey,"false"); | 137 | string value = pt.get<std::string>(xmlattrkey,"false"); |
138 | + | ||
139 | + if(value.find_first_of('#') ==0 && value.find_last_of('#') == value.length()-1) | ||
140 | + { | ||
141 | + value = replace(value, "#", ""); | ||
142 | + if(para.size() ==0) | ||
143 | + { | ||
144 | + paraList[value] = "bool"; | ||
145 | + } | ||
146 | + else | ||
147 | + { | ||
148 | + value = para[value] ; | ||
149 | + } | ||
150 | + } | ||
151 | + | ||
94 | if(value == "false")v = false; | 152 | if(value == "false")v = false; |
95 | if(value == "true") v= true; | 153 | if(value == "true") v= true; |
96 | 154 | ||
@@ -103,10 +161,11 @@ namespace DmpWms | @@ -103,10 +161,11 @@ namespace DmpWms | ||
103 | } | 161 | } |
104 | 162 | ||
105 | 163 | ||
106 | - bool DmpPrintLayer::ReadXmlColorAttribute(boost::property_tree::ptree &pt,int& r, int& g, int& b, const char* key) | 164 | + bool DmpPrintLayer::ReadXmlColorAttribute(boost::property_tree::ptree &pt,int& r, int& g, int& b, const char* key, |
165 | + map<string,string>& para, map<string,string>& paraList) | ||
107 | { | 166 | { |
108 | string color; | 167 | string color; |
109 | - if(this->ReadXmlAttribute(pt, color, key)) | 168 | + if(this->ReadXmlAttribute(pt, color, key,para ,paraList)) |
110 | { | 169 | { |
111 | string str_red; | 170 | string str_red; |
112 | string str_greed; | 171 | string str_greed; |
@@ -141,13 +200,33 @@ namespace DmpWms | @@ -141,13 +200,33 @@ namespace DmpWms | ||
141 | return false; | 200 | return false; |
142 | } | 201 | } |
143 | 202 | ||
144 | - bool DmpPrintLayer::ReadXmlAttribute(boost::property_tree::ptree &pt,std::string& v, const char* key) | 203 | + bool DmpPrintLayer::ReadXmlAttribute(boost::property_tree::ptree &pt,std::string& v, const char* key, |
204 | + map<string,string>& para, map<string,string>& paraList) | ||
145 | { | 205 | { |
146 | try | 206 | try |
147 | { | 207 | { |
148 | string xmlattrkey = "<xmlattr>."; | 208 | string xmlattrkey = "<xmlattr>."; |
149 | xmlattrkey += key; | 209 | xmlattrkey += key; |
150 | v = pt.get<std::string>(xmlattrkey,""); | 210 | v = pt.get<std::string>(xmlattrkey,""); |
211 | + if(v.find_first_of('#') != v.find_last_of('#')) | ||
212 | + { | ||
213 | + int begin = v.find_first_of('#'); | ||
214 | + int end = v.find_last_of('#'); | ||
215 | + int length = end - begin +1; | ||
216 | + std::string parakey = v.substr(begin, length); | ||
217 | + std::string sparakey = replace(parakey, "#", ""); | ||
218 | + | ||
219 | + if(para.size() ==0 || para.find(sparakey) == para.end()) | ||
220 | + { | ||
221 | + paraList[sparakey] = "string"; | ||
222 | + } | ||
223 | + else | ||
224 | + { | ||
225 | + std::string paravalue = para[sparakey]; | ||
226 | + v = replace(v, parakey, paravalue); | ||
227 | + } | ||
228 | + } | ||
229 | + | ||
151 | return true; | 230 | return true; |
152 | } | 231 | } |
153 | catch(...) | 232 | catch(...) |
@@ -156,12 +235,26 @@ namespace DmpWms | @@ -156,12 +235,26 @@ namespace DmpWms | ||
156 | } | 235 | } |
157 | } | 236 | } |
158 | 237 | ||
159 | - bool DmpPrintLayer::ReadXmlValue(boost::property_tree::ptree &pt,std::string& v, const char* key) | 238 | + bool DmpPrintLayer::ReadXmlValue(boost::property_tree::ptree &pt,std::string& v, const char* key, |
239 | + map<string,string>& para, map<string,string>& paraList) | ||
160 | { | 240 | { |
161 | try | 241 | try |
162 | { | 242 | { |
163 | string xmlattrkey = key; | 243 | string xmlattrkey = key; |
164 | v = pt.get<std::string>(xmlattrkey,""); | 244 | v = pt.get<std::string>(xmlattrkey,""); |
245 | + if(v.find_first_of('#') ==0 && v.find_last_of('#') == v.length()-1) | ||
246 | + { | ||
247 | + v = replace(v, "#", ""); | ||
248 | + if(para.size() ==0) | ||
249 | + { | ||
250 | + paraList[v] = "bool"; | ||
251 | + } | ||
252 | + else | ||
253 | + { | ||
254 | + v = para[v] ; | ||
255 | + } | ||
256 | + } | ||
257 | + | ||
165 | return true; | 258 | return true; |
166 | } | 259 | } |
167 | catch(...) | 260 | catch(...) |
@@ -52,23 +52,26 @@ namespace DmpWms | @@ -52,23 +52,26 @@ namespace DmpWms | ||
52 | // virtual bool InitNodeClass(); | 52 | // virtual bool InitNodeClass(); |
53 | virtual bool DrawData(clsCrSurf* pClsCS,DmpWmsParameters::Format format) = 0; | 53 | virtual bool DrawData(clsCrSurf* pClsCS,DmpWmsParameters::Format format) = 0; |
54 | 54 | ||
55 | - virtual bool ReadXML(boost::property_tree::ptree &pt, shared_ptr<DmpPrintParameter> pPrintParameter, std::string& errorstr)= 0; | 55 | + virtual bool ReadXML(boost::property_tree::ptree &pt, shared_ptr<DmpPrintParameter> pPrintParameter, |
56 | + std::string& errorstr, map<string,string>& para, map<string,string>& paraList)= 0; | ||
56 | 57 | ||
57 | bool DrawBound(clsCrSurf* pClsCS,double width, double height); | 58 | bool DrawBound(clsCrSurf* pClsCS,double width, double height); |
58 | 59 | ||
59 | - bool ReadXmlAttribute(boost::property_tree::ptree &pt,double& v, const char* key); | 60 | + bool ReadXmlAttribute(boost::property_tree::ptree &pt,double& v, const char* key,map<string,string>& para, map<string,string>& paraList); |
60 | 61 | ||
61 | - bool ReadXmlAttribute(boost::property_tree::ptree &pt,int& v, const char* key); | 62 | + bool ReadXmlAttribute(boost::property_tree::ptree &pt,int& v, const char* key,map<string,string>& para, map<string,string>& paraList); |
62 | 63 | ||
63 | - bool ReadXmlAttribute(boost::property_tree::ptree &pt,std::string& v, const char* key); | 64 | + bool ReadXmlAttribute(boost::property_tree::ptree &pt,std::string& v, const char* key,map<string,string>& para, map<string,string>& paraList); |
64 | 65 | ||
65 | - bool ReadXmlAttribute(boost::property_tree::ptree &pt,bool& v, const char* key); | 66 | + bool ReadXmlAttribute(boost::property_tree::ptree &pt,bool& v, const char* key,map<string,string>& para, map<string,string>& paraList); |
66 | 67 | ||
67 | - bool ReadXmlColorAttribute(boost::property_tree::ptree &pt,int& r, int& g, int& b, const char* key); | 68 | + bool ReadXmlColorAttribute(boost::property_tree::ptree &pt,int& r, int& g, int& b, const char* key,map<string,string>& para, map<string,string>& paraList); |
68 | 69 | ||
69 | - bool ReadXmlValue(boost::property_tree::ptree &pt,std::string& v, const char* key); | 70 | + bool ReadXmlValue(boost::property_tree::ptree &pt,std::string& v, const char* key,map<string,string>& para, map<string,string>& paraList); |
70 | 71 | ||
71 | shared_ptr<clsCrSurf> CreateSurface(int width, int height, DmpWmsParameters::Format format); | 72 | shared_ptr<clsCrSurf> CreateSurface(int width, int height, DmpWmsParameters::Format format); |
73 | + | ||
74 | + std::string replace(std::string strsrc, std::string strfind, std::string strrep); | ||
72 | }; | 75 | }; |
73 | } | 76 | } |
74 | 77 |
@@ -21,65 +21,47 @@ namespace DmpWms | @@ -21,65 +21,47 @@ namespace DmpWms | ||
21 | return true; | 21 | return true; |
22 | } | 22 | } |
23 | 23 | ||
24 | - bool DmpPrintLayout::ReadXML(boost::property_tree::ptree &pt, shared_ptr<DmpPrintParameter> pPrintParameter,string& errorstr) | 24 | + bool DmpPrintLayout::ReadXML(boost::property_tree::ptree &pt, shared_ptr<DmpPrintParameter> pPrintParameter, |
25 | + string& errorstr, map<string,string>& para, map<string,string>& paraList) | ||
25 | { | 26 | { |
26 | - /* try | ||
27 | - { | ||
28 | - boost::property_tree::ptree ptbound = pt.get_child("bound"); | ||
29 | - this->ReadXmlAttribute(ptbound, showbound_, "show"); | ||
30 | - this->ReadXmlAttribute(ptbound, localtionX_, "localtion_x"); | ||
31 | - this->ReadXmlAttribute(ptbound, localtionY_, "localtion_y"); | ||
32 | - | ||
33 | - this->ReadXmlAttribute(ptbound, width_, "width"); | ||
34 | - this->ReadXmlAttribute(ptbound, height_, "height"); | ||
35 | - | ||
36 | - this->ReadXmlAttribute(ptbound, boundSize_, "bound_size"); | ||
37 | - } | ||
38 | - catch(const std::exception& e) | ||
39 | - { | ||
40 | - | ||
41 | - }*/ | ||
42 | 27 | ||
43 | try | 28 | try |
44 | { | 29 | { |
45 | boost::property_tree::ptree ptlayouts = pt.get_child("layouts"); | 30 | boost::property_tree::ptree ptlayouts = pt.get_child("layouts"); |
46 | - // for (rapidxml::xml_node<char> *layout_node = layouts_node->first_node("layout"); | ||
47 | - // layout_node != nullptr; | ||
48 | - // layout_node = layout_node->next_sibling()) | ||
49 | for (boost::property_tree::ptree::iterator pos = ptlayouts.begin(); pos != ptlayouts.end(); ++pos) | 31 | for (boost::property_tree::ptree::iterator pos = ptlayouts.begin(); pos != ptlayouts.end(); ++pos) |
50 | { | 32 | { |
51 | string type; | 33 | string type; |
52 | boost::property_tree::ptree ptlayout = pos->second; | 34 | boost::property_tree::ptree ptlayout = pos->second; |
53 | - this->ReadXmlAttribute(ptlayout, type, "type"); | 35 | + this->ReadXmlAttribute(ptlayout, type, "type",para,paraList); |
54 | bool result = true; | 36 | bool result = true; |
55 | if (type == "text") | 37 | if (type == "text") |
56 | { | 38 | { |
57 | shared_ptr<DmpPrintLayer> layer(new DmpPrintText()); | 39 | shared_ptr<DmpPrintLayer> layer(new DmpPrintText()); |
58 | - result = layer->ReadXML(ptlayout, pPrintParameter, errorstr); | 40 | + result = layer->ReadXML(ptlayout, pPrintParameter, errorstr,para,paraList); |
59 | this->data.push_back(layer); | 41 | this->data.push_back(layer); |
60 | } | 42 | } |
61 | else if (type == "dmapservice") | 43 | else if (type == "dmapservice") |
62 | { | 44 | { |
63 | shared_ptr<DmpPrintLayer> layer(new DmpPrintWMSService()); | 45 | shared_ptr<DmpPrintLayer> layer(new DmpPrintWMSService()); |
64 | - result = layer->ReadXML(ptlayout, pPrintParameter, errorstr); | 46 | + result = layer->ReadXML(ptlayout, pPrintParameter, errorstr,para,paraList); |
65 | this->data.push_back(layer); | 47 | this->data.push_back(layer); |
66 | } | 48 | } |
67 | else if (type == "scale") | 49 | else if (type == "scale") |
68 | { | 50 | { |
69 | shared_ptr<DmpPrintLayer> layer(new DmpPrintScale()); | 51 | shared_ptr<DmpPrintLayer> layer(new DmpPrintScale()); |
70 | - result = layer->ReadXML(ptlayout, pPrintParameter, errorstr); | 52 | + result = layer->ReadXML(ptlayout, pPrintParameter, errorstr,para,paraList); |
71 | this->data.push_back(layer); | 53 | this->data.push_back(layer); |
72 | } | 54 | } |
73 | else if (type == "compass") | 55 | else if (type == "compass") |
74 | { | 56 | { |
75 | shared_ptr<DmpPrintLayer> layer(new DmpPrintCompass()); | 57 | shared_ptr<DmpPrintLayer> layer(new DmpPrintCompass()); |
76 | - result = layer->ReadXML(ptlayout, pPrintParameter, errorstr); | 58 | + result = layer->ReadXML(ptlayout, pPrintParameter, errorstr,para,paraList); |
77 | this->data.push_back(layer); | 59 | this->data.push_back(layer); |
78 | } | 60 | } |
79 | else if (type == "rectangle" || type == "rect") | 61 | else if (type == "rectangle" || type == "rect") |
80 | { | 62 | { |
81 | shared_ptr<DmpPrintLayer> layer(new DmpPrintRect()); | 63 | shared_ptr<DmpPrintLayer> layer(new DmpPrintRect()); |
82 | - result = layer->ReadXML(ptlayout, pPrintParameter, errorstr); | 64 | + result = layer->ReadXML(ptlayout, pPrintParameter, errorstr,para,paraList); |
83 | this->data.push_back(layer); | 65 | this->data.push_back(layer); |
84 | } | 66 | } |
85 | else | 67 | else |
@@ -34,7 +34,8 @@ namespace DmpWms | @@ -34,7 +34,8 @@ namespace DmpWms | ||
34 | public: | 34 | public: |
35 | 35 | ||
36 | bool DrawData(clsCrSurf* pClsCS,DmpWmsParameters::Format format); | 36 | bool DrawData(clsCrSurf* pClsCS,DmpWmsParameters::Format format); |
37 | - bool ReadXML(boost::property_tree::ptree &pt, shared_ptr<DmpPrintParameter> pPrintParameter, string& errorstr); | 37 | + bool ReadXML(boost::property_tree::ptree &pt, shared_ptr<DmpPrintParameter> pPrintParameter, |
38 | + string& errorstr, map<string,string>& para, map<string,string>& paraList); | ||
38 | private: | 39 | private: |
39 | bool DrawBound(clsCrSurf* pClsCS); | 40 | bool DrawBound(clsCrSurf* pClsCS); |
40 | 41 |
@@ -12,6 +12,7 @@ | @@ -12,6 +12,7 @@ | ||
12 | #include <math.h> | 12 | #include <math.h> |
13 | #include "dmpproject.h" | 13 | #include "dmpproject.h" |
14 | #include <memory> | 14 | #include <memory> |
15 | +#include <map> | ||
15 | using namespace std; | 16 | using namespace std; |
16 | namespace DmpWms | 17 | namespace DmpWms |
17 | { | 18 | { |
@@ -37,6 +38,8 @@ namespace DmpWms | @@ -37,6 +38,8 @@ namespace DmpWms | ||
37 | double m_dR = 0; | 38 | double m_dR = 0; |
38 | double m_dXdis = 0;//width / 2.0 - m_dR * (right + left) / 2.0; | 39 | double m_dXdis = 0;//width / 2.0 - m_dR * (right + left) / 2.0; |
39 | double m_dYdis = 0;//height / 2.0 + m_dR * (top + bottom) / 2.0; | 40 | double m_dYdis = 0;//height / 2.0 + m_dR * (top + bottom) / 2.0; |
41 | + | ||
42 | + map<string,string> params; | ||
40 | public: | 43 | public: |
41 | void InitParameter(double l0,double r0,double t0,double b0, int w0,int h0); | 44 | void InitParameter(double l0,double r0,double t0,double b0, int w0,int h0); |
42 | 45 |
@@ -22,16 +22,17 @@ namespace DmpWms | @@ -22,16 +22,17 @@ namespace DmpWms | ||
22 | return true; | 22 | return true; |
23 | } | 23 | } |
24 | 24 | ||
25 | - bool DmpPrintRect::ReadXML(boost::property_tree::ptree &pt,shared_ptr<DmpPrintParameter> pPrintParameter, string& errorstr) | 25 | + bool DmpPrintRect::ReadXML(boost::property_tree::ptree &pt,shared_ptr<DmpPrintParameter> pPrintParameter, |
26 | + string& errorstr,map<string,string>& para, map<string,string>& paraList) | ||
26 | { | 27 | { |
27 | //this->ReadXmlAttribute(bound_node, showbound, "show"); | 28 | //this->ReadXmlAttribute(bound_node, showbound, "show"); |
28 | - this->ReadXmlAttribute(pt, localtionX_, "localtion_x"); | ||
29 | - this->ReadXmlAttribute(pt, localtionY_, "localtion_y"); | 29 | + this->ReadXmlAttribute(pt, localtionX_, "localtion_x",para,paraList); |
30 | + this->ReadXmlAttribute(pt, localtionY_, "localtion_y",para,paraList); | ||
30 | 31 | ||
31 | - this->ReadXmlAttribute(pt, width_, "width"); | ||
32 | - this->ReadXmlAttribute(pt, height_, "height"); | 32 | + this->ReadXmlAttribute(pt, width_, "width",para,paraList); |
33 | + this->ReadXmlAttribute(pt, height_, "height",para,paraList); | ||
33 | 34 | ||
34 | - this->ReadXmlAttribute(pt, boundSize_, "bound_size"); | 35 | + this->ReadXmlAttribute(pt, boundSize_, "bound_size",para,paraList); |
35 | this->pPrintParameter_ = pPrintParameter; | 36 | this->pPrintParameter_ = pPrintParameter; |
36 | 37 | ||
37 | return true; | 38 | return true; |
@@ -17,7 +17,8 @@ namespace DmpWms | @@ -17,7 +17,8 @@ namespace DmpWms | ||
17 | public: | 17 | public: |
18 | shared_ptr<DmpPrintParameter> pPrintParameter_ = nullptr; | 18 | shared_ptr<DmpPrintParameter> pPrintParameter_ = nullptr; |
19 | bool DrawData(clsCrSurf* pClsCS,DmpWmsParameters::Format format); | 19 | bool DrawData(clsCrSurf* pClsCS,DmpWmsParameters::Format format); |
20 | - bool ReadXML(boost::property_tree::ptree &pt,shared_ptr<DmpPrintParameter> pPrintParameter, string& errorstr); | 20 | + bool ReadXML(boost::property_tree::ptree &pt,shared_ptr<DmpPrintParameter> pPrintParameter, |
21 | + string& errorstr,map<string,string>& para, map<string,string>& paraList); | ||
21 | 22 | ||
22 | private: | 23 | private: |
23 | int width_ =0; | 24 | int width_ =0; |
@@ -115,14 +115,15 @@ namespace DmpWms | @@ -115,14 +115,15 @@ namespace DmpWms | ||
115 | return true; | 115 | return true; |
116 | } | 116 | } |
117 | 117 | ||
118 | - bool DmpPrintScale::ReadXML(boost::property_tree::ptree &pt,shared_ptr<DmpPrintParameter> pPrintParameter, string& errorstr) | 118 | + bool DmpPrintScale::ReadXML(boost::property_tree::ptree &pt,shared_ptr<DmpPrintParameter> pPrintParameter, |
119 | + string& errorstr, map<string,string>& para, map<string,string>& paraList) | ||
119 | { | 120 | { |
120 | - this->ReadXmlAttribute(pt,localtionX_,"localtion_x"); | ||
121 | - this->ReadXmlAttribute(pt,localtionY_,"localtion_y"); | 121 | + this->ReadXmlAttribute(pt,localtionX_,"localtion_x",para,paraList); |
122 | + this->ReadXmlAttribute(pt,localtionY_,"localtion_y",para,paraList); | ||
122 | // this->ReadXmlAttribute(pt,type,"type"); | 123 | // this->ReadXmlAttribute(pt,type,"type"); |
123 | 124 | ||
124 | - this->ReadXmlAttribute(pt, boundSize_, "bound_size"); | ||
125 | - this->ReadXmlAttribute(pt, showbound_, "showBound"); | 125 | + this->ReadXmlAttribute(pt, boundSize_, "bound_size",para,paraList); |
126 | + this->ReadXmlAttribute(pt, showbound_, "showBound",para,paraList); | ||
126 | 127 | ||
127 | this->pPrintParameter_ = pPrintParameter; | 128 | this->pPrintParameter_ = pPrintParameter; |
128 | 129 |
@@ -21,7 +21,8 @@ namespace DmpWms | @@ -21,7 +21,8 @@ namespace DmpWms | ||
21 | public: | 21 | public: |
22 | //bool DrawImage(); | 22 | //bool DrawImage(); |
23 | bool DrawData(clsCrSurf* pClsCS,DmpWmsParameters::Format format); | 23 | bool DrawData(clsCrSurf* pClsCS,DmpWmsParameters::Format format); |
24 | - bool ReadXML(boost::property_tree::ptree &pt,shared_ptr<DmpPrintParameter> pPrintParameter, string& errorstr); | 24 | + bool ReadXML(boost::property_tree::ptree &pt,shared_ptr<DmpPrintParameter> pPrintParameter, |
25 | + string& errorstr, map<string,string>& para, map<string,string>& paraList); | ||
25 | }; | 26 | }; |
26 | } | 27 | } |
27 | #endif // __dmpprintscale_h__ | 28 | #endif // __dmpprintscale_h__ |
@@ -23,21 +23,22 @@ namespace DmpWms | @@ -23,21 +23,22 @@ namespace DmpWms | ||
23 | return true; | 23 | return true; |
24 | } | 24 | } |
25 | 25 | ||
26 | - bool DmpPrintText::ReadXML(boost::property_tree::ptree &pt, shared_ptr<DmpPrintParameter> pMapParameter,string& errorstr) | 26 | + bool DmpPrintText::ReadXML(boost::property_tree::ptree &pt, shared_ptr<DmpPrintParameter> pMapParameter, |
27 | + string& errorstr, map<string,string>& para, map<string,string>& paraList) | ||
27 | { | 28 | { |
28 | try | 29 | try |
29 | { | 30 | { |
30 | - this->ReadXmlAttribute(pt, localtionX_, "localtion_x"); | ||
31 | - this->ReadXmlAttribute(pt, localtionY_, "localtion_y"); | 31 | + this->ReadXmlAttribute(pt, localtionX_, "localtion_x",para,paraList); |
32 | + this->ReadXmlAttribute(pt, localtionY_, "localtion_y",para,paraList); | ||
32 | 33 | ||
33 | - this->ReadXmlAttribute(pt, boundSize_, "bound_size"); | ||
34 | - this->ReadXmlAttribute(pt, showbound_, "showBound"); | 34 | + this->ReadXmlAttribute(pt, boundSize_, "bound_size",para,paraList); |
35 | + this->ReadXmlAttribute(pt, showbound_, "showBound",para,paraList); | ||
35 | boost::property_tree::ptree pttext = pt.get_child("text"); | 36 | boost::property_tree::ptree pttext = pt.get_child("text"); |
36 | - this->ReadXmlColorAttribute(pttext, r_, g_, b_, "fontcolor"); | ||
37 | - this->ReadXmlAttribute(pttext, text_, "title"); | ||
38 | - this->ReadXmlAttribute(pttext, fontSize_, "fontsize"); | ||
39 | - this->ReadXmlAttribute(pttext, font_, "font"); | ||
40 | - this->ReadXmlAttribute(pttext, isBold_, "bold"); | 37 | + this->ReadXmlColorAttribute(pttext, r_, g_, b_, "fontcolor",para,paraList); |
38 | + this->ReadXmlAttribute(pttext, text_, "title",para,paraList); | ||
39 | + this->ReadXmlAttribute(pttext, fontSize_, "fontsize",para,paraList); | ||
40 | + this->ReadXmlAttribute(pttext, font_, "font",para,paraList); | ||
41 | + this->ReadXmlAttribute(pttext, isBold_, "bold",para,paraList); | ||
41 | return true; | 42 | return true; |
42 | } | 43 | } |
43 | catch(const std::exception& e) | 44 | catch(const std::exception& e) |
@@ -24,7 +24,8 @@ namespace DmpWms | @@ -24,7 +24,8 @@ namespace DmpWms | ||
24 | 24 | ||
25 | public: | 25 | public: |
26 | bool DrawData(clsCrSurf* pClsCS,DmpWmsParameters::Format format); | 26 | bool DrawData(clsCrSurf* pClsCS,DmpWmsParameters::Format format); |
27 | - bool ReadXML(boost::property_tree::ptree &pt,shared_ptr<DmpPrintParameter> pMapParameter, string& errorstr); | 27 | + bool ReadXML(boost::property_tree::ptree &pt,shared_ptr<DmpPrintParameter> pMapParameter, |
28 | + string& errorstr, map<string,string>& para, map<string,string>& paraList); | ||
28 | }; | 29 | }; |
29 | } | 30 | } |
30 | 31 |
@@ -242,17 +242,18 @@ namespace DmpWms | @@ -242,17 +242,18 @@ namespace DmpWms | ||
242 | } | 242 | } |
243 | 243 | ||
244 | 244 | ||
245 | - bool DmpPrintWMSService::ReadXML(boost::property_tree::ptree &pt,shared_ptr<DmpPrintParameter> pPrintParameter, string& errorstr) | 245 | + bool DmpPrintWMSService::ReadXML(boost::property_tree::ptree &pt,shared_ptr<DmpPrintParameter> pPrintParameter, |
246 | + string& errorstr, map<string,string>& para, map<string,string>& paraList) | ||
246 | { | 247 | { |
247 | try | 248 | try |
248 | { | 249 | { |
249 | - this->ReadXmlAttribute(pt, localtionX_, "localtion_x"); | ||
250 | - this->ReadXmlAttribute(pt, localtionY_, "localtion_y"); | ||
251 | - this->ReadXmlAttribute(pt, width_, "width"); | ||
252 | - this->ReadXmlAttribute(pt, height_, "height"); | ||
253 | - this->ReadXmlAttribute(pt, showCoord_, "showCoord"); | ||
254 | - this->ReadXmlAttribute(pt, boundSize_, "bound_size"); | ||
255 | - this->ReadXmlAttribute(pt, showbound_, "showBound"); | 250 | + this->ReadXmlAttribute(pt, localtionX_, "localtion_x",para,paraList ); |
251 | + this->ReadXmlAttribute(pt, localtionY_, "localtion_y",para,paraList); | ||
252 | + this->ReadXmlAttribute(pt, width_, "width",para,paraList); | ||
253 | + this->ReadXmlAttribute(pt, height_, "height",para,paraList); | ||
254 | + this->ReadXmlAttribute(pt, showCoord_, "showCoord",para,paraList); | ||
255 | + this->ReadXmlAttribute(pt, boundSize_, "bound_size",para,paraList); | ||
256 | + this->ReadXmlAttribute(pt, showbound_, "showBound",para,paraList); | ||
256 | 257 | ||
257 | // rapidxml::xml_node<char> *text_node = node->first_node("legend"); | 258 | // rapidxml::xml_node<char> *text_node = node->first_node("legend"); |
258 | 259 | ||
@@ -262,19 +263,19 @@ namespace DmpWms | @@ -262,19 +263,19 @@ namespace DmpWms | ||
262 | shared_ptr<legendParamater> pLegendParamater_0(new legendParamater()); | 263 | shared_ptr<legendParamater> pLegendParamater_0(new legendParamater()); |
263 | pLegendParamater_ = pLegendParamater_0; | 264 | pLegendParamater_ = pLegendParamater_0; |
264 | 265 | ||
265 | - this->ReadXmlColorAttribute(ptlegend, pLegendParamater_->r, pLegendParamater_->g, pLegendParamater_->b, "fontcolor"); | ||
266 | - this->ReadXmlAttribute(ptlegend, pLegendParamater_->title, "title"); | ||
267 | - this->ReadXmlAttribute(ptlegend, pLegendParamater_->fontSize, "fontsize"); | ||
268 | - this->ReadXmlAttribute(ptlegend, pLegendParamater_->font, "font"); | ||
269 | - this->ReadXmlAttribute(ptlegend, pLegendParamater_->isbold, "bold"); | ||
270 | - this->ReadXmlColorAttribute(ptlegend, pLegendParamater_->back_r, pLegendParamater_->back_g, pLegendParamater_->back_b, "backgroundcolor"); | ||
271 | - this->ReadXmlAttribute(ptlegend, pLegendParamater_->back_a, "backgroundalpha"); | ||
272 | - | ||
273 | - this->ReadXmlAttribute(ptlegend, pLegendParamater_->showclassification, "showclassification"); | ||
274 | - this->ReadXmlAttribute(ptlegend, pLegendParamater_->rowspacing, "rowspacing"); | ||
275 | - this->ReadXmlAttribute(ptlegend, pLegendParamater_->size_x, "size_x"); | ||
276 | - this->ReadXmlAttribute(ptlegend, pLegendParamater_->size_y, "size_y"); | ||
277 | - this->ReadXmlAttribute(ptlegend, pLegendParamater_->row_maxsize, "row_maxsize"); | 266 | + this->ReadXmlColorAttribute(ptlegend, pLegendParamater_->r, pLegendParamater_->g, pLegendParamater_->b, "fontcolor",para,paraList); |
267 | + this->ReadXmlAttribute(ptlegend, pLegendParamater_->title, "title",para,paraList); | ||
268 | + this->ReadXmlAttribute(ptlegend, pLegendParamater_->fontSize, "fontsize",para,paraList); | ||
269 | + this->ReadXmlAttribute(ptlegend, pLegendParamater_->font, "font",para,paraList); | ||
270 | + this->ReadXmlAttribute(ptlegend, pLegendParamater_->isbold, "bold",para,paraList); | ||
271 | + this->ReadXmlColorAttribute(ptlegend, pLegendParamater_->back_r, pLegendParamater_->back_g, pLegendParamater_->back_b, "backgroundcolor",para,paraList); | ||
272 | + this->ReadXmlAttribute(ptlegend, pLegendParamater_->back_a, "backgroundalpha",para,paraList); | ||
273 | + | ||
274 | + this->ReadXmlAttribute(ptlegend, pLegendParamater_->showclassification, "showclassification",para,paraList); | ||
275 | + this->ReadXmlAttribute(ptlegend, pLegendParamater_->rowspacing, "rowspacing",para,paraList); | ||
276 | + this->ReadXmlAttribute(ptlegend, pLegendParamater_->size_x, "size_x",para,paraList); | ||
277 | + this->ReadXmlAttribute(ptlegend, pLegendParamater_->size_y, "size_y",para,paraList); | ||
278 | + this->ReadXmlAttribute(ptlegend, pLegendParamater_->row_maxsize, "row_maxsize",para,paraList); | ||
278 | showMapLegend_ = true; | 279 | showMapLegend_ = true; |
279 | } | 280 | } |
280 | catch(...) | 281 | catch(...) |
@@ -41,7 +41,8 @@ namespace DmpWms | @@ -41,7 +41,8 @@ namespace DmpWms | ||
41 | //bool DrawImage(); | 41 | //bool DrawImage(); |
42 | bool DrawData(clsCrSurf* pClsCS,DmpWmsParameters::Format format); | 42 | bool DrawData(clsCrSurf* pClsCS,DmpWmsParameters::Format format); |
43 | 43 | ||
44 | - bool ReadXML(boost::property_tree::ptree &pt, shared_ptr<DmpPrintParameter> pPrintParameter,string& errorstr); | 44 | + bool ReadXML(boost::property_tree::ptree &pt, shared_ptr<DmpPrintParameter> pPrintParameter, |
45 | + string& errorstr, map<string,string>& para, map<string,string>& paraList); | ||
45 | private: | 46 | private: |
46 | 47 | ||
47 | bool DrawLegend(clsCrSurf* pClsCS, shared_ptr<DmpWmsRenderer> _map, DmpWmsParameters::Format format,int locationX,int localtionY,int width,int height); | 48 | bool DrawLegend(clsCrSurf* pClsCS, shared_ptr<DmpWmsRenderer> _map, DmpWmsParameters::Format format,int locationX,int localtionY,int width,int height); |
请
注册
或
登录
后发表评论