17#include "moc_qgsextentgroupbox.cpp"
22 , mTitleBase( tr(
"Extent" ) )
25 QVBoxLayout *layout =
new QVBoxLayout();
26 layout->addWidget( mWidget );
29 connect(
this, &QGroupBox::toggled,
this, &QgsExtentGroupBox::groupBoxClicked );
35 QWidget *w = window();
37 if ( w->objectName() == QLatin1String(
"QgisApp" ) )
39 w->setVisible( visible );
78void QgsExtentGroupBox::updateTitle()
87 msg = tr(
"map view" );
90 msg = tr(
"user defined" );
96 msg = tr(
"drawn on canvas" );
99 if ( isCheckable() && !isChecked() )
101 msg = tr(
"%1 (current: %2)" ).arg( mTitleBase, msg );
136void QgsExtentGroupBox::groupBoxClicked()
138 if ( !isCheckable() )
147void QgsExtentGroupBox::widgetExtentChanged()
154void QgsExtentGroupBox::validationChanged(
bool valid )
158 if ( isCheckable() && !isChecked() )
161 else if ( isCheckable() && isChecked() )
167 if ( isCheckable() && !isChecked() )
201 return mWidget->
ratio();
A groupbox that collapses/expands when toggled and can save its collapsed and checked states.
This class represents a coordinate reference system (CRS).
ExtentState
Available states for the current extent selection in the widget.
void setOutputExtentFromLayer(const QgsMapLayer *layer)
Sets the output extent to match a layer's extent (may be transformed to output CRS).
QSize ratio() const
Returns the current fixed aspect ratio to be used when dragging extent onto the canvas.
void setOutputExtentFromUser(const QgsRectangle &extent, const QgsCoordinateReferenceSystem &crs)
Sets the output extent to a custom extent (may be transformed to output CRS).
QgsExtentGroupBox::ExtentState extentState() const
Returns the currently selected state for the widget's extent.
void setOriginalExtent(const QgsRectangle &originalExtent, const QgsCoordinateReferenceSystem &originalCrs)
Sets the original extent and coordinate reference system for the widget.
QgsExtentGroupBox(QWidget *parent=nullptr)
Constructor for QgsExtentGroupBox.
QgsRectangle originalExtent() const
Returns the original extent set for the widget.
void setOutputExtentFromCurrent()
Sets the output extent to be the same as current extent (may be transformed to output CRS).
QgsCoordinateReferenceSystem outputCrs() const
Returns the current output CRS, used in the display.
void extentChanged(const QgsRectangle &r)
Emitted when the widget's extent is changed.
QgsCoordinateReferenceSystem originalCrs() const
Returns the original coordinate reference system set for the widget.
void setOutputCrs(const QgsCoordinateReferenceSystem &outputCrs)
Sets the output CRS - may need to be used for transformation from original/current extent.
QgsCoordinateReferenceSystem currentCrs() const
Returns the coordinate reference system for the current extent set for the widget.
void setMapCanvas(QgsMapCanvas *canvas, bool drawOnCanvasOption=true)
Sets the map canvas to enable dragging of extent on a canvas.
QgsRectangle currentExtent() const
Returns the current extent set for the widget.
void setOutputExtentFromDrawOnCanvas()
Sets the output extent by dragging on the canvas.
void setOutputExtentFromOriginal()
Sets the output extent to be the same as original extent (may be transformed to output CRS).
void setTitleBase(const QString &title)
Sets the base part of title of the group box (will be appended with extent state)
QgsRectangle outputExtent() const
Returns the extent shown in the widget - in output CRS coordinates.
void setRatio(QSize ratio)
Sets a 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 whenev...
Map canvas is a class for displaying all GIS data types on a canvas.
Base class for all map layer types.
A rectangle specified with double values.
const QgsCoordinateReferenceSystem & outputCrs
const QgsCoordinateReferenceSystem & crs