Skip to content

Commit

Permalink
[processing] Remove ParamaterGeometryPredicate from ExtractByLocation…
Browse files Browse the repository at this point in the history
… algorithm
  • Loading branch information
arnaud-morvan committed Dec 12, 2016
1 parent 955563f commit 09035a4
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions python/plugins/processing/algs/qgis/ExtractByLocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from qgis.core import QgsFeatureRequest
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.parameters import ParameterVector
from processing.core.parameters import ParameterGeometryPredicate
from processing.core.parameters import ParameterSelection
from processing.core.parameters import ParameterNumber
from processing.core.outputs import OutputVector
from processing.tools import dataobjects, vector
Expand All @@ -48,13 +48,24 @@ def defineCharacteristics(self):
self.group, self.i18n_group = self.trAlgorithm('Vector selection tools')
self.tags = self.tr('extract,filter,location,intersects,contains,within')

self.predicates = (
('intersects', self.tr('intersects')),
('contains', self.tr('contains')),
('disjoint', self.tr('disjoint')),
('equals', self.tr('equals')),
('touches', self.tr('touches')),
('overlaps', self.tr('overlaps')),
('within', self.tr('within')),
('crosses', self.tr('crosses')))

self.addParameter(ParameterVector(self.INPUT,
self.tr('Layer to select from')))
self.addParameter(ParameterVector(self.INTERSECT,
self.tr('Additional layer (intersection layer)')))
self.addParameter(ParameterGeometryPredicate(self.PREDICATE,
self.tr('Geometric predicate'),
left=self.INPUT, right=self.INTERSECT))
self.addParameter(ParameterSelection(self.PREDICATE,
self.tr('Geometric predicate'),
self.predicates,
multiple=True))
self.addParameter(ParameterNumber(self.PRECISION,
self.tr('Precision'),
0.0, None, 0.0))
Expand Down Expand Up @@ -98,20 +109,7 @@ def processAlgorithm(self, progress):
except:
pass # already removed
else:
if predicate == 'intersects':
res = tmpGeom.intersects(geom)
elif predicate == 'contains':
res = tmpGeom.contains(geom)
elif predicate == 'equals':
res = tmpGeom.equals(geom)
elif predicate == 'touches':
res = tmpGeom.touches(geom)
elif predicate == 'overlaps':
res = tmpGeom.overlaps(geom)
elif predicate == 'within':
res = tmpGeom.within(geom)
elif predicate == 'crosses':
res = tmpGeom.crosses(geom)
res = getattr(tmpGeom, predicate)(geom)
if res:
selectedSet.append(feat.id())
break
Expand Down

0 comments on commit 09035a4

Please sign in to comment.