@@ -368,20 +368,25 @@ QgsDelimitedTextProvider::getNextFeature_( QgsFeature & feature,
368
368
if (! (xOk && yOk))
369
369
{
370
370
// Accumulate any lines that weren't ok, to report on them
371
- // later, and look at the next line in the file.
372
- mInvalidLines << line;
371
+ // later, and look at the next line in the file, but only if
372
+ // we need to.
373
+ if (mShowInvalidLines )
374
+ mInvalidLines << line;
375
+
373
376
continue ;
374
377
}
375
378
379
+ // Give every valid line in the file an id, even if it's not
380
+ // in the current extent or bounds.
381
+ ++mFid ; // increment to next feature ID
382
+
376
383
if (! boundsCheck (x,y))
377
384
continue ;
378
385
379
386
// at this point, one way or another, the current feature values
380
387
// are valid
381
388
feature.setValid ( true );
382
389
383
- ++mFid ; // increment to next feature ID
384
-
385
390
feature.setFeatureId ( mFid );
386
391
387
392
QByteArray buffer;
@@ -439,7 +444,7 @@ QgsDelimitedTextProvider::getNextFeature_( QgsFeature & feature,
439
444
} // ! textStream EOF
440
445
441
446
// End of the file. If there are any lines that couldn't be
442
- // loaded, display them now, but only once .
447
+ // loaded, display them now.
443
448
444
449
if (mShowInvalidLines && !mInvalidLines .isEmpty ())
445
450
{
@@ -450,6 +455,8 @@ QgsDelimitedTextProvider::getNextFeature_( QgsFeature & feature,
450
455
lineViewer.appendMessage (mInvalidLines .at (i));
451
456
452
457
lineViewer.exec ();
458
+ // We no longer need these lines.
459
+ mInvalidLines .empty ();
453
460
}
454
461
455
462
return false ;
@@ -522,7 +529,6 @@ void QgsDelimitedTextProvider::select(QgsRect * rect, bool useIntersect)
522
529
reset ();
523
530
// Reset the feature id to 0
524
531
mFid = 0 ;
525
-
526
532
}
527
533
528
534
@@ -700,10 +706,12 @@ bool QgsDelimitedTextProvider::isValid()
700
706
*/
701
707
bool QgsDelimitedTextProvider::boundsCheck (double x, double y)
702
708
{
703
- bool inBounds = (((x < mSelectionRectangle ->xMax ()) &&
704
- (x > mSelectionRectangle ->xMin ())) &&
705
- ((y < mSelectionRectangle ->yMax ()) &&
706
- (y > mSelectionRectangle ->yMin ())));
709
+ bool inBounds (true );
710
+ if (mSelectionRectangle )
711
+ inBounds = (((x < mSelectionRectangle ->xMax ()) &&
712
+ (x > mSelectionRectangle ->xMin ())) &&
713
+ ((y < mSelectionRectangle ->yMax ()) &&
714
+ (y > mSelectionRectangle ->yMin ())));
707
715
// QString hit = inBounds?"true":"false";
708
716
709
717
// std::cerr << "Checking if " << x << ", " << y << " is in " <<
0 commit comments