QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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;
31
39class GUI_EXPORT QgsCrsSelectionWidget : public QgsPanelWidget, private Ui::QgsGenericProjectionSelectorBase
40{
41 Q_OBJECT
42 public:
51
52 ~QgsCrsSelectionWidget() override;
53
59
63 void setMessage( const QString &message );
64
70 void setShowNoCrs( bool show );
71
77 bool showNoCrs() const;
78
86 void setNotSetText( const QString &text, const QString &description = QString() );
87
91 bool hasValidSelection() const;
92
100
108
109 public slots:
110
116
129 void setOgcWmsCrsFilter( const QSet<QString> &crsFilter );
130
131 signals:
132
137
142
146 void hasValidSelectionChanged( bool isValid );
147
148 private:
152 enum class CrsType
153 {
154 Predefined,
155 Custom,
156 };
157
158 QString mNotSetText;
159 bool mShowNoCrsOption = false;
160 bool mDeferredInvalidCrsSet = false;
161 int mBlockSignals = 0;
162};
163
164
185class GUI_EXPORT QgsProjectionSelectionDialog : public QDialog
186{
187 Q_OBJECT
188 public:
197
203
209 void setMessage( const QString &message );
210
218
224 void setShowNoProjection( bool show );
225
231 bool showNoProjection() const;
232
242 void setNotSetText( const QString &text, const QString &description = QString() );
243
251
257 bool hasValidSelection() const;
258
266
274
275 public slots:
276
282
295 void setOgcWmsCrsFilter( const QSet<QString> &crsFilter );
296
297 private slots:
298
299 void showHelp();
300
301 private:
302 QDialogButtonBox *mButtonBox = nullptr;
303 QgsCrsSelectionWidget *mCrsWidget = nullptr;
304
305 bool mRequireValidSelection = false;
306};
307
308#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 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 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.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53