Skip to content
Permalink
Browse files

[processing] Remove ParamaterGeometryPredicate from SpatialJoin algor…

…ithm
  • Loading branch information
arnaud-morvan committed Dec 12, 2016
1 parent 65a4e97 commit 955563f99ab745803a3e93652b7111af3d378dab
Showing with 14 additions and 21 deletions.
  1. +14 −21 python/plugins/processing/algs/qgis/SpatialJoin.py
@@ -37,7 +37,6 @@

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.parameters import ParameterVector
from processing.core.parameters import ParameterGeometryPredicate
from processing.core.parameters import ParameterNumber
from processing.core.parameters import ParameterSelection
from processing.core.parameters import ParameterString
@@ -64,6 +63,15 @@ def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Join attributes by location')
self.group, self.i18n_group = self.trAlgorithm('Vector general tools')

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

self.summarys = [
self.tr('Take attributes of the first located feature'),
self.tr('Take summary of intersecting features')
@@ -78,12 +86,10 @@ def defineCharacteristics(self):
self.tr('Target vector layer')))
self.addParameter(ParameterVector(self.JOIN,
self.tr('Join vector layer')))
predicates = list(ParameterGeometryPredicate.predicates)
predicates.remove('disjoint')
self.addParameter(ParameterGeometryPredicate(self.PREDICATE,
self.tr('Geometric predicate'),
left=self.TARGET, right=self.JOIN,
enabledPredicates=predicates))
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))
@@ -174,20 +180,7 @@ def processAlgorithm(self, progress):

res = False
for predicate in predicates:
if predicate == 'intersects':
res = inGeom.intersects(inGeomB)
elif predicate == 'contains':
res = inGeom.contains(inGeomB)
elif predicate == 'equals':
res = inGeom.equals(inGeomB)
elif predicate == 'touches':
res = inGeom.touches(inGeomB)
elif predicate == 'overlaps':
res = inGeom.overlaps(inGeomB)
elif predicate == 'within':
res = inGeom.within(inGeomB)
elif predicate == 'crosses':
res = inGeom.crosses(inGeomB)
res= getattr(inGeom, predicate)(inGeomB)
if res:
break

0 comments on commit 955563f

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