正在显示
11 个修改的文件
包含
348 行增加
和
25 行删除
| ... | ... | @@ -12,7 +12,7 @@ namespace DmapCore_30 |
| 12 | 12 | { |
| 13 | 13 | SimpleMarkerSymbol::SimpleMarkerSymbol() |
| 14 | 14 | { |
| 15 | - m_iAntialiasing = CAIRO_ANTIALIAS_BEST; | |
| 15 | + m_iAntialiasing = CAIRO_ANTIALIAS_FAST; | |
| 16 | 16 | m_bBoundary = true; |
| 17 | 17 | m_iColor = clsUtil::RandomColor(); |
| 18 | 18 | clsUtil::ToCairoColor(m_iColor, r, g, b, a); | ... | ... |
| ... | ... | @@ -12,7 +12,7 @@ namespace DmapCore_30 |
| 12 | 12 | { |
| 13 | 13 | SimplePolygonSymbol::SimplePolygonSymbol() |
| 14 | 14 | { |
| 15 | - m_iAntialiasing = CAIRO_ANTIALIAS_BEST; | |
| 15 | + m_iAntialiasing = CAIRO_ANTIALIAS_FAST; | |
| 16 | 16 | m_iBackgroundColor = clsUtil::RandomColor(); |
| 17 | 17 | clsUtil::ToCairoColor(m_iBackgroundColor, r, g, b, a); |
| 18 | 18 | m_iLineType = 0; | ... | ... |
| ... | ... | @@ -323,7 +323,7 @@ namespace DmapCore_30 |
| 323 | 323 | //int surf_w = pClsCS->m_iW; int surf_h = pClsCS->m_iH; |
| 324 | 324 | |
| 325 | 325 | //文字被截取 |
| 326 | - if(iX < -30 || (iX + iTextW) > pClsCS->m_iW + 30 || (iY - iTextH ) < -15 || iY > pClsCS->m_iH + 15) | |
| 326 | + if(iX < 0 || (iX + iTextW) > pClsCS->m_iW || (iY - iTextH ) < 0 || iY > pClsCS->m_iH) | |
| 327 | 327 | { |
| 328 | 328 | return false; |
| 329 | 329 | } | ... | ... |
| ... | ... | @@ -287,7 +287,7 @@ namespace DmapCore_30 |
| 287 | 287 | //CAIRO_ANTIALIAS_FAST, |
| 288 | 288 | // CAIRO_ANTIALIAS_GOOD, |
| 289 | 289 | // CAIRO_ANTIALIAS_BEST |
| 290 | - // cairo_set_antialias(cr,CAIRO_ANTIALIAS_FAST); | |
| 290 | + cairo_set_antialias(cr,CAIRO_ANTIALIAS_FAST); | |
| 291 | 291 | return true; |
| 292 | 292 | switch (iAntialias) |
| 293 | 293 | { | ... | ... |
| ... | ... | @@ -8,6 +8,7 @@ SET (MAPSERVER_SRCS |
| 8 | 8 | dmppgsql.cpp |
| 9 | 9 | dmppgsqlpool.cpp |
| 10 | 10 | dmppgsqlsourcepools.cpp |
| 11 | + dmpgeometry.cpp | |
| 11 | 12 | wfs/dmpwfs.cpp |
| 12 | 13 | wfs/dmpwfsfilter.cpp |
| 13 | 14 | wfs/dmpgmlfilter.cpp |
| ... | ... | @@ -44,6 +45,7 @@ SET (MAPSERVER_HDRS |
| 44 | 45 | dmppgsql.h |
| 45 | 46 | dmppgsqlpool.h |
| 46 | 47 | dmppgsqlsourcepools.h |
| 48 | + dmpgeometry.h | |
| 47 | 49 | wfs/dmpwfs.h |
| 48 | 50 | wfs/dmpwfsfilter.h |
| 49 | 51 | wfs/dmpgmlfilter.h | ... | ... |
| 1 | +/************************************************************************** | |
| 2 | +* file: dmpgeometry.cpp | |
| 3 | + | |
| 4 | +* Author: qingxiongf | |
| 5 | +* Date: 2022-02-22 10:13:27 | |
| 6 | +* Email: qingxiongf@chinadci.com | |
| 7 | +* copyright: 广州城市信息研究所有限公司 | |
| 8 | +***************************************************************************/ | |
| 9 | +#include "dmpgeometry.h" | |
| 10 | +#include <iostream> | |
| 11 | +#include <string.h> | |
| 12 | +#include <sstream> | |
| 13 | + | |
| 14 | +namespace mapserver | |
| 15 | +{ | |
| 16 | + std::string Dmpgeometry::geoJsonfromWKB(const char* wkb) | |
| 17 | + { | |
| 18 | + unsigned char* pwkb = (unsigned char*)wkb; | |
| 19 | + unsigned char hasZorSrsid = ((unsigned char *)(pwkb + 4))[0] / 16; | |
| 20 | + | |
| 21 | + unsigned char type = ((unsigned char *)(pwkb + 1))[0]; | |
| 22 | + this->hasZ_ = hasZorSrsid / 8; | |
| 23 | + this->hasSrid_ = hasZorSrsid % 8; | |
| 24 | + | |
| 25 | + | |
| 26 | + notbig_ = this->ReadByte(pwkb); | |
| 27 | + int shape = this->ReadInt(pwkb, notbig_); | |
| 28 | + if (hasSrid_) | |
| 29 | + { | |
| 30 | + srid_ = this->ReadInt(pwkb, notbig_); | |
| 31 | + } | |
| 32 | + | |
| 33 | + std::stringstream sstream; | |
| 34 | + | |
| 35 | + switch (type) | |
| 36 | + { | |
| 37 | + case DmpWkbTypes::Type::Point: | |
| 38 | + // case DmpWkbTypes::Type::PointZ: | |
| 39 | + // case DmpWkbTypes::Type::PointM: | |
| 40 | + // case DmpWkbTypes::Type::PointZM: | |
| 41 | + { | |
| 42 | + sstream << R"({"type":"Point","coordinates": [)"; | |
| 43 | + readPointfromWKB(pwkb,sstream); | |
| 44 | + break; | |
| 45 | + } | |
| 46 | + | |
| 47 | + | |
| 48 | + case DmpWkbTypes::Type::MultiPoint: | |
| 49 | + // case DmpWkbTypes::Type::MultiPointZ: | |
| 50 | + // case DmpWkbTypes::Type::MultiPointM: | |
| 51 | + // case DmpWkbTypes::Type::MultiPointZM: | |
| 52 | + { | |
| 53 | + sstream << R"({"type":"MultiPoint","coordinates": [)"; | |
| 54 | + int nPoint = this->ReadInt(pwkb, notbig_); | |
| 55 | + for (int j = 0; j < nPoint; j++) | |
| 56 | + { | |
| 57 | + pwkb += 5; | |
| 58 | + if(j>0) sstream << ","; | |
| 59 | + readPointfromWKB(pwkb,sstream); | |
| 60 | + } | |
| 61 | + break; | |
| 62 | + } | |
| 63 | + | |
| 64 | + case DmpWkbTypes::Type::LineString: | |
| 65 | + // case DmpWkbTypes::Type::LineStringZ: | |
| 66 | + // case DmpWkbTypes::Type::LineStringM: | |
| 67 | + // case DmpWkbTypes::Type::LineStringZM: | |
| 68 | + { | |
| 69 | + sstream << R"({"type":"LineString","coordinates": [)"; | |
| 70 | + readLinefromWKB(pwkb,sstream); | |
| 71 | + break; | |
| 72 | + } | |
| 73 | + | |
| 74 | + | |
| 75 | + case DmpWkbTypes::Type::MultiLineString: | |
| 76 | + // case DmpWkbTypes::Type::MultiLineStringZ: | |
| 77 | + // case DmpWkbTypes::Type::MultiLineStringM: | |
| 78 | + // case DmpWkbTypes::Type::MultiLineStringZM: | |
| 79 | + { | |
| 80 | + sstream << R"({"type":"MultiLineString","coordinates": [)"; | |
| 81 | + int nLine = this->ReadInt(pwkb, notbig_); | |
| 82 | + for (int j = 0; j < nLine; j++) | |
| 83 | + { | |
| 84 | + pwkb += 5; | |
| 85 | + if(j>0) sstream << ","; | |
| 86 | + readLinefromWKB(pwkb,sstream); | |
| 87 | + } | |
| 88 | + break; | |
| 89 | + } | |
| 90 | + | |
| 91 | + case DmpWkbTypes::Type::Polygon: | |
| 92 | + // case DmpWkbTypes::Type::PolygonZ: | |
| 93 | + // case DmpWkbTypes::Type::PolygonM: | |
| 94 | + // case DmpWkbTypes::Type::PolygonZM: | |
| 95 | + { | |
| 96 | + sstream << R"({"type":"Polygon","coordinates": [)"; | |
| 97 | + readPolygonfromWKB(pwkb,sstream); | |
| 98 | + break; | |
| 99 | + } | |
| 100 | + | |
| 101 | + case DmpWkbTypes::Type::MultiPolygon: | |
| 102 | + // case DmpWkbTypes::Type::MultiPolygonZ: | |
| 103 | + // case DmpWkbTypes::Type::MultiPolygonM: | |
| 104 | + // case DmpWkbTypes::Type::MultiPolygonZM: | |
| 105 | + { | |
| 106 | + sstream << R"({"type":"MultiPolygon","coordinates": [)"; | |
| 107 | + int nPolygon = this->ReadInt(pwkb, notbig_); | |
| 108 | + for (int j = 0; j < nPolygon; j++) | |
| 109 | + { | |
| 110 | + pwkb += 5; | |
| 111 | + if(j>0) sstream << ","; | |
| 112 | + readPolygonfromWKB(pwkb,sstream); | |
| 113 | + } | |
| 114 | + break; | |
| 115 | + } | |
| 116 | + | |
| 117 | + default: | |
| 118 | + break; | |
| 119 | + } | |
| 120 | + | |
| 121 | + sstream << "]}"; | |
| 122 | + | |
| 123 | + return sstream.str();; | |
| 124 | + } | |
| 125 | + | |
| 126 | + bool Dmpgeometry::readPointfromWKB(unsigned char*& pwkb, stringstream& sstream ) | |
| 127 | + { | |
| 128 | + double xx = this->ReadDouble(pwkb,notbig_); | |
| 129 | + double yy = this->ReadDouble(pwkb,notbig_); | |
| 130 | + | |
| 131 | + // sprintf(buff, "[%.6f,%.6f]" ,xx,yy); | |
| 132 | + sstream << "[" << ToDoubleStr(xx) << "," << ToDoubleStr(yy) << "]"; | |
| 133 | + | |
| 134 | + if(hasZ_) | |
| 135 | + { | |
| 136 | + pwkb += 8; | |
| 137 | + // double zz = this->ReadDouble(pwkb,notbig_); | |
| 138 | + } | |
| 139 | + return true; | |
| 140 | + } | |
| 141 | + | |
| 142 | + char* Dmpgeometry::ToDoubleStr(double value) | |
| 143 | + { | |
| 144 | + int len = sprintf(buff, "%.6f" ,value); | |
| 145 | + for ( len --; len >0; len--) | |
| 146 | + { | |
| 147 | + if(buff[len] == '0') | |
| 148 | + { | |
| 149 | + buff[len] = 0; | |
| 150 | + } | |
| 151 | + else if(buff[len] == '.') | |
| 152 | + { | |
| 153 | + buff[len] = 0; | |
| 154 | + break; | |
| 155 | + } | |
| 156 | + else | |
| 157 | + { | |
| 158 | + break; | |
| 159 | + } | |
| 160 | + } | |
| 161 | + | |
| 162 | + return buff; | |
| 163 | + | |
| 164 | + } | |
| 165 | + | |
| 166 | + bool Dmpgeometry::readLinefromWKB(unsigned char*& pwkb, stringstream& sstream) | |
| 167 | + { | |
| 168 | + int nPoint = this->ReadInt(pwkb, notbig_); | |
| 169 | + sstream << "["; | |
| 170 | + for (size_t i = 0; i < nPoint; i++) | |
| 171 | + { | |
| 172 | + if(i>0) sstream << ","; | |
| 173 | + readPointfromWKB(pwkb, sstream); | |
| 174 | + } | |
| 175 | + sstream << "]"; | |
| 176 | + | |
| 177 | + return true; | |
| 178 | + } | |
| 179 | + | |
| 180 | + bool Dmpgeometry::readPolygonfromWKB(unsigned char*& pwkb, stringstream& sstream) | |
| 181 | + { | |
| 182 | + int nline = this->ReadInt(pwkb, notbig_); | |
| 183 | + sstream << "["; | |
| 184 | + for (size_t i = 0; i < nline; i++) | |
| 185 | + { | |
| 186 | + if(i>0) sstream << ","; | |
| 187 | + readLinefromWKB(pwkb, sstream); | |
| 188 | + } | |
| 189 | + sstream << "]"; | |
| 190 | + | |
| 191 | + return true; | |
| 192 | + } | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | +int Dmpgeometry::ReadInt(unsigned char*& here, int not_big1) | |
| 197 | +{ | |
| 198 | + unsigned char * mem = (unsigned char *)malloc(4); | |
| 199 | + memcpy(mem, here, 4); | |
| 200 | + if (!not_big1) | |
| 201 | + this->Exchange4(mem); | |
| 202 | + int num = ((int*)mem)[0]; | |
| 203 | + free(mem); | |
| 204 | + here += 4; | |
| 205 | + return num; | |
| 206 | +} | |
| 207 | +int Dmpgeometry::ReadByte(unsigned char*& here) | |
| 208 | +{ | |
| 209 | + int num = ((char*)here)[0]; | |
| 210 | + here++; | |
| 211 | + return num; | |
| 212 | +} | |
| 213 | + | |
| 214 | +double Dmpgeometry::ReadDouble(unsigned char*& here, int not_big) | |
| 215 | +{ | |
| 216 | + //DmapCore_30::clsMalloc clsM(8); | |
| 217 | + unsigned char * mem = (unsigned char *)malloc(8); | |
| 218 | + memcpy(mem, here, 8); | |
| 219 | + if (!not_big) | |
| 220 | + Exchange8(mem); | |
| 221 | + double num = ((double*)mem)[0]; | |
| 222 | + free(mem); | |
| 223 | + here += 8; | |
| 224 | + return num; | |
| 225 | +} | |
| 226 | + | |
| 227 | +bool Dmpgeometry::Exchange4(unsigned char * here) | |
| 228 | +{ | |
| 229 | + unsigned char temp; | |
| 230 | + for (int i = 0; i < 2; i++) | |
| 231 | + { | |
| 232 | + temp = here[i]; | |
| 233 | + here[i] = here[3 - i]; | |
| 234 | + here[3 - i] = temp; | |
| 235 | + } | |
| 236 | + return true; | |
| 237 | +} | |
| 238 | + | |
| 239 | +bool Dmpgeometry::Exchange8(unsigned char * here) | |
| 240 | +{ | |
| 241 | + unsigned char temp; | |
| 242 | + for (int i = 0; i < 4; i++) | |
| 243 | + { | |
| 244 | + temp = here[i]; | |
| 245 | + here[i] = here[7 - i]; | |
| 246 | + here[7 - i] = temp; | |
| 247 | + } | |
| 248 | + return true; | |
| 249 | +} | |
| 250 | + | |
| 251 | + | |
| 252 | +} | |
| 253 | + | ... | ... |
src/server/services/mapserver/dmpgeometry.h
0 → 100644
| 1 | +/************************************************************************** | |
| 2 | +* file: dmpgeometry.h | |
| 3 | + | |
| 4 | +* Author: qingxiongf | |
| 5 | +* Date: 2022-02-22 10:07:04 | |
| 6 | +* Email: qingxiongf@chinadci.com | |
| 7 | +* copyright: 广州城市信息研究所有限公司 | |
| 8 | +***************************************************************************/ | |
| 9 | + | |
| 10 | +#ifndef __dmpgeometry_h__ | |
| 11 | +#define __dmpgeometry_h__ | |
| 12 | +#include <geometry/dmpwkbtypes.h> | |
| 13 | +#include <string> | |
| 14 | +using namespace std; | |
| 15 | +namespace mapserver | |
| 16 | +{ | |
| 17 | + class Dmpgeometry | |
| 18 | + { | |
| 19 | + /* data */ | |
| 20 | + public: | |
| 21 | + // Dmpgeometry(/* args */); | |
| 22 | + // ~Dmpgeometry(); | |
| 23 | + | |
| 24 | + // static Dmpgeometry geometryfromWKT(const char* wkt); | |
| 25 | + | |
| 26 | + std::string geoJsonfromWKB(const char* wkb); | |
| 27 | + | |
| 28 | + bool readPointfromWKB(unsigned char*& pwkb, stringstream& outstream); | |
| 29 | + bool readLinefromWKB(unsigned char*& pwkb, stringstream& outstream); | |
| 30 | + bool readPolygonfromWKB(unsigned char*& pwkb, stringstream& outstream); | |
| 31 | + | |
| 32 | + // static string geoJsonfromWKT(const char* wkt); | |
| 33 | + private: | |
| 34 | + int ReadInt(unsigned char*& pwkb, int not_big1); | |
| 35 | + double ReadDouble(unsigned char*& pwkb, int not_big1); | |
| 36 | + int ReadByte(unsigned char*& pwkb); | |
| 37 | + bool Exchange4(unsigned char* pwkb); | |
| 38 | + bool Exchange8(unsigned char* pwkb); | |
| 39 | + | |
| 40 | + char* ToDoubleStr(double value); | |
| 41 | + private: | |
| 42 | + int srid_; | |
| 43 | + bool hasZ_; | |
| 44 | + bool hasSrid_; | |
| 45 | + int notbig_; | |
| 46 | + | |
| 47 | + DmpWkbTypes::Type type_; | |
| 48 | + char buff[100]; | |
| 49 | + | |
| 50 | + }; | |
| 51 | + | |
| 52 | +} | |
| 53 | + | |
| 54 | +#endif // __dmpgeometry_h__ | ... | ... |
| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | #include <ostream> |
| 13 | 13 | #include <string> |
| 14 | 14 | #include <boost/asio.hpp> |
| 15 | - | |
| 15 | +#include "dmpgeometry.h" | |
| 16 | 16 | using boost::asio::ip::tcp; |
| 17 | 17 | |
| 18 | 18 | namespace mapserver |
| ... | ... | @@ -56,17 +56,9 @@ namespace mapserver |
| 56 | 56 | int fieldsCount = pPgsqlConn->GetFieldCount(); |
| 57 | 57 | for (; pPgsqlConn->next();) |
| 58 | 58 | { |
| 59 | - // css++; | |
| 60 | - //if(css!=24)continue; | |
| 61 | - //break; | |
| 62 | - //string geometry = ""; | |
| 63 | - //string properties = ""; | |
| 64 | 59 | responseData.append("<gims:featureMember>"); |
| 65 | 60 | sprintf(buff, "<gims:%s fid=\"%s.%d\">", layerName.c_str(), layerName.c_str(), count + 1); |
| 66 | 61 | responseData.append(buff); |
| 67 | - //responseData.append("\r\n"); | |
| 68 | - | |
| 69 | - //columns[md[ i ].getString(MetaData::ATTR_NAME)] = i; | |
| 70 | 62 | for (int i = 0; i < fieldsCount; i++) |
| 71 | 63 | { |
| 72 | 64 | const char *sfieldName = pPgsqlConn->GetFieldName(i); //pPgsqlConn->field_name[i].c_str(); |
| ... | ... | @@ -77,7 +69,7 @@ namespace mapserver |
| 77 | 69 | if (strncmp(sfieldName, "RN_RN", 5) == 0) |
| 78 | 70 | continue; |
| 79 | 71 | std::string strFieldName = sfieldName; |
| 80 | - //DmapDll::StringHelp::ToXMLString(strFieldName); | |
| 72 | + //DmapDll::StringHelp::ToXMLString(strFieldName); | |
| 81 | 73 | |
| 82 | 74 | if (strFieldName == "geometry_as_gml") |
| 83 | 75 | { |
| ... | ... | @@ -165,6 +157,12 @@ namespace mapserver |
| 165 | 157 | geometry = pPgsqlConn->getString(i); |
| 166 | 158 | continue; |
| 167 | 159 | } |
| 160 | + else if(strFieldName == "geometry_as_wkt") | |
| 161 | + { | |
| 162 | + Dmpgeometry dmpgeometry; | |
| 163 | + geometry = dmpgeometry.geoJsonfromWKB(pPgsqlConn->getString(i)); | |
| 164 | + continue; | |
| 165 | + } | |
| 168 | 166 | else |
| 169 | 167 | { |
| 170 | 168 | const char *v = pPgsqlConn->getString(i); |
| ... | ... | @@ -535,7 +533,7 @@ namespace mapserver |
| 535 | 533 | |
| 536 | 534 | for (i = 0; i < strlen(cd); i++) |
| 537 | 535 | { |
| 538 | - memset(p, '/0', 2); | |
| 536 | + memset(p, '\0', 2); | |
| 539 | 537 | if (cd[i] != '%') |
| 540 | 538 | { |
| 541 | 539 | decd[j++] = cd[i]; |
| ... | ... | @@ -549,7 +547,7 @@ namespace mapserver |
| 549 | 547 | p[1] = p[1] - 48 - ((p[1] >= 'A') ? 7 : 0) - ((p[1] >= 'a') ? 32 : 0); |
| 550 | 548 | decd[j++] = (unsigned char)(p[0] * 16 + p[1]); |
| 551 | 549 | } |
| 552 | - decd[j] = '/0'; | |
| 550 | + decd[j] = '\0'; | |
| 553 | 551 | |
| 554 | 552 | return decd; |
| 555 | 553 | } | ... | ... |
| ... | ... | @@ -537,7 +537,8 @@ 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 += " st_asgeojson(\"" + (fieldname) + "\") as geometry_as_geojson"; | |
| 540 | + fields_str += " \"" + (fieldname) + "\" as geometry_as_wkt "; | |
| 541 | + //fields_str += " st_asgeojson(\"" + (fieldname) + "\") as geometry_as_geojson"; | |
| 541 | 542 | } |
| 542 | 543 | else if (typeString == "integer") |
| 543 | 544 | { |
| ... | ... | @@ -591,8 +592,14 @@ ST_GeometryFromText('POLYGON((%f %f, %f %f, %f %f, %f %f, %f %f))',%s),\ |
| 591 | 592 | std::string sql = format(ss.c_str(), layer->schema().c_str(), tableName.c_str()); |
| 592 | 593 | |
| 593 | 594 | string shapeName = layer->geom(); |
| 594 | - sql += format(" ST_DWithin(\"%s\", ST_GeometryFromText('POINT(%f %f)',%s),%f) limit %d ", | |
| 595 | - shapeName.c_str(), x, y,layer->srid().c_str(), dis, feature_count); | |
| 595 | + // WHERE \"%s\" && \'BOX3D(%lf %lf,%lf %lf)\'::box3d | |
| 596 | + //sql += format(" ST_DWithin(\"%s\", ST_GeometryFromText('POINT(%f %f)',%s),%f) limit %d ", | |
| 597 | + // shapeName.c_str(), x, y,layer->srid().c_str(), dis, feature_count); | |
| 598 | + | |
| 599 | + sql += format(" \"%s\" && \'BOX3D(%lf %lf,%lf %lf)\'::box3d limit %d ", | |
| 600 | + shapeName.c_str(), x - dis, y - dis, x + dis, y + dis, feature_count); | |
| 601 | + | |
| 602 | + | |
| 596 | 603 | //cout<<sql.c_str() <<endl; |
| 597 | 604 | return sql; |
| 598 | 605 | } |
| ... | ... | @@ -625,7 +632,7 @@ ST_GeometryFromText('POLYGON((%f %f, %f %f, %f %f, %f %f, %f %f))',%s),\ |
| 625 | 632 | string sql = this->GetFeatureInfoSQL(layer, x0, y0, dis, feature_count); //sql语句中使用 ::box |
| 626 | 633 | if (sql == "") continue; |
| 627 | 634 | string layerName = layer->name(); |
| 628 | - //printf("%s\r\n",sql.c_str()); | |
| 635 | + printf("%s\r\n",sql.c_str()); | |
| 629 | 636 | if (pPgsqlConn->ExecWaitBinary(sql)) |
| 630 | 637 | { |
| 631 | 638 | if(pPgsqlConn->GetRowCount()>0 || i==0) |
| ... | ... | @@ -970,7 +977,7 @@ ST_GeometryFromText('POLYGON((%f %f, %f %f, %f %f, %f %f, %f %f))',%s),\ |
| 970 | 977 | } |
| 971 | 978 | |
| 972 | 979 | //for (int i = 0; i < (int)(m_vLayers.size()); i++) |
| 973 | - for (int i = (int)(m_vLayers.size()) -1; i > 0; i--) | |
| 980 | + for (int i = (int)(m_vLayers.size()) -1; i >= 0; i--) | |
| 974 | 981 | { |
| 975 | 982 | DmpVectorLayer *layer = m_vLayers[i]; |
| 976 | 983 | sprintf(buff, "<log>draw layer %s</log>", layer->name().c_str()); |
| ... | ... | @@ -1229,7 +1236,7 @@ ST_GeometryFromText('POLYGON((%f %f, %f %f, %f %f, %f %f, %f %f))',%s),\ |
| 1229 | 1236 | |
| 1230 | 1237 | |
| 1231 | 1238 | //for (int i = 0; i < (int)(m_vLayers.size()); i++) |
| 1232 | - for (int i = (int)(m_vLayers.size()) -1; i > 0; i--) | |
| 1239 | + for (int i = (int)(m_vLayers.size()) -1; i >= 0; i--) | |
| 1233 | 1240 | { |
| 1234 | 1241 | DmpVectorLayer *layer = m_vLayers[i]; |
| 1235 | 1242 | ... | ... |
| ... | ... | @@ -74,7 +74,11 @@ namespace DmpWms |
| 74 | 74 | ptGeographicBoundingbox.add("southBoundLatitude", miny); |
| 75 | 75 | ptGeographicBoundingbox.add("northBoundLatitude", maxy); |
| 76 | 76 | ptProject.add_child("EX_GeographicBoundingBox",ptGeographicBoundingbox); |
| 77 | - | |
| 77 | + if( mapLayers.begin() != mapLayers.end()) | |
| 78 | + { | |
| 79 | + ptProject.add("source", mapLayers.begin()->second->source()); | |
| 80 | + } | |
| 81 | + | |
| 78 | 82 | boost::property_tree::ptree ptLayers; |
| 79 | 83 | for (std::map<std::string, DmpMapLayer*>::iterator iter= mapLayers.begin();iter != mapLayers.end(); iter++) |
| 80 | 84 | { |
| ... | ... | @@ -90,8 +94,9 @@ namespace DmpWms |
| 90 | 94 | boost::property_tree::ptree ptLayer; |
| 91 | 95 | ptLayer.add("Name", layer->name()); |
| 92 | 96 | ptLayer.add("Title", layer->title()); |
| 93 | - ptLayer.add("CRS", srs); | |
| 97 | + ptLayer.add("CRS", layer->srid().empty()?srs:("EPSG:" + layer->srid())); | |
| 94 | 98 | ptLayer.add("Type", layer->GeomTypeString()); |
| 99 | + ptLayer.add("source", layer->source()); | |
| 95 | 100 | |
| 96 | 101 | boost::property_tree::ptree ptGeographicBoundingbox; |
| 97 | 102 | ptGeographicBoundingbox.add("westBoundLongitude", layer->extent().xmin()); | ... | ... |
请
注册
或
登录
后发表评论