Skip to content

Commit b2dc354

Browse files
author
cfarmer
committed
now supports fields containing non-ascii chars. Fixes #2496. Patch from alexbruy
git-svn-id: http://svn.osgeo.org/qgis/trunk@13478 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent b168560 commit b2dc354

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎python/plugins/fTools/tools/doPointDistance.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def __init__(self, iface):
8585
QObject.connect(self.btnFile, SIGNAL("clicked()"), self.saveFile)
8686
QObject.connect(self.inPoint1, SIGNAL("currentIndexChanged(QString)"), self.update1)
8787
QObject.connect(self.inPoint2, SIGNAL("currentIndexChanged(QString)"), self.update2)
88+
self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
8889
# populate layer list
8990
self.setWindowTitle(self.tr("Distance matrix"))
9091
self.progressBar.setValue(0)
@@ -112,6 +113,7 @@ def update2(self, inputLayer):
112113
self.inField2.addItem(unicode(changedField[i].name()))
113114

114115
def accept(self):
116+
self.buttonOk.setEnabled( False )
115117
if self.inPoint1.currentText() == "":
116118
QMessageBox.information(self, self.tr("Create Point Distance Matrix"), self.tr("Please specify input point layer"))
117119
elif self.outFile.text() == "":
@@ -144,6 +146,7 @@ def accept(self):
144146
self.progressBar.setValue(100)
145147
addToTOC = QMessageBox.information(self, "Create Point Distance Matrix", self.tr("Created output matrix:\n") + outPath)
146148
self.progressBar.setValue(0)
149+
self.buttonOk.setEnabled( True )
147150

148151
def saveFile(self):
149152
self.outFile.clear()
@@ -239,14 +242,14 @@ def linearMatrix(self, writer, provider1, provider2, index1, index2, nearest, di
239242
outGeom = outFeat.geometry()
240243
dist = distArea.measureLine(inGeom.asPoint(), outGeom.asPoint())
241244
if dist > 0:
242-
if matType == "Linear": writer.writerow([unicode(inID), unicode(outID), float(dist)])
245+
if matType == "Linear": writer.writerow([unicode(inID), unicode(outID), str(dist)])
243246
else: distList.append(float(dist))
244247
if matType == "Summary":
245248
mean = sum(distList) / len(distList)
246249
for i in distList:
247250
vari = vari + ((i - mean)*(i - mean))
248251
vari = sqrt(vari / len(distList))
249-
writer.writerow([unicode(inID), float(mean), float(vari), float(min(distList)), float(max(distList))])
252+
writer.writerow([unicode(inID), str(mean), str(vari), str(min(distList)), str(max(distList))])
250253
start = start + add
251254
progressBar.setValue(start)
252255
del writer

0 commit comments

Comments
 (0)