@@ -283,9 +283,9 @@ void QgsVectorLayer::drawLabels(QgsRenderContext& renderContext)
283
283
{
284
284
QPainter* thePainter = renderContext.painter ();
285
285
if (!thePainter)
286
- {
287
- return ;
288
- }
286
+ {
287
+ return ;
288
+ }
289
289
drawLabels (thePainter, renderContext.extent (), &(renderContext.mapToPixel ()), renderContext.coordTransform (), 1.0 / renderContext.rasterScaleFactor ());
290
290
}
291
291
@@ -311,7 +311,7 @@ void QgsVectorLayer::drawLabels(QPainter * p, const QgsRect& viewExtent, const Q
311
311
{
312
312
// select the records in the extent. The provider sets a spatial filter
313
313
// and sets up the selection set for retrieval
314
- select (attributes, viewExtent, true );
314
+ select (attributes, viewExtent);
315
315
316
316
QgsFeature fet;
317
317
while ( getNextFeature (fet) )
@@ -715,12 +715,12 @@ bool QgsVectorLayer::draw(QgsRenderContext& renderContext)
715
715
int totalFeatures = pendingFeatureCount ();
716
716
int featureCount = 0 ;
717
717
718
- QgsFeature fet;
719
- QgsAttributeList attributes = mRenderer ->classificationAttributes ();
720
- select (attributes, renderContext.extent (), true );
721
-
722
718
try
723
719
{
720
+ QgsFeature fet;
721
+ QgsAttributeList attributes = mRenderer ->classificationAttributes ();
722
+ select (attributes, renderContext.extent ());
723
+
724
724
while ( getNextFeature (fet) )
725
725
{
726
726
@@ -840,8 +840,7 @@ void QgsVectorLayer::select(QgsRect & rect, bool lock)
840
840
}
841
841
842
842
// select all the elements
843
-
844
- select (QgsAttributeList (), rect, false );
843
+ select (QgsAttributeList (), rect, false , true );
845
844
846
845
QgsFeature f;
847
846
while ( getNextFeature (f) )
@@ -859,7 +858,7 @@ void QgsVectorLayer::invertSelection()
859
858
860
859
removeSelection (FALSE ); // don't emit signal
861
860
862
- select (QgsAttributeList (), QgsRect (), true );
861
+ select (QgsAttributeList (), QgsRect (), false );
863
862
864
863
QgsFeature fet;
865
864
while ( getNextFeature (fet) )
@@ -1081,8 +1080,6 @@ void QgsVectorLayer::updateExtents()
1081
1080
QgsRect r = it->geometry ()->boundingBox ();
1082
1081
mLayerExtent .combineExtentWith (&r);
1083
1082
}
1084
-
1085
- return ;
1086
1083
}
1087
1084
else
1088
1085
{
@@ -1149,7 +1146,7 @@ void QgsVectorLayer::updateFeatureGeometry(QgsFeature &f)
1149
1146
}
1150
1147
1151
1148
1152
- void QgsVectorLayer::select (QgsAttributeList attributes, QgsRect rect, bool fetchGeometries)
1149
+ void QgsVectorLayer::select (QgsAttributeList attributes, QgsRect rect, bool fetchGeometries, bool useIntersect )
1153
1150
{
1154
1151
if (!mDataProvider )
1155
1152
return ;
@@ -1171,11 +1168,11 @@ void QgsVectorLayer::select(QgsAttributeList attributes, QgsRect rect, bool fetc
1171
1168
// look in the normal features of the provider
1172
1169
if ( mFetchAttributes .size ()>0 )
1173
1170
{
1174
- mDataProvider ->select (mFetchAttributes , rect, fetchGeometries, true );
1171
+ mDataProvider ->select (mFetchAttributes , rect, fetchGeometries, useIntersect );
1175
1172
}
1176
1173
else
1177
1174
{
1178
- mDataProvider ->select (QgsAttributeList (), rect, fetchGeometries, true );
1175
+ mDataProvider ->select (QgsAttributeList (), rect, fetchGeometries, useIntersect );
1179
1176
}
1180
1177
}
1181
1178
@@ -1311,29 +1308,29 @@ int QgsVectorLayer::getFeatureAtId(int featureId, QgsFeature& f, bool fetchGeome
1311
1308
{
1312
1309
if ( featureId<0 )
1313
1310
{
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 ()) );
1329
1326
}
1330
1327
else
1331
1328
{
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 () );
1337
1334
}
1338
1335
updateFeatureAttributes (f);
1339
1336
}
@@ -1548,7 +1545,7 @@ int QgsVectorLayer::addRing(const QList<QgsPoint>& ring)
1548
1545
return 3 ; // ring not valid
1549
1546
}
1550
1547
1551
- select (QgsAttributeList (), bBox, true );
1548
+ select (QgsAttributeList (), bBox, true , true );
1552
1549
1553
1550
QgsFeature f;
1554
1551
while ( getNextFeature (f) )
@@ -1693,7 +1690,7 @@ int QgsVectorLayer::splitFeatures(const QList<QgsPoint>& splitLine, bool topolog
1693
1690
}
1694
1691
}
1695
1692
1696
- select (QgsAttributeList (), bBox, true );
1693
+ select (QgsAttributeList (), bBox, true , true );
1697
1694
1698
1695
QgsFeature f;
1699
1696
while ( getNextFeature (f) )
@@ -1758,7 +1755,7 @@ int QgsVectorLayer::removePolygonIntersections(QgsGeometry* geom)
1758
1755
QgsRect geomBBox = geom->boundingBox ();
1759
1756
1760
1757
// get list of features that intersect this bounding box
1761
- select (QgsAttributeList (), geomBBox, true );
1758
+ select (QgsAttributeList (), geomBBox, true , true );
1762
1759
1763
1760
QgsFeature f;
1764
1761
while ( getNextFeature (f) )
@@ -1794,7 +1791,7 @@ int QgsVectorLayer::addTopologicalPoints(QgsGeometry* geom)
1794
1791
case QGis::WKBLineString:
1795
1792
{
1796
1793
QgsPolyline theLine = geom->asPolyline ();
1797
- QgsPolyline::const_iterator line_it = theLine.constBegin ();
1794
+ QgsPolyline::const_iterator line_it = theLine.constBegin ();
1798
1795
for (; line_it != theLine.constEnd (); ++line_it)
1799
1796
{
1800
1797
if (addTopologicalPoints (*line_it) != 0 )
@@ -1836,7 +1833,7 @@ int QgsVectorLayer::addTopologicalPoints(QgsGeometry* geom)
1836
1833
for (int i = 0 ; i < thePolygon.size (); ++i)
1837
1834
{
1838
1835
currentRing = thePolygon.at (i);
1839
- QgsPolyline::const_iterator line_it = currentRing.constBegin ();
1836
+ QgsPolyline::const_iterator line_it = currentRing.constBegin ();
1840
1837
for (; line_it != currentRing.constEnd (); ++line_it)
1841
1838
{
1842
1839
if (addTopologicalPoints (*line_it) != 0 )
@@ -1862,7 +1859,7 @@ int QgsVectorLayer::addTopologicalPoints(QgsGeometry* geom)
1862
1859
for (int j = 0 ; j < currentPolygon.size (); ++j)
1863
1860
{
1864
1861
currentRing = currentPolygon.at (j);
1865
- QgsPolyline::const_iterator line_it = currentRing.constBegin ();
1862
+ QgsPolyline::const_iterator line_it = currentRing.constBegin ();
1866
1863
for (; line_it != currentRing.constEnd (); ++line_it)
1867
1864
{
1868
1865
if (addTopologicalPoints (*line_it) != 0 )
@@ -3057,7 +3054,7 @@ int QgsVectorLayer::snapWithContext(const QgsPoint& startPoint, double snappingT
3057
3054
startPoint.x ()+snappingTolerance, startPoint.y ()+snappingTolerance);
3058
3055
double sqrSnappingTolerance = snappingTolerance * snappingTolerance;
3059
3056
3060
- select (QgsAttributeList (), searchRect, true );
3057
+ select (QgsAttributeList (), searchRect, true , true );
3061
3058
3062
3059
int n=0 ;
3063
3060
QgsFeature f;
0 commit comments