QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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
outputCrs
const QgsCoordinateReferenceSystem & outputCrs
Definition: qgswfsgetfeature.cpp:115
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: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
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:89
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:185
QgsRectangle
A rectangle specified with double values.
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
A widget for configuration of a map extent.
Definition: qgsextentwidget.h:51
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition: qgscoordinatereferencesystem.h:211
QgsMapLayer
Base class for all map layer types. This is the base class for all map layer types (vector,...
Definition: qgsmaplayer.h:72
QgsExtentGroupBox::OriginalExtent
@ OriginalExtent
Layer's extent.
Definition: qgsextentgroupbox.h:59
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
qgscoordinatereferencesystem.h