Skip to content

Commit

Permalink
Fix for ticket #237 (delimited layers don't select properly). Was
Browse files Browse the repository at this point in the history
caused by changes in recent delimited text provider commits.


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5701 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Aug 16, 2006
1 parent becbe50 commit c4939aa
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
Expand Up @@ -368,20 +368,25 @@ QgsDelimitedTextProvider::getNextFeature_( QgsFeature & feature,
if (! (xOk && yOk))
{
// Accumulate any lines that weren't ok, to report on them
// later, and look at the next line in the file.
mInvalidLines << line;
// later, and look at the next line in the file, but only if
// we need to.
if (mShowInvalidLines)
mInvalidLines << line;

continue;
}

// Give every valid line in the file an id, even if it's not
// in the current extent or bounds.
++mFid; // increment to next feature ID

if (! boundsCheck(x,y))
continue;

// at this point, one way or another, the current feature values
// are valid
feature.setValid( true );

++mFid; // increment to next feature ID

feature.setFeatureId( mFid );

QByteArray buffer;
Expand Down Expand Up @@ -439,7 +444,7 @@ QgsDelimitedTextProvider::getNextFeature_( QgsFeature & feature,
} // ! textStream EOF

// End of the file. If there are any lines that couldn't be
// loaded, display them now, but only once.
// loaded, display them now.

if (mShowInvalidLines && !mInvalidLines.isEmpty())
{
Expand All @@ -450,6 +455,8 @@ QgsDelimitedTextProvider::getNextFeature_( QgsFeature & feature,
lineViewer.appendMessage(mInvalidLines.at(i));

lineViewer.exec();
// We no longer need these lines.
mInvalidLines.empty();
}

return false;
Expand Down Expand Up @@ -522,7 +529,6 @@ void QgsDelimitedTextProvider::select(QgsRect * rect, bool useIntersect)
reset();
// Reset the feature id to 0
mFid = 0;

}


Expand Down Expand Up @@ -700,10 +706,12 @@ bool QgsDelimitedTextProvider::isValid()
*/
bool QgsDelimitedTextProvider::boundsCheck(double x, double y)
{
bool inBounds = (((x < mSelectionRectangle->xMax()) &&
(x > mSelectionRectangle->xMin())) &&
((y < mSelectionRectangle->yMax()) &&
(y > mSelectionRectangle->yMin())));
bool inBounds(true);
if (mSelectionRectangle)
inBounds = (((x < mSelectionRectangle->xMax()) &&
(x > mSelectionRectangle->xMin())) &&
((y < mSelectionRectangle->yMax()) &&
(y > mSelectionRectangle->yMin())));
// QString hit = inBounds?"true":"false";

// std::cerr << "Checking if " << x << ", " << y << " is in " <<
Expand Down

0 comments on commit c4939aa

Please sign in to comment.