QGIS API Documentation 3.43.0-Master (3ee7834ace6)
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
20#include "qgis_sip.h"
21
23#include "qgsrectangle.h"
24#include "qgis_gui.h"
25
27class QgsMapLayer;
28class QgsExtentWidget;
29class QgsMapCanvas;
30
45{
46 Q_OBJECT
47 Q_PROPERTY( QString titleBase READ titleBase WRITE setTitleBase )
48
49 public:
50 // TODO QGIS 4.0 -- use QgsExtentWidget enum instead
51
61
65 explicit QgsExtentGroupBox( QWidget *parent SIP_TRANSFERTHIS = nullptr );
66
72 void setOriginalExtent( const QgsRectangle &originalExtent, const QgsCoordinateReferenceSystem &originalCrs );
73
79 QgsRectangle originalExtent() const;
80
86 QgsCoordinateReferenceSystem originalCrs() const;
87
94 void setCurrentExtent( const QgsRectangle &currentExtent, const QgsCoordinateReferenceSystem &currentCrs );
95
102 QgsRectangle currentExtent() const;
103
110 QgsCoordinateReferenceSystem currentCrs() const;
111
117 void setOutputCrs( const QgsCoordinateReferenceSystem &outputCrs );
118
123 QgsRectangle outputExtent() const;
124
130
134 QgsExtentGroupBox::ExtentState extentState() const;
135
140 void setTitleBase( const QString &title );
141
146 QString titleBase() const;
147
153 void setMapCanvas( QgsMapCanvas *canvas, bool drawOnCanvasOption = true );
154
159 QSize ratio() const;
160
161 public slots:
162
166 void setOutputExtentFromOriginal();
167
171 void setOutputExtentFromCurrent();
172
176 void setOutputExtentFromUser( const QgsRectangle &extent, const QgsCoordinateReferenceSystem &crs );
177
181 void setOutputExtentFromLayer( const QgsMapLayer *layer );
182
186 void setOutputExtentFromDrawOnCanvas();
187
193 void setRatio( QSize ratio );
194
195 signals:
196
200 void extentChanged( const QgsRectangle &r );
201
207
208 private slots:
209
210 void groupBoxClicked();
211
212 void widgetExtentChanged();
213
214 void validationChanged( bool valid );
215
216 private:
217 void updateTitle();
218
219 QgsExtentWidget *mWidget = nullptr;
220
222 QString mTitleBase;
223};
224
225#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 extentLayerChanged(QgsMapLayer *layer)
Emitted when the extent layer is changed.
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.
Base class for all map layer types.
Definition qgsmaplayer.h:76
A rectangle specified with double values.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
const QgsCoordinateReferenceSystem & outputCrs
const QgsCoordinateReferenceSystem & crs