Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use 'combine' instead of 'Union' in order to preserve coding style ru…
…les (methods should be lower case). Union cant be used in lower case since it is a reserved c++ word

git-svn-id: http://svn.osgeo.org/qgis/trunk@9521 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Oct 23, 2008
1 parent ea43c2c commit 6c7bd3b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
6 changes: 4 additions & 2 deletions python/core/qgsgeometry.sip
Expand Up @@ -230,8 +230,10 @@ not disjoint with existing polygons of the feature*/
/** Returns a geometry representing the points shared by this geometry and other. */
QgsGeometry* intersection(QgsGeometry* geometry) /Factory/;

/** Returns a geometry representing all the points in this geometry and other. */
QgsGeometry* Union(QgsGeometry* geometry) /Factory/;
/** Returns a geometry representing all the points in this geometry and other (a
* union geometry operation).
* @note this operation is not called union since its a reserved word in C++.*/
QgsGeometry* combine( QgsGeometry* geometry );

/** Returns a geometry representing the points making up this geometry that do not make up other. */
QgsGeometry* difference(QgsGeometry* geometry) /Factory/;
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsgeometry.cpp
Expand Up @@ -5347,7 +5347,7 @@ QgsGeometry* QgsGeometry::intersection( QgsGeometry* geometry )
CATCH_GEOS( 0 )
}

QgsGeometry* QgsGeometry::Union( QgsGeometry* geometry )
QgsGeometry* QgsGeometry::combine( QgsGeometry* geometry )
{
if ( geometry == NULL )
{
Expand Down
6 changes: 4 additions & 2 deletions src/core/qgsgeometry.h
Expand Up @@ -276,8 +276,10 @@ class CORE_EXPORT QgsGeometry
/** Returns a geometry representing the points shared by this geometry and other. */
QgsGeometry* intersection( QgsGeometry* geometry );

/** Returns a geometry representing all the points in this geometry and other. */
QgsGeometry* Union( QgsGeometry* geometry );
/** Returns a geometry representing all the points in this geometry and other (a
* union geometry operation).
* @note this operation is not called union since its a reserved word in C++.*/
QgsGeometry* combine( QgsGeometry* geometry );

/** Returns a geometry representing the points making up this geometry that do not make up other. */
QgsGeometry* difference( QgsGeometry* geometry );
Expand Down
4 changes: 2 additions & 2 deletions tests/src/core/testqgsgeometry.cpp
Expand Up @@ -227,7 +227,7 @@ void TestQgsGeometry::intersectionCheck2()
void TestQgsGeometry::unionCheck1()
{
// should be a multipolygon with 2 parts as A does not intersect C
QgsGeometry * mypUnionGeometry = mpPolygonGeometryA->Union( mpPolygonGeometryC );
QgsGeometry * mypUnionGeometry = mpPolygonGeometryA->combine( mpPolygonGeometryC );
qDebug( "Geometry Type: " + wkbTypeAsString( mypUnionGeometry->wkbType() ).toLocal8Bit() );
QVERIFY( mypUnionGeometry->wkbType() == QGis::WKBMultiPolygon );
QgsMultiPolygon myMultiPolygon = mypUnionGeometry->asMultiPolygon();
Expand All @@ -240,7 +240,7 @@ void TestQgsGeometry::unionCheck1()
void TestQgsGeometry::unionCheck2()
{
// should be a single polygon as A intersect B
QgsGeometry * mypUnionGeometry = mpPolygonGeometryA->Union( mpPolygonGeometryB );
QgsGeometry * mypUnionGeometry = mpPolygonGeometryA->combine( mpPolygonGeometryB );
qDebug( "Geometry Type: " + wkbTypeAsString( mypUnionGeometry->wkbType() ).toLocal8Bit() );
QVERIFY( mypUnionGeometry->wkbType() == QGis::WKBPolygon );
QgsPolygon myPolygon = mypUnionGeometry->asPolygon();
Expand Down

0 comments on commit 6c7bd3b

Please sign in to comment.