QGIS API Documentation 4.1.0-Master (5bf3c20f3c9)
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 QWidget *parent SIP_TRANSFERTHIS = nullptr,
53 );
54
55 ~QgsCrsSelectionWidget() override;
56
62
66 void setMessage( const QString &message );
67
73 void setShowNoCrs( bool show );
74
80 bool showNoCrs() const;
81
89 void setNotSetText( const QString &text, const QString &description = QString() );
90
94 bool hasValidSelection() const;
95
103
111
112 public slots:
113
119
132 void setOgcWmsCrsFilter( const QSet<QString> &crsFilter );
133
134 signals:
135
140
145
149 void hasValidSelectionChanged( bool isValid );
150
151 private:
155 enum class CrsType
156 {
157 Predefined,
158 Custom,
159 };
160
161 QString mNotSetText;
162 bool mShowNoCrsOption = false;
163 bool mDeferredInvalidCrsSet = false;
164 int mBlockSignals = 0;
165};
166
167
188class GUI_EXPORT QgsProjectionSelectionDialog : public QDialog
189{
190 Q_OBJECT
191 public:
200 QWidget *parent SIP_TRANSFERTHIS = nullptr,
201 Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags,
203 );
204
210
216 void setMessage( const QString &message );
217
225
231 void setShowNoProjection( bool show );
232
238 bool showNoProjection() const;
239
249 void setNotSetText( const QString &text, const QString &description = QString() );
250
258
264 bool hasValidSelection() const;
265
273
281
282 public slots:
283
289
302 void setOgcWmsCrsFilter( const QSet<QString> &crsFilter );
303
304 private slots:
305
306 void showHelp();
307
308 private:
309 QDialogButtonBox *mButtonBox = nullptr;
310 QgsCrsSelectionWidget *mCrsWidget = nullptr;
311
312 bool mRequireValidSelection = false;
313};
314
315#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:52