Skip to content
Permalink
Browse files
Merge pull request #45785 from nyalldawson/area_no_geos
Use QgsAbstractGeometry methods for QgsGeometry::area results
  • Loading branch information
lbartoletti committed Nov 4, 2021
2 parents ac03801 + f229106 commit 209fd381885f99383f7d97888628671528d37a55
@@ -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
@@ -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.
Loading

0 comments on commit 209fd38

Please sign in to comment.