Skip to content
Permalink
Browse files

Cleanup variable names, fix error string

  • Loading branch information
nyalldawson committed Nov 4, 2020
1 parent 9fbe872 commit 08f65f2f8d12039fa573afc38949fc23cd130dfa
Showing with 9 additions and 9 deletions.
  1. +7 −7 src/core/qgsgeometryvalidator.cpp
  2. +2 −2 src/core/qgsgeometryvalidator.h
@@ -41,7 +41,7 @@ void QgsGeometryValidator::stop()
mStop = true;
}

void QgsGeometryValidator::checkRingIntersections( int p0, int i0, const QgsLineString *ring0, int p1, int i1, const QgsLineString *ring1 )
void QgsGeometryValidator::checkRingIntersections( int partIndex0, int ringIndex0, const QgsLineString *ring0, int partIndex1, int ringIndex1, const QgsLineString *ring1 )
{
for ( int i = 0; !mStop && i < ring0->numPoints() - 1; i++ )
{
@@ -69,8 +69,8 @@ void QgsGeometryValidator::checkRingIntersections( int p0, int i0, const QgsLine
ring0->pointN( i + 0 ) != ring1->pointN( j + 1 ) && ring0->pointN( i + 0 ) != ring1->pointN( j ) )
{
QString msg = QObject::tr( "segment %1 of ring %2 of polygon %3 intersects segment %4 of ring %5 of polygon %6 at %7, %8" )
.arg( i0 ).arg( i ).arg( p0 )
.arg( i1 ).arg( j ).arg( p1 )
.arg( i ).arg( ringIndex0 ).arg( partIndex0 )
.arg( j ).arg( ringIndex1 ).arg( partIndex1 )
.arg( sX ).arg( sY );
QgsDebugMsg( msg );
emit errorFound( QgsGeometry::Error( msg, QgsPointXY( sX, sY ) ) );
@@ -214,14 +214,14 @@ void QgsGeometryValidator::validatePolyline( int i, const QgsLineString *line, b
}
}

void QgsGeometryValidator::validatePolygon( int idx, const QgsPolygon *polygon )
void QgsGeometryValidator::validatePolygon( int partIndex, const QgsPolygon *polygon )
{
// check if holes are inside polygon
for ( int i = 0; !mStop && i < polygon->numInteriorRings(); ++i )
{
if ( !ringInRing( static_cast< const QgsLineString * >( polygon->interiorRing( i ) ), static_cast< const QgsLineString * >( polygon->exteriorRing() ) ) )
{
QString msg = QObject::tr( "ring %1 of polygon %2 not in exterior ring" ).arg( i + 1 ).arg( idx );
QString msg = QObject::tr( "ring %1 of polygon %2 not in exterior ring" ).arg( i + 1 ).arg( partIndex );
QgsDebugMsg( msg );
emit errorFound( QgsGeometry::Error( msg ) );
mErrorCount++;
@@ -233,8 +233,8 @@ void QgsGeometryValidator::validatePolygon( int idx, const QgsPolygon *polygon )
{
for ( int j = i + 1; !mStop && j < polygon->numInteriorRings(); j++ )
{
checkRingIntersections( idx, i + 1, qgsgeometry_cast< QgsLineString * >( polygon->interiorRing( i ) ),
idx, j + 1, qgsgeometry_cast< QgsLineString * >( polygon->interiorRing( j ) ) );
checkRingIntersections( partIndex, i + 1, qgsgeometry_cast< QgsLineString * >( polygon->interiorRing( i ) ),
partIndex, j + 1, qgsgeometry_cast< QgsLineString * >( polygon->interiorRing( j ) ) );
}
}

@@ -71,8 +71,8 @@ class CORE_EXPORT QgsGeometryValidator : public QThread

private:
void validatePolyline( int i, const QgsLineString *line, bool ring = false );
void validatePolygon( int i, const QgsPolygon *polygon );
void checkRingIntersections( int p0, int i0, const QgsLineString *ring0, int p1, int i1, const QgsLineString *ring1 );
void validatePolygon( int partIndex, const QgsPolygon *polygon );
void checkRingIntersections( int partIndex0, int ringIndex0, const QgsLineString *ring0, int partIndex1, int ringIndex1, const QgsLineString *ring1 );
double distLine2Point( double px, double py, QgsVector v, double qX, double qY );
bool intersectLines( double px, double py, QgsVector v, double qx, double qy, QgsVector w, double &sX, double &sY );
bool ringInRing( const QgsLineString *inside, const QgsLineString *outside );

0 comments on commit 08f65f2

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