mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
Fixes polygon centroids tool, updates version number and about dialog
git-svn-id: http://svn.osgeo.org/qgis/trunk@10422 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
5094636e9a
commit
f36f14d507
@ -21,7 +21,7 @@ def description():
|
|||||||
return "Tools for vector data analysis and management"
|
return "Tools for vector data analysis and management"
|
||||||
|
|
||||||
def version():
|
def version():
|
||||||
return "0.5.7"
|
return "0.5.8"
|
||||||
|
|
||||||
def qgisMinimumVersion():
|
def qgisMinimumVersion():
|
||||||
return "1"
|
return "1"
|
||||||
|
@ -32,7 +32,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
QObject.connect(self.btnWeb, SIGNAL("clicked()"), self.openWeb)
|
QObject.connect(self.btnWeb, SIGNAL("clicked()"), self.openWeb)
|
||||||
QObject.connect(self.btnHelp, SIGNAL("clicked()"), self.openHelp)
|
QObject.connect(self.btnHelp, SIGNAL("clicked()"), self.openHelp)
|
||||||
self.fToolsLogo.setPixmap(QPixmap(":/icons/default/ftools_logo.png"))
|
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())
|
self.textEdit.setText(self.getText())
|
||||||
|
|
||||||
def getText(self):
|
def getText(self):
|
||||||
|
@ -447,29 +447,31 @@ class geometryThread( QThread ):
|
|||||||
for h in k:
|
for h in k:
|
||||||
for i in range(0, len(h) - 1):
|
for i in range(0, len(h) - 1):
|
||||||
j = (i + 1) % len(h)
|
j = (i + 1) % len(h)
|
||||||
factor = ((h[i].x()) * (h[j].y()) - (h[j].x()) * (h[i].y()))
|
factor = ((h[i].x()-xmin) * (h[j].y()-ymin) - (h[j].x()-xmin) * (h[i].y()-ymin))
|
||||||
cx = cx + ((h[i].x()) + (h[j].x())) * factor
|
cx = cx + ((h[i].x()-xmin) + (h[j].x()-xmin)) * factor
|
||||||
cy = cy + ((h[i].y()) + (h[j].y())) * factor
|
cy = cy + ((h[i].y()-ymin) + (h[j].y()-ymin)) * factor
|
||||||
else:
|
else:
|
||||||
multi_geom = geom.asPolygon()
|
multi_geom = geom.asPolygon()
|
||||||
for k in multi_geom:
|
for k in multi_geom:
|
||||||
for i in range(0, len(k) - 1):
|
for i in range(0, len(k) - 1):
|
||||||
j = (i + 1) % len(k)
|
j = (i + 1) % len(k)
|
||||||
factor = (k[i].x()) * (k[j].y()) - (k[j].x()) * (k[i].y())
|
factor = (k[i].x()-xmin) * (k[j].y()-ymin) - (k[j].x()-xmin) * (k[i].y()-ymin)
|
||||||
cx = cx + ((k[i].x()) + (k[j].x())) * factor
|
cx = cx + ((k[i].x()-xmin) + (k[j].x()-xmin)) * factor
|
||||||
cy = cy + ((k[i].y()) + (k[j].y())) * factor
|
cy = cy + ((k[i].y()-ymin) + (k[j].y()-ymin)) * factor
|
||||||
A = A * 6
|
A = A * 6
|
||||||
factor = 1/A
|
factor = 1/A
|
||||||
cx = cx * factor
|
cx = cx * factor
|
||||||
cy = cy * factor
|
cy = cy * factor
|
||||||
if cx < xmin:
|
# if cx < xmin:
|
||||||
cx = cx * -1
|
# cx = cx * -1
|
||||||
if cy < ymin:
|
# if cy < ymin:
|
||||||
cy = cy * -1
|
# cy = cy * -1
|
||||||
if cx > xmax:
|
# if cx > xmax:
|
||||||
cx = cx * -1
|
# cx = cx * -1
|
||||||
if cy > ymax:
|
# if cy > ymax:
|
||||||
cy = cy * -1
|
# cy = cy * -1
|
||||||
|
cx = cx + xmin
|
||||||
|
cy = cy + ymin
|
||||||
outfeat.setGeometry( QgsGeometry.fromPoint( QgsPoint( cx, cy ) ) )
|
outfeat.setGeometry( QgsGeometry.fromPoint( QgsPoint( cx, cy ) ) )
|
||||||
atMap = inFeat.attributeMap()
|
atMap = inFeat.attributeMap()
|
||||||
outfeat.setAttributeMap( atMap )
|
outfeat.setAttributeMap( atMap )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user