Skip to content
Permalink
Browse files

[processing] Remove ParamaterGeometryPredicate from ExtractByLocation…

… algorithm
  • Loading branch information
arnaud-morvan committed Dec 12, 2016
1 parent 955563f commit 09035a4dabc05cc9b82388af245bdd3cbcd80e31
Showing with 16 additions and 18 deletions.
  1. +16 −18 python/plugins/processing/algs/qgis/ExtractByLocation.py
@@ -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
@@ -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))
@@ -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

0 comments on commit 09035a4

Please sign in to comment.
You can’t perform that action at this time.