QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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 
160  void setMapCanvas( QgsMapCanvas *canvas );
161 
167  QSize ratio() const;
168 
169  public slots:
170 
174  void setOutputExtentFromOriginal();
175 
179  void setOutputExtentFromCurrent();
180 
184  void setOutputExtentFromUser( const QgsRectangle &extent, const QgsCoordinateReferenceSystem &crs );
185 
190  void setOutputExtentFromLayer( const QgsMapLayer *layer );
191 
196  void setOutputExtentFromDrawOnCanvas();
197 
204  void setRatio( QSize ratio );
205 
206  signals:
207 
211  void extentChanged( const QgsRectangle &r );
212 
213  private slots:
214 
215  void groupBoxClicked();
216 
217  void widgetExtentChanged();
218 
219  void validationChanged( bool valid );
220 
221  private:
222  void updateTitle();
223 
224  QgsExtentWidget *mWidget = nullptr;
225 
227  QString mTitleBase;
228 
229 };
230 
231 #endif // QGSEXTENTGROUPBOX_H
outputCrs
const QgsCoordinateReferenceSystem & outputCrs
Definition: qgswfsgetfeature.cpp:61
qgscollapsiblegroupbox.h
QgsExtentGroupBox::CurrentExtent
@ CurrentExtent
Map canvas extent.
Definition: qgsextentgroupbox.h:60
qgsrectangle.h
QgsExtentGroupBox
Collapsible group box for configuration of extent, typically for a save operation.
Definition: qgsextentgroupbox.h:48
QgsExtentGroupBox::UserExtent
@ UserExtent
Extent manually entered/modified by the user.
Definition: qgsextentgroupbox.h:61
QgsExtentGroupBox::DrawOnCanvas
@ DrawOnCanvas
Extent taken from a rectangled drawn onto the map canvas.
Definition: qgsextentgroupbox.h:63
crs
const QgsCoordinateReferenceSystem & crs
Definition: qgswfsgetfeature.cpp:51
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:85
QgsExtentGroupBox::ProjectLayerExtent
@ ProjectLayerExtent
Extent taken from a layer within the project.
Definition: qgsextentgroupbox.h:62
QgsCollapsibleGroupBox
A groupbox that collapses/expands when toggled and can save its collapsed and checked states.
Definition: qgscollapsiblegroupbox.h:179
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:42
qgis_sip.h
QgsExtentGroupBox::ExtentState
ExtentState
Available states for the current extent selection in the widget.
Definition: qgsextentgroupbox.h:58
QgsExtentWidget
A widget for configuration of a map extent.
Definition: qgsextentwidget.h:51
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition: qgscoordinatereferencesystem.h:206
QgsMapLayer
Base class for all map layer types.
Definition: qgsmaplayer.h:83
QgsExtentGroupBox::OriginalExtent
@ OriginalExtent
Layer's extent.
Definition: qgsextentgroupbox.h:59
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
qgscoordinatereferencesystem.h
QgsExtentGroupBox::extentChanged
void extentChanged(const QgsRectangle &r)
Emitted when the widget's extent is changed.