Class: QgsMapToolExtent¶
- class qgis.gui.QgsMapToolExtent(canvas: QgsMapCanvas)¶
Bases:
QgsMapTool
constructor
A map tool that emits an extent from a rectangle drawn onto the map canvas.
New in version 3.0:
Methods
- param e
- param e
- param e
Returns the current extent drawn onto the canvas.
- rtype
QgsMapTool.Flags
Returns the current fixed aspect ratio to be used when dragging extent onto the canvas.
Sets a fixed aspect ratio to be used when dragging extent onto the canvas.
transformation from map coordinates to screen coordinates
transformation from screen coordinates to layer's coordinates
transformation from screen coordinates to map coordinates
transformation from layer's coordinates to map coordinates (which is different in case reprojection is used)
Signals
signal emitted on extent change [signal]
- activate(self)¶
- canvasMoveEvent(self, e: QgsMapMouseEvent)¶
- Parameters
e (QgsMapMouseEvent) –
- canvasPressEvent(self, e: QgsMapMouseEvent)¶
- Parameters
e (QgsMapMouseEvent) –
- canvasReleaseEvent(self, e: QgsMapMouseEvent)¶
- Parameters
e (QgsMapMouseEvent) –
- childEvent(self, QChildEvent)¶
- connectNotify(self, QMetaMethod)¶
- customEvent(self, QEvent)¶
- deactivate(self)¶
- disconnectNotify(self, QMetaMethod)¶
- extent(self) QgsRectangle ¶
Returns the current extent drawn onto the canvas.
- Return type
- extentChanged¶
signal emitted on extent change [signal]
- Parameters
extent (QgsRectangle) –
- flags(self) QgsMapTool.Flags ¶
- Return type
- isSignalConnected(self, QMetaMethod) bool ¶
- ratio(self) QSize ¶
Returns the current fixed aspect ratio to be used when dragging extent onto the canvas. If the aspect ratio isn’t fixed, the width and height will be set to zero.
- Return type
QSize
- receivers(self, PYQT_SIGNAL) int ¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setRatio(self, ratio: QSize)¶
Sets a fixed aspect ratio to be used when dragging extent onto the canvas. To unset a fixed aspect ratio, set the width and height to zero.
- Parameters
ratio (QSize) – aspect ratio’s width and height
- timerEvent(self, QTimerEvent)¶
- toCanvasCoordinates(self, point: QgsPointXY) QPoint ¶
transformation from map coordinates to screen coordinates
- toLayerCoordinates(self, layer: QgsMapLayer, point: QPoint) QgsPointXY ¶
transformation from screen coordinates to layer’s coordinates
toLayerCoordinates(self, layer:
QgsMapLayer
, point:QgsPointXY
) -> QgsPointXY transformation from map coordinates to layer’s coordinatestoLayerCoordinates(self, layer:
QgsMapLayer
, rect:QgsRectangle
) -> QgsRectangle trnasformation of the rect from map coordinates to layer’s coordinates
- toMapCoordinates(self, point: QPoint) QgsPointXY ¶
transformation from screen coordinates to map coordinates
toMapCoordinates(self, layer:
QgsMapLayer
, point:QgsPointXY
) -> QgsPointXY transformation from layer’s coordinates to map coordinates (which is different in case reprojection is used)
- toMapCoordinatesV2(self, layer: QgsMapLayer, point: QgsPoint) QgsPoint ¶
transformation from layer’s coordinates to map coordinates (which is different in case reprojection is used)
Note
available in Python bindings as toMapCoordinatesV2