QGIS API Documentation  3.37.0-Master (a5b4d9743e8)
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 
46 class GUI_EXPORT QgsExtentGroupBox : public QgsCollapsibleGroupBox
47 {
48  Q_OBJECT
49  Q_PROPERTY( QString titleBase READ titleBase WRITE setTitleBase )
50 
51  public:
52 
53  // TODO QGIS 4.0 -- use QgsExtentWidget enum instead
54 
57  {
63  };
64 
68  explicit QgsExtentGroupBox( QWidget *parent SIP_TRANSFERTHIS = nullptr );
69 
75  void setOriginalExtent( const QgsRectangle &originalExtent, const QgsCoordinateReferenceSystem &originalCrs );
76 
82  QgsRectangle originalExtent() const;
83 
89  QgsCoordinateReferenceSystem originalCrs() const;
90 
97  void setCurrentExtent( const QgsRectangle &currentExtent, const QgsCoordinateReferenceSystem &currentCrs );
98 
105  QgsRectangle currentExtent() const;
106 
113  QgsCoordinateReferenceSystem currentCrs() const;
114 
120  void setOutputCrs( const QgsCoordinateReferenceSystem &outputCrs );
121 
126  QgsRectangle outputExtent() const;
127 
133 
137  QgsExtentGroupBox::ExtentState extentState() const;
138 
143  void setTitleBase( const QString &title );
144 
149  QString titleBase() const;
150 
156  void setMapCanvas( QgsMapCanvas *canvas, bool drawOnCanvasOption = true );
157 
162  QSize ratio() const;
163 
164  public slots:
165 
169  void setOutputExtentFromOriginal();
170 
174  void setOutputExtentFromCurrent();
175 
179  void setOutputExtentFromUser( const QgsRectangle &extent, const QgsCoordinateReferenceSystem &crs );
180 
184  void setOutputExtentFromLayer( const QgsMapLayer *layer );
185 
189  void setOutputExtentFromDrawOnCanvas();
190 
196  void setRatio( QSize ratio );
197 
198  signals:
199 
203  void extentChanged( const QgsRectangle &r );
204 
205  private slots:
206 
207  void groupBoxClicked();
208 
209  void widgetExtentChanged();
210 
211  void validationChanged( bool valid );
212 
213  private:
214  void updateTitle();
215 
216  QgsExtentWidget *mWidget = nullptr;
217 
219  QString mTitleBase;
220 
221 };
222 
223 #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:93
Base class for all map layer types.
Definition: qgsmaplayer.h:75
A rectangle specified with double values.
Definition: qgsrectangle.h:42
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
const QgsCoordinateReferenceSystem & outputCrs
const QgsCoordinateReferenceSystem & crs