QGIS API Documentation 3.99.0-Master (21b3aa880ba)
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:
43
52
53 ~QgsCrsSelectionWidget() override;
54
60
64 void setMessage( const QString &message );
65
71 void setShowNoCrs( bool show );
72
78 bool showNoCrs() const;
79
87 void setNotSetText( const QString &text, const QString &description = QString() );
88
92 bool hasValidSelection() const;
93
101
109
110 public slots:
111
117
130 void setOgcWmsCrsFilter( const QSet<QString> &crsFilter );
131
132 signals:
133
138
143
147 void hasValidSelectionChanged( bool isValid );
148
149 private:
150
154 enum class CrsType
155 {
156 Predefined,
157 Custom,
158 };
159
160 QString mNotSetText;
161 bool mShowNoCrsOption = false;
162 bool mDeferredInvalidCrsSet = false;
163 int mBlockSignals = 0;
164};
165
166
187class GUI_EXPORT QgsProjectionSelectionDialog : public QDialog
188{
189 Q_OBJECT
190 public:
191
200
206
212 void setMessage( const QString &message );
213
221
227 void setShowNoProjection( bool show );
228
234 bool showNoProjection() const;
235
245 void setNotSetText( const QString &text, const QString &description = QString() );
246
254
260 bool hasValidSelection() const;
261
269
277
278 public slots:
279
285
298 void setOgcWmsCrsFilter( const QSet<QString> &crsFilter );
299
300 private slots:
301
302 void showHelp();
303
304 private:
305 QDialogButtonBox *mButtonBox = nullptr;
306 QgsCrsSelectionWidget *mCrsWidget = nullptr;
307
308 bool mRequireValidSelection = false;
309};
310
311#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