-
Notifications
You must be signed in to change notification settings - Fork 0
/
qgsgeorefplugingui.h
211 lines (173 loc) · 5.84 KB
/
qgsgeorefplugingui.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/***************************************************************************
* Copyright (C) 2003 by Tim Sutton *
* *
* This is a plugin generated from the QGIS plugin template *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
/* $Id$ */
#ifndef QGSGEOREFPLUGINGUI_H
#define QGSGEOREFPLUGINGUI_H
#include "ui_qgsgeorefpluginguibase.h"
#include "qgsgeoreftransform.h"
#include "qgsgcplist.h"
#include "qgsmapcoordsdialog.h"
#include "qgsimagewarper.h"
#include <QPointer>
class QAction;
class QActionGroup;
class QIcon;
class QPlainTextEdit;
class QLabel;
class QgisInterface;
class QgsGeorefDataPoint;
class QgsGCPListWidget;
class QgsMapTool;
class QgsMapCanvas;
class QgsMapCoordsDialog;
class QgsPoint;
class QgsRasterLayer;
class QgsRectangle;
class QgsGeorefPluginGui : public QMainWindow, private Ui::QgsGeorefPluginGuiBase
{
Q_OBJECT
public:
QgsGeorefPluginGui( QgisInterface* theQgisInterface, QWidget* parent = 0, Qt::WFlags fl = 0 );
~QgsGeorefPluginGui();
protected:
void closeEvent(QCloseEvent *);
private slots:
// file
void openRaster();
void doGeoreference();
void generateGDALScript();
bool getTransformSettings();
// edit
void setAddPointTool();
void setDeletePointTool();
void setMovePointTool();
// view
void setZoomInTool();
void setZoomOutTool();
void zoomToLayerTool();
void zoomToLast();
void zoomToNext();
void setPanTool();
void linkGeorefToQGis( bool link );
void linkQGisToGeoref( bool link );
// gcps
void addPoint( const QgsPoint& pixelCoords, const QgsPoint& mapCoords,
bool enable = true, bool refreshCanvas = true/*, bool verbose = true*/ );
void deleteDataPoint( const QPoint &pixelCoords );
void deleteDataPoint(int index);
void showCoordDialog( const QgsPoint &pixelCoords );
void selectPoint(const QPoint &);
void movePoint(const QPoint &);
void releasePoint(const QPoint &);
void loadGCPsDialog();
void saveGCPsDialog();
// settings
void showRasterPropertiesDialog();
void showGeorefConfigDialog();
// plugin info
void contextHelp();
// comfort
void jumpToGCP(uint theGCPIndex);
void extentsChangedGeorefCanvas();
void extentsChangedQGisCanvas();
// canvas info
void showMouseCoords(const QgsPoint pt);
void updateMouseCoordinatePrecision();
private:
enum SaveGCPs
{
GCPSAVE,
GCPSILENTSAVE,
GCPDISCARD,
GCPCANCEL
};
// gui
void createActions();
void createActionGroups();
void createMapCanvas();
void createMenus();
void createDockWidgets();
void createStatusBar();
void setupConnections();
// settings
void readSettings();
void writeSettings();
// gcp points
void loadGCPs(/*bool verbose = true*/);
void saveGCPs();
QgsGeorefPluginGui::SaveGCPs checkNeedGCPSave();
// georeference
bool georeference();
bool writeWorldFile(QgsPoint origin, double pixelXSize, double pixelYSize);
// gdal script
void showGDALScript(int argNum...);
QString gdal_translateCommand(bool generateTFW = true);
QString gdalwarpCommandGCP(QString resampling, QString compress, bool useZeroForTrans,
int order);
QString gdalwarpCommandTPS(QString resampling, QString compress, bool useZeroForTrans);
// log
void showMessageInLog(const QString &description, const QString &msg);
void clearLog();
// utils
bool checkReadyGeoref();
bool updateGeorefTransform();
QgsRectangle transformViewportBoundingBox(const QgsRectangle &canvasExtent, const QgsGeorefTransform &t,
bool rasterToWorld = true, uint numSamples = 4);
QString convertTransformEnumToString(QgsGeorefTransform::TransformParametrisation transform);
QString convertResamplingEnumToString(QgsImageWarper::ResamplingMethod resampling);
int polynomeOrder(QgsGeorefTransform::TransformParametrisation transform);
QString guessWorldFileName( const QString &rasterFileName );
QIcon getThemeIcon( const QString &theName );
bool checkFileExisting(QString fileName, QString title, QString question);
bool equalGCPlists(const QgsGCPList &list1, const QgsGCPList &list2);
void logTransformOptions();
void logRequaredGCPs();
void clearGCPData();
QMenu *mPanelMenu;
QMenu *mToolbarMenu;
// QPlainTextEdit *mLogViewer;
QAction *mActionHelp;
QgsGCPListWidget *mGCPListWidget;
QLineEdit *mScaleEdit;
QLabel *mScaleLabel;
QLabel *mCoordsLabel;
QLabel *mTransformParamLabel;
unsigned int mMousePrecisionDecimalPlaces;
QString mRasterFileName;
QString mModifiedRasterFileName;
QString mWorldFileName;
QString mTranslatedRasterFileName;
QString mGCPpointsFileName;
QString mProjection;
QgsGeorefTransform::TransformParametrisation mTransformParam;
QgsImageWarper::ResamplingMethod mResamplingMethod;
QgsGeorefTransform mGeorefTransform;
QString mCompressionMethod;
QgisInterface *mIface;
QgsGCPList mPoints;
QgsGCPList mInitialPoints;
QgsMapCanvas *mCanvas;
QgsRasterLayer *mLayer;
QgsMapTool *mToolZoomIn;
QgsMapTool *mToolZoomOut;
QgsMapTool *mToolPan;
QgsMapTool *mToolAddPoint;
QgsMapTool *mToolDeletePoint;
QgsMapTool *mToolMovePoint;
QgsGeorefDataPoint *mMovingPoint;
QPointer<QgsMapCoordsDialog> mMapCoordsDialog;
bool mUseZeroForTrans;
bool mExtentsChangedRecursionGuard;
bool mGCPsDirty;
bool mLoadInQgis;
};
#endif