Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #2985 from manisandro/geom_checker_fixes
Browse files Browse the repository at this point in the history
Geom checker fixes
  • Loading branch information
nyalldawson committed Apr 8, 2016
2 parents d07bc18 + a0b9877 commit edee876
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/plugins/geometry_checker/checks/qgsgeometryareacheck.cpp
Expand Up @@ -182,14 +182,6 @@ bool QgsGeometryAreaCheck::mergeWithNeighbor( QgsFeature& feature, int partIdx,
return method == MergeIdenticalAttribute ? true : false;
}


// Remove polygon from source geometry
deleteFeatureGeometryPart( feature, partIdx, changes );
if ( mergeFeature.id() == feature.id() && mergePartIdx > partIdx )
{
--mergePartIdx;
}

// Merge geometries
QgsAbstractGeometryV2* mergeGeom = mergeFeature.geometry()->geometry();
QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( QgsGeomUtils::getGeomPart( mergeGeom, mergePartIdx ), QgsGeometryCheckPrecision::tolerance() );
Expand All @@ -199,6 +191,14 @@ bool QgsGeometryAreaCheck::mergeWithNeighbor( QgsFeature& feature, int partIdx,
{
return false;
}

// Remove polygon from source geometry
deleteFeatureGeometryPart( feature, partIdx, changes );
if ( mergeFeature.id() == feature.id() && mergePartIdx > partIdx )
{
--mergePartIdx;
}
// Replace polygon in merge geometry
replaceFeatureGeometryPart( mergeFeature, mergePartIdx, combinedGeom, changes );

return true;
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/geometry_checker/checks/qgsgeometrycheck.cpp
Expand Up @@ -70,7 +70,10 @@ QgsAbstractGeometryV2 *QgsGeometryCheckError::geometry()
{
QgsFeature f;
if ( mCheck->getFeaturePool()->get( featureId(), f ) && f.geometry() )
return f.geometry()->geometry()->clone();
{
QgsAbstractGeometryV2* geom = f.geometry()->geometry();
return mVidx.part >= 0 ? QgsGeomUtils::getGeomPart( geom, mVidx.part )->clone() : geom->clone();
}
return nullptr;
}

Expand Down

0 comments on commit edee876

Please sign in to comment.