@@ -283,9 +283,9 @@ void QgsVectorLayer::drawLabels(QgsRenderContext& renderContext)
283283{
284284 QPainter* thePainter = renderContext.painter ();
285285 if (!thePainter)
286- {
287- return ;
288- }
286+ {
287+ return ;
288+ }
289289 drawLabels (thePainter, renderContext.extent (), &(renderContext.mapToPixel ()), renderContext.coordTransform (), 1.0 / renderContext.rasterScaleFactor ());
290290}
291291
@@ -311,7 +311,7 @@ void QgsVectorLayer::drawLabels(QPainter * p, const QgsRect& viewExtent, const Q
311311 {
312312 // select the records in the extent. The provider sets a spatial filter
313313 // and sets up the selection set for retrieval
314- select (attributes, viewExtent, true );
314+ select (attributes, viewExtent);
315315
316316 QgsFeature fet;
317317 while ( getNextFeature (fet) )
@@ -715,12 +715,12 @@ bool QgsVectorLayer::draw(QgsRenderContext& renderContext)
715715 int totalFeatures = pendingFeatureCount ();
716716 int featureCount = 0 ;
717717
718- QgsFeature fet;
719- QgsAttributeList attributes = mRenderer ->classificationAttributes ();
720- select (attributes, renderContext.extent (), true );
721-
722718 try
723719 {
720+ QgsFeature fet;
721+ QgsAttributeList attributes = mRenderer ->classificationAttributes ();
722+ select (attributes, renderContext.extent ());
723+
724724 while ( getNextFeature (fet) )
725725 {
726726
@@ -840,8 +840,7 @@ void QgsVectorLayer::select(QgsRect & rect, bool lock)
840840 }
841841
842842 // select all the elements
843-
844- select (QgsAttributeList (), rect, false );
843+ select (QgsAttributeList (), rect, false , true );
845844
846845 QgsFeature f;
847846 while ( getNextFeature (f) )
@@ -859,7 +858,7 @@ void QgsVectorLayer::invertSelection()
859858
860859 removeSelection (FALSE ); // don't emit signal
861860
862- select (QgsAttributeList (), QgsRect (), true );
861+ select (QgsAttributeList (), QgsRect (), false );
863862
864863 QgsFeature fet;
865864 while ( getNextFeature (fet) )
@@ -1081,8 +1080,6 @@ void QgsVectorLayer::updateExtents()
10811080 QgsRect r = it->geometry ()->boundingBox ();
10821081 mLayerExtent .combineExtentWith (&r);
10831082 }
1084-
1085- return ;
10861083 }
10871084 else
10881085 {
@@ -1149,7 +1146,7 @@ void QgsVectorLayer::updateFeatureGeometry(QgsFeature &f)
11491146}
11501147
11511148
1152- void QgsVectorLayer::select (QgsAttributeList attributes, QgsRect rect, bool fetchGeometries)
1149+ void QgsVectorLayer::select (QgsAttributeList attributes, QgsRect rect, bool fetchGeometries, bool useIntersect )
11531150{
11541151 if (!mDataProvider )
11551152 return ;
@@ -1171,11 +1168,11 @@ void QgsVectorLayer::select(QgsAttributeList attributes, QgsRect rect, bool fetc
11711168 // look in the normal features of the provider
11721169 if ( mFetchAttributes .size ()>0 )
11731170 {
1174- mDataProvider ->select (mFetchAttributes , rect, fetchGeometries, true );
1171+ mDataProvider ->select (mFetchAttributes , rect, fetchGeometries, useIntersect );
11751172 }
11761173 else
11771174 {
1178- mDataProvider ->select (QgsAttributeList (), rect, fetchGeometries, true );
1175+ mDataProvider ->select (QgsAttributeList (), rect, fetchGeometries, useIntersect );
11791176 }
11801177}
11811178
@@ -1311,29 +1308,29 @@ int QgsVectorLayer::getFeatureAtId(int featureId, QgsFeature& f, bool fetchGeome
13111308 {
13121309 if ( featureId<0 )
13131310 {
1314- // featureId<0 => in mAddedFeatures
1315- bool found = false ;
1316-
1317- for (QgsFeatureList::iterator it=mAddedFeatures .begin (); it!=mAddedFeatures .end (); it++)
1318- {
1319- if ( featureId!=it->featureId () )
1320- {
1321- found = true ;
1322- f.setAttributeMap ( it->attributeMap () );
1323- break ;
1324- }
1325- }
1326-
1327- if (!found)
1328- QgsLogger::warning ( QString (" No attributes for the added feature %1 found" ).arg (f.featureId ()) );
1311+ // featureId<0 => in mAddedFeatures
1312+ bool found = false ;
1313+
1314+ for (QgsFeatureList::iterator it=mAddedFeatures .begin (); it!=mAddedFeatures .end (); it++)
1315+ {
1316+ if ( featureId!=it->featureId () )
1317+ {
1318+ found = true ;
1319+ f.setAttributeMap ( it->attributeMap () );
1320+ break ;
1321+ }
1322+ }
1323+
1324+ if (!found)
1325+ QgsLogger::warning ( QString (" No attributes for the added feature %1 found" ).arg (f.featureId ()) );
13291326 }
13301327 else
13311328 {
1332- // retrieve attributes from provider
1333- QgsFeature tmp;
1334- mDataProvider ->getFeatureAtId (featureId, tmp, false , mDataProvider ->allAttributesList ());
1335- updateFeatureAttributes (tmp);
1336- f.setAttributeMap ( tmp.attributeMap () );
1329+ // retrieve attributes from provider
1330+ QgsFeature tmp;
1331+ mDataProvider ->getFeatureAtId (featureId, tmp, false , mDataProvider ->allAttributesList ());
1332+ updateFeatureAttributes (tmp);
1333+ f.setAttributeMap ( tmp.attributeMap () );
13371334 }
13381335 updateFeatureAttributes (f);
13391336 }
@@ -1548,7 +1545,7 @@ int QgsVectorLayer::addRing(const QList<QgsPoint>& ring)
15481545 return 3 ; // ring not valid
15491546 }
15501547
1551- select (QgsAttributeList (), bBox, true );
1548+ select (QgsAttributeList (), bBox, true , true );
15521549
15531550 QgsFeature f;
15541551 while ( getNextFeature (f) )
@@ -1693,7 +1690,7 @@ int QgsVectorLayer::splitFeatures(const QList<QgsPoint>& splitLine, bool topolog
16931690 }
16941691 }
16951692
1696- select (QgsAttributeList (), bBox, true );
1693+ select (QgsAttributeList (), bBox, true , true );
16971694
16981695 QgsFeature f;
16991696 while ( getNextFeature (f) )
@@ -1758,7 +1755,7 @@ int QgsVectorLayer::removePolygonIntersections(QgsGeometry* geom)
17581755 QgsRect geomBBox = geom->boundingBox ();
17591756
17601757 // get list of features that intersect this bounding box
1761- select (QgsAttributeList (), geomBBox, true );
1758+ select (QgsAttributeList (), geomBBox, true , true );
17621759
17631760 QgsFeature f;
17641761 while ( getNextFeature (f) )
@@ -1794,7 +1791,7 @@ int QgsVectorLayer::addTopologicalPoints(QgsGeometry* geom)
17941791 case QGis::WKBLineString:
17951792 {
17961793 QgsPolyline theLine = geom->asPolyline ();
1797- QgsPolyline::const_iterator line_it = theLine.constBegin ();
1794+ QgsPolyline::const_iterator line_it = theLine.constBegin ();
17981795 for (; line_it != theLine.constEnd (); ++line_it)
17991796 {
18001797 if (addTopologicalPoints (*line_it) != 0 )
@@ -1836,7 +1833,7 @@ int QgsVectorLayer::addTopologicalPoints(QgsGeometry* geom)
18361833 for (int i = 0 ; i < thePolygon.size (); ++i)
18371834 {
18381835 currentRing = thePolygon.at (i);
1839- QgsPolyline::const_iterator line_it = currentRing.constBegin ();
1836+ QgsPolyline::const_iterator line_it = currentRing.constBegin ();
18401837 for (; line_it != currentRing.constEnd (); ++line_it)
18411838 {
18421839 if (addTopologicalPoints (*line_it) != 0 )
@@ -1862,7 +1859,7 @@ int QgsVectorLayer::addTopologicalPoints(QgsGeometry* geom)
18621859 for (int j = 0 ; j < currentPolygon.size (); ++j)
18631860 {
18641861 currentRing = currentPolygon.at (j);
1865- QgsPolyline::const_iterator line_it = currentRing.constBegin ();
1862+ QgsPolyline::const_iterator line_it = currentRing.constBegin ();
18661863 for (; line_it != currentRing.constEnd (); ++line_it)
18671864 {
18681865 if (addTopologicalPoints (*line_it) != 0 )
@@ -3057,7 +3054,7 @@ int QgsVectorLayer::snapWithContext(const QgsPoint& startPoint, double snappingT
30573054 startPoint.x ()+snappingTolerance, startPoint.y ()+snappingTolerance);
30583055 double sqrSnappingTolerance = snappingTolerance * snappingTolerance;
30593056
3060- select (QgsAttributeList (), searchRect, true );
3057+ select (QgsAttributeList (), searchRect, true , true );
30613058
30623059 int n=0 ;
30633060 QgsFeature f;
0 commit comments