Skip to content

Commit c7b9fa6

Browse files
committedOct 12, 2015
Merge pull request #2353 from manisandro/geos_snap
Replace GEOS C++ dependency with hand-rolled snap-to-grid implementation
2 parents 4d35175 + c927073 commit c7b9fa6

19 files changed

+120
-251
lines changed
 

‎ci/travis/linux/before_install.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ sudo apt-get install --force-yes --no-install-recommends --no-install-suggests \
1818
libexpat1-dev \
1919
libfcgi-dev \
2020
libgdal1-dev \
21-
libgeos++-dev \
2221
libgeos-dev \
2322
libgsl0-dev \
2423
libpq-dev \

‎cmake/FindGEOS.cmake

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,11 @@ IF(WIN32)
2323
IF (MINGW)
2424
FIND_PATH(GEOS_INCLUDE_DIR geos_c.h /usr/local/include /usr/include c:/msys/local/include)
2525
FIND_LIBRARY(GEOS_LIBRARY NAMES geos_c PATHS /usr/local/lib /usr/lib c:/msys/local/lib)
26-
FIND_LIBRARY(GEOS_CPP_LIBRARY NAMES geos PATHS /usr/local/lib /usr/lib c:/msys/local/lib)
2726
ENDIF (MINGW)
2827

2928
IF (MSVC)
3029
FIND_PATH(GEOS_INCLUDE_DIR geos_c.h $ENV{LIB_DIR}/include $ENV{INCLUDE})
31-
FIND_LIBRARY(GEOS_LIBRARY NAMES geos_c_i geos_c PATHS
32-
"$ENV{LIB_DIR}/lib"
33-
$ENV{LIB}
34-
)
35-
FIND_LIBRARY(GEOS_CPP_LIBRARY NAMES geos PATHS
30+
FIND_LIBRARY(GEOS_LIBRARY NAMES geos geos_c_i geos_c PATHS
3631
"$ENV{LIB_DIR}/lib"
3732
$ENV{LIB}
3833
)
@@ -72,7 +67,6 @@ ELSE(WIN32)
7267

7368
IF(CYGWIN)
7469
FIND_LIBRARY(GEOS_LIBRARY NAMES geos_c PATHS /usr/lib /usr/local/lib)
75-
FIND_LIBRARY(GEOS_CPP_LIBRARY NAMES geos PATHS /usr/lib /usr/local/lib)
7670
ENDIF(CYGWIN)
7771

7872
IF (NOT GEOS_INCLUDE_DIR OR NOT GEOS_LIBRARY OR NOT GEOS_CONFIG)
@@ -138,16 +132,12 @@ ELSE(WIN32)
138132
#MESSAGE("DBG GEOS_CONFIG_LIBS=${GEOS_CONFIG_LIBS}")
139133
#MESSAGE("DBG GEOS_LIB_NAME_WITH_PREFIX=${GEOS_LIB_NAME_WITH_PREFIX}")
140134
SET(GEOS_LIB_NAME_WITH_PREFIX -lgeos_c CACHE STRING INTERNAL)
141-
SET(GEOS_CPP_LIB_NAME_WITH_PREFIX -lgeos CACHE STRING INTERNAL)
142135

143136
## remove prefix -l because we need the pure name
144137

145138
IF (GEOS_LIB_NAME_WITH_PREFIX)
146139
STRING(REGEX REPLACE "[-][l]" "" GEOS_LIB_NAME ${GEOS_LIB_NAME_WITH_PREFIX} )
147140
ENDIF (GEOS_LIB_NAME_WITH_PREFIX)
148-
IF (GEOS_CPP_LIB_NAME_WITH_PREFIX)
149-
STRING(REGEX REPLACE "[-][l]" "" GEOS_CPP_LIB_NAME ${GEOS_CPP_LIB_NAME_WITH_PREFIX} )
150-
ENDIF (GEOS_CPP_LIB_NAME_WITH_PREFIX)
151141
#MESSAGE("DBG GEOS_LIB_NAME=${GEOS_LIB_NAME}")
152142

153143
IF (APPLE)
@@ -156,11 +146,9 @@ ELSE(WIN32)
156146
# while still preserving user setting if given
157147
# ***FIXME*** need to improve framework check so below not needed
158148
SET(GEOS_LIBRARY ${GEOS_LINK_DIRECTORIES}/lib${GEOS_LIB_NAME}.dylib CACHE STRING INTERNAL FORCE)
159-
SET(GEOS_CPP_LIBRARY ${GEOS_LINK_DIRECTORIES}/lib${GEOS_CPP_LIB_NAME}.dylib CACHE STRING INTERNAL FORCE)
160149
ENDIF (NOT GEOS_LIBRARY)
161150
ELSE (APPLE)
162151
SET(GEOS_LIBRARY ${GEOS_LINK_DIRECTORIES}/lib${GEOS_LIB_NAME}.so CACHE STRING INTERNAL)
163-
SET(GEOS_CPP_LIBRARY ${GEOS_LINK_DIRECTORIES}/lib${GEOS_CPP_LIB_NAME}.so CACHE STRING INTERNAL)
164152
ENDIF (APPLE)
165153
#MESSAGE("DBG GEOS_LIBRARY=${GEOS_LIBRARY}")
166154

‎python/core/geometry/qgsgeometry.sip

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,11 @@ class QgsGeometry
123123
size_t wkbSize() const;
124124

125125
/** Returns a geos geometry. QgsGeometry retains ownership of the geometry, so the returned object should not be deleted.
126+
@param precision The precision of the grid to which to snap the geometry vertices. If 0, no snapping is performed.
126127
@note this method was added in version 1.1
127128
@note not available in python bindings
128129
*/
129-
// const GEOSGeometry* asGeos() const;
130+
// const GEOSGeometry* asGeos( double precision = 0 ) const;
130131

131132
/** Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
132133
* @see type

‎src/core/CMakeLists.txt

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ STRING(REPLACE "\)" "\\)" JSON_HELP_FILES "${JSON_HELP_FILES}")
334334
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/qgsexpression_texts.cpp
335335
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripts/process_function_template.py ${CMAKE_CURRENT_BINARY_DIR}/qgsexpression_texts.cpp.temp
336336
COMMAND ${CMAKE_COMMAND} -DSRC=${CMAKE_CURRENT_BINARY_DIR}/qgsexpression_texts.cpp.temp -DDST=${CMAKE_CURRENT_SOURCE_DIR}/qgsexpression_texts.cpp -P ${CMAKE_SOURCE_DIR}/cmake/CopyIfChanged.cmake
337-
DEPENDS ${JSON_HELP_FILES}
338-
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
337+
DEPENDS ${JSON_HELP_FILES}
338+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
339339
)
340340

341341
IF(ENABLE_MODELTEST)
@@ -756,12 +756,6 @@ SET(QGIS_CORE_HDRS
756756
geometry/qgspointv2.h
757757
)
758758

759-
IF(GEOS_CPP_LIBRARY)
760-
SET(QGIS_CORE_SRCS ${QGIS_CORE_SRCS} geosextra/geos_c_extra.cpp)
761-
SET(QGIS_CORE_HDRS ${QGIS_CORE_HDRS} geosextra/geos_c_extra.h)
762-
ADD_DEFINITIONS("-DHAVE_GEOS_CPP")
763-
ENDIF(GEOS_CPP_LIBRARY)
764-
765759
IF (QT_MOBILITY_LOCATION_FOUND OR Qt5Positioning_FOUND)
766760
SET(QGIS_CORE_HDRS ${QGIS_CORE_HDRS}
767761
gps/qgsqtlocationconnection.h
@@ -885,10 +879,6 @@ TARGET_LINK_LIBRARIES(qgis_core
885879
${SPATIALITE_LIBRARY}
886880
)
887881

888-
IF(GEOS_CPP_LIBRARY)
889-
TARGET_LINK_LIBRARIES(qgis_core ${GEOS_CPP_LIBRARY})
890-
ENDIF(GEOS_CPP_LIBRARY)
891-
892882
IF (Qt5Positioning_FOUND)
893883
TARGET_LINK_LIBRARIES(qgis_core
894884
Qt5::Positioning

‎src/core/geometry/qgsgeometry.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ size_t QgsGeometry::wkbSize() const
294294
return d->mWkbSize;
295295
}
296296

297-
const GEOSGeometry* QgsGeometry::asGeos() const
297+
const GEOSGeometry* QgsGeometry::asGeos( double precision ) const
298298
{
299299
if ( !d || !d->geometry )
300300
{
@@ -303,7 +303,7 @@ const GEOSGeometry* QgsGeometry::asGeos() const
303303

304304
if ( !d->mGeos )
305305
{
306-
d->mGeos = QgsGeos::asGeos( d->geometry );
306+
d->mGeos = QgsGeos::asGeos( d->geometry, precision );
307307
}
308308
return d->mGeos;
309309
}

‎src/core/geometry/qgsgeometry.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,11 @@ class CORE_EXPORT QgsGeometry
158158
size_t wkbSize() const;
159159

160160
/** Returns a geos geometry. QgsGeometry retains ownership of the geometry, so the returned object should not be deleted.
161+
@param precision The precision of the grid to which to snap the geometry vertices. If 0, no snapping is performed.
161162
@note this method was added in version 1.1
162163
@note not available in python bindings
163164
*/
164-
const GEOSGeometry* asGeos() const;
165+
const GEOSGeometry* asGeos( double precision = 0 ) const;
165166

166167
/** Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
167168
* @see type

‎src/core/geometry/qgsgeos.cpp

Lines changed: 79 additions & 80 deletions
Large diffs are not rendered by default.

‎src/core/geometry/qgsgeos.h

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ email : marco.hugentobler at sourcepole dot com
1919
#include "qgsgeometryengine.h"
2020
#include "qgspointv2.h"
2121
#include <geos_c.h>
22-
#if defined(HAVE_GEOS_CPP) && !defined(HAVE_GEOS_CAPI_PRECISION_MODEL)
23-
#include "geosextra/geos_c_extra.h"
24-
#endif
2522

2623
class QgsLineStringV2;
2724
class QgsPolygonV2;
@@ -32,7 +29,11 @@ class QgsPolygonV2;
3229
class CORE_EXPORT QgsGeos: public QgsGeometryEngine
3330
{
3431
public:
35-
QgsGeos( const QgsAbstractGeometryV2* geometry, int precision = 7 );
32+
/** GEOS geometry engine constructor
33+
* @param geometry The geometry
34+
* @param precision The precision of the grid to which to snap the geometry vertices. If 0, no snapping is performed.
35+
*/
36+
QgsGeos( const QgsAbstractGeometryV2* geometry, double precision = 0 );
3637
~QgsGeos();
3738

3839
/** Removes caches*/
@@ -84,19 +85,15 @@ class CORE_EXPORT QgsGeos: public QgsGeometryEngine
8485

8586
static QgsAbstractGeometryV2* fromGeos( const GEOSGeometry* geos );
8687
static QgsPolygonV2* fromGeosPolygon( const GEOSGeometry* geos );
87-
static GEOSGeometry* asGeos( const QgsAbstractGeometryV2* geom );
88+
static GEOSGeometry* asGeos( const QgsAbstractGeometryV2* geom , double precision = 0 );
8889
static QgsPointV2 coordSeqPoint( const GEOSCoordSequence* cs, int i, bool hasZ, bool hasM );
8990

9091
static GEOSContextHandle_t getGEOSHandler();
9192

9293
private:
9394
mutable GEOSGeometry* mGeos;
9495
const GEOSPreparedGeometry* mGeosPrepared;
95-
#if defined(HAVE_GEOS_CPP) || defined(HAVE_GEOS_CAPI_PRECISION_MODEL)
96-
//precision reducer
97-
GEOSPrecisionModel* mPrecisionModel;
98-
GEOSGeometryPrecisionReducer* mPrecisionReducer;
99-
#endif
96+
double mPrecision;
10097

10198
enum Overlay
10299
{
@@ -121,16 +118,16 @@ class CORE_EXPORT QgsGeos: public QgsGeometryEngine
121118
void cacheGeos() const;
122119
QgsAbstractGeometryV2* overlay( const QgsAbstractGeometryV2& geom, Overlay op, QString* errorMsg = 0 ) const;
123120
bool relation( const QgsAbstractGeometryV2& geom, Relation r, QString* errorMsg = 0 ) const;
124-
static GEOSCoordSequence* createCoordinateSequence( const QgsCurveV2* curve );
121+
static GEOSCoordSequence* createCoordinateSequence( const QgsCurveV2* curve , double precision );
125122
static QgsLineStringV2* sequenceToLinestring( const GEOSGeometry* geos, bool hasZ, bool hasM );
126123
static int numberOfGeometries( GEOSGeometry* g );
127124
static GEOSGeometry* nodeGeometries( const GEOSGeometry *splitLine, const GEOSGeometry *geom );
128125
int mergeGeometriesMultiTypeSplit( QVector<GEOSGeometry*>& splitResult ) const;
129126
static GEOSGeometry* createGeosCollection( int typeId, const QVector<GEOSGeometry*>& geoms );
130127

131-
static GEOSGeometry* createGeosPoint( const QgsAbstractGeometryV2* point, int coordDims );
132-
static GEOSGeometry* createGeosLinestring( const QgsAbstractGeometryV2* curve );
133-
static GEOSGeometry* createGeosPolygon( const QgsAbstractGeometryV2* poly );
128+
static GEOSGeometry* createGeosPoint( const QgsAbstractGeometryV2* point, int coordDims , double precision );
129+
static GEOSGeometry* createGeosLinestring( const QgsAbstractGeometryV2* curve, double precision );
130+
static GEOSGeometry* createGeosPolygon( const QgsAbstractGeometryV2* poly, double precision );
134131

135132
//utils for geometry split
136133
int topologicalTestPointsSplit( const GEOSGeometry* splitLine, QList<QgsPointV2>& testPoints, QString* errorMsg = 0 ) const;
@@ -139,14 +136,11 @@ class CORE_EXPORT QgsGeos: public QgsGeometryEngine
139136
int splitPolygonGeometry( GEOSGeometry* splitLine, QList<QgsAbstractGeometryV2*>& newGeometries ) const;
140137

141138
//utils for reshape
142-
static GEOSGeometry* reshapeLine( const GEOSGeometry* line, const GEOSGeometry* reshapeLineGeos );
143-
static GEOSGeometry* reshapePolygon( const GEOSGeometry* polygon, const GEOSGeometry* reshapeLineGeos );
139+
static GEOSGeometry* reshapeLine( const GEOSGeometry* line, const GEOSGeometry* reshapeLineGeos, double precision );
140+
static GEOSGeometry* reshapePolygon( const GEOSGeometry* polygon, const GEOSGeometry* reshapeLineGeos , double precision );
144141
static int lineContainedInLine( const GEOSGeometry* line1, const GEOSGeometry* line2 );
145142
static int pointContainedInLine( const GEOSGeometry* point, const GEOSGeometry* line );
146143
static int geomDigits( const GEOSGeometry* geom );
147-
148-
private:
149-
inline GEOSGeometry *getReducedGeometry( GEOSGeometry* geom ) const;
150144
};
151145

152146
/// @cond

‎src/core/geosextra/geos_c_extra.cpp

Lines changed: 0 additions & 60 deletions
This file was deleted.

‎src/core/geosextra/geos_c_extra.h

Lines changed: 0 additions & 40 deletions
This file was deleted.

‎src/plugins/geometry_checker/checks/qgsgeometryareacheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ bool QgsGeometryAreaCheck::mergeWithNeighbor( QgsFeature& feature, int partIdx,
192192

193193
// Merge geometries
194194
QgsAbstractGeometryV2* mergeGeom = mergeFeature.geometry()->geometry();
195-
QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( QgsGeomUtils::getGeomPart( mergeGeom, mergePartIdx ), QgsGeometryCheckPrecision::precision() );
195+
QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( QgsGeomUtils::getGeomPart( mergeGeom, mergePartIdx ), QgsGeometryCheckPrecision::tolerance() );
196196
QgsAbstractGeometryV2* combinedGeom = geomEngine->combine( *QgsGeomUtils::getGeomPart( geom, partIdx ), &errMsg );
197197
delete geomEngine;
198198
if ( !combinedGeom || combinedGeom->isEmpty() )

‎src/plugins/geometry_checker/checks/qgsgeometrycheck.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
#include "geometry/qgsgeometry.h"
1616
#include "../utils/qgsgeomutils.h"
1717
#include "geos_c.h"
18-
#if defined(HAVE_GEOS_CPP) || !defined(HAVE_GEOS_CAPI_PRECISION_MODEL)
19-
#include <geosextra/geos_c_extra.h>
20-
#endif
2118
#include <QApplication>
2219

2320
class QgsGeometryCheckError;

‎src/plugins/geometry_checker/checks/qgsgeometrycontainedcheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void QgsGeometryContainedCheck::collectErrors( QList<QgsGeometryCheckError*>& er
2121
continue;
2222
}
2323

24-
QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( feature.geometry()->geometry(), QgsGeometryCheckPrecision::precision() );
24+
QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( feature.geometry()->geometry(), QgsGeometryCheckPrecision::tolerance() );
2525

2626
QgsFeatureIds ids = mFeaturePool->getIntersects( feature.geometry()->geometry()->boundingBox() );
2727
foreach ( const QgsFeatureId& otherid, ids )
@@ -64,7 +64,7 @@ void QgsGeometryContainedCheck::fixError( QgsGeometryCheckError* error, int meth
6464
}
6565

6666
// Check if error still applies
67-
QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( feature.geometry()->geometry(), QgsGeometryCheckPrecision::precision() );
67+
QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( feature.geometry()->geometry(), QgsGeometryCheckPrecision::tolerance() );
6868

6969
if ( !geomEngine->within( *otherFeature.geometry()->geometry() ) )
7070
{

‎src/plugins/geometry_checker/checks/qgsgeometryduplicatecheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void QgsGeometryDuplicateCheck::collectErrors( QList<QgsGeometryCheckError*>& er
2222
{
2323
continue;
2424
}
25-
QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( feature.geometry()->geometry(), QgsGeometryCheckPrecision::precision() );
25+
QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( feature.geometry()->geometry(), QgsGeometryCheckPrecision::tolerance() );
2626

2727
QList<QgsFeatureId> duplicates;
2828
QgsFeatureIds ids = mFeaturePool->getIntersects( feature.geometry()->geometry()->boundingBox() );
@@ -74,7 +74,7 @@ void QgsGeometryDuplicateCheck::fixError( QgsGeometryCheckError* error, int meth
7474
}
7575
else if ( method == RemoveDuplicates )
7676
{
77-
QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( feature.geometry()->geometry(), QgsGeometryCheckPrecision::precision() );
77+
QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( feature.geometry()->geometry(), QgsGeometryCheckPrecision::tolerance() );
7878

7979
QgsGeometryDuplicateCheckError* duplicateError = static_cast<QgsGeometryDuplicateCheckError*>( error );
8080
foreach ( const QgsFeatureId& id, duplicateError->duplicates() )

‎src/plugins/geometry_checker/checks/qgsgeometrygapcheck.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void QgsGeometryGapCheck::collectErrors( QList<QgsGeometryCheckError*>& errors,
3333
return;
3434
}
3535

36-
QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( 0, QgsGeometryCheckPrecision::precision() );
36+
QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( 0, QgsGeometryCheckPrecision::tolerance() );
3737

3838
// Create union of geometry
3939
QString errMsg;
@@ -47,7 +47,7 @@ void QgsGeometryGapCheck::collectErrors( QList<QgsGeometryCheckError*>& errors,
4747
}
4848

4949
// Get envelope of union
50-
geomEngine = QgsGeomUtils::createGeomEngine( unionGeom, QgsGeometryCheckPrecision::precision() );
50+
geomEngine = QgsGeomUtils::createGeomEngine( unionGeom, QgsGeometryCheckPrecision::tolerance() );
5151
QgsAbstractGeometryV2* envelope = geomEngine->envelope( &errMsg );
5252
delete geomEngine;
5353
if ( !envelope )
@@ -58,14 +58,14 @@ void QgsGeometryGapCheck::collectErrors( QList<QgsGeometryCheckError*>& errors,
5858
}
5959

6060
// Buffer envelope
61-
geomEngine = QgsGeomUtils::createGeomEngine( envelope, QgsGeometryCheckPrecision::precision() );
61+
geomEngine = QgsGeomUtils::createGeomEngine( envelope, QgsGeometryCheckPrecision::tolerance() );
6262
QgsAbstractGeometryV2* bufEnvelope = geomEngine->buffer( 2, 0, GEOSBUF_CAP_SQUARE, GEOSBUF_JOIN_MITRE, 4. );
6363
delete geomEngine;
6464
delete envelope;
6565
envelope = bufEnvelope;
6666

6767
// Compute difference between envelope and union to obtain gap polygons
68-
geomEngine = QgsGeomUtils::createGeomEngine( envelope, QgsGeometryCheckPrecision::precision() );
68+
geomEngine = QgsGeomUtils::createGeomEngine( envelope, QgsGeometryCheckPrecision::tolerance() );
6969
QgsAbstractGeometryV2* diffGeom = geomEngine->difference( *unionGeom, &errMsg );
7070
delete geomEngine;
7171
if ( !diffGeom )
@@ -186,7 +186,7 @@ bool QgsGeometryGapCheck::mergeWithNeighbor( QgsGeometryGapCheckError* err, Chan
186186

187187
// Merge geometries
188188
QgsAbstractGeometryV2* mergeGeom = mergeFeature.geometry()->geometry();
189-
QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( errGeometry, QgsGeometryCheckPrecision::precision() );
189+
QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( errGeometry, QgsGeometryCheckPrecision::tolerance() );
190190
QgsAbstractGeometryV2* combinedGeom = geomEngine->combine( *QgsGeomUtils::getGeomPart( mergeGeom, mergePartIdx ), &errMsg );
191191
delete geomEngine;
192192
if ( !combinedGeom || combinedGeom->isEmpty() )

‎src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void QgsGeometryOverlapCheck::collectErrors( QList<QgsGeometryCheckError*>& erro
2121
continue;
2222
}
2323
QgsAbstractGeometryV2* geom = feature.geometry()->geometry();
24-
QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( geom, QgsGeometryCheckPrecision::precision() );
24+
QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( geom, QgsGeometryCheckPrecision::tolerance() );
2525

2626
QgsFeatureIds ids = mFeaturePool->getIntersects( feature.geometry()->boundingBox() );
2727
foreach ( const QgsFeatureId& otherid, ids )
@@ -79,7 +79,7 @@ void QgsGeometryOverlapCheck::fixError( QgsGeometryCheckError* error, int method
7979
return;
8080
}
8181
QgsAbstractGeometryV2* geom = feature.geometry()->geometry();
82-
QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( geom, QgsGeometryCheckPrecision::precision() );
82+
QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( geom, QgsGeometryCheckPrecision::tolerance() );
8383

8484
// Check if error still applies
8585
if ( !geomEngine->overlaps( *otherFeature.geometry()->geometry() ) )
@@ -122,7 +122,7 @@ void QgsGeometryOverlapCheck::fixError( QgsGeometryCheckError* error, int method
122122
}
123123
else if ( method == Subtract )
124124
{
125-
geomEngine = QgsGeomUtils::createGeomEngine( geom, QgsGeometryCheckPrecision::reducedPrecision() );
125+
geomEngine = QgsGeomUtils::createGeomEngine( geom, QgsGeometryCheckPrecision::reducedTolerance() );
126126
QgsAbstractGeometryV2* diff1 = geomEngine->difference( *interPart, &errMsg );
127127
delete geomEngine;
128128
if ( !diff1 || diff1->isEmpty() )
@@ -134,7 +134,7 @@ void QgsGeometryOverlapCheck::fixError( QgsGeometryCheckError* error, int method
134134
{
135135
QgsGeomUtils::filter1DTypes( diff1 );
136136
}
137-
QgsGeometryEngine* otherGeomEngine = QgsGeomUtils::createGeomEngine( otherFeature.geometry()->geometry(), QgsGeometryCheckPrecision::reducedPrecision() );
137+
QgsGeometryEngine* otherGeomEngine = QgsGeomUtils::createGeomEngine( otherFeature.geometry()->geometry(), QgsGeometryCheckPrecision::reducedTolerance() );
138138
QgsAbstractGeometryV2* diff2 = otherGeomEngine->difference( *interPart, &errMsg );
139139
delete otherGeomEngine;
140140
if ( !diff2 || diff2->isEmpty() )

‎src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ void QgsGeometrySelfIntersectionCheck::fixError( QgsGeometryCheckError* error, i
197197
poly2->setExteriorRing( ringGeom2 );
198198

199199
// Reassing interiors as necessary
200-
QgsGeometryEngine* geomEnginePoly1 = QgsGeomUtils::createGeomEngine( poly, QgsGeometryCheckPrecision::precision() );
201-
QgsGeometryEngine* geomEnginePoly2 = QgsGeomUtils::createGeomEngine( poly2, QgsGeometryCheckPrecision::precision() );
200+
QgsGeometryEngine* geomEnginePoly1 = QgsGeomUtils::createGeomEngine( poly, QgsGeometryCheckPrecision::tolerance() );
201+
QgsGeometryEngine* geomEnginePoly2 = QgsGeomUtils::createGeomEngine( poly2, QgsGeometryCheckPrecision::tolerance() );
202202
for ( int n = poly->numInteriorRings(), i = n - 1; i >= 0; --i )
203203
{
204204
if ( !geomEnginePoly1->contains( *poly->interiorRing( i ) ) )

‎src/plugins/geometry_checker/utils/qgsgeomutils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
namespace QgsGeomUtils
2424
{
2525

26-
QgsGeometryEngine* createGeomEngine( QgsAbstractGeometryV2* geometry, int precision )
26+
QgsGeometryEngine* createGeomEngine( QgsAbstractGeometryV2* geometry, double tolerance )
2727
{
28-
return new QgsGeos( geometry, precision );
28+
return new QgsGeos( geometry, tolerance );
2929
}
3030

3131
QgsAbstractGeometryV2* getGeomPart( QgsAbstractGeometryV2* geom, int partIdx )

‎src/plugins/geometry_checker/utils/qgsgeomutils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class QgsGeometryEngine;
2626
namespace QgsGeomUtils
2727
{
2828

29-
QgsGeometryEngine *createGeomEngine( QgsAbstractGeometryV2* geometry, int precision );
29+
QgsGeometryEngine *createGeomEngine( QgsAbstractGeometryV2* geometry, double tolerance );
3030

3131
QgsAbstractGeometryV2* getGeomPart( QgsAbstractGeometryV2* geom, int partIdx );
3232

0 commit comments

Comments
 (0)
Please sign in to comment.