Skip to content

Commit

Permalink
Improve geometry type detection for wfs
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14539 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Nov 9, 2010
1 parent a0c977e commit 3994d1e
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/providers/wfs/qgswfsdata.cpp
Expand Up @@ -351,7 +351,11 @@ void QgsWFSData::endElement( const XML_Char* el )
{
//error
}
*mWkbType = QGis::WKBPoint;

if ( *mWkbType != QGis::WKBMultiPoint ) //keep multitype in case of geometry type mix
{
*mWkbType = QGis::WKBPoint;
}
}
else //multipoint, add WKB as fragment
{
Expand Down Expand Up @@ -386,7 +390,11 @@ void QgsWFSData::endElement( const XML_Char* el )
{
//error
}
*mWkbType = QGis::WKBLineString;

if ( *mWkbType != QGis::WKBMultiLineString )//keep multitype in case of geometry type mix
{
*mWkbType = QGis::WKBLineString;
}
}
else //multiline, add WKB as fragment
{
Expand Down Expand Up @@ -424,14 +432,18 @@ void QgsWFSData::endElement( const XML_Char* el )
}
else if ( elementName == GML_NAMESPACE + NS_SEPARATOR + "Polygon" )
{
*mWkbType = QGis::WKBPolygon;
if ( *mWkbType != QGis::WKBMultiPolygon )//keep multitype in case of geometry type mix
{
*mWkbType = QGis::WKBPolygon;
}
if ( mParseModeStack.top() != QgsWFSData::multiPolygon )
{
createPolygonFromFragments();
}
}
else if ( elementName == GML_NAMESPACE + NS_SEPARATOR + "MultiPoint" )
{
*mWkbType = QGis::WKBMultiPoint;
if ( !mParseModeStack.empty() )
{
mParseModeStack.pop();
Expand All @@ -440,6 +452,7 @@ void QgsWFSData::endElement( const XML_Char* el )
}
else if ( elementName == GML_NAMESPACE + NS_SEPARATOR + "MultiLineString" )
{
*mWkbType = QGis::WKBMultiLineString;
if ( !mParseModeStack.empty() )
{
mParseModeStack.pop();
Expand All @@ -448,6 +461,7 @@ void QgsWFSData::endElement( const XML_Char* el )
}
else if ( elementName == GML_NAMESPACE + NS_SEPARATOR + "MultiPolygon" )
{
*mWkbType = QGis::WKBMultiPolygon;
if ( !mParseModeStack.empty() )
{
mParseModeStack.pop();
Expand Down

0 comments on commit 3994d1e

Please sign in to comment.