QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
qgscoordinateoperationwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscoordinateoperationwidget.h
3  ------------------------------
4  begin : December 2019
5  copyright : (C) 2019 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
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 QGSCOORDINATEOPERATIONWIDGET_H
19 #define QGSCOORDINATEOPERATIONWIDGET_H
20 
21 #include "ui_qgscoordinateoperationwidgetbase.h"
23 #include "qgis_gui.h"
24 
33 class GUI_EXPORT QgsCoordinateOperationWidget : public QWidget, private Ui::QgsCoordinateOperationWidgetBase
34 {
35  Q_OBJECT
36  public:
37 
40  {
42  int sourceTransformId = -1;
43 
45  int destinationTransformId = -1;
46 
48  QString proj;
49 
51  bool isAvailable = true;
52 
54  bool allowFallback = true;
55  };
56 
60  QgsCoordinateOperationWidget( QWidget *parent = nullptr );
61 
62  ~QgsCoordinateOperationWidget() override;
63 
70  QgsCoordinateReferenceSystem sourceCrs() const { return mSourceCrs; }
71 
78  QgsCoordinateReferenceSystem destinationCrs() const { return mDestinationCrs; }
79 
86  void setSourceCrs( const QgsCoordinateReferenceSystem &crs );
87 
94  void setDestinationCrs( const QgsCoordinateReferenceSystem &crs );
95 
100  void setMapCanvas( QgsMapCanvas *canvas );
101 
105  void setShowMakeDefault( bool show );
106 
110  bool makeDefaultSelected() const;
111 
115  bool hasSelection() const;
116 
120  QList< QgsCoordinateOperationWidget::OperationDetails > availableOperations() const;
121 
125  QgsCoordinateOperationWidget::OperationDetails defaultOperation() const;
126 
131  QgsCoordinateOperationWidget::OperationDetails selectedOperation() const;
132 
137  void setSelectedOperation( const QgsCoordinateOperationWidget::OperationDetails &operation );
138 
145  void setSelectedOperationUsingContext( const QgsCoordinateTransformContext &context );
146 
152  void setShowFallbackOption( bool visible );
153 
154  signals:
155 
160 
165 
166  private slots:
167 
168  void tableCurrentItemChanged( QTableWidgetItem *, QTableWidgetItem * );
169 
170  void showSupersededToggled( bool toggled );
171 
172  void installGrid();
173 
174  private:
175 
176  enum Roles
177  {
178  TransformIdRole = Qt::UserRole + 1,
179  ProjRole,
180  AvailableRole,
181  BoundsRole,
182  MissingGridsRole,
183  MissingGridPackageNamesRole,
184  MissingGridUrlsRole
185  };
186 
187  bool gridShiftTransformation( const QString &itemText ) const;
189  bool testGridShiftFileAvailability( QTableWidgetItem *item ) const;
190  void loadAvailableOperations();
191 
195  QString formatScope( const QString &scope );
196 
197  QList< QgsDatumTransform::TransformDetails > mDatumTransforms;
198 
199  QgsCoordinateReferenceSystem mSourceCrs;
200  QgsCoordinateReferenceSystem mDestinationCrs;
201  OperationDetails mPreviousOp;
202  int mBlockSignals = 0;
203 };
204 
205 #endif // QGSCOORDINATEOPERATIONWIDGET_H
A widget for selecting the coordinate operation to use when transforming between a source and destina...
QgsCoordinateReferenceSystem sourceCrs() const
Returns the source CRS for the operations shown in the widget.
void operationChanged()
Emitted when the operation selected in the dialog is changed.
void operationDoubleClicked()
Emitted when an operation is double-clicked in the widget.
QgsCoordinateReferenceSystem destinationCrs() const
Returns the destination CRS for the operations shown in the widget.
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:89
const QgsCoordinateReferenceSystem & crs
QString proj
Proj coordinate operation description, for Proj >= 6.0 builds only.