-
Notifications
You must be signed in to change notification settings - Fork 0
/
qgsimagewarper.h
92 lines (77 loc) · 3.65 KB
/
qgsimagewarper.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
/***************************************************************************
qgsimagewarper.h
--------------------------------------
Date : Sun Sep 16 12:03:20 AKDT 2007
Copyright : (C) 2007 by Gary E. Sherman
Email : sherman at mrcc dot com
***************************************************************************
* *
* 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 QGSIMAGEWARPER_H
#define QGSIMAGEWARPER_H
#include <QCoreApplication>
#include <QString>
#include <gdalwarper.h>
#include <vector>
#include "qgspoint.h"
class QgsGeorefTransform;
class QProgressDialog;
class QWidget;
class QgsImageWarper
{
Q_DECLARE_TR_FUNCTIONS(QgsImageWarper);
public:
QgsImageWarper(QWidget *theParent);
enum ResamplingMethod
{
NearestNeighbour = GRA_NearestNeighbour,
Bilinear = GRA_Bilinear,
Cubic = GRA_Cubic,
CubicSpline = GRA_CubicSpline,
Lanczos = GRA_Lanczos
};
int warpFile( const QString& input,
const QString& output,
const QgsGeorefTransform &georefTransform,
ResamplingMethod resampling,
bool useZeroAsTrans,
const QString& compression,
const QString &projection);
private:
struct TransformChain {
GDALTransformerFunc GDALTransformer;
void * GDALTransformerArg;
double adfGeotransform[6];
double adfInvGeotransform[6];
};
//! \sa addGeoToPixelTransform
static int GeoToPixelTransform( void *pTransformerArg, int bDstToSrc, int nPointCount,
double *x, double *y, double *z, int *panSuccess );
/**
* \brief Appends a transform from geocoordinates to pixel/line coordinates to the given GDAL transformer.
*
* The resulting transform is the functional composition of the given GDAL transformer and the
* inverse geo transform.
* \sa destroyGeoToPixelTransform
* \returns Argument to use with the static GDAL callback \ref GeoToPixelTransform
*/
void *addGeoToPixelTransform(GDALTransformerFunc GDALTransformer, void *GDALTransformerArg, double *padfGeotransform) const;
void destroyGeoToPixelTransform(void *GeoToPixelTransfomArg) const;
bool openSrcDSAndGetWarpOpt(const QString &input, const ResamplingMethod &resampling,
const GDALTransformerFunc &pfnTransform, GDALDatasetH &hSrcDS,
GDALWarpOptions *&psWarpOptions);
bool createDestinationDataset(const QString &outputName, GDALDatasetH hSrcDS, GDALDatasetH &hDstDS, uint resX, uint resY,
double *adfGeoTransform, bool useZeroAsTrans, const QString& compression, const QString &projection);
QWidget *mParent;
void *createWarpProgressArg(QProgressDialog *progressDialog) const;
//! \brief GDAL progress callback, used to display warping progress via a QProgressDialog
static int CPL_STDCALL updateWarpProgress(double dfComplete, const char *pszMessage, void *pProgressArg);
static bool mWarpCanceled;
};
#endif