Class: QgsExtentGroupBox¶
Collapsible group box for configuration of extent, typically for a save operation.
Besides allowing the user to enter the extent manually, it comes with options to use original extent or extent defined by the current view in map canvas.
When using the group box, make sure to call
setOriginalExtent()
, setCurrentExtent()
and
setOutputCrs()
during initialization.
See also
Class Hierarchy¶
Base classes¶
A groupbox that collapses/expands when toggled and can save its collapsed and checked states. By default, it auto-saves only its collapsed state to the global settings based on the widget and it’s parent names. Holding Alt modifier key when toggling collapsed state will synchronize the toggling across other collapsible group boxes with the same syncGroup QString value Holding Shift modifier key when attempting to toggle collapsed state will expand current group box, then collapse any others with |
|
A groupbox that collapses/expands when toggled. Basic class |
|
Methods
Returns the coordinate reference system for the current extent set for the widget. |
|
Returns the current extent set for the widget. |
|
Returns the currently selected state for the widget's extent. |
|
Returns the original coordinate reference system set for the widget. |
|
Returns the original extent set for the widget. |
|
Returns the current output CRS, used in the display. |
|
Returns the extent shown in the widget - in output CRS coordinates. |
|
Returns the current fixed aspect ratio to be used when dragging extent onto the canvas. |
|
Sets the current extent to show in the widget - should be called as part of initialization (or whenever current extent changes). |
|
Sets the map canvas to enable dragging of extent on a canvas. |
|
Sets the original extent and coordinate reference system for the widget. |
|
Sets the output CRS - may need to be used for transformation from original/current extent. |
|
Sets the output extent to be the same as current extent (may be transformed to output CRS). |
|
Sets the output extent by dragging on the canvas. |
|
Sets the output extent to match a layer's extent (may be transformed to output CRS). |
|
Sets the output extent to be the same as original extent (may be transformed to output CRS). |
|
Sets the output extent to a custom extent (may be transformed to output CRS). |
|
Sets a fixed aspect ratio to be used when dragging extent onto the canvas. |
|
Sets the base part of title of the group box (will be appended with extent state) |
|
Returns the base part of title of the group box (will be appended with extent state). |
Signals
Emitted when the widget's extent is changed. |
Attributes
- class qgis.gui.QgsExtentGroupBox[source]¶
Bases:
QgsCollapsibleGroupBox
- __init__(parent: QWidget | None = None)
Constructor for QgsExtentGroupBox.
- Parameters:
parent (Optional[QWidget] = None)
- CurrentExtent = 1¶
- DrawOnCanvas = 4¶
- class ExtentState¶
Bases:
int
- OriginalExtent = 0¶
- ProjectLayerExtent = 3¶
- UserExtent = 2¶
- currentCrs(self) QgsCoordinateReferenceSystem [source]¶
Returns the coordinate reference system for the current extent set for the widget. The current extent and CRS usually reflects the map canvas extent and CRS.
See also
See also
- Return type:
- currentExtent(self) QgsRectangle [source]¶
Returns the current extent set for the widget. The current extent is usually set to match the current map canvas extent.
See also
See also
- Return type:
- signal extentChanged(r: QgsRectangle)[source]¶
Emitted when the widget’s extent is changed.
- Parameters:
r (QgsRectangle)
- extentState(self) QgsExtentGroupBox.ExtentState [source]¶
Returns the currently selected state for the widget’s extent.
- Return type:
- originalCrs(self) QgsCoordinateReferenceSystem [source]¶
Returns the original coordinate reference system set for the widget.
See also
See also
- Return type:
- originalExtent(self) QgsRectangle [source]¶
Returns the original extent set for the widget.
See also
See also
- Return type:
- outputCrs(self) QgsCoordinateReferenceSystem [source]¶
Returns the current output CRS, used in the display.
See also
- Return type:
- outputExtent(self) QgsRectangle [source]¶
Returns the extent shown in the widget - in output CRS coordinates.
See also
- Return type:
- ratio(self) QSize [source]¶
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
- setCurrentExtent(self, currentExtent: QgsRectangle, currentCrs: QgsCoordinateReferenceSystem)[source]¶
Sets the current extent to show in the widget - should be called as part of initialization (or whenever current extent changes). The current extent is usually set to match the current map canvas extent.
See also
See also
- Parameters:
currentExtent (QgsRectangle)
currentCrs (QgsCoordinateReferenceSystem)
- setMapCanvas(self, canvas: QgsMapCanvas | None, drawOnCanvasOption: bool = True)[source]¶
Sets the map canvas to enable dragging of extent on a canvas.
- Parameters:
canvas (Optional[QgsMapCanvas]) – the map canvas
drawOnCanvasOption (bool = True) – set to false to disable to draw on canvas option
- setOriginalExtent(self, originalExtent: QgsRectangle, originalCrs: QgsCoordinateReferenceSystem)[source]¶
Sets the original extent and coordinate reference system for the widget. This should be called as part of initialization.
See also
See also
- Parameters:
originalExtent (QgsRectangle)
originalCrs (QgsCoordinateReferenceSystem)
- setOutputCrs(self, outputCrs: QgsCoordinateReferenceSystem)[source]¶
Sets the output CRS - may need to be used for transformation from original/current extent. Should be called as part of initialization and whenever the the output CRS is changed. The current extent will be reprojected into the new output CRS.
- Parameters:
outputCrs (QgsCoordinateReferenceSystem)
- setOutputExtentFromCurrent(self)[source]¶
Sets the output extent to be the same as current extent (may be transformed to output CRS).
- setOutputExtentFromLayer(self, layer: QgsMapLayer | None)[source]¶
Sets the output extent to match a
layer
’s extent (may be transformed to output CRS).- Parameters:
layer (Optional[QgsMapLayer])
- setOutputExtentFromOriginal(self)[source]¶
Sets the output extent to be the same as original extent (may be transformed to output CRS).
- setOutputExtentFromUser(self, extent: QgsRectangle, crs: QgsCoordinateReferenceSystem)[source]¶
Sets the output extent to a custom extent (may be transformed to output CRS).
- Parameters:
extent (QgsRectangle)
- setRatio(self, ratio: QSize)[source]¶
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
- setTitleBase(self, title: str | None)[source]¶
Sets the base part of
title
of the group box (will be appended with extent state)See also
- Parameters:
title (Optional[str])