Skip to content

Commit

Permalink
[Geometry checker] Fix angle check possibly reporting end nodes of lines
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Oct 23, 2017
1 parent 57c348b commit 7a51866
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/plugins/geometry_checker/checks/qgsgeometryanglecheck.cpp
Expand Up @@ -28,13 +28,14 @@ void QgsGeometryAngleCheck::collectErrors( QList<QgsGeometryCheckError *> &error
{
for ( int iRing = 0, nRings = geom->ringCount( iPart ); iRing < nRings; ++iRing )
{
int nVerts = QgsGeometryCheckerUtils::polyLineSize( geom, iPart, iRing );
bool closed = false;
int nVerts = QgsGeometryCheckerUtils::polyLineSize( geom, iPart, iRing, &closed );
// Less than three points, no angles to check
if ( nVerts < 3 )
{
continue;
}
for ( int iVert = 0; iVert < nVerts; ++iVert )
for ( int iVert = !closed; iVert < nVerts - !closed; ++iVert )
{
const QgsPoint &p1 = geom->vertexAt( QgsVertexId( iPart, iRing, ( iVert - 1 + nVerts ) % nVerts ) );
const QgsPoint &p2 = geom->vertexAt( QgsVertexId( iPart, iRing, iVert ) );
Expand Down

0 comments on commit 7a51866

Please sign in to comment.