QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
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 
73  static bool run( const QgsCoordinateReferenceSystem &sourceCrs = QgsCoordinateReferenceSystem(),
75  QWidget *parent = nullptr,
76  QgsMapCanvas *mapCanvas = nullptr,
77  const QString &windowTitle = QString() );
78 
79  // TODO QGIS 4.0 - remove selectedDatumTransform
80 
86  bool allowCrsChanges = false,
87  bool showMakeDefault = true,
88  bool forceChoice = true,
89  QPair<int, int> selectedDatumTransforms = qMakePair( -1, -1 ),
90  QWidget *parent = nullptr,
91  Qt::WindowFlags f = nullptr,
92  const QString &selectedProj = QString(),
93  QgsMapCanvas *mapCanvas = nullptr );
94  ~QgsDatumTransformDialog() override;
95 
96  void accept() override;
97  void reject() override;
98 
103  TransformInfo selectedDatumTransform();
104 
105  private slots:
106 
107  void tableCurrentItemChanged( QTableWidgetItem *, QTableWidgetItem * );
108  void setSourceCrs( const QgsCoordinateReferenceSystem &sourceCrs );
109  void setDestinationCrs( const QgsCoordinateReferenceSystem &destinationCrs );
110  void showSupersededToggled( bool toggled );
111 
112  private:
113 
114  enum Roles
115  {
116  TransformIdRole = Qt::UserRole + 1,
117  ProjRole,
118  AvailableRole,
119  BoundsRole
120  };
121 
122  bool gridShiftTransformation( const QString &itemText ) const;
124  bool testGridShiftFileAvailability( QTableWidgetItem *item ) const;
125  void load( QPair<int, int> selectedDatumTransforms = qMakePair( -1, -1 ), const QString &selectedProj = QString() );
126  void setOKButtonEnabled();
127 
133  bool shouldAskUserForSelection() const;
134 
142  TransformInfo defaultDatumTransform() const;
143 
147  void applyDefaultTransform();
148 
152  QString formatScope( const QString &scope );
153 
154 #if PROJ_VERSION_MAJOR>=6
155  QList< QgsDatumTransform::TransformDetails > mDatumTransforms;
156 #else
157  QList< QgsDatumTransform::TransformPair > mDatumTransforms;
158 #endif
159  QgsCoordinateReferenceSystem mSourceCrs;
160  QgsCoordinateReferenceSystem mDestinationCrs;
161  std::unique_ptr< QgsTemporaryCursorRestoreOverride > mPreviousCursorOverride;
162 
163  friend class TestQgsDatumTransformDialog;
164 };
165 
166 #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.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:75
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