Skip to content
Permalink
Browse files

Apply @nyalldawson 's suggestion

  • Loading branch information
nirvn authored and github-actions committed Apr 27, 2021
1 parent 09e822f commit f64d8e63f234f7dfca2ae71c27e9ea288a1b94ec
Showing with 5 additions and 10 deletions.
  1. +3 −9 src/analysis/vector/qgsgeometrysnapper.cpp
  2. +2 −1 src/analysis/vector/qgsgeometrysnapper.h
@@ -24,7 +24,6 @@
#include "qgssurface.h"
#include "qgsmultisurface.h"
#include "qgscurve.h"
#include "qgsgeos.h"

#include <QtConcurrentMap>
#include <geos_c.h>
@@ -199,12 +198,7 @@ QgsSnapIndex::~QgsSnapIndex()
qDeleteAll( mCoordIdxs );
qDeleteAll( mSnapItems );

GEOSContextHandle_t geosctxt = QgsGeos::getGEOSHandler();
for ( GEOSGeometry *geom : mSTRTreeItems )
{
GEOSGeom_destroy_r( geosctxt, geom );
}
GEOSSTRtree_destroy_r( geosctxt, mSTRTree );
GEOSSTRtree_destroy_r( QgsGeos::getGEOSHandler(), mSTRTree );
}

void QgsSnapIndex::addPoint( const CoordIdx *idx, bool isEndPoint )
@@ -226,7 +220,7 @@ void QgsSnapIndex::addPoint( const CoordIdx *idx, bool isEndPoint )
PointSnapItem *item = new PointSnapItem( idx, isEndPoint );
GEOSSTRtree_insert_r( geosctxt, mSTRTree, point.get(), item );
#if GEOS_VERSION_MAJOR>3 || GEOS_VERSION_MINOR<9
mSTRTreeItems << point.release();
mSTRTreeItems.push_back( std::move( point ) );
#endif
mSnapItems << item;
}
@@ -257,7 +251,7 @@ void QgsSnapIndex::addSegment( const CoordIdx *idxFrom, const CoordIdx *idxTo )
SegmentSnapItem *item = new SegmentSnapItem( idxFrom, idxTo );
GEOSSTRtree_insert_r( geosctxt, mSTRTree, point.get(), item );
#if GEOS_VERSION_MAJOR>3 || GEOS_VERSION_MINOR<9
mSTRTreeItems << point.release();
mSTRTreeItems.push_back( std::move( point ) );
#endif
mSnapItems << item;
}
@@ -21,6 +21,7 @@
#include "qgsabstractgeometry.h"
#include "qgspoint.h"
#include "qgsgeometry.h"
#include "qgsgeos.h"
#include "qgis_analysis.h"

#include <QMutex>
@@ -238,7 +239,7 @@ class QgsSnapIndex
void addSegment( const CoordIdx *idxFrom, const CoordIdx *idxTo );

GEOSSTRtree *mSTRTree = nullptr;
QList<GEOSGeometry *> mSTRTreeItems;
std::vector< geos::unique_ptr > mSTRTreeItems;
};

///@endcond

0 comments on commit f64d8e6

Please sign in to comment.