QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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:115
qgscollapsiblegroupbox.h
QgsExtentGroupBox::CurrentExtent
@ CurrentExtent
Map canvas extent.
Definition: qgsextentgroupbox.h:60
qgsrectangle.h
QgsExtentGroupBox
Definition: qgsextentgroupbox.h:47
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:105
QgsMapCanvas
Definition: qgsmapcanvas.h:83
QgsExtentGroupBox::ProjectLayerExtent
@ ProjectLayerExtent
Extent taken from a layer within the project.
Definition: qgsextentgroupbox.h:62
QgsCollapsibleGroupBox
Definition: qgscollapsiblegroupbox.h:178
QgsRectangle
Definition: qgsrectangle.h:41
qgis_sip.h
QgsExtentGroupBox::ExtentState
ExtentState
Available states for the current extent selection in the widget.
Definition: qgsextentgroupbox.h:57
QgsExtentWidget
Definition: qgsextentwidget.h:50
QgsCoordinateReferenceSystem
Definition: qgscoordinatereferencesystem.h:206
QgsMapLayer
Definition: qgsmaplayer.h:81
QgsExtentGroupBox::OriginalExtent
@ OriginalExtent
Layer's extent.
Definition: qgsextentgroupbox.h:59
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
qgscoordinatereferencesystem.h