[mapguide-commits] r9573 - sandbox/jng/wfs_hits/Web/src/HttpHandler
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sat Jul 13 05:02:18 PDT 2019
Author: jng
Date: 2019-07-13 05:02:18 -0700 (Sat, 13 Jul 2019)
New Revision: 9573
Modified:
sandbox/jng/wfs_hits/Web/src/HttpHandler/HttpWfsGetFeature.cpp
sandbox/jng/wfs_hits/Web/src/HttpHandler/ReaderByteSourceImpl.cpp
sandbox/jng/wfs_hits/Web/src/HttpHandler/WmsMapUtil.cpp
Log:
Fix up the expected format of a WFS GetFeatures when resultType=hits.
If format is JSON just return an object with the total.
Also fix an assortment of warnings
Modified: sandbox/jng/wfs_hits/Web/src/HttpHandler/HttpWfsGetFeature.cpp
===================================================================
--- sandbox/jng/wfs_hits/Web/src/HttpHandler/HttpWfsGetFeature.cpp 2019-07-12 14:37:42 UTC (rev 9572)
+++ sandbox/jng/wfs_hits/Web/src/HttpHandler/HttpWfsGetFeature.cpp 2019-07-13 12:02:18 UTC (rev 9573)
@@ -309,20 +309,28 @@
if (sOutputFormat == MgMimeType::Json)
{
std::string json = "{";
- json += "\"total\": ";
+ json += "\"numberOfFeatures\": ";
json += sTotal;
json += "}";
- Ptr<MgByteSource> bs = new MgByteSource((BYTE_ARRAY_IN)json.data(), json.length());
+ Ptr<MgByteSource> bs = new MgByteSource((BYTE_ARRAY_IN)json.data(), (INT32)json.length());
bs->SetMimeType(MgMimeType::Json);
resultReader = bs->GetReader();
}
else
{
- std::string xml = "<test>";
- xml += "total is: ";
+ std::string mbPrefix;
+ MgUtil::WideCharToMultiByte(sPrefix, mbPrefix);
+
+ std::string xml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
+ xml += "<wfs:FeatureCollection xmlns:gml=\"http://www.opengis.net/gml\" xmlns:wfs=\"http://www.opengis.net/wfs\" xmlns:";
+ xml += mbPrefix;
+ xml += "=\"http://fdo.osgeo.org/schemas/feature/";
+ xml += mbPrefix;
+ xml += "\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/base/feature.xsd http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd\"";
+ xml += " numberOfFeatures=\"";
xml += sTotal;
- xml += "</test>";
- Ptr<MgByteSource> bs = new MgByteSource((BYTE_ARRAY_IN)xml.data(), xml.length());
+ xml += "\" />";
+ Ptr<MgByteSource> bs = new MgByteSource((BYTE_ARRAY_IN)xml.data(), (INT32)xml.length());
bs->SetMimeType(MgMimeType::Xml);
resultReader = bs->GetReader();
}
Modified: sandbox/jng/wfs_hits/Web/src/HttpHandler/ReaderByteSourceImpl.cpp
===================================================================
--- sandbox/jng/wfs_hits/Web/src/HttpHandler/ReaderByteSourceImpl.cpp 2019-07-12 14:37:42 UTC (rev 9572)
+++ sandbox/jng/wfs_hits/Web/src/HttpHandler/ReaderByteSourceImpl.cpp 2019-07-13 12:02:18 UTC (rev 9573)
@@ -166,7 +166,7 @@
}
}
- INT32 maxIndex = m_buf.length() - 1;
+ auto maxIndex = m_buf.length() - 1;
//We have an internal buffer. Clear this out first
if (m_bufOffset < maxIndex)
{
@@ -311,7 +311,7 @@
while (ret < length)
{
m_bufOffset++;
- INT32 maxIndex = m_buf.length() - 1;
+ auto maxIndex = m_buf.length() - 1;
if (m_bufOffset <= maxIndex)
{
buffer[fromIndex + ret] = m_buf[m_bufOffset];
Modified: sandbox/jng/wfs_hits/Web/src/HttpHandler/WmsMapUtil.cpp
===================================================================
--- sandbox/jng/wfs_hits/Web/src/HttpHandler/WmsMapUtil.cpp 2019-07-12 14:37:42 UTC (rev 9572)
+++ sandbox/jng/wfs_hits/Web/src/HttpHandler/WmsMapUtil.cpp 2019-07-13 12:02:18 UTC (rev 9573)
@@ -219,7 +219,7 @@
STRING qualifiedName = mgLayer->GetFeatureClassName();
- int pos = qualifiedName.find(L":");
+ auto pos = qualifiedName.find(L":");
STRING schemaName = qualifiedName.substr(0,pos);
STRING className = qualifiedName.substr(pos+1,qualifiedName.length()-pos-1);
@@ -527,11 +527,11 @@
// Looking for all <Bounds> elements from layerBounds
// Example: <Bounds SRS="EPSG:4326" west="-87.74" south="43.68" east="-87.69" north="43.815"/>
Ptr<MgStringCollection> bounds = new MgStringCollection();
- int pos = 0;
+ size_t pos = 0;
while((pos = layerBounds.find(L"<Bounds",pos)) != STRING::npos)
{
pos += 7; // pos+7 to the first character after <Bounds
- int endPos = layerBounds.find(L"/>",pos);
+ auto endPos = layerBounds.find(L"/>",pos);
bounds->Add(layerBounds.substr(pos,endPos-pos));
}
@@ -541,8 +541,8 @@
STRING bound = bounds->GetItem(i);
//Find SRS value from Bounds element
- int startPos = bound.find(L"SRS=\"");
- int endPos = bound.find(L"\"",startPos+5); // pos+5 to the first character after SRS="
+ auto startPos = bound.find(L"SRS=\"");
+ auto endPos = bound.find(L"\"",startPos+5); // pos+5 to the first character after SRS="
STRING srs = bound.substr(startPos+5,endPos-startPos-5);
if(MgUtil::ToUpper(srs) == MgUtil::ToUpper(sSrs))
More information about the mapguide-commits
mailing list