Skip to content
Permalink
Browse files
wfs provider: added tests for empty stack
git-svn-id: http://svn.osgeo.org/qgis/trunk@6953 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed May 22, 2007
1 parent 1938278 commit 2c24223c1d27543ec8c88516a3a5ce57c677c5f3
Showing with 31 additions and 16 deletions.
  1. +31 −16 src/providers/wfs/qgswfsdata.cpp
@@ -63,6 +63,7 @@ int QgsWFSData::getWFSData()
}
mHttp.get(mUri);


//loop to read the data
QByteArray readData;
int atEnd = 0;
@@ -184,23 +185,27 @@ void QgsWFSData::endElement(const XML_Char* el)
QString localName = elementName.section(NS_SEPARATOR, 1, 1);
if(elementName == GML_NAMESPACE + NS_SEPARATOR + "coordinates")
{
//qWarning("Poping coordinate from the stack");
mParseModeStack.pop();
if(!mParseModeStack.empty())
{
mParseModeStack.pop();
}
}
else if(localName == mAttributeName)
{
mParseModeStack.pop();
//qWarning("adding attribute");
//qWarning(mAttributeName.toLocal8Bit().data());
//qWarning(mStringCash.toLocal8Bit().data());
//mCurrentFeature->addAttribute(mAttributeName, mStringCash);
if(!mParseModeStack.empty())
{
mParseModeStack.pop();
}

mCurrentFeature->addAttribute(mAttributeIndex, QVariant(mStringCash));
++mAttributeIndex;
}
else if(localName == mGeometryAttribute)
{
//qWarning("Poping geometry from the stack");
mParseModeStack.pop();
if(!mParseModeStack.empty())
{
mParseModeStack.pop();
}
}
else if(elementName == GML_NAMESPACE + NS_SEPARATOR + "boundedBy" && mParseModeStack.top() == QgsWFSData::boundingBox)
{
@@ -209,10 +214,11 @@ void QgsWFSData::endElement(const XML_Char* el)
{
qWarning("creation of bounding box failed");
}
//qWarning("bounding box");
//qWarning(mExtent->stringRep().toLocal8Bit().data());
//qWarning("Removing boundingBox from stack");
mParseModeStack.pop();

if(!mParseModeStack.empty())
{
mParseModeStack.pop();
}
}
else if(elementName == GML_NAMESPACE + NS_SEPARATOR + "featureMember")
{
@@ -318,17 +324,26 @@ void QgsWFSData::endElement(const XML_Char* el)
}
else if(elementName == GML_NAMESPACE + NS_SEPARATOR + "MultiPoint")
{
mParseModeStack.pop();
if(!mParseModeStack.empty())
{
mParseModeStack.pop();
}
createMultiPointFromFragments();
}
else if(elementName == GML_NAMESPACE + NS_SEPARATOR + "MultiLineString")
{
mParseModeStack.pop();
if(!mParseModeStack.empty())
{
mParseModeStack.pop();
}
createMultiLineFromFragments();
}
else if(elementName == GML_NAMESPACE + NS_SEPARATOR + "MultiPolygon")
{
mParseModeStack.pop();
if(!mParseModeStack.empty())
{
mParseModeStack.pop();
}
createMultiPolygonFromFragments();
}
}

0 comments on commit 2c24223

Please sign in to comment.