QGIS API Documentation  3.24.2-Tisler (13c1a02865)
qgsextentgroupbox.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsextentgroupbox.h
3  ---------------------
4  begin : March 2014
5  copyright : (C) 2014 by Martin Dobias
6  email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSEXTENTGROUPBOX_H
17 #define QGSEXTENTGROUPBOX_H
18 
19 #include "qgscollapsiblegroupbox.h"
20 #include "qgis_sip.h"
21 
23 #include "qgsrectangle.h"
24 #include "qgis_gui.h"
25 
26 #include <memory>
27 
29 class QgsMapLayer;
30 class QgsExtentWidget;
31 class QgsMapCanvas;
32 
47 class GUI_EXPORT QgsExtentGroupBox : public QgsCollapsibleGroupBox
48 {
49  Q_OBJECT
50  Q_PROPERTY( QString titleBase READ titleBase WRITE setTitleBase )
51 
52  public:
53 
54  // TODO QGIS 4.0 -- use QgsExtentWidget enum instead
55 
58  {
64  };
65 
69  explicit QgsExtentGroupBox( QWidget *parent SIP_TRANSFERTHIS = nullptr );
70 
76  void setOriginalExtent( const QgsRectangle &originalExtent, const QgsCoordinateReferenceSystem &originalCrs );
77 
83  QgsRectangle originalExtent() const;
84 
90  QgsCoordinateReferenceSystem originalCrs() const;
91 
98  void setCurrentExtent( const QgsRectangle &currentExtent, const QgsCoordinateReferenceSystem &currentCrs );
99 
106  QgsRectangle currentExtent() const;
107 
114  QgsCoordinateReferenceSystem currentCrs() const;
115 
121  void setOutputCrs( const QgsCoordinateReferenceSystem &outputCrs );
122 
127  QgsRectangle outputExtent() const;
128 
135 
139  QgsExtentGroupBox::ExtentState extentState() const;
140 
146  void setTitleBase( const QString &title );
147 
153  QString titleBase() const;
154 
161  void setMapCanvas( QgsMapCanvas *canvas, bool drawOnCanvasOption = true );
162 
168  QSize ratio() const;
169 
170  public slots:
171 
175  void setOutputExtentFromOriginal();
176 
180  void setOutputExtentFromCurrent();
181 
185  void setOutputExtentFromUser( const QgsRectangle &extent, const QgsCoordinateReferenceSystem &crs );
186 
191  void setOutputExtentFromLayer( const QgsMapLayer *layer );
192 
197  void setOutputExtentFromDrawOnCanvas();
198 
205  void setRatio( QSize ratio );
206 
207  signals:
208 
212  void extentChanged( const QgsRectangle &r );
213 
214  private slots:
215 
216  void groupBoxClicked();
217 
218  void widgetExtentChanged();
219 
220  void validationChanged( bool valid );
221 
222  private:
223  void updateTitle();
224 
225  QgsExtentWidget *mWidget = nullptr;
226 
228  QString mTitleBase;
229 
230 };
231 
232 #endif // QGSEXTENTGROUPBOX_H
A groupbox that collapses/expands when toggled and can save its collapsed and checked states.
This class represents a coordinate reference system (CRS).
Collapsible group box for configuration of extent, typically for a save operation.
ExtentState
Available states for the current extent selection in the widget.
@ UserExtent
Extent manually entered/modified by the user.
@ CurrentExtent
Map canvas extent.
@ ProjectLayerExtent
Extent taken from a layer within the project.
@ DrawOnCanvas
Extent taken from a rectangled drawn onto the map canvas.
@ OriginalExtent
Layer's extent.
void extentChanged(const QgsRectangle &r)
Emitted when the widget's extent is changed.
A widget for configuration of a map extent.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:90
Base class for all map layer types.
Definition: qgsmaplayer.h:73
A rectangle specified with double values.
Definition: qgsrectangle.h:42
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
const QgsCoordinateReferenceSystem & outputCrs
const QgsCoordinateReferenceSystem & crs