正在显示
25 个修改的文件
包含
258 行增加
和
140 行删除
| 1 | 1 | /************************************************************************** |
| 2 | -* file: dmpgeometry.cpp | |
| 2 | +* file: DmpGeometry.cpp | |
| 3 | 3 | |
| 4 | 4 | * Author: qingxiongf |
| 5 | 5 | * Date: 2022-02-22 10:13:27 |
| 6 | 6 | * Email: qingxiongf@chinadci.com |
| 7 | 7 | * copyright: 广州城市信息研究所有限公司 |
| 8 | 8 | ***************************************************************************/ |
| 9 | -#include "dmpgeometry.h" | |
| 9 | +#include "DmpGeometry.h" | |
| 10 | 10 | #include <iostream> |
| 11 | 11 | #include <string.h> |
| 12 | 12 | #include <sstream> |
| 13 | 13 | |
| 14 | 14 | namespace mapserver |
| 15 | 15 | { |
| 16 | - std::string Dmpgeometry::geoJsonfromWKB(const char* wkb) | |
| 16 | + std::string DmpGeometry::geoJsonfromWKB(const char* wkb) | |
| 17 | 17 | { |
| 18 | 18 | unsigned char* pwkb = (unsigned char*)wkb; |
| 19 | 19 | unsigned char hasZorSrsid = ((unsigned char *)(pwkb + 4))[0] / 16; |
| ... | ... | @@ -123,7 +123,7 @@ namespace mapserver |
| 123 | 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 | 128 | double xx = this->ReadDouble(pwkb,notbig_); |
| 129 | 129 | double yy = this->ReadDouble(pwkb,notbig_); |
| ... | ... | @@ -139,7 +139,7 @@ namespace mapserver |
| 139 | 139 | return true; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - char* Dmpgeometry::ToDoubleStr(double value) | |
| 142 | + char* DmpGeometry::ToDoubleStr(double value) | |
| 143 | 143 | { |
| 144 | 144 | int len = sprintf(buff, "%.6f" ,value); |
| 145 | 145 | for ( len --; len >0; len--) |
| ... | ... | @@ -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 | 168 | int nPoint = this->ReadInt(pwkb, notbig_); |
| 169 | 169 | sstream << "["; |
| ... | ... | @@ -177,7 +177,7 @@ namespace mapserver |
| 177 | 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 | 182 | int nline = this->ReadInt(pwkb, notbig_); |
| 183 | 183 | sstream << "["; |
| ... | ... | @@ -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 | 198 | unsigned char * mem = (unsigned char *)malloc(4); |
| 199 | 199 | memcpy(mem, here, 4); |
| ... | ... | @@ -204,14 +204,14 @@ int Dmpgeometry::ReadInt(unsigned char*& here, int not_big1) |
| 204 | 204 | here += 4; |
| 205 | 205 | return num; |
| 206 | 206 | } |
| 207 | -int Dmpgeometry::ReadByte(unsigned char*& here) | |
| 207 | +int DmpGeometry::ReadByte(unsigned char*& here) | |
| 208 | 208 | { |
| 209 | 209 | int num = ((char*)here)[0]; |
| 210 | 210 | here++; |
| 211 | 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 | 216 | //DmapCore_30::clsMalloc clsM(8); |
| 217 | 217 | unsigned char * mem = (unsigned char *)malloc(8); |
| ... | ... | @@ -224,7 +224,7 @@ double Dmpgeometry::ReadDouble(unsigned char*& here, int not_big) |
| 224 | 224 | return num; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | -bool Dmpgeometry::Exchange4(unsigned char * here) | |
| 227 | +bool DmpGeometry::Exchange4(unsigned char * here) | |
| 228 | 228 | { |
| 229 | 229 | unsigned char temp; |
| 230 | 230 | for (int i = 0; i < 2; i++) |
| ... | ... | @@ -236,7 +236,7 @@ bool Dmpgeometry::Exchange4(unsigned char * here) |
| 236 | 236 | return true; |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | -bool Dmpgeometry::Exchange8(unsigned char * here) | |
| 239 | +bool DmpGeometry::Exchange8(unsigned char * here) | |
| 240 | 240 | { |
| 241 | 241 | unsigned char temp; |
| 242 | 242 | for (int i = 0; i < 4; i++) | ... | ... |
| 1 | 1 | /************************************************************************** |
| 2 | -* file: dmpgeometry.h | |
| 2 | +* file: DmpGeometry.h | |
| 3 | 3 | |
| 4 | 4 | * Author: qingxiongf |
| 5 | 5 | * Date: 2022-02-22 10:07:04 |
| ... | ... | @@ -7,21 +7,21 @@ |
| 7 | 7 | * copyright: 广州城市信息研究所有限公司 |
| 8 | 8 | ***************************************************************************/ |
| 9 | 9 | |
| 10 | -#ifndef __dmpgeometry_h__ | |
| 11 | -#define __dmpgeometry_h__ | |
| 10 | +#ifndef __DmpGeometry_h__ | |
| 11 | +#define __DmpGeometry_h__ | |
| 12 | 12 | #include <geometry/dmpwkbtypes.h> |
| 13 | 13 | #include <string> |
| 14 | 14 | using namespace std; |
| 15 | 15 | namespace mapserver |
| 16 | 16 | { |
| 17 | - class Dmpgeometry | |
| 17 | + class DmpGeometry | |
| 18 | 18 | { |
| 19 | 19 | /* data */ |
| 20 | 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 | 26 | std::string geoJsonfromWKB(const char* wkb); |
| 27 | 27 | |
| ... | ... | @@ -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 | 86 | responseData.append(buff); |
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | - //tickAA=GetTickCount(); | |
| 90 | - | |
| 91 | 89 | sprintf(buff, "</gims:%s>\r", layerName.c_str()); |
| 92 | 90 | responseData.append(buff); |
| 93 | 91 | responseData.append("</gims:featureMember>"); |
| ... | ... | @@ -97,17 +95,11 @@ namespace mapserver |
| 97 | 95 | |
| 98 | 96 | if (pointCountTemp > 2000) |
| 99 | 97 | break; |
| 100 | - //Sleep(5000); | |
| 101 | - // break; | |
| 102 | 98 | } |
| 103 | 99 | } |
| 104 | 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 | 103 | responseData.append("</wfs:FeatureCollection>"); |
| 112 | 104 | |
| 113 | 105 | return; |
| ... | ... | @@ -157,16 +149,17 @@ namespace mapserver |
| 157 | 149 | geometry = pPgsqlConn->getString(i); |
| 158 | 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 | 155 | geometry = dmpgeometry.geoJsonfromWKB(pPgsqlConn->getString(i)); |
| 164 | 156 | continue; |
| 165 | 157 | } |
| 166 | 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 | 163 | properties += buff; |
| 171 | 164 | } |
| 172 | 165 | } | ... | ... |
| ... | ... | @@ -311,7 +311,7 @@ namespace DmpWfs |
| 311 | 311 | typeInt = PGFieldType::ShapeFieldType; |
| 312 | 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 | 316 | else |
| 317 | 317 | { | ... | ... |
| ... | ... | @@ -29,8 +29,9 @@ namespace DmpWms |
| 29 | 29 | std::string title = context.serverProject()->title(); |
| 30 | 30 | std::string boxx = params.BBox(); |
| 31 | 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 | 36 | if(outformat == DmpWmsParameters::Format::PDF) |
| 36 | 37 | { |
| ... | ... | @@ -52,4 +53,11 @@ namespace DmpWms |
| 52 | 53 | |
| 53 | 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 | } |
| \ No newline at end of file | ... | ... |
| ... | ... | @@ -176,6 +176,13 @@ namespace DmpWms |
| 176 | 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 | 186 | DmpWmsParameters::Format DmpWmsParameters::InfoFormat() const |
| 180 | 187 | { |
| 181 | 188 | std::string value = ""; | ... | ... |
| ... | ... | @@ -63,6 +63,8 @@ namespace DmpWms |
| 63 | 63 | DmpWmsParameters::Format ResFormat() const; //GetMap URL为Format GetFeatureInfo url为:info_format |
| 64 | 64 | |
| 65 | 65 | std::string printTemp() const; |
| 66 | + | |
| 67 | + std::string printPara() const; | |
| 66 | 68 | private: |
| 67 | 69 | bool GetStringParameter(const char* key, std::string &value) const; |
| 68 | 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 | 537 | { |
| 538 | 538 | typeString = "geometry"; |
| 539 | 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 | 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 | 621 | double start = clock(); |
| 623 | 622 | double cost, cost2; |
| 624 | 623 | |
| 625 | - | |
| 626 | 624 | try |
| 627 | 625 | { |
| 628 | 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 | 630 | string sql = this->GetFeatureInfoSQL(layer, x0, y0, dis, feature_count); //sql语句中使用 ::box |
| 633 | 631 | if (sql == "") continue; |
| 634 | 632 | string layerName = layer->name(); |
| 635 | - printf("%s\r\n",sql.c_str()); | |
| 636 | 633 | if (pPgsqlConn->ExecWaitBinary(sql)) |
| 637 | 634 | { |
| 638 | 635 | if(pPgsqlConn->GetRowCount()>0 || i==0) | ... | ... |
| ... | ... | @@ -188,7 +188,8 @@ namespace DmpWms |
| 188 | 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 | 194 | string path = "../template/"; |
| 194 | 195 | path += tempName; |
| ... | ... | @@ -205,11 +206,11 @@ namespace DmpWms |
| 205 | 206 | buffer << fin.rdbuf(); |
| 206 | 207 | string content(buffer.str()); |
| 207 | 208 | fin.close(); |
| 208 | - return getPrintLayout(responseData, project, content.c_str(), bbox); | |
| 209 | + return getPrintLayout(responseData, project, content.c_str(), bbox, paras); | |
| 209 | 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 | 215 | string result_msg; |
| 215 | 216 | if (xml == nullptr || bbox == nullptr) |
| ... | ... | @@ -218,9 +219,24 @@ namespace DmpWms |
| 218 | 219 | m_height = 1122; |
| 219 | 220 | m_width = 793; |
| 220 | 221 | |
| 221 | - | |
| 222 | 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 | 240 | std::stringstream stream(xml); |
| 225 | 241 | boost::property_tree::ptree ptree; |
| 226 | 242 | boost::property_tree::read_xml(stream, ptree); |
| ... | ... | @@ -246,7 +262,7 @@ namespace DmpWms |
| 246 | 262 | |
| 247 | 263 | shared_ptr<DmpPrintLayout> printLayout(new DmpPrintLayout()); |
| 248 | 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 | 267 | this->vector_DmpPrintLayout.push_back(printLayout); |
| 252 | 268 | ToPrint(responseData); | ... | ... |
| ... | ... | @@ -21,6 +21,7 @@ |
| 21 | 21 | #include "clsUtil.h" |
| 22 | 22 | #include <boost/property_tree/ptree.hpp> |
| 23 | 23 | #include <boost/property_tree/xml_parser.hpp> |
| 24 | +#include <boost/property_tree/json_parser.hpp> | |
| 24 | 25 | #include <boost/typeof/typeof.hpp> |
| 25 | 26 | #include "dmpprintlayout.h" |
| 26 | 27 | #include "dmpprintparameter.h" |
| ... | ... | @@ -63,12 +64,14 @@ namespace DmpWms |
| 63 | 64 | bool getPrintLayout(std::string &responseData, |
| 64 | 65 | const DmpProject* project, |
| 65 | 66 | const char *xml, |
| 66 | - const char *bbox); | |
| 67 | + const char *bbox, | |
| 68 | + const char *paras); | |
| 67 | 69 | |
| 68 | 70 | bool getPrintTempFile(std::string &responseData, |
| 69 | 71 | const DmpProject* project, |
| 70 | 72 | const char *tempName, |
| 71 | - const char *bbox); | |
| 73 | + const char *bbox, | |
| 74 | + const char *paras); | |
| 72 | 75 | |
| 73 | 76 | // bool Test(std::string &responseData, DmpProject* project, string servername); |
| 74 | 77 | ... | ... |
| ... | ... | @@ -16,14 +16,15 @@ namespace DmpWms |
| 16 | 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 | 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 | 29 | this->pPrintParameter_ = pPrintParameter; |
| 29 | 30 | ... | ... |
| ... | ... | @@ -24,7 +24,8 @@ namespace DmpWms |
| 24 | 24 | public: |
| 25 | 25 | //bool DrawImage(); |
| 26 | 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 | 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 | 70 | try |
| 58 | 71 | { |
| 59 | 72 | string xmlattrkey = "<xmlattr>."; |
| 60 | 73 | xmlattrkey += key; |
| 61 | 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 | 89 | return true; |
| 64 | 90 | } |
| 65 | 91 | catch(...) |
| ... | ... | @@ -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 | 100 | try |
| 74 | 101 | { |
| 75 | 102 | string xmlattrkey = "<xmlattr>."; |
| 76 | 103 | xmlattrkey += key; |
| 104 | + //string value = pt.get<std::string>(xmlattrkey,"0"); | |
| 105 | + // v = atoi(value.c_str()); | |
| 106 | + | |
| 77 | 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 | 122 | return true; |
| 80 | 123 | } |
| 81 | 124 | catch(...) |
| ... | ... | @@ -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 | 133 | try |
| 90 | 134 | { |
| 91 | 135 | string xmlattrkey = "<xmlattr>."; |
| 92 | 136 | xmlattrkey += key; |
| 93 | 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 | 152 | if(value == "false")v = false; |
| 95 | 153 | if(value == "true") v= true; |
| 96 | 154 | |
| ... | ... | @@ -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 | 167 | string color; |
| 109 | - if(this->ReadXmlAttribute(pt, color, key)) | |
| 168 | + if(this->ReadXmlAttribute(pt, color, key,para ,paraList)) | |
| 110 | 169 | { |
| 111 | 170 | string str_red; |
| 112 | 171 | string str_greed; |
| ... | ... | @@ -141,13 +200,33 @@ namespace DmpWms |
| 141 | 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 | 206 | try |
| 147 | 207 | { |
| 148 | 208 | string xmlattrkey = "<xmlattr>."; |
| 149 | 209 | xmlattrkey += key; |
| 150 | 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 | 230 | return true; |
| 152 | 231 | } |
| 153 | 232 | catch(...) |
| ... | ... | @@ -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 | 241 | try |
| 162 | 242 | { |
| 163 | 243 | string xmlattrkey = key; |
| 164 | 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 | 258 | return true; |
| 166 | 259 | } |
| 167 | 260 | catch(...) | ... | ... |
| ... | ... | @@ -52,23 +52,26 @@ namespace DmpWms |
| 52 | 52 | // virtual bool InitNodeClass(); |
| 53 | 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 | 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 | 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 | 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 | 28 | try |
| 44 | 29 | { |
| 45 | 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 | 31 | for (boost::property_tree::ptree::iterator pos = ptlayouts.begin(); pos != ptlayouts.end(); ++pos) |
| 50 | 32 | { |
| 51 | 33 | string type; |
| 52 | 34 | boost::property_tree::ptree ptlayout = pos->second; |
| 53 | - this->ReadXmlAttribute(ptlayout, type, "type"); | |
| 35 | + this->ReadXmlAttribute(ptlayout, type, "type",para,paraList); | |
| 54 | 36 | bool result = true; |
| 55 | 37 | if (type == "text") |
| 56 | 38 | { |
| 57 | 39 | shared_ptr<DmpPrintLayer> layer(new DmpPrintText()); |
| 58 | - result = layer->ReadXML(ptlayout, pPrintParameter, errorstr); | |
| 40 | + result = layer->ReadXML(ptlayout, pPrintParameter, errorstr,para,paraList); | |
| 59 | 41 | this->data.push_back(layer); |
| 60 | 42 | } |
| 61 | 43 | else if (type == "dmapservice") |
| 62 | 44 | { |
| 63 | 45 | shared_ptr<DmpPrintLayer> layer(new DmpPrintWMSService()); |
| 64 | - result = layer->ReadXML(ptlayout, pPrintParameter, errorstr); | |
| 46 | + result = layer->ReadXML(ptlayout, pPrintParameter, errorstr,para,paraList); | |
| 65 | 47 | this->data.push_back(layer); |
| 66 | 48 | } |
| 67 | 49 | else if (type == "scale") |
| 68 | 50 | { |
| 69 | 51 | shared_ptr<DmpPrintLayer> layer(new DmpPrintScale()); |
| 70 | - result = layer->ReadXML(ptlayout, pPrintParameter, errorstr); | |
| 52 | + result = layer->ReadXML(ptlayout, pPrintParameter, errorstr,para,paraList); | |
| 71 | 53 | this->data.push_back(layer); |
| 72 | 54 | } |
| 73 | 55 | else if (type == "compass") |
| 74 | 56 | { |
| 75 | 57 | shared_ptr<DmpPrintLayer> layer(new DmpPrintCompass()); |
| 76 | - result = layer->ReadXML(ptlayout, pPrintParameter, errorstr); | |
| 58 | + result = layer->ReadXML(ptlayout, pPrintParameter, errorstr,para,paraList); | |
| 77 | 59 | this->data.push_back(layer); |
| 78 | 60 | } |
| 79 | 61 | else if (type == "rectangle" || type == "rect") |
| 80 | 62 | { |
| 81 | 63 | shared_ptr<DmpPrintLayer> layer(new DmpPrintRect()); |
| 82 | - result = layer->ReadXML(ptlayout, pPrintParameter, errorstr); | |
| 64 | + result = layer->ReadXML(ptlayout, pPrintParameter, errorstr,para,paraList); | |
| 83 | 65 | this->data.push_back(layer); |
| 84 | 66 | } |
| 85 | 67 | else | ... | ... |
| ... | ... | @@ -34,7 +34,8 @@ namespace DmpWms |
| 34 | 34 | public: |
| 35 | 35 | |
| 36 | 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 | 39 | private: |
| 39 | 40 | bool DrawBound(clsCrSurf* pClsCS); |
| 40 | 41 | ... | ... |
| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | #include <math.h> |
| 13 | 13 | #include "dmpproject.h" |
| 14 | 14 | #include <memory> |
| 15 | +#include <map> | |
| 15 | 16 | using namespace std; |
| 16 | 17 | namespace DmpWms |
| 17 | 18 | { |
| ... | ... | @@ -37,6 +38,8 @@ namespace DmpWms |
| 37 | 38 | double m_dR = 0; |
| 38 | 39 | double m_dXdis = 0;//width / 2.0 - m_dR * (right + left) / 2.0; |
| 39 | 40 | double m_dYdis = 0;//height / 2.0 + m_dR * (top + bottom) / 2.0; |
| 41 | + | |
| 42 | + map<string,string> params; | |
| 40 | 43 | public: |
| 41 | 44 | void InitParameter(double l0,double r0,double t0,double b0, int w0,int h0); |
| 42 | 45 | ... | ... |
| ... | ... | @@ -22,16 +22,17 @@ namespace DmpWms |
| 22 | 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 | 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 | 36 | this->pPrintParameter_ = pPrintParameter; |
| 36 | 37 | |
| 37 | 38 | return true; | ... | ... |
| ... | ... | @@ -17,7 +17,8 @@ namespace DmpWms |
| 17 | 17 | public: |
| 18 | 18 | shared_ptr<DmpPrintParameter> pPrintParameter_ = nullptr; |
| 19 | 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 | 23 | private: |
| 23 | 24 | int width_ =0; | ... | ... |
| ... | ... | @@ -115,14 +115,15 @@ namespace DmpWms |
| 115 | 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 | 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 | 128 | this->pPrintParameter_ = pPrintParameter; |
| 128 | 129 | ... | ... |
| ... | ... | @@ -21,7 +21,8 @@ namespace DmpWms |
| 21 | 21 | public: |
| 22 | 22 | //bool DrawImage(); |
| 23 | 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 | 28 | #endif // __dmpprintscale_h__ | ... | ... |
| ... | ... | @@ -23,21 +23,22 @@ namespace DmpWms |
| 23 | 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 | 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 | 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 | 42 | return true; |
| 42 | 43 | } |
| 43 | 44 | catch(const std::exception& e) | ... | ... |
| ... | ... | @@ -24,7 +24,8 @@ namespace DmpWms |
| 24 | 24 | |
| 25 | 25 | public: |
| 26 | 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 | 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 | 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 | 258 | // rapidxml::xml_node<char> *text_node = node->first_node("legend"); |
| 258 | 259 | |
| ... | ... | @@ -262,19 +263,19 @@ namespace DmpWms |
| 262 | 263 | shared_ptr<legendParamater> pLegendParamater_0(new legendParamater()); |
| 263 | 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 | 279 | showMapLegend_ = true; |
| 279 | 280 | } |
| 280 | 281 | catch(...) | ... | ... |
| ... | ... | @@ -41,7 +41,8 @@ namespace DmpWms |
| 41 | 41 | //bool DrawImage(); |
| 42 | 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 | 46 | private: |
| 46 | 47 | |
| 47 | 48 | bool DrawLegend(clsCrSurf* pClsCS, shared_ptr<DmpWmsRenderer> _map, DmpWmsParameters::Format format,int locationX,int localtionY,int width,int height); | ... | ... |
请
注册
或
登录
后发表评论