Exemplo n.º 1
0
    def canvasReleaseEvent(self, event):
        x = event.pos().x()
        y = event.pos().y()

        point = self.canvas.getCoordinateTransform().toMapCoordinates(x, y)
        bbox = QgsRectangle(4999.99,4999.69,660000.06,1225000.12)

        if bbox.contains(point):
            os_ref = xy_to_osgb(point.x(), point.y(), 10)
            point_4326 = reproject_point_to_4326(self.canvas, point)
            QApplication.clipboard().setText(os_ref)
            msg = "Grid Ref: {}\n\nLong,Lat: {:.2f}, {:.2f}\n\nCopied to clipboard".format(os_ref, point_4326.x(), point_4326.y())
            QMessageBox.information(None, "OS Grid Reference", msg)
        else:
            QMessageBox.information(None, "OS Grid Reference", "Point out of bounds")
Exemplo n.º 2
0
    def canvasReleaseEvent(self, event):
        x = event.pos().x()
        y = event.pos().y()
        point = self.canvas.getCoordinateTransform().toMapCoordinates(x, y)
        bbox = QgsRectangle(4999.99, 4999.69, 660000.06, 1225000.12)

        if bbox.contains(point):
            os_ref = xy_to_osgb(point.x(), point.y(), self.precision)
            point_4326 = reproject_point_to_4326(self.canvas, point)

            msg = "Grid Ref: {}\n\nLong,Lat: {:.2f}, {:.2f}\n".format(
                os_ref, point_4326.x(), point_4326.y())
            if self.clipboard_enable:
                QApplication.clipboard().setText(os_ref)
                msg += "\nCopied to clipboard"

            QMessageBox.information(None, "OS Grid Reference", msg)
        else:
            QMessageBox.information(None, "OS Grid Reference",
                                    "Point out of bounds")
 def _setEditLongLatOnMouseMove(self, pt):
     point_4326 = reproject_point_to_4326(self.iface.mapCanvas(), pt)
     msg = "{:.2f}, {:.2f}".format(point_4326.x(), point_4326.y())
     self.editLongLat.setText(msg)
Exemplo n.º 4
0
 def _setEditLongLatOnMouseMove(self, pt):
     point_4326 = reproject_point_to_4326(self.iface.mapCanvas(), pt)
     msg = "{:.2f}, {:.2f}".format(point_4326.x(), point_4326.y())
     self.editLongLat.setText(msg)