QGIS API Documentation  3.8.0-Zanzibar (11aff65)
qgsdatumtransformdialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsdatumtransformdialog.h
3  -------------------------
4  begin : November 2013
5  copyright : (C) 2013 by Marco Hugentobler
6  email : marco.hugentobler at sourcepole dot ch
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSDATUMTRANSFORMDIALOG_H
19 #define QGSDATUMTRANSFORMDIALOG_H
20 
21 #include "ui_qgsdatumtransformdialogbase.h"
23 #include "qgscoordinatetransform.h"
24 #include "qgis_gui.h"
25 
27 
28 #define SIP_NO_FILE
29 
35 class GUI_EXPORT QgsDatumTransformDialog : public QDialog, private Ui::QgsDatumTransformDialogBase
36 {
37  Q_OBJECT
38  public:
39 
42  {
45 
47  int sourceTransformId = -1;
48 
51 
53  int destinationTransformId = -1;
54 
56  QString proj;
57  };
58 
70  static bool run( const QgsCoordinateReferenceSystem &sourceCrs = QgsCoordinateReferenceSystem(),
72  QWidget *parent = nullptr );
73 
74  // TODO QGIS 4.0 - remove selectedDatumTransform
75 
81  bool allowCrsChanges = false,
82  bool showMakeDefault = true,
83  bool forceChoice = true,
84  QPair<int, int> selectedDatumTransforms = qMakePair( -1, -1 ),
85  QWidget *parent = nullptr,
86  Qt::WindowFlags f = nullptr,
87  const QString &selectedProj = QString() );
88  ~QgsDatumTransformDialog() override;
89 
90  void accept() override;
91  void reject() override;
92 
97  TransformInfo selectedDatumTransform();
98 
99  private slots:
100 
101  void tableCurrentItemChanged( QTableWidgetItem *, QTableWidgetItem * );
102  void setSourceCrs( const QgsCoordinateReferenceSystem &sourceCrs );
103  void setDestinationCrs( const QgsCoordinateReferenceSystem &destinationCrs );
104 
105  private:
106 
107  enum Roles
108  {
109  TransformIdRole = Qt::UserRole + 1,
110  ProjRole,
111  };
112 
113  bool gridShiftTransformation( const QString &itemText ) const;
115  bool testGridShiftFileAvailability( QTableWidgetItem *item ) const;
116  void load( QPair<int, int> selectedDatumTransforms = qMakePair( -1, -1 ), const QString &selectedProj = QString() );
117  void setOKButtonEnabled();
118 
124  bool shouldAskUserForSelection() const;
125 
133  TransformInfo defaultDatumTransform() const;
134 
138  void applyDefaultTransform();
139 
140 #if PROJ_VERSION_MAJOR>=6
141  QList< QgsDatumTransform::TransformDetails > mDatumTransforms;
142 #else
143  QList< QgsDatumTransform::TransformPair > mDatumTransforms;
144 #endif
145  QgsCoordinateReferenceSystem mSourceCrs;
146  QgsCoordinateReferenceSystem mDestinationCrs;
147  std::unique_ptr< QgsTemporaryCursorRestoreOverride > mPreviousCursorOverride;
148 
149  friend class TestQgsDatumTransformDialog;
150 };
151 
152 #endif // QGSDATUMTRANSFORMDIALOG_H
Dialog transformation entry info.
QgsCoordinateReferenceSystem destinationCrs
Destination coordinate reference system.
QString proj
Proj coordinate operation description, for Proj >= 6.0 builds only.
QgsCoordinateReferenceSystem sourceCrs
Source coordinate reference system.
This class represents a coordinate reference system (CRS).
Temporarily removes all cursor overrides for the QApplication for the lifetime of the object...
Definition: qgsguiutils.h:235