Skip to content

Commit

Permalink
More implicit sharing of geometries
Browse files Browse the repository at this point in the history
Because massive cloning preemptively only makes sense when you want to fight the universe like in star wars.
  • Loading branch information
m-kuhn committed Dec 17, 2018
1 parent bebc34b commit d77c74a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/analysis/vector/geometry_checker/qgsgeometrygapcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,17 @@ void QgsGeometryGapCheck::collectErrors( const QMap<QString, QgsFeaturePool *> &
if ( feedback )
feedback->setProgress( feedback->progress() + 1.0 );

QVector<QgsAbstractGeometry *> geomList;
QVector<QgsGeometry> geomList;


QMap<QString, QgsFeatureIds> featureIds = ids.isEmpty() ? allLayerFeatureIds( featurePools ) : ids.toMap();
const QgsGeometryCheckerUtils::LayerFeatures layerFeatures( featurePools, featureIds, compatibleGeometryTypes(), nullptr, mContext, true );
for ( const QgsGeometryCheckerUtils::LayerFeature &layerFeature : layerFeatures )
{
geomList.append( layerFeature.geometry().constGet()->clone() );
geomList.append( layerFeature.geometry() );

if ( feedback->isCanceled() )
{
qDeleteAll( geomList );
geomList.clear();
break;
}
Expand All @@ -63,7 +62,6 @@ void QgsGeometryGapCheck::collectErrors( const QMap<QString, QgsFeaturePool *> &
// Create union of geometry
QString errMsg;
std::unique_ptr<QgsAbstractGeometry> unionGeom( geomEngine->combine( geomList, &errMsg ) );
qDeleteAll( geomList );
if ( !unionGeom )
{
messages.append( tr( "Gap check: %1" ).arg( errMsg ) );
Expand Down

0 comments on commit d77c74a

Please sign in to comment.