QGIS API Documentation 4.3.0-Master (bf28115e945)
Loading...
Searching...
No Matches
qgsprojectionselectiondialog.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsgenericprojectionselector.h
3 Set user defined projection using projection selector widget
4 -------------------
5 begin : May 28, 2004
6 copyright : (C) 2004 by Gary E.Sherman
7 email : sherman at mrcc.com
8 ***************************************************************************/
9
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18#ifndef QGSGENERICPROJECTIONSELECTOR_H
19#define QGSGENERICPROJECTIONSELECTOR_H
20#include "ui_qgsgenericprojectionselectorbase.h"
21
22#include "qgis_gui.h"
23#include "qgis_sip.h"
25#include "qgsguiutils.h"
26
27#include <QDialog>
28#include <QSet>
29
30class QDialogButtonBox;
31class QgsRectangle;
32
40class GUI_EXPORT QgsCrsSelectionWidget : public QgsPanelWidget, private Ui::QgsGenericProjectionSelectorBase
41{
42 Q_OBJECT
43 public:
52 QWidget *parent SIP_TRANSFERTHIS = nullptr,
54 );
55
56 ~QgsCrsSelectionWidget() override;
57
63
67 void setMessage( const QString &message );
68
74 void setShowNoCrs( bool show );
75
81 bool showNoCrs() const;
82
90 void setNotSetText( const QString &text, const QString &description = QString() );
91
95 bool hasValidSelection() const;
96
104
112
120 void setAllowTopocentricCrs( bool allow );
121
127 void setPreviewRect( const QgsRectangle &rect );
128
129 public slots:
130
136
149 void setOgcWmsCrsFilter( const QSet<QString> &crsFilter );
150
151 signals:
152
157
162
166 void hasValidSelectionChanged( bool isValid );
167
168 private:
172 enum class CrsType
173 {
174 Predefined,
175 Custom,
176 Topocentric,
177 };
178
179 QString mNotSetText;
180 bool mShowNoCrsOption = false;
181 bool mDeferredInvalidCrsSet = false;
182 bool mAllowTopocentricCrs = true;
183 int mBlockSignals = 0;
184};
185
186
207class GUI_EXPORT QgsProjectionSelectionDialog : public QDialog
208{
209 Q_OBJECT
210 public:
219 QWidget *parent SIP_TRANSFERTHIS = nullptr,
220 Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags,
222 );
223
229
235 void setMessage( const QString &message );
236
244
250 void setShowNoProjection( bool show );
251
257 bool showNoProjection() const;
258
268 void setNotSetText( const QString &text, const QString &description = QString() );
269
277
283 bool hasValidSelection() const;
284
292
300
307 void setAllowTopocentricCrs( bool allow );
308
309 public slots:
310
316
329 void setOgcWmsCrsFilter( const QSet<QString> &crsFilter );
330
331 private slots:
332
333 void showHelp();
334
335 private:
336 QDialogButtonBox *mButtonBox = nullptr;
337 QgsCrsSelectionWidget *mCrsWidget = nullptr;
338
339 bool mRequireValidSelection = false;
340};
341
342#endif // #ifndef QGSLAYERCRSSELECTOR_H
@ FilterHorizontal
Include horizontal CRS (excludes compound CRS containing a horizontal component).
Represents a coordinate reference system (CRS).
A generic widget allowing users to pick a Coordinate Reference System (or define their own).
bool showNoCrs() const
Returns whether the "no/invalid" CRS option is shown.
QgsCoordinateReferenceSystem crs() const
Returns the CRS currently selected in the widget.
void setAllowTopocentricCrs(bool allow)
Sets whether the topocentric CRS type option is shown in the widget's CRS type combobox.
void hasValidSelectionChanged(bool isValid)
Emitted when the widget has a valid selection or not.
QgsCrsSelectionWidget(QWidget *parent=nullptr, QgsCoordinateReferenceSystemProxyModel::Filters filters=QgsCoordinateReferenceSystemProxyModel::FilterHorizontal|QgsCoordinateReferenceSystemProxyModel::FilterCompound)
Constructor for QgsCrsSelectionWidget, with the specified parent widget.
QgsCoordinateReferenceSystemProxyModel::Filters filters() const
Returns the filters set on the available CRS.
void setFilters(QgsCoordinateReferenceSystemProxyModel::Filters filters)
Sets filters for the available CRS.
void crsDoubleClicked(const QgsCoordinateReferenceSystem &crs)
Emitted when a CRS entry in the widget is double-clicked.
void setShowNoCrs(bool show)
Sets whether a "no/invalid" CRS option should be shown.
void crsChanged()
Emitted when the CRS defined in the widget is changed.
void setMessage(const QString &message)
Sets a message to show in the dialog.
bool hasValidSelection() const
Returns true if the widget has a valid CRS defined.
void setNotSetText(const QString &text, const QString &description=QString())
Sets the text to show for the not set option.
void setOgcWmsCrsFilter(const QSet< QString > &crsFilter)
filters this dialog by the given CRSs
void setPreviewRect(const QgsRectangle &rect)
Sets the visible area to use when showing a preview of the CRS in the widget.
void setCrs(const QgsCoordinateReferenceSystem &crs)
Sets the crs to show within the widget.
QgsPanelWidget(QWidget *parent=nullptr)
Base class for any widget that can be shown as an inline panel.
void showNoCrsForLayerMessage()
When called, the dialog will show a default "layer has no CRS set" message above the projection selec...
void setShowNoProjection(bool show)
Sets whether a "no/invalid" projection option should be shown.
bool showNoProjection() const
Returns whether the "no/invalid" projection option is shown.
QgsCoordinateReferenceSystemProxyModel::Filters filters() const
Returns the filters set on the available CRS.
bool hasValidSelection() const
Returns true if the dialog has a valid CRS defined.
void setNotSetText(const QString &text, const QString &description=QString())
Sets the text to show for the not set option.
void setCrs(const QgsCoordinateReferenceSystem &crs)
Sets the initial crs to show within the dialog.
void setMessage(const QString &message)
Sets a message to show in the dialog.
QgsCoordinateReferenceSystem crs() const
Returns the CRS currently selected in the widget.
QgsProjectionSelectionDialog(QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags, QgsCoordinateReferenceSystemProxyModel::Filters filters=QgsCoordinateReferenceSystemProxyModel::FilterHorizontal|QgsCoordinateReferenceSystemProxyModel::FilterCompound)
Constructor for QgsProjectionSelectionDialog.
void setRequireValidSelection()
Sets the dialog to require a valid selection only, preventing users from accepting the dialog if no s...
void setOgcWmsCrsFilter(const QSet< QString > &crsFilter)
filters this dialog by the given CRSs
void setFilters(QgsCoordinateReferenceSystemProxyModel::Filters filters)
Sets filters for the available CRS.
void setAllowTopocentricCrs(bool allow)
Sets whether the topocentric CRS type option is shown in the dialog.
A rectangle specified with double values.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52