[Qgis-user] Need Help on Coordinate Capture in Python Plugin

Bruce, Bob (CON) Bob.Bruce at gov.mb.ca
Tue Jun 16 19:05:41 PDT 2009


Hi:
	I am writing a python plugin to clip images to a user selected
rectangle and am stuck at the point where the plugin gets the
coordinates from mouse clicks. Here are some code snippets from my
plugin:

	-
	-
	-
    # connect QGSMapCanvas mouse click event to the rubber band clip
window
    # function
    self.mapCanvas = self.iface.mapCanvas()
    self.emitPoint = QgsMapToolEmitPoint(self.mapCanvas)
    self.mapCanvas.setMapTool(self.emitPoint)
    QObject.connect(self.emitPoint, SIGNAL("canvasClicked(QgsPoint &,\
                    Qt.MouseButton)"), self.setClipWindow)

    def setClipWindow(self, point, button):
        QMessageBox.information(self.iface.mainWindow(),\
           "ImageClipperDlg Mouse Click Event"," Here are the
coordinates ")


I have tried many variations of the argument lists but I cannot seem to
get the method/function setClipWindow to be called. Can someone see what
I'm doing wrong?

Thanks,
		Bob Bruce

************************************************************************
****
**  Bob Bruce, P.Eng.        Geomatics Support Engineer
**  bbruce at gov.mb.ca         Manitoba Geomatics/Remote Sensing Branch,
**  work # (204) 945-6636    1007 Century Street,
**  FAX  # (204) 945-1365    Winnipeg, Manitoba, Canada, R3H 0W4
**
**  The Manitoba Centre for:  
**     Cadastral & Topographical Mapping, and Remote Sensing
**     See us on the Web at:
http://www.gov.mb.ca/conservation/geomatics/
**  and:
http://www.gov.mb.ca/conservation/geomatics/cada_mapping/index.html
**     Check out our digital maps at: http://mlidata.gov.mb.ca/WPMLI
**        and: https://mli2.gov.mb.ca/
************************************************************************
****



More information about the Qgis-user mailing list