Skip to content
Permalink
Browse files

Avoid extra copy of point in QgsGeometry::centroid()

  • Loading branch information
m-kuhn committed Aug 13, 2017
1 parent 7f4880b commit 3da4c33bb3ff727a201dddfeb0223ad58c020874
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/core/geometry/qgsgeometry.cpp
@@ -1585,16 +1585,16 @@ QgsGeometry QgsGeometry::centroid() const
}

QgsGeos geos( d->geometry );
QgsPoint centroid;
std::unique_ptr<QgsPoint> centroid( new QgsPoint() );
QString error;
bool ok = geos.centroid( centroid, &error );
bool ok = geos.centroid( *centroid.get(), &error );
if ( !ok )
{
QgsGeometry geom;
geom.d->error = error;
return geom;
}
return QgsGeometry( centroid.clone() );
return QgsGeometry( centroid.release() );
}

QgsGeometry QgsGeometry::pointOnSurface() const

0 comments on commit 3da4c33

Please sign in to comment.
You can’t perform that action at this time.