Skip to content

Commit

Permalink
fix polygon generalization artifacts, if last ring segment is one of two
Browse files Browse the repository at this point in the history
segments exceeding the tolerance plus some cleanups
  • Loading branch information
jef-n committed Aug 17, 2014
1 parent 4f367f5 commit d9e8a94
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 118 deletions.
4 changes: 2 additions & 2 deletions python/core/qgsmaptopixelgeometrysimplifier.sip
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ class QgsMapToPixelSimplifier : QgsAbstractGeometrySimplifier
public:

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

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

//! Simplifies the geometry when is applied the specified map2pixel context
static bool simplifyGeometry( QgsGeometry* geometry, int simplifyFlags, double tolerance );
Expand Down
6 changes: 4 additions & 2 deletions src/core/qgsfeatureiterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ bool QgsAbstractFeatureIterator::nextFeature( QgsFeature& f )
if ( dataOk && mLocalSimplification )
{
QgsGeometry* geometry = f.geometry();
if ( geometry ) simplify( f );
if ( geometry )
simplify( f );
}
return dataOk;
}
Expand Down Expand Up @@ -133,7 +134,8 @@ bool QgsAbstractFeatureIterator::simplify( QgsFeature& feature )
QgsGeometry* geometry = feature.geometry();

QGis::GeometryType geometryType = geometry->type();
if ( geometryType == QGis::Line || geometryType == QGis::Polygon ) return mGeometrySimplifier->simplifyGeometry( geometry );
if ( geometryType == QGis::Line || geometryType == QGis::Polygon )
return mGeometrySimplifier->simplifyGeometry( geometry );
}
return false;
}
Expand Down

0 comments on commit d9e8a94

Please sign in to comment.