Skip to content

Commit

Permalink
Avoid extra copy of point in QgsGeometry::centroid()
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Aug 13, 2017
1 parent 7f4880b commit 3da4c33
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/geometry/qgsgeometry.cpp
Expand Up @@ -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
Expand Down

0 comments on commit 3da4c33

Please sign in to comment.