[QGIS Commit] r9097 - in trunk/qgis: python/core src/core
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Wed Aug 20 14:25:17 EDT 2008
Author: jef
Date: 2008-08-20 14:25:17 -0400 (Wed, 20 Aug 2008)
New Revision: 9097
Modified:
trunk/qgis/python/core/qgsvectorlayer.sip
trunk/qgis/src/core/qgsvectorlayer.cpp
trunk/qgis/src/core/qgsvectorlayer.h
Log:
re-add useIntersect support in QgsVectorLayer
Modified: trunk/qgis/python/core/qgsvectorlayer.sip
===================================================================
--- trunk/qgis/python/core/qgsvectorlayer.sip 2008-08-20 17:39:42 UTC (rev 9096)
+++ trunk/qgis/python/core/qgsvectorlayer.sip 2008-08-20 18:25:17 UTC (rev 9097)
@@ -143,7 +143,8 @@
void select(QList<int> fetchAttributes = QList<int>(),
QgsRect rect = QgsRect(),
- bool fetchGeometry = true);
+ bool fetchGeometry = true,
+ bool useIntersect = false);
bool getNextFeature(QgsFeature& feature);
Modified: trunk/qgis/src/core/qgsvectorlayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.cpp 2008-08-20 17:39:42 UTC (rev 9096)
+++ trunk/qgis/src/core/qgsvectorlayer.cpp 2008-08-20 18:25:17 UTC (rev 9097)
@@ -283,9 +283,9 @@
{
QPainter* thePainter = renderContext.painter();
if(!thePainter)
- {
- return;
- }
+ {
+ return;
+ }
drawLabels(thePainter, renderContext.extent(), &(renderContext.mapToPixel()), renderContext.coordTransform(), 1.0 / renderContext.rasterScaleFactor());
}
@@ -311,7 +311,7 @@
{
// select the records in the extent. The provider sets a spatial filter
// and sets up the selection set for retrieval
- select(attributes, viewExtent, true);
+ select(attributes, viewExtent);
QgsFeature fet;
while( getNextFeature(fet) )
@@ -715,12 +715,12 @@
int totalFeatures = pendingFeatureCount();
int featureCount = 0;
- QgsFeature fet;
- QgsAttributeList attributes = mRenderer->classificationAttributes();
- select(attributes, renderContext.extent(), true);
-
try
{
+ QgsFeature fet;
+ QgsAttributeList attributes = mRenderer->classificationAttributes();
+ select(attributes, renderContext.extent());
+
while( getNextFeature(fet) )
{
@@ -840,9 +840,8 @@
}
//select all the elements
+ select(QgsAttributeList(), rect, false, true);
- select(QgsAttributeList(), rect, false);
-
QgsFeature f;
while( getNextFeature(f) )
{
@@ -859,7 +858,7 @@
removeSelection(FALSE); // don't emit signal
- select(QgsAttributeList(), QgsRect(), true);
+ select(QgsAttributeList(), QgsRect(), false);
QgsFeature fet;
while ( getNextFeature(fet) )
@@ -1081,8 +1080,6 @@
QgsRect r = it->geometry()->boundingBox();
mLayerExtent.combineExtentWith(&r);
}
-
- return;
}
else
{
@@ -1149,7 +1146,7 @@
}
-void QgsVectorLayer::select(QgsAttributeList attributes, QgsRect rect, bool fetchGeometries)
+void QgsVectorLayer::select(QgsAttributeList attributes, QgsRect rect, bool fetchGeometries, bool useIntersect)
{
if(!mDataProvider)
return;
@@ -1171,11 +1168,11 @@
//look in the normal features of the provider
if( mFetchAttributes.size()>0 )
{
- mDataProvider->select(mFetchAttributes, rect, fetchGeometries, true);
+ mDataProvider->select(mFetchAttributes, rect, fetchGeometries, useIntersect);
}
else
{
- mDataProvider->select(QgsAttributeList(), rect, fetchGeometries, true);
+ mDataProvider->select(QgsAttributeList(), rect, fetchGeometries, useIntersect);
}
}
@@ -1311,29 +1308,29 @@
{
if( featureId<0 )
{
- // featureId<0 => in mAddedFeatures
- bool found = false;
+ // featureId<0 => in mAddedFeatures
+ bool found = false;
- for (QgsFeatureList::iterator it=mAddedFeatures.begin(); it!=mAddedFeatures.end(); it++)
- {
- if( featureId!=it->featureId() )
- {
- found = true;
- f.setAttributeMap( it->attributeMap() );
- break;
- }
- }
+ for (QgsFeatureList::iterator it=mAddedFeatures.begin(); it!=mAddedFeatures.end(); it++)
+ {
+ if( featureId!=it->featureId() )
+ {
+ found = true;
+ f.setAttributeMap( it->attributeMap() );
+ break;
+ }
+ }
- if(!found)
- QgsLogger::warning( QString("No attributes for the added feature %1 found").arg(f.featureId()) );
+ if(!found)
+ QgsLogger::warning( QString("No attributes for the added feature %1 found").arg(f.featureId()) );
}
else
{
- // retrieve attributes from provider
- QgsFeature tmp;
- mDataProvider->getFeatureAtId(featureId, tmp, false, mDataProvider->allAttributesList());
- updateFeatureAttributes(tmp);
- f.setAttributeMap( tmp.attributeMap() );
+ // retrieve attributes from provider
+ QgsFeature tmp;
+ mDataProvider->getFeatureAtId(featureId, tmp, false, mDataProvider->allAttributesList());
+ updateFeatureAttributes(tmp);
+ f.setAttributeMap( tmp.attributeMap() );
}
updateFeatureAttributes(f);
}
@@ -1548,7 +1545,7 @@
return 3; //ring not valid
}
- select(QgsAttributeList(), bBox, true);
+ select(QgsAttributeList(), bBox, true, true);
QgsFeature f;
while( getNextFeature(f) )
@@ -1693,7 +1690,7 @@
}
}
- select(QgsAttributeList(), bBox, true);
+ select(QgsAttributeList(), bBox, true, true);
QgsFeature f;
while( getNextFeature(f) )
@@ -1758,7 +1755,7 @@
QgsRect geomBBox = geom->boundingBox();
//get list of features that intersect this bounding box
- select(QgsAttributeList(), geomBBox, true);
+ select(QgsAttributeList(), geomBBox, true, true);
QgsFeature f;
while( getNextFeature(f) )
@@ -1794,7 +1791,7 @@
case QGis::WKBLineString:
{
QgsPolyline theLine = geom->asPolyline();
- QgsPolyline::const_iterator line_it = theLine.constBegin();
+ QgsPolyline::const_iterator line_it = theLine.constBegin();
for(; line_it != theLine.constEnd(); ++line_it)
{
if(addTopologicalPoints(*line_it) != 0)
@@ -1836,7 +1833,7 @@
for(int i = 0; i < thePolygon.size(); ++i)
{
currentRing = thePolygon.at(i);
- QgsPolyline::const_iterator line_it = currentRing.constBegin();
+ QgsPolyline::const_iterator line_it = currentRing.constBegin();
for(; line_it != currentRing.constEnd(); ++line_it)
{
if(addTopologicalPoints(*line_it) != 0)
@@ -1862,7 +1859,7 @@
for(int j = 0; j < currentPolygon.size(); ++j)
{
currentRing = currentPolygon.at(j);
- QgsPolyline::const_iterator line_it = currentRing.constBegin();
+ QgsPolyline::const_iterator line_it = currentRing.constBegin();
for(; line_it != currentRing.constEnd(); ++line_it)
{
if(addTopologicalPoints(*line_it) != 0)
@@ -3057,7 +3054,7 @@
startPoint.x()+snappingTolerance, startPoint.y()+snappingTolerance);
double sqrSnappingTolerance = snappingTolerance * snappingTolerance;
- select(QgsAttributeList(), searchRect, true);
+ select(QgsAttributeList(), searchRect, true, true);
int n=0;
QgsFeature f;
Modified: trunk/qgis/src/core/qgsvectorlayer.h
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.h 2008-08-20 17:39:42 UTC (rev 9096)
+++ trunk/qgis/src/core/qgsvectorlayer.h 2008-08-20 18:25:17 UTC (rev 9097)
@@ -199,7 +199,8 @@
void select(QgsAttributeList fetchAttributes,
QgsRect rect = QgsRect(),
- bool fetchGeometry = true);
+ bool fetchGeometry = true,
+ bool useIntersect = false);
bool getNextFeature(QgsFeature& feature);
More information about the QGIS-commit
mailing list