Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[sextante] fixed PointsInPolygonWeighted and PointsLayerFromTable alg…
…orithms
  • Loading branch information
volaya committed Feb 26, 2013
1 parent e60891c commit 7267c6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
9 changes: 2 additions & 7 deletions python/plugins/sextante/algs/PointsLayerFromTable.py
Expand Up @@ -39,11 +39,6 @@ class PointsLayerFromTable(GeoAlgorithm):
YFIELD = "YFIELD"
OUTPUT = "OUTPUT"

#===========================================================================
# def getIcon(self):
# return QtGui.QIcon(os.path.dirname(__file__) + "/../images/toolbox.png")
#===========================================================================

def processAlgorithm(self, progress):
source = self.getParameterValue(self.INPUT)
vlayer = QGisLayers.getObjectFromUri(source)
Expand Down Expand Up @@ -79,7 +74,7 @@ def defineCharacteristics(self):
self.name = "Points layer from table"
self.group = "Vector creation tools"
self.addParameter(ParameterTable(self.INPUT, "Input layer"))
self.addParameter(ParameterTableField(self.XFIELD, "X field", self.INPUT, ParameterTableField.DATA_TYPE_NUMBER))
self.addParameter(ParameterTableField(self.YFIELD, "Y field", self.INPUT, ParameterTableField.DATA_TYPE_NUMBER))
self.addParameter(ParameterTableField(self.XFIELD, "X field", self.INPUT, ParameterTableField.DATA_TYPE_ANY))
self.addParameter(ParameterTableField(self.YFIELD, "Y field", self.INPUT, ParameterTableField.DATA_TYPE_ANY))
self.addOutput(OutputVector(self.OUTPUT, "Output layer"))

14 changes: 7 additions & 7 deletions python/plugins/sextante/algs/ftools/PointsInPolygonWeighted.py
Expand Up @@ -106,15 +106,15 @@ def processAlgorithm(self, progress):
hasIntersections = True

if hasIntersections:
for i in points:
pointLayer.featureAtId(int(i), ftPoint, True, True)
progress.setText(str(len(points)))
for i in points:
pointLayer.featureAtId(int(i), ftPoint, True, True)
tmpGeom = QgsGeometry(ftPoint.geometry())
if geom.contains(tmpGeom):
try:
weight = float(ftPoint.attributes()[fieldidx])
except:
weight = 1
count += weight
#try:
weight, ok = ftPoint.attributes()[fieldidx].toDouble()
if ok:
count += weight

outFeat.setGeometry(geom)
if idxCount == len(atMap):
Expand Down

0 comments on commit 7267c6e

Please sign in to comment.