Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix filter in OGR provider
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9098 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Aug 20, 2008
1 parent 4acf538 commit e1a4d10
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -268,7 +268,7 @@ bool QgsOgrProvider::getNextFeature(QgsFeature& feature)
feature.setTypeName(featureTypeName);

/* fetch geometry */
if (mFetchGeom)
if (mFetchGeom || mUseIntersect)
{
OGRGeometryH geom = OGR_F_GetGeometryRef(fet);

Expand Down Expand Up @@ -324,8 +324,7 @@ bool QgsOgrProvider::getNextFeature(QgsFeature& feature)
}
}

void QgsOgrProvider::select(QgsAttributeList fetchAttributes, QgsRect rect, bool fetchGeometry, \
bool useIntersect)
void QgsOgrProvider::select(QgsAttributeList fetchAttributes, QgsRect rect, bool fetchGeometry, bool useIntersect)
{
mUseIntersect = useIntersect;
mAttributesToFetch = fetchAttributes;
Expand All @@ -339,8 +338,9 @@ void QgsOgrProvider::select(QgsAttributeList fetchAttributes, QgsRect rect, bool
else
{
OGRGeometryH filter = 0;
QString wktExtent = QString("POLYGON ((%1))").arg(rect.asPolygon());
const char *wktText = wktExtent.toAscii();
QString wktExtent = QString("POLYGON((%1))").arg(rect.asPolygon());
QByteArray ba = wktExtent.toAscii();
const char *wktText= ba;

if(useIntersect)
{
Expand All @@ -349,11 +349,10 @@ void QgsOgrProvider::select(QgsAttributeList fetchAttributes, QgsRect rect, bool
if( mSelectionRectangle )
OGR_G_DestroyGeometry( mSelectionRectangle );

OGR_G_CreateFromWkt( (char **)&wktText,
NULL, &mSelectionRectangle);
OGR_G_CreateFromWkt( (char **)&wktText, NULL, &mSelectionRectangle);
wktText= ba;
}

wktText = wktExtent.toAscii();

OGR_G_CreateFromWkt( (char **)&wktText, NULL, &filter );
QgsDebugMsg("Setting spatial filter using " + wktExtent);
OGR_L_SetSpatialFilter( ogrLayer, filter );
Expand Down

0 comments on commit e1a4d10

Please sign in to comment.