Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #2365 from manisandro/geom_checker_fixes
Geometry checker fixes
  • Loading branch information
mhugent committed Oct 12, 2015
2 parents de8b045 + c1028ef commit 5f82f1b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Expand Up @@ -6,11 +6,11 @@
***************************************************************************/

#include "qgsgeometryselfintersectioncheck.h"
#include "qgscurvepolygonv2.h"
#include "qgspolygonv2.h"
#include "qgslinestringv2.h"
#include "qgsgeometryengine.h"
#include "qgsmultipolygonv2.h"
#include "qgsmulticurvev2.h"
#include "qgsmultilinestringv2.h"
#include "qgsgeometryutils.h"
#include "../utils/qgsfeaturepool.h"

Expand Down Expand Up @@ -193,7 +193,8 @@ void QgsGeometrySelfIntersectionCheck::fixError( QgsGeometryCheckError* error, i
// If ring is exterior, build two polygons, and reassign interiors as necessary
poly->setExteriorRing( ringGeom1 );

QgsCurvePolygonV2* poly2 = new QgsCurvePolygonV2();
// If original feature was a linear polygon, also create the new part as a linear polygon
QgsCurvePolygonV2* poly2 = dynamic_cast<QgsPolygonV2*>( part ) ? new QgsPolygonV2() : new QgsCurvePolygonV2();
poly2->setExteriorRing( ringGeom2 );

// Reassing interiors as necessary
Expand Down Expand Up @@ -265,7 +266,7 @@ void QgsGeometrySelfIntersectionCheck::fixError( QgsGeometryCheckError* error, i
}
else
{
QgsMultiCurveV2* geomCollection = new QgsMultiCurveV2();
QgsMultiCurveV2* geomCollection = new QgsMultiLineStringV2();
geomCollection->addGeometry( ringGeom1 );
geomCollection->addGeometry( ringGeom2 );
feature.setGeometry( new QgsGeometry( geomCollection ) );
Expand Down
Expand Up @@ -323,7 +323,7 @@ void QgsGeometryCheckerResultTab::highlightErrors( bool current )
if ( ui.checkBoxHighlight->isChecked() && geometry )
{
QgsRubberBand* featureRubberBand = new QgsRubberBand( mIface->mapCanvas() );
QgsGeometry geom( geometry );
QgsGeometry geom( geometry->clone() );
featureRubberBand->addGeometry( &geom, mFeaturePool->getLayer() );
featureRubberBand->setWidth( 5 );
featureRubberBand->setColor( Qt::yellow );
Expand Down

0 comments on commit 5f82f1b

Please sign in to comment.