Skip to content

Commit

Permalink
Regression bug fix - API method name change. (#19)
Browse files Browse the repository at this point in the history
* Updated fromPoint to fromPointXY because of API breaking change between QGIS 2 and 3.

* Updated fromMultiPoint to fromMultiPointXY.
  • Loading branch information
jaminmelville authored and olivierdalang committed Dec 3, 2019
1 parent b4f60e9 commit e7e4130
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions vectorbender.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __init__(self, iface):


def initGui(self):

self.action = QAction( QIcon(os.path.join(os.path.dirname(__file__),'resources','icon.png')), "Vector Bender", self.iface.mainWindow())
self.action.triggered.connect(self.showUi)
self.iface.addToolBarIcon(self.action)
Expand All @@ -79,7 +79,7 @@ def showHelp(self):
if self.aboutWindow is None:
self.aboutWindow = VectorBenderHelp()
self.aboutWindow.show()
self.aboutWindow.raise_()
self.aboutWindow.raise_()

def unload(self):
if self.dlg is not None:
Expand Down Expand Up @@ -113,7 +113,7 @@ def determineTransformationType(self):
return 0

featuresCount = len(pairsLayer.selectedFeatureIds()) if self.dlg.restrictBox_pairsLayer.isChecked() else len(pairsLayer.allFeatureIds())

if featuresCount == 1:
return 1
elif featuresCount == 2:
Expand All @@ -127,7 +127,7 @@ def determineTransformationType(self):
return 4

return 0

def run(self):

self.dlg.progressBar.setValue( 0 )
Expand Down Expand Up @@ -179,15 +179,15 @@ def run(self):
if not geom.isMultipart():
# SINGLE PART POINT
p = geom.asPoint()
newGeom = QgsGeometry.fromPoint( self.transformer.map(p) )
newGeom = QgsGeometry.fromPointXY( self.transformer.map(p) )

else:
# MULTI PART POINT
listA = geom.asMultiPoint()
newListA = []
for p in listA:
newListA.append( self.transformer.map(p) )
newGeom = QgsGeometry.fromMultiPoint( newListA )
newGeom = QgsGeometry.fromMultiPointXY( newListA )

elif geom.type() == QgsWkbTypes.LineGeometry:

Expand Down Expand Up @@ -274,4 +274,3 @@ def run(self):
self.dlg.displayMsg( "Finished !" )
self.dlg.progressBar.setValue( 100 )
pairsLayer.repaintRequested.emit()

0 comments on commit e7e4130

Please sign in to comment.