QGIS API Documentation  3.13.0-Master (740be229cb)
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 "qgsguiutils.h"
25 #include "qgis_gui.h"
26 
27 #define SIP_NO_FILE
28 
34 class GUI_EXPORT QgsDatumTransformDialog : public QDialog, private Ui::QgsDatumTransformDialogBase
35 {
36  Q_OBJECT
37  public:
38 
41  {
44 
46  int sourceTransformId = -1;
47 
50 
52  int destinationTransformId = -1;
53 
55  QString proj;
56 
58  bool allowFallback = true;
59  };
60 
75  static bool run( const QgsCoordinateReferenceSystem &sourceCrs = QgsCoordinateReferenceSystem(),
77  QWidget *parent = nullptr,
78  QgsMapCanvas *mapCanvas = nullptr,
79  const QString &windowTitle = QString() );
80 
81  // TODO QGIS 4.0 - remove selectedDatumTransform, forceChoice
82 
88  bool allowCrsChanges = false,
89  bool showMakeDefault = true,
90  bool forceChoice = true,
91  QPair<int, int> selectedDatumTransforms = qMakePair( -1, -1 ),
92  QWidget *parent = nullptr,
93  Qt::WindowFlags f = nullptr,
94  const QString &selectedProj = QString(),
95  QgsMapCanvas *mapCanvas = nullptr,
96  bool allowFallback = true );
97 
98  void accept() override;
99  void reject() override;
100 
105  TransformInfo selectedDatumTransform();
106 
107  private slots:
108 
109  void operationChanged();
110  void setSourceCrs( const QgsCoordinateReferenceSystem &sourceCrs );
111  void setDestinationCrs( const QgsCoordinateReferenceSystem &destinationCrs );
112 
113  private:
114 
115  enum Roles
116  {
117  TransformIdRole = Qt::UserRole + 1,
118  ProjRole,
119  AvailableRole,
120  BoundsRole
121  };
122 
123  bool gridShiftTransformation( const QString &itemText ) const;
124 
125  void setOKButtonEnabled();
126 
132  bool shouldAskUserForSelection() const;
133 
141  TransformInfo defaultDatumTransform() const;
142 
146  void applyDefaultTransform();
147 
148  std::unique_ptr< QgsTemporaryCursorRestoreOverride > mPreviousCursorOverride;
149 
150  friend class TestQgsDatumTransformDialog;
151 };
152 
153 #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:78
QgsCoordinateReferenceSystem sourceCrs
Source coordinate reference system.
This class represents a coordinate reference system (CRS).