use fast geos export method on little- and big endian machine since QgsGeometry::geosGeometry is now endian-aware. Fixed a memory leak in the OgrProvider. Use ->getNextFeature(false) when selecting vector features because attributes are not needed for geometric selection

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@4066 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
mhugent 2005-10-11 17:39:22 +00:00
parent 5f5264f7c2
commit ae9360060b
2 changed files with 7 additions and 28 deletions

View File

@ -402,39 +402,18 @@ QgsFeature *QgsOgrProvider::getNextFeature(bool fetchAttributes)
delete fet;
continue;
} */
}
}
if(mUseIntersect)
{
geos::Geometry *geosGeom = 0;
// XXX This if/else block fixes the endian issue on
// XDR (big endian) platforms for release 0.7. This
// code should be revisited to see if there is a more
// efficient way to create the geos geometry and to push
// the job down to QgsFeature instead of the mix we have
// here. The side-effect of this fix is extremely slow
// performance on when identifying or selecting multipart
// features on XDR platforms.
if (endian() == QgsDataProvider::XDR)
{
// big endian -- use wkt method
geom = fet->GetGeometryRef();
char *wkt = new char[2 * f->getGeometrySize()];
assert(wkt != 0);
geom->exportToWkt(&wkt);
geosGeom = wktReader->read(wkt);
}
else
{
// little endian -- use QgsFeature method
geosGeom=f->geosGeometry();
}
assert(geosGeom != 0);
geos::Geometry *geosGeom = 0;
geosGeom=f->geosGeometry();
assert(geosGeom != 0);
char *sWkt = new char[2 * mSelectionRectangle->WkbSize()];
mSelectionRectangle->exportToWkt(&sWkt);
geos::Geometry *geosRect = wktReader->read(sWkt);
assert(geosGeom != 0);
assert(geosRect != 0);
if(geosGeom->intersects(geosRect))
{
#ifdef QGISDEBUG
@ -636,7 +615,7 @@ void QgsOgrProvider::select(QgsRect *rect, bool useIntersect)
{
// store the selection rectangle for use in filtering features during
// an identify and display attributes
// delete mSelectionRectangle;
delete mSelectionRectangle;
mSelectionRectangle = new OGRPolygon();
mSelectionRectangle->importFromWkt((char **)&wktText);
}

View File

@ -1189,7 +1189,7 @@ void QgsVectorLayer::select(QgsRect * rect, bool lock)
QgsFeature *fet;
while (fet = dataProvider->getNextFeature(true))
while (fet = dataProvider->getNextFeature(false))
{
if(mDeleted.find(fet->featureId())==mDeleted.end())//don't select deleted features
{