Skip to content

Commit

Permalink
[processing] Remove ParamaterGeometryPredicate from SelectByLocation …
Browse files Browse the repository at this point in the history
…algorithm
  • Loading branch information
arnaud-morvan committed Dec 12, 2016
1 parent 09035a4 commit ecb25c4
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions python/plugins/processing/algs/qgis/SelectByLocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.parameters import ParameterSelection
from processing.core.parameters import ParameterVector
from processing.core.parameters import ParameterGeometryPredicate
from processing.core.parameters import ParameterNumber
from processing.core.outputs import OutputVector
from processing.tools import dataobjects, vector
Expand All @@ -59,6 +58,16 @@ def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Select by location')
self.group, self.i18n_group = self.trAlgorithm('Vector selection tools')

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.methods = [self.tr('creating new selection'),
self.tr('adding to current selection'),
self.tr('removing from current selection')]
Expand All @@ -67,9 +76,10 @@ def defineCharacteristics(self):
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 @@ -118,20 +128,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 ecb25c4

Please sign in to comment.