Skip to content

Commit e1a4d10

Browse files
author
jef
committed
fix filter in OGR provider
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9098 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 4acf538 commit e1a4d10

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/providers/ogr/qgsogrprovider.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ bool QgsOgrProvider::getNextFeature(QgsFeature& feature)
268268
feature.setTypeName(featureTypeName);
269269

270270
/* fetch geometry */
271-
if (mFetchGeom)
271+
if (mFetchGeom || mUseIntersect)
272272
{
273273
OGRGeometryH geom = OGR_F_GetGeometryRef(fet);
274274

@@ -324,8 +324,7 @@ bool QgsOgrProvider::getNextFeature(QgsFeature& feature)
324324
}
325325
}
326326

327-
void QgsOgrProvider::select(QgsAttributeList fetchAttributes, QgsRect rect, bool fetchGeometry, \
328-
bool useIntersect)
327+
void QgsOgrProvider::select(QgsAttributeList fetchAttributes, QgsRect rect, bool fetchGeometry, bool useIntersect)
329328
{
330329
mUseIntersect = useIntersect;
331330
mAttributesToFetch = fetchAttributes;
@@ -339,8 +338,9 @@ void QgsOgrProvider::select(QgsAttributeList fetchAttributes, QgsRect rect, bool
339338
else
340339
{
341340
OGRGeometryH filter = 0;
342-
QString wktExtent = QString("POLYGON ((%1))").arg(rect.asPolygon());
343-
const char *wktText = wktExtent.toAscii();
341+
QString wktExtent = QString("POLYGON((%1))").arg(rect.asPolygon());
342+
QByteArray ba = wktExtent.toAscii();
343+
const char *wktText= ba;
344344

345345
if(useIntersect)
346346
{
@@ -349,11 +349,10 @@ void QgsOgrProvider::select(QgsAttributeList fetchAttributes, QgsRect rect, bool
349349
if( mSelectionRectangle )
350350
OGR_G_DestroyGeometry( mSelectionRectangle );
351351

352-
OGR_G_CreateFromWkt( (char **)&wktText,
353-
NULL, &mSelectionRectangle);
352+
OGR_G_CreateFromWkt( (char **)&wktText, NULL, &mSelectionRectangle);
353+
wktText= ba;
354354
}
355-
356-
wktText = wktExtent.toAscii();
355+
357356
OGR_G_CreateFromWkt( (char **)&wktText, NULL, &filter );
358357
QgsDebugMsg("Setting spatial filter using " + wktExtent);
359358
OGR_L_SetSpatialFilter( ogrLayer, filter );

0 commit comments

Comments
 (0)