49 for (
int i = 0; !
mStop && i < ring0.size() - 1; i++ )
53 for (
int j = 0; !
mStop && j < ring1.size() - 1; j++ )
62 if ( d >= 0 && d <= v.
length() )
65 if ( d >= 0 && d <= w.
length() )
67 QString msg =
QObject::tr(
"segment %1 of ring %2 of polygon %3 intersects segment %4 of ring %5 of polygon %6 at %7" )
68 .arg( i0 ).arg( i ).arg( p0 )
69 .arg( i1 ).arg( j ).arg( p1 )
85 if ( line.size() < 4 )
87 QString msg =
QObject::tr(
"ring %1 with less than four points" ).arg( i );
94 if ( line[0] != line[ line.size()-1 ] )
96 QString msg =
QObject::tr(
"ring %1 not closed" ).arg( i );
103 else if ( line.size() < 2 )
105 QString msg =
QObject::tr(
"line %1 with less than two points" ).arg( i );
113 while ( j < line.size() - 1 )
116 while ( j < line.size() - 1 && line[j] == line[j+1] )
124 QString msg =
QObject::tr(
"line %1 contains %n duplicate node(s) at %2",
"number of duplicate nodes", n ).arg( i ).arg( j );
133 for ( j = 0; !
mStop && j < line.size() - 3; j++ )
138 int n = ( j == 0 && ring ) ? line.size() - 2 : line.size() - 1;
140 for (
int k = j + 2; !
mStop && k < n; k++ )
149 if ( d < 0 || d > vl )
153 if ( d < 0 || d > w.
length() )
156 QString msg =
QObject::tr(
"segments %1 and %2 of line %3 intersect at %4" ).arg( j ).arg( k ).arg( i ).arg( s.
toString() );
167 for (
int i = 1; !
mStop && i < polygon.size(); i++ )
171 QString msg =
QObject::tr(
"ring %1 of polygon %2 not in exterior ring" ).arg( i ).arg( idx );
179 for (
int i = 1; !
mStop && i < polygon.size(); i++ )
181 for (
int j = i + 1; !
mStop && j < polygon.size(); j++ )
188 for (
int i = 0; !
mStop && i < polygon.size(); i++ )
197 #if defined(GEOS_VERSION_MAJOR) && defined(GEOS_VERSION_MINOR) && \
198 ( (GEOS_VERSION_MAJOR==3 && GEOS_VERSION_MINOR>=3) || GEOS_VERSION_MAJOR>3)
200 if ( settings.value(
"/qgis/digitizing/validate_geometries", 1 ).toInt() == 2 )
203 const GEOSGeometry *g0 =
mG.
asGeos();
210 GEOSGeometry *g1 = 0;
211 if ( GEOSisValidDetail( g0, GEOSVALID_ALLOW_SELFTOUCHING_RING_FORMING_HOLE, &r, &g1 ) != 1 )
215 const GEOSCoordSequence *cs = GEOSGeom_getCoordSeq( g1 );
218 if ( GEOSCoordSeq_getSize( cs, &n ) && n == 1 )
221 GEOSCoordSeq_getX( cs, 0, &x );
222 GEOSCoordSeq_getY( cs, 0, &y );
227 GEOSGeom_destroy( g1 );
262 for (
int i = 0; !
mStop && i < mp.size(); i++ )
278 for (
int i = 0; !
mStop && i < mp.size(); i++ )
283 for (
int i = 0; !
mStop && i < mp.size(); i++ )
285 if ( mp[i].isEmpty() )
292 for (
int j = i + 1; !
mStop && j < mp.size(); j++ )
294 if ( mp[j].isEmpty() )
368 return ( v.
x()*( q.
y() - p.
y() ) - v.
y()*( q.
x() - p.
x() ) ) / v.
length();
373 double d = v.
y() * w.
x() - v.
x() * w.
y();
378 double dx = q.
x() - p.
x();
379 double dy = q.
y() - p.
y();
380 double k = ( dy * w.
x() - dx * w.
y() ) / d;
390 int j = ring.size() - 1;
392 for (
int i = 0; !
mStop && i < ring.size(); i++ )
394 if ( ring[i].x() == p.
x() && ring[i].y() == p.
y() )
397 if (( ring[i].y() < p.
y() && ring[j].y() >= p.
y() ) ||
398 ( ring[j].y() < p.
y() && ring[i].y() >= p.
y() ) )
400 if ( ring[i].x() + ( p.
y() - ring[i].y() ) / ( ring[j].y() - ring[i].y() )*( ring[j].x() - ring[i].x() ) <= p.
x() )
412 for (
int i = 0; !
mStop && i < inside.size(); i++ )