Skip to content
Permalink
Browse files

Merge pull request #9307 from m-kuhn/avoid-intersection-use-geometry-…

…precision

Add topological points on layers with configured precision
  • Loading branch information
m-kuhn committed Mar 2, 2019
2 parents 252791e + 2e05cf1 commit c2679926b89e2ec73b733b6042a7f66187609a53
Showing with 14 additions and 7 deletions.
  1. +14 −7 src/core/qgsvectorlayereditutils.cpp
@@ -25,6 +25,7 @@
#include "qgswkbtypes.h"
#include "qgsvectorlayerutils.h"
#include "qgsvectorlayer.h"
#include "qgsgeometryoptions.h"

#include <limits>

@@ -614,14 +615,20 @@ int QgsVectorLayerEditUtils::addTopologicalPoints( const QgsPointXY &p )
double segmentSearchEpsilon = mLayer->crs().isGeographic() ? 1e-12 : 1e-8;

//work with a tolerance because coordinate projection may introduce some rounding
double threshold = 0.0000001;
if ( mLayer->crs().mapUnits() == QgsUnitTypes::DistanceMeters )
{
threshold = 0.001;
}
else if ( mLayer->crs().mapUnits() == QgsUnitTypes::DistanceFeet )
double threshold = mLayer->geometryOptions()->geometryPrecision();

if ( qgsDoubleNear( threshold, 0.0 ) )
{
threshold = 0.0001;
threshold = 0.0000001;

if ( mLayer->crs().mapUnits() == QgsUnitTypes::DistanceMeters )
{
threshold = 0.001;
}
else if ( mLayer->crs().mapUnits() == QgsUnitTypes::DistanceFeet )
{
threshold = 0.0001;
}
}

QgsRectangle searchRect( p.x() - threshold, p.y() - threshold,

0 comments on commit c267992

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