QGIS API Documentation 3.41.0-Master (3440c17df1d)
|
A widget for configuration of a map extent. More...
#include <qgsextentwidget.h>
Public Types | |
enum | ExtentState { OriginalExtent , CurrentExtent , UserExtent , ProjectLayerExtent , DrawOnCanvas } |
Available states for the current extent selection in the widget. More... | |
enum | WidgetStyle { CondensedStyle , ExpandedStyle } |
Widget styles. More... | |
Public Slots | |
void | clear () |
Clears the widget, setting it to a null value. | |
void | setOutputExtentFromCurrent () |
Sets the output extent to be the same as current extent (may be transformed to output CRS). | |
void | setOutputExtentFromDrawOnCanvas () |
Sets the output extent by dragging on the canvas. | |
void | setOutputExtentFromLayer (const QgsMapLayer *layer) |
Sets the output extent to match a layer's extent (may be transformed to output CRS). | |
void | setOutputExtentFromOriginal () |
Sets the output extent to be the same as original extent (may be transformed to output CRS). | |
void | setOutputExtentFromUser (const QgsRectangle &extent, const QgsCoordinateReferenceSystem &crs) |
Sets the output extent to a custom extent (may be transformed to output CRS). | |
void | setRatio (QSize ratio) |
Sets a fixed aspect ratio to be used when dragging extent onto the canvas. | |
Signals | |
void | extentChanged (const QgsRectangle &r) |
Emitted when the widget's extent is changed. | |
void | toggleDialogVisibility (bool visible) |
Emitted when the parent dialog visibility must be changed (e.g. | |
void | validationChanged (bool valid) |
Emitted when the widget's validation state changes. | |
Public Member Functions | |
QgsExtentWidget (QWidget *parent=nullptr, WidgetStyle style=CondensedStyle) | |
Constructor for QgsExtentWidget. | |
~QgsExtentWidget () override | |
QgsCoordinateReferenceSystem | currentCrs () const |
Returns the coordinate reference system for the current extent set for the widget. | |
QgsRectangle | currentExtent () const |
Returns the current extent set for the widget. | |
QString | extentLayerName () const |
Returns the name of the extent layer. | |
QgsExtentWidget::ExtentState | extentState () const |
Returns the currently selected state for the widget's extent. | |
bool | isValid () const |
Returns true if the widget is in a valid state, i.e. | |
QgsCoordinateReferenceSystem | originalCrs () const |
Returns the original coordinate reference system set for the widget. | |
QgsRectangle | originalExtent () const |
Returns the original extent set for the widget. | |
QgsCoordinateReferenceSystem | outputCrs () const |
Returns the current output CRS, used in the display. | |
QgsRectangle | outputExtent () const |
Returns the extent shown in the widget - in output CRS coordinates. | |
QSize | ratio () const |
Returns the current fixed aspect ratio to be used when dragging extent onto the canvas. | |
void | setCurrentExtent (const QgsRectangle ¤tExtent, const QgsCoordinateReferenceSystem ¤tCrs) |
Sets the current extent to show in the widget - should be called as part of initialization (or whenever current extent changes). | |
void | setMapCanvas (QgsMapCanvas *canvas, bool drawOnCanvasOption=true) |
Sets the map canvas to enable dragging of extent on a canvas. | |
void | setNullValueAllowed (bool allowed, const QString ¬SetText=QString()) |
Sets whether the widget can be set to a "not set" (null) state. | |
void | setOriginalExtent (const QgsRectangle &originalExtent, const QgsCoordinateReferenceSystem &originalCrs) |
Sets the original extent and coordinate reference system for the widget. | |
void | setOutputCrs (const QgsCoordinateReferenceSystem &outputCrs) |
Sets the output CRS - may need to be used for transformation from original/current extent. | |
Protected Member Functions | |
void | dragEnterEvent (QDragEnterEvent *event) override |
void | dragLeaveEvent (QDragLeaveEvent *event) override |
void | dropEvent (QDropEvent *event) override |
void | showEvent (QShowEvent *event) override |
Friends | |
class | TestProcessingGui |
A widget for configuration of a map extent.
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 widget, make sure to call setOriginalExtent(), setCurrentExtent() and setOutputCrs() during initialization.
Definition at line 51 of file qgsextentwidget.h.
Available states for the current extent selection in the widget.
Definition at line 58 of file qgsextentwidget.h.
Widget styles.
Enumerator | |
---|---|
CondensedStyle | Shows a compressed widget, for use when available space is minimal. |
ExpandedStyle | Shows an expanded widget, for use when space is not constrained. |
Definition at line 68 of file qgsextentwidget.h.
|
explicit |
Constructor for QgsExtentWidget.
Definition at line 37 of file qgsextentwidget.cpp.
|
override |
Definition at line 118 of file qgsextentwidget.cpp.
|
slot |
Clears the widget, setting it to a null value.
Definition at line 340 of file qgsextentwidget.cpp.
|
inline |
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.
Definition at line 124 of file qgsextentwidget.h.
|
inline |
Returns the current extent set for the widget.
The current extent is usually set to match the current map canvas extent.
Definition at line 116 of file qgsextentwidget.h.
|
overrideprotected |
Definition at line 610 of file qgsextentwidget.cpp.
|
overrideprotected |
Definition at line 632 of file qgsextentwidget.cpp.
|
overrideprotected |
Definition at line 646 of file qgsextentwidget.cpp.
|
signal |
Emitted when the widget's extent is changed.
QString QgsExtentWidget::extentLayerName | ( | ) | const |
Returns the name of the extent layer.
Definition at line 355 of file qgsextentwidget.cpp.
|
inline |
Returns the currently selected state for the widget's extent.
Definition at line 148 of file qgsextentwidget.h.
bool QgsExtentWidget::isValid | ( | ) | const |
Returns true
if the widget is in a valid state, i.e.
has an extent set.
Definition at line 360 of file qgsextentwidget.cpp.
|
inline |
Returns the original coordinate reference system set for the widget.
Definition at line 100 of file qgsextentwidget.h.
|
inline |
Returns the original extent set for the widget.
Definition at line 93 of file qgsextentwidget.h.
|
inline |
Returns the current output CRS, used in the display.
Definition at line 143 of file qgsextentwidget.h.
QgsRectangle QgsExtentWidget::outputExtent | ( | ) | const |
Returns the extent shown in the widget - in output CRS coordinates.
Definition at line 565 of file qgsextentwidget.cpp.
|
inline |
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.
Definition at line 161 of file qgsextentwidget.h.
void QgsExtentWidget::setCurrentExtent | ( | const QgsRectangle & | currentExtent, |
const QgsCoordinateReferenceSystem & | currentCrs | ||
) |
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.
Definition at line 138 of file qgsextentwidget.cpp.
void QgsExtentWidget::setMapCanvas | ( | QgsMapCanvas * | canvas, |
bool | drawOnCanvasOption = true |
||
) |
Sets the map canvas to enable dragging of extent on a canvas.
canvas | the map canvas |
drawOnCanvasOption | set to false to disable to draw on canvas option |
Definition at line 580 of file qgsextentwidget.cpp.
void QgsExtentWidget::setNullValueAllowed | ( | bool | allowed, |
const QString & | notSetText = QString() |
||
) |
Sets whether the widget can be set to a "not set" (null) state.
The specified notSetText will be used for showing null values.
Definition at line 365 of file qgsextentwidget.cpp.
void QgsExtentWidget::setOriginalExtent | ( | const QgsRectangle & | originalExtent, |
const QgsCoordinateReferenceSystem & | originalCrs | ||
) |
Sets the original extent and coordinate reference system for the widget.
This should be called as part of initialization.
Definition at line 129 of file qgsextentwidget.cpp.
void QgsExtentWidget::setOutputCrs | ( | const QgsCoordinateReferenceSystem & | outputCrs | ) |
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.
Definition at line 147 of file qgsextentwidget.cpp.
|
slot |
Sets the output extent to be the same as current extent (may be transformed to output CRS).
Definition at line 496 of file qgsextentwidget.cpp.
|
slot |
Sets the output extent by dragging on the canvas.
Definition at line 533 of file qgsextentwidget.cpp.
|
slot |
Sets the output extent to match a layer's extent (may be transformed to output CRS).
Definition at line 522 of file qgsextentwidget.cpp.
|
slot |
Sets the output extent to be the same as original extent (may be transformed to output CRS).
Definition at line 512 of file qgsextentwidget.cpp.
|
slot |
Sets the output extent to a custom extent (may be transformed to output CRS).
Definition at line 517 of file qgsextentwidget.cpp.
|
inlineslot |
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.
ratio | aspect ratio's width and height |
Definition at line 214 of file qgsextentwidget.h.
|
overrideprotected |
Definition at line 671 of file qgsextentwidget.cpp.
|
signal |
Emitted when the parent dialog visibility must be changed (e.g.
to permit access to the map canvas)
|
signal |
Emitted when the widget's validation state changes.
|
friend |
Definition at line 306 of file qgsextentwidget.h.