File tree Expand file tree Collapse file tree 3 files changed +18
-16
lines changed
Expand file tree Collapse file tree 3 files changed +18
-16
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ def description():
2121 return "Tools for vector data analysis and management"
2222
2323def version ():
24- return "0.5.7 "
24+ return "0.5.8 "
2525
2626def qgisMinimumVersion ():
2727 return "1"
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ def __init__(self, iface):
3232 QObject .connect (self .btnWeb , SIGNAL ("clicked()" ), self .openWeb )
3333 QObject .connect (self .btnHelp , SIGNAL ("clicked()" ), self .openHelp )
3434 self .fToolsLogo .setPixmap (QPixmap (":/icons/default/ftools_logo.png" ))
35- self .label_3 .setText ("fTools 0.5.6 " )
35+ self .label_3 .setText ("fTools 0.5.8 " )
3636 self .textEdit .setText (self .getText ())
3737
3838 def getText (self ):
Original file line number Diff line number Diff line change @@ -447,29 +447,31 @@ def polygon_centroids( self ):
447447 for h in k :
448448 for i in range (0 , len (h ) - 1 ):
449449 j = (i + 1 ) % len (h )
450- factor = ((h [i ].x ()) * (h [j ].y ()) - (h [j ].x ()) * (h [i ].y ()))
451- cx = cx + ((h [i ].x ()) + (h [j ].x ())) * factor
452- cy = cy + ((h [i ].y ()) + (h [j ].y ())) * factor
450+ factor = ((h [i ].x ()- xmin ) * (h [j ].y ()- ymin ) - (h [j ].x ()- xmin ) * (h [i ].y ()- ymin ))
451+ cx = cx + ((h [i ].x ()- xmin ) + (h [j ].x ()- xmin )) * factor
452+ cy = cy + ((h [i ].y ()- ymin ) + (h [j ].y ()- ymin )) * factor
453453 else :
454454 multi_geom = geom .asPolygon ()
455455 for k in multi_geom :
456456 for i in range (0 , len (k ) - 1 ):
457457 j = (i + 1 ) % len (k )
458- factor = (k [i ].x ()) * (k [j ].y ()) - (k [j ].x ()) * (k [i ].y ())
459- cx = cx + ((k [i ].x ()) + (k [j ].x ())) * factor
460- cy = cy + ((k [i ].y ()) + (k [j ].y ())) * factor
458+ factor = (k [i ].x ()- xmin ) * (k [j ].y ()- ymin ) - (k [j ].x ()- xmin ) * (k [i ].y ()- ymin )
459+ cx = cx + ((k [i ].x ()- xmin ) + (k [j ].x ()- xmin )) * factor
460+ cy = cy + ((k [i ].y ()- ymin ) + (k [j ].y ()- ymin )) * factor
461461 A = A * 6
462462 factor = 1 / A
463463 cx = cx * factor
464464 cy = cy * factor
465- if cx < xmin :
466- cx = cx * - 1
467- if cy < ymin :
468- cy = cy * - 1
469- if cx > xmax :
470- cx = cx * - 1
471- if cy > ymax :
472- cy = cy * - 1
465+ # if cx < xmin:
466+ # cx = cx * -1
467+ # if cy < ymin:
468+ # cy = cy * -1
469+ # if cx > xmax:
470+ # cx = cx * -1
471+ # if cy > ymax:
472+ # cy = cy * -1
473+ cx = cx + xmin
474+ cy = cy + ymin
473475 outfeat .setGeometry ( QgsGeometry .fromPoint ( QgsPoint ( cx , cy ) ) )
474476 atMap = inFeat .attributeMap ()
475477 outfeat .setAttributeMap ( atMap )
You can’t perform that action at this time.
0 commit comments