Skip to content

Commit d9e8a94

Browse files
committed
fix polygon generalization artifacts, if last ring segment is one of two
segments exceeding the tolerance plus some cleanups
1 parent 4f367f5 commit d9e8a94

4 files changed

+137
-118
lines changed

python/core/qgsmaptopixelgeometrysimplifier.sip

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ class QgsMapToPixelSimplifier : QgsAbstractGeometrySimplifier
2828
public:
2929

3030
//! Returns whether the envelope can be replaced by its BBOX when is applied the specified map2pixel context
31-
static bool canbeGeneralizedByMapBoundingBox( const QgsRectangle& envelope, double map2pixelTol );
31+
static bool isGeneralizableByMapBoundingBox( const QgsRectangle& envelope, double map2pixelTol );
3232

3333
//! Returns whether the envelope can be replaced by its BBOX when is applied the specified map2pixel context
34-
bool canbeGeneralizedByMapBoundingBox( const QgsRectangle& envelope ) const;
34+
bool isGeneralizableByMapBoundingBox( const QgsRectangle& envelope ) const;
3535

3636
//! Simplifies the geometry when is applied the specified map2pixel context
3737
static bool simplifyGeometry( QgsGeometry* geometry, int simplifyFlags, double tolerance );

src/core/qgsfeatureiterator.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ bool QgsAbstractFeatureIterator::nextFeature( QgsFeature& f )
5656
if ( dataOk && mLocalSimplification )
5757
{
5858
QgsGeometry* geometry = f.geometry();
59-
if ( geometry ) simplify( f );
59+
if ( geometry )
60+
simplify( f );
6061
}
6162
return dataOk;
6263
}
@@ -133,7 +134,8 @@ bool QgsAbstractFeatureIterator::simplify( QgsFeature& feature )
133134
QgsGeometry* geometry = feature.geometry();
134135

135136
QGis::GeometryType geometryType = geometry->type();
136-
if ( geometryType == QGis::Line || geometryType == QGis::Polygon ) return mGeometrySimplifier->simplifyGeometry( geometry );
137+
if ( geometryType == QGis::Line || geometryType == QGis::Polygon )
138+
return mGeometrySimplifier->simplifyGeometry( geometry );
137139
}
138140
return false;
139141
}

0 commit comments

Comments
 (0)