Skip to content

Commit

Permalink
Merge pull request #45785 from nyalldawson/area_no_geos
Browse files Browse the repository at this point in the history
Use QgsAbstractGeometry methods for QgsGeometry::area results
  • Loading branch information
lbartoletti committed Nov 4, 2021
2 parents ac03801 + f229106 commit 209fd38
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 155 deletions.
15 changes: 1 addition & 14 deletions src/core/geometry/qgsgeometry.cpp
Expand Up @@ -1889,21 +1889,8 @@ double QgsGeometry::area() const
{
return -1.0;
}
QgsGeos g( d->geometry.get() );

#if 0
//debug: compare geos area with calculation in QGIS
double geosArea = g.area();
double qgisArea = 0;
QgsSurface *surface = qgsgeometry_cast<QgsSurface *>( d->geometry );
if ( surface )
{
qgisArea = surface->area();
}
#endif

mLastError.clear();
return g.area( &mLastError );
return d->geometry->area();
}

double QgsGeometry::length() const
Expand Down
6 changes: 3 additions & 3 deletions src/test/qgstest.h
Expand Up @@ -56,19 +56,19 @@
#define QGSCOMPARENEARPOINT(point1,point2,epsilon) { \
QGSCOMPARENEAR( point1.x(), point2.x(), epsilon ); \
QGSCOMPARENEAR( point1.y(), point2.y(), epsilon ); \
}
}(void)(0)

#define QGSCOMPARENEARRECTANGLE(rectangle1,rectangle2,epsilon) { \
QGSCOMPARENEAR( rectangle1.xMinimum(), rectangle2.xMinimum(), epsilon ); \
QGSCOMPARENEAR( rectangle1.xMaximum(), rectangle2.xMaximum(), epsilon ); \
QGSCOMPARENEAR( rectangle1.yMinimum(), rectangle2.yMinimum(), epsilon ); \
QGSCOMPARENEAR( rectangle1.yMaximum(), rectangle2.yMaximum(), epsilon ); \
}
}(void)(0)

//sometimes GML attributes are in a different order - but that's ok
#define QGSCOMPAREGML(result,expected) { \
QCOMPARE( result.replace( QStringLiteral("ts=\" \" cs=\",\""), QStringLiteral("cs=\",\" ts=\" \"") ), expected ); \
}
}(void)(0)

/**
* QGIS unit test utilities.
Expand Down

0 comments on commit 209fd38

Please sign in to comment.