mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-16 00:03:12 -04:00
re-add useIntersect support in QgsVectorLayer
git-svn-id: http://svn.osgeo.org/qgis/trunk@9097 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
1543f506b0
commit
c175c12f98
@ -143,7 +143,8 @@ public:
|
||||
|
||||
void select(QList<int> fetchAttributes = QList<int>(),
|
||||
QgsRect rect = QgsRect(),
|
||||
bool fetchGeometry = true);
|
||||
bool fetchGeometry = true,
|
||||
bool useIntersect = false);
|
||||
|
||||
bool getNextFeature(QgsFeature& feature);
|
||||
|
||||
|
@ -311,7 +311,7 @@ void QgsVectorLayer::drawLabels(QPainter * p, const QgsRect& viewExtent, const Q
|
||||
{
|
||||
// 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 @@ bool QgsVectorLayer::draw(QgsRenderContext& renderContext)
|
||||
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,8 +840,7 @@ void QgsVectorLayer::select(QgsRect & rect, bool lock)
|
||||
}
|
||||
|
||||
//select all the elements
|
||||
|
||||
select(QgsAttributeList(), rect, false);
|
||||
select(QgsAttributeList(), rect, false, true);
|
||||
|
||||
QgsFeature f;
|
||||
while( getNextFeature(f) )
|
||||
@ -859,7 +858,7 @@ void QgsVectorLayer::invertSelection()
|
||||
|
||||
removeSelection(FALSE); // don't emit signal
|
||||
|
||||
select(QgsAttributeList(), QgsRect(), true);
|
||||
select(QgsAttributeList(), QgsRect(), false);
|
||||
|
||||
QgsFeature fet;
|
||||
while ( getNextFeature(fet) )
|
||||
@ -1081,8 +1080,6 @@ void QgsVectorLayer::updateExtents()
|
||||
QgsRect r = it->geometry()->boundingBox();
|
||||
mLayerExtent.combineExtentWith(&r);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1149,7 +1146,7 @@ void QgsVectorLayer::updateFeatureGeometry(QgsFeature &f)
|
||||
}
|
||||
|
||||
|
||||
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 @@ void QgsVectorLayer::select(QgsAttributeList attributes, QgsRect rect, bool fetc
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1548,7 +1545,7 @@ int QgsVectorLayer::addRing(const QList<QgsPoint>& ring)
|
||||
return 3; //ring not valid
|
||||
}
|
||||
|
||||
select(QgsAttributeList(), bBox, true);
|
||||
select(QgsAttributeList(), bBox, true, true);
|
||||
|
||||
QgsFeature f;
|
||||
while( getNextFeature(f) )
|
||||
@ -1693,7 +1690,7 @@ int QgsVectorLayer::splitFeatures(const QList<QgsPoint>& splitLine, bool topolog
|
||||
}
|
||||
}
|
||||
|
||||
select(QgsAttributeList(), bBox, true);
|
||||
select(QgsAttributeList(), bBox, true, true);
|
||||
|
||||
QgsFeature f;
|
||||
while( getNextFeature(f) )
|
||||
@ -1758,7 +1755,7 @@ int QgsVectorLayer::removePolygonIntersections(QgsGeometry* geom)
|
||||
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) )
|
||||
@ -3057,7 +3054,7 @@ int QgsVectorLayer::snapWithContext(const QgsPoint& startPoint, double snappingT
|
||||
startPoint.x()+snappingTolerance, startPoint.y()+snappingTolerance);
|
||||
double sqrSnappingTolerance = snappingTolerance * snappingTolerance;
|
||||
|
||||
select(QgsAttributeList(), searchRect, true);
|
||||
select(QgsAttributeList(), searchRect, true, true);
|
||||
|
||||
int n=0;
|
||||
QgsFeature f;
|
||||
|
@ -199,7 +199,8 @@ public:
|
||||
|
||||
void select(QgsAttributeList fetchAttributes,
|
||||
QgsRect rect = QgsRect(),
|
||||
bool fetchGeometry = true);
|
||||
bool fetchGeometry = true,
|
||||
bool useIntersect = false);
|
||||
|
||||
bool getNextFeature(QgsFeature& feature);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user