Skip to content
Permalink
Browse files

Fix for merge of adjacent multipolygons, ticket #2188

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12327 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Dec 3, 2009
1 parent 5d30883 commit 6509bc230f26c421da7b5c75936e549ac19fe98c
Showing with 19 additions and 5 deletions.
  1. +5 −0 python/core/qgsgeometry.sip
  2. +9 −0 src/app/qgisapp.cpp
  3. +5 −5 src/core/qgsgeometry.h
@@ -309,5 +309,10 @@ not disjoint with existing polygons of the feature*/
@note added in version 1.2 */
bool deletePart( int partNum );

/**Converts single type geometry into multitype geometry
e.g. a polygon into a multipolygon geometry with one polygon
@return true in case of success and false else*/
bool convertToMultiType();

}; // class QgsGeometry

@@ -4229,6 +4229,15 @@ QgsGeometry* QgisApp::unionGeometries( const QgsVectorLayer* vl, QgsFeatureList&
}
}

//convert unionGeom to a multipart geometry in case it is necessary to match the layer type
QGis::WkbType t = vl->wkbType();
bool layerIsMultiType = ( t == QGis::WKBMultiPoint || t == QGis::WKBMultiPoint25D || t == QGis::WKBMultiLineString \
|| t == QGis::WKBMultiLineString25D || t == QGis::WKBMultiPolygon || t == QGis::WKBMultiPoint25D );
if ( layerIsMultiType && !unionGeom->isMultipart() )
{
unionGeom->convertToMultiType();
}

QApplication::restoreOverrideCursor();
progress.setValue( featureList.size() );
return unionGeom;
@@ -348,6 +348,11 @@ class CORE_EXPORT QgsGeometry
@note added in version 1.2 */
bool deletePart( int partNum );

/**Converts single type geometry into multitype geometry
e.g. a polygon into a multipolygon geometry with one polygon
@return true in case of success and false else*/
bool convertToMultiType();


private:
// Private variables
@@ -410,11 +415,6 @@ class CORE_EXPORT QgsGeometry
const GEOSCoordSequence* old_sequence,
GEOSCoordSequence** new_sequence );

/**Converts single type geometry into multitype geometry
e.g. a polygon into a multipolygon geometry with one polygon
@return true in case of success and false else*/
bool convertToMultiType();

/**Translates a single vertex by dx and dy.
@param ptr pointer to the wkb fragment containing the vertex
@param wkbPosition position in wkb array. Is increased automatically by the function

0 comments on commit 6509bc2

Please sign in to comment.