Skip to content
Permalink
Browse files

fix polygon generalization artifacts, if last ring segment is one of two

segments exceeding the tolerance plus some cleanups
  • Loading branch information
jef-n committed Aug 17, 2014
1 parent 4f367f5 commit d9e8a940b9788044c12670f059dc12cd3544943d
@@ -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 );
@@ -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;
}
@@ -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;
}

0 comments on commit d9e8a94

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