Skip to content

Commit

Permalink
[processing] Remove vector.bufferedBoundingBox()
Browse files Browse the repository at this point in the history
Use QgsRectangle.grow() instead
  • Loading branch information
nyalldawson committed May 2, 2017
1 parent 8e55654 commit 7eb7a7a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 15 deletions.
1 change: 1 addition & 0 deletions doc/api_break.dox
Expand Up @@ -2232,6 +2232,7 @@ object of type QgsProcessingFeedback, and will need to adapt their use of progre
- Processing.algs was removed. QgsApplication.processingRegistry().algorithms() instead.
- ProcessingLog should not be used when reporting log messages from algorithms. Use QgsMessageLog.logMessage() instead.
- dataobjects.getLayerFromString() was removed. Use QgsProcessingUtils.mapLayerFromString() instead.
- vector.bufferedBoundingBox() was removed. Use QgsRectangle.grow() instead.

Triangulation {#qgis_api_break_3_0_Triangulation}
-------------
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/processing/algs/qgis/ExtractByLocation.py
Expand Up @@ -109,7 +109,8 @@ def processAlgorithm(self, context, feedback):
total = 100.0 / QgsProcessingUtils.featureCount(selectLayer, context)
for current, f in enumerate(features):
geom = vector.snapToPrecision(f.geometry(), precision)
bbox = vector.bufferedBoundingBox(geom.boundingBox(), 0.51 * precision)
bbox = geom.boundingBox()
bbox.grow(0.51 * precision)
intersects = index.intersects(bbox)
request = QgsFeatureRequest().setFilterFids(intersects).setSubsetOfAttributes([])
for feat in layer.getFeatures(request):
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/processing/algs/qgis/SelectByLocation.py
Expand Up @@ -117,7 +117,8 @@ def processAlgorithm(self, context, feedback):
total = 100.0 / QgsProcessingUtils.featureCount(selectLayer, context)
for current, f in enumerate(features):
geom = vector.snapToPrecision(f.geometry(), precision)
bbox = vector.bufferedBoundingBox(geom.boundingBox(), 0.51 * precision)
bbox = geom.boundingBox()
bbox.grow(0.51 * precision)
intersects = index.intersects(bbox)

request = QgsFeatureRequest().setFilterFids(intersects).setSubsetOfAttributes([])
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/qgis/SpatialJoin.py
Expand Up @@ -173,8 +173,8 @@ def processAlgorithm(self, context, feedback):
bbox = inGeom.buffer(10, 2).boundingBox()
else:
bbox = inGeom.boundingBox()
bufferedBox = vector.bufferedBoundingBox(bbox, 0.51 * precision)
joinList = index.intersects(bufferedBox)
bbox.grow(0.51 * precision)
joinList = index.intersects(bbox)
if len(joinList) > 0:
count = 0
for i in joinList:
Expand Down
11 changes: 0 additions & 11 deletions python/plugins/processing/tools/vector.py
Expand Up @@ -391,17 +391,6 @@ def snapToPrecision(geom, precision):
return snapped


def bufferedBoundingBox(bbox, buffer_size):
if buffer_size == 0.0:
return QgsRectangle(bbox)

return QgsRectangle(
bbox.xMinimum() - buffer_size,
bbox.yMinimum() - buffer_size,
bbox.xMaximum() + buffer_size,
bbox.yMaximum() + buffer_size)


def ogrConnectionString(uri):
"""Generates OGR connection sting from layer source
"""
Expand Down

0 comments on commit 7eb7a7a

Please sign in to comment.