Class: QgsMapToolPan¶
- class qgis.gui.QgsMapToolPan¶
Bases:
QgsMapTool
A map tool for panning the map.
See also
QgsMapToolPan(canvas:
QgsMapCanvas
) constructorMethods
- param e
- param e
- param e
- param e
- rtype
QgsMapTool.Flags
- param e
Returns
True
if a drag operation is in progress.Returns the map layer with the matching ID, or
None
if no layers could be found.Sets the tool's
name
.Transforms a
point
from map coordinates to screen coordinates.Transforms a
point
from screen coordinates tolayer
coordinates.Transforms a
point
from map coordinates tolayer
coordinates.Transforms a
point
from screen coordinates to map coordinates.Transforms a
point
fromlayer
coordinates to map coordinates (which is different in case reprojection is used).Signals
Emitted whenever the distance or bearing of an in-progress panning operation is changed.
- activate(self)¶
- canvasDoubleClickEvent(self, e: QgsMapMouseEvent)¶
- Parameters
e (QgsMapMouseEvent) –
- 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)¶
- flags(self) QgsMapTool.Flags ¶
- Return type
- gestureEvent(self, e: QGestureEvent) bool ¶
- Parameters
e (QGestureEvent) –
- Return type
bool
- isDragging(self) bool ¶
Returns
True
if a drag operation is in progress.New in version 3.12.
- Return type
bool
- isSignalConnected(self, QMetaMethod) bool ¶
- layer(self, id: str) QgsMapLayer ¶
Returns the map layer with the matching ID, or
None
if no layers could be found.This method searches both layers associated with the map canvas (see
QgsMapCanvas.layers()
) and layers from theQgsProject
associated with the canvas. It can be used to resolve layer IDs to layers which may be visible in the canvas, but not associated with aQgsProject
.New in version 3.22.
- panDistanceBearingChanged¶
Emitted whenever the distance or bearing of an in-progress panning operation is changed.
This signal will be emitted during a pan operation as the user moves the map, giving the total distance and bearing between the map position at the start of the pan and the current pan position.
New in version 3.12: [signal]
- Parameters
distance (float) –
unit (QgsUnitTypes.DistanceUnit) –
bearing (float) –
- receivers(self, PYQT_SIGNAL) int ¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setToolName(self, name: str)¶
Sets the tool’s
name
.See also
toolName()
New in version 3.20.
- timerEvent(self, QTimerEvent)¶
- toCanvasCoordinates(self, point: QgsPointXY) QPoint ¶
Transforms a
point
from map coordinates to screen coordinates.
- toLayerCoordinates(self, layer: QgsMapLayer, point: QPoint) QgsPointXY ¶
Transforms a
point
from screen coordinates tolayer
coordinates.toLayerCoordinates(self, layer:
QgsMapLayer
, point:QgsPointXY
) -> QgsPointXY Transforms apoint
from map coordinates tolayer
coordinates.toLayerCoordinates(self, layer:
QgsMapLayer
, rect:QgsRectangle
) -> QgsRectangle Transforms arect
from map coordinates tolayer
coordinates.
- toLayerCoordinatesV2(self, layer: QgsMapLayer, point: QgsPoint) QgsPoint ¶
Transforms a
point
from map coordinates tolayer
coordinates.Note
This method is available in the Python bindings as toLayerCoordinatesV2.
- toMapCoordinates(self, point: QPoint) QgsPointXY ¶
Transforms a
point
from screen coordinates to map coordinates.toMapCoordinates(self, layer:
QgsMapLayer
, point:QgsPointXY
) -> QgsPointXY Transforms apoint
fromlayer
coordinates to map coordinates (which is different in case reprojection is used).
- toMapCoordinatesV2(self, layer: QgsMapLayer, point: QgsPoint) QgsPoint ¶
Transforms a
point
fromlayer
coordinates to map coordinates (which is different in case reprojection is used).Note
This method is available in the Python bindings as toMapCoordinatesV2.