[QGIS Commit] r9098 - trunk/qgis/src/providers/ogr
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Wed Aug 20 14:25:56 EDT 2008
Author: jef
Date: 2008-08-20 14:25:56 -0400 (Wed, 20 Aug 2008)
New Revision: 9098
Modified:
trunk/qgis/src/providers/ogr/qgsogrprovider.cpp
Log:
fix filter in OGR provider
Modified: trunk/qgis/src/providers/ogr/qgsogrprovider.cpp
===================================================================
--- trunk/qgis/src/providers/ogr/qgsogrprovider.cpp 2008-08-20 18:25:17 UTC (rev 9097)
+++ trunk/qgis/src/providers/ogr/qgsogrprovider.cpp 2008-08-20 18:25:56 UTC (rev 9098)
@@ -268,7 +268,7 @@
feature.setTypeName(featureTypeName);
/* fetch geometry */
- if (mFetchGeom)
+ if (mFetchGeom || mUseIntersect)
{
OGRGeometryH geom = OGR_F_GetGeometryRef(fet);
@@ -324,8 +324,7 @@
}
}
-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;
@@ -339,8 +338,9 @@
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)
{
@@ -349,11 +349,10 @@
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 );
More information about the QGIS-commit
mailing list