Skip to content
Permalink
Browse files

[Geometry checker] Fix incorrect change parametrization in QgsGeometr…

…yCheck::replaceFeatureGeometryPart
  • Loading branch information
manisandro committed Oct 19, 2017
1 parent f0116b4 commit 15b5da8fea4a7e8047b3a15ac43bf04e8c656026
@@ -160,11 +160,11 @@ void QgsGeometryCheck::replaceFeatureGeometryPart( const QString &layerId, QgsFe
QgsAbstractGeometry *geom = featureGeom.geometry();
if ( dynamic_cast<QgsGeometryCollection *>( geom ) )
{
QgsGeometryCollection *GeomCollection = static_cast<QgsGeometryCollection *>( geom );
GeomCollection->removeGeometry( partIdx );
GeomCollection->addGeometry( newPartGeom );
changes[layerId][feature.id()].append( Change( ChangeFeature, ChangeRemoved, QgsVertexId( partIdx ) ) );
changes[layerId][feature.id()].append( Change( ChangeFeature, ChangeAdded, QgsVertexId( GeomCollection->partCount() - 1 ) ) );
QgsGeometryCollection *geomCollection = static_cast<QgsGeometryCollection *>( geom );
geomCollection->removeGeometry( partIdx );
geomCollection->addGeometry( newPartGeom );
changes[layerId][feature.id()].append( Change( ChangePart, ChangeRemoved, QgsVertexId( partIdx ) ) );
changes[layerId][feature.id()].append( Change( ChangePart, ChangeAdded, QgsVertexId( geomCollection->partCount() - 1 ) ) );
feature.setGeometry( featureGeom );
}
else
@@ -231,8 +231,8 @@ void TestQgsGeometryChecks::testAreaCheck()
QgsGeometryAreaCheck::MergeLargestArea, QgsGeometryCheckError::StatusFixed,
{
{errs2[0]->layerId(), errs2[0]->featureId(), QgsGeometryCheck::ChangeFeature, QgsGeometryCheck::ChangeRemoved, QgsVertexId()},
{layers["polygon_layer.shp"], 15, QgsGeometryCheck::ChangeFeature, QgsGeometryCheck::ChangeRemoved, QgsVertexId( 0 )},
{layers["polygon_layer.shp"], 15, QgsGeometryCheck::ChangeFeature, QgsGeometryCheck::ChangeAdded, QgsVertexId( 0 )}
{layers["polygon_layer.shp"], 15, QgsGeometryCheck::ChangePart, QgsGeometryCheck::ChangeRemoved, QgsVertexId( 0 )},
{layers["polygon_layer.shp"], 15, QgsGeometryCheck::ChangePart, QgsGeometryCheck::ChangeAdded, QgsVertexId( 0 )}
} ) );
context->featurePools[layers["polygon_layer.shp"]]->get( 15, f );
QVERIFY( f.geometry().area() > area15 );
@@ -245,8 +245,8 @@ void TestQgsGeometryChecks::testAreaCheck()
QgsGeometryAreaCheck::MergeLongestEdge, QgsGeometryCheckError::StatusFixed,
{
{errs3[0]->layerId(), errs3[0]->featureId(), QgsGeometryCheck::ChangeFeature, QgsGeometryCheck::ChangeRemoved, QgsVertexId()},
{layers["polygon_layer.shp"], 18, QgsGeometryCheck::ChangeFeature, QgsGeometryCheck::ChangeRemoved, QgsVertexId( 0 )},
{layers["polygon_layer.shp"], 18, QgsGeometryCheck::ChangeFeature, QgsGeometryCheck::ChangeAdded, QgsVertexId( 0 )}
{layers["polygon_layer.shp"], 18, QgsGeometryCheck::ChangePart, QgsGeometryCheck::ChangeRemoved, QgsVertexId( 0 )},
{layers["polygon_layer.shp"], 18, QgsGeometryCheck::ChangePart, QgsGeometryCheck::ChangeAdded, QgsVertexId( 0 )}
} ) );
context->featurePools[layers["polygon_layer.shp"]]->get( 18, f );
QVERIFY( f.geometry().area() > area18 );
@@ -261,8 +261,8 @@ void TestQgsGeometryChecks::testAreaCheck()
QgsGeometryAreaCheck::MergeIdenticalAttribute, QgsGeometryCheckError::StatusFixed,
{
{errs4[0]->layerId(), errs4[0]->featureId(), QgsGeometryCheck::ChangeFeature, QgsGeometryCheck::ChangeRemoved, QgsVertexId()},
{layers["polygon_layer.shp"], 21, QgsGeometryCheck::ChangeFeature, QgsGeometryCheck::ChangeRemoved, QgsVertexId( 0 )},
{layers["polygon_layer.shp"], 21, QgsGeometryCheck::ChangeFeature, QgsGeometryCheck::ChangeAdded, QgsVertexId( 0 )}
{layers["polygon_layer.shp"], 21, QgsGeometryCheck::ChangePart, QgsGeometryCheck::ChangeRemoved, QgsVertexId( 0 )},
{layers["polygon_layer.shp"], 21, QgsGeometryCheck::ChangePart, QgsGeometryCheck::ChangeAdded, QgsVertexId( 0 )}
}, mergeIdx ) );
context->featurePools[layers["polygon_layer.shp"]]->get( 21, f );
QVERIFY( f.geometry().area() > area21 );
@@ -520,8 +520,8 @@ void TestQgsGeometryChecks::testGapCheck()
QVERIFY( fixCheckError( errs1[0],
QgsGeometryGapCheck::MergeLongestEdge, QgsGeometryCheckError::StatusFixed,
{
{layers["gap_layer.shp"], 0, QgsGeometryCheck::ChangeFeature, QgsGeometryCheck::ChangeRemoved, QgsVertexId( 0 )},
{layers["gap_layer.shp"], 0, QgsGeometryCheck::ChangeFeature, QgsGeometryCheck::ChangeAdded, QgsVertexId( 0 )}
{layers["gap_layer.shp"], 0, QgsGeometryCheck::ChangePart, QgsGeometryCheck::ChangeRemoved, QgsVertexId( 0 )},
{layers["gap_layer.shp"], 0, QgsGeometryCheck::ChangePart, QgsGeometryCheck::ChangeAdded, QgsVertexId( 0 )}
} ) );
context->featurePools[layers["gap_layer.shp"]]->get( 0, f );
QVERIFY( f.geometry().area() > areaOld );

0 comments on commit 15b5da8

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