QGIS API Documentation  3.17.0-Master (8af46bc54f)
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
Extent manually entered/modified by the user.
A rectangle specified with double values.
Definition: qgsrectangle.h:41
Base class for all map layer types.
Definition: qgsmaplayer.h:83
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
A groupbox that collapses/expands when toggled and can save its collapsed and checked states...
const QgsCoordinateReferenceSystem & crs
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:84
ExtentState
Available states for the current extent selection in the widget.
Extent taken from a rectangled drawn onto the map canvas.
Extent taken from a layer within the project.
A widget for configuration of a map extent.
This class represents a coordinate reference system (CRS).
const QgsCoordinateReferenceSystem & outputCrs
Collapsible group box for configuration of extent, typically for a save operation.