[QGIS Commit] r10422 - in trunk/qgis/python/plugins/fTools: . tools
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Thu Mar 26 17:25:04 EDT 2009
Author: cfarmer
Date: 2009-03-26 17:25:03 -0400 (Thu, 26 Mar 2009)
New Revision: 10422
Modified:
trunk/qgis/python/plugins/fTools/__init__.py
trunk/qgis/python/plugins/fTools/doAbout.py
trunk/qgis/python/plugins/fTools/tools/doGeometry.py
Log:
Fixes polygon centroids tool, updates version number and about dialog
Modified: trunk/qgis/python/plugins/fTools/__init__.py
===================================================================
--- trunk/qgis/python/plugins/fTools/__init__.py 2009-03-26 18:58:27 UTC (rev 10421)
+++ trunk/qgis/python/plugins/fTools/__init__.py 2009-03-26 21:25:03 UTC (rev 10422)
@@ -21,7 +21,7 @@
return "Tools for vector data analysis and management"
def version():
- return "0.5.7"
+ return "0.5.8"
def qgisMinimumVersion():
return "1"
Modified: trunk/qgis/python/plugins/fTools/doAbout.py
===================================================================
--- trunk/qgis/python/plugins/fTools/doAbout.py 2009-03-26 18:58:27 UTC (rev 10421)
+++ trunk/qgis/python/plugins/fTools/doAbout.py 2009-03-26 21:25:03 UTC (rev 10422)
@@ -32,7 +32,7 @@
QObject.connect(self.btnWeb, SIGNAL("clicked()"), self.openWeb)
QObject.connect(self.btnHelp, SIGNAL("clicked()"), self.openHelp)
self.fToolsLogo.setPixmap(QPixmap(":/icons/default/ftools_logo.png"))
- self.label_3.setText("fTools 0.5.6")
+ self.label_3.setText("fTools 0.5.8")
self.textEdit.setText(self.getText())
def getText(self):
Modified: trunk/qgis/python/plugins/fTools/tools/doGeometry.py
===================================================================
--- trunk/qgis/python/plugins/fTools/tools/doGeometry.py 2009-03-26 18:58:27 UTC (rev 10421)
+++ trunk/qgis/python/plugins/fTools/tools/doGeometry.py 2009-03-26 21:25:03 UTC (rev 10422)
@@ -447,29 +447,31 @@
for h in k:
for i in range(0, len(h) - 1):
j = (i + 1) % len(h)
- factor = ((h[i].x()) * (h[j].y()) - (h[j].x()) * (h[i].y()))
- cx = cx + ((h[i].x()) + (h[j].x())) * factor
- cy = cy + ((h[i].y()) + (h[j].y())) * factor
+ factor = ((h[i].x()-xmin) * (h[j].y()-ymin) - (h[j].x()-xmin) * (h[i].y()-ymin))
+ cx = cx + ((h[i].x()-xmin) + (h[j].x()-xmin)) * factor
+ cy = cy + ((h[i].y()-ymin) + (h[j].y()-ymin)) * factor
else:
multi_geom = geom.asPolygon()
for k in multi_geom:
for i in range(0, len(k) - 1):
j = (i + 1) % len(k)
- factor = (k[i].x()) * (k[j].y()) - (k[j].x()) * (k[i].y())
- cx = cx + ((k[i].x()) + (k[j].x())) * factor
- cy = cy + ((k[i].y()) + (k[j].y())) * factor
+ factor = (k[i].x()-xmin) * (k[j].y()-ymin) - (k[j].x()-xmin) * (k[i].y()-ymin)
+ cx = cx + ((k[i].x()-xmin) + (k[j].x()-xmin)) * factor
+ cy = cy + ((k[i].y()-ymin) + (k[j].y()-ymin)) * factor
A = A * 6
factor = 1/A
cx = cx * factor
cy = cy * factor
- if cx < xmin:
- cx = cx * -1
- if cy < ymin:
- cy = cy * -1
- if cx > xmax:
- cx = cx * -1
- if cy > ymax:
- cy = cy * -1
+# if cx < xmin:
+# cx = cx * -1
+# if cy < ymin:
+# cy = cy * -1
+# if cx > xmax:
+# cx = cx * -1
+# if cy > ymax:
+# cy = cy * -1
+ cx = cx + xmin
+ cy = cy + ymin
outfeat.setGeometry( QgsGeometry.fromPoint( QgsPoint( cx, cy ) ) )
atMap = inFeat.attributeMap()
outfeat.setAttributeMap( atMap )
More information about the QGIS-commit
mailing list