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():
21
21
return "Tools for vector data analysis and management"
22
22
23
23
def version ():
24
- return "0.5.7 "
24
+ return "0.5.8 "
25
25
26
26
def qgisMinimumVersion ():
27
27
return "1"
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ def __init__(self, iface):
32
32
QObject .connect (self .btnWeb , SIGNAL ("clicked()" ), self .openWeb )
33
33
QObject .connect (self .btnHelp , SIGNAL ("clicked()" ), self .openHelp )
34
34
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 " )
36
36
self .textEdit .setText (self .getText ())
37
37
38
38
def getText (self ):
Original file line number Diff line number Diff line change @@ -447,29 +447,31 @@ def polygon_centroids( self ):
447
447
for h in k :
448
448
for i in range (0 , len (h ) - 1 ):
449
449
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
453
453
else :
454
454
multi_geom = geom .asPolygon ()
455
455
for k in multi_geom :
456
456
for i in range (0 , len (k ) - 1 ):
457
457
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
461
461
A = A * 6
462
462
factor = 1 / A
463
463
cx = cx * factor
464
464
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
473
475
outfeat .setGeometry ( QgsGeometry .fromPoint ( QgsPoint ( cx , cy ) ) )
474
476
atMap = inFeat .attributeMap ()
475
477
outfeat .setAttributeMap ( atMap )
You can’t perform that action at this time.
0 commit comments