~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/plugins/georeferencer/qgsimagewarper.h

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
     qgsimagewarper.h
 
3
     --------------------------------------
 
4
   Date                 : Sun Sep 16 12:03:20 AKDT 2007
 
5
    Copyright            : (C) 2007 by Gary E. Sherman
 
6
    Email                : sherman at mrcc dot com
 
7
 ***************************************************************************
 
8
 *                                                                         *
 
9
 *   This program is free software; you can redistribute it and/or modify  *
 
10
 *   it under the terms of the GNU General Public License as published by  *
 
11
 *   the Free Software Foundation; either version 2 of the License, or     *
 
12
 *   (at your option) any later version.                                   *
 
13
 *                                                                         *
 
14
 ***************************************************************************/
 
15
 
1
16
#ifndef QGSIMAGEWARPER_H
2
17
#define QGSIMAGEWARPER_H
3
18
 
4
19
#include <gdalwarper.h>
5
20
#include <QString>
6
21
 
7
 
 
8
 
class QgsImageWarper {
9
 
public:
10
 
  
11
 
  enum ResamplingMethod {
12
 
    NearestNeighbour = GRA_NearestNeighbour,
13
 
    Bilinear = GRA_Bilinear,
14
 
    Cubic = GRA_Cubic
15
 
  };
16
 
  
17
 
  
18
 
  QgsImageWarper(double angle) : mAngle(angle) { }
19
 
  
20
 
  void warp(const QString& input, const QString& output, 
21
 
            double& xOffset, double& yOffset, 
22
 
            ResamplingMethod resampling = Bilinear, bool useZeroAsTrans = true);
23
 
  
24
 
private:
25
 
  
26
 
  struct TransformParameters {
27
 
    double angle;
28
 
    double x0;
29
 
    double y0;
30
 
  };
31
 
 
32
 
  
33
 
  static int transform(void *pTransformerArg, int bDstToSrc, int nPointCount, 
34
 
                       double *x, double *y, double *z, int *panSuccess);
35
 
  
36
 
  double mAngle;
37
 
  
 
22
#include <vector>
 
23
#include "qgspoint.h"
 
24
 
 
25
class QgsImageWarper
 
26
{
 
27
  public:
 
28
 
 
29
    enum ResamplingMethod
 
30
    {
 
31
      NearestNeighbour = GRA_NearestNeighbour,
 
32
      Bilinear = GRA_Bilinear,
 
33
      Cubic = GRA_Cubic,
 
34
    };
 
35
 
 
36
 
 
37
    QgsImageWarper() { };
 
38
    QgsImageWarper( double angle ) : mAngle( angle ) { };
 
39
 
 
40
    void warp( const QString& input, const QString& output,
 
41
               double& xOffset, double& yOffset,
 
42
               ResamplingMethod resampling = Bilinear,
 
43
               bool useZeroAsTrans = true,
 
44
               const QString& compression = "NONE" );
 
45
 
 
46
    bool warpgcp( const QString& input, const QString& output,
 
47
                  const char *worldExt,
 
48
                  std::vector<QgsPoint> mapCoords,
 
49
                  std::vector<QgsPoint> pixelCoords,
 
50
                  const int nReqOrder = 1, ResamplingMethod resampling = Bilinear,
 
51
                  bool useZeroAsTrans = true, const QString& compression = "NONE",
 
52
                  bool bUseTPS = false );
 
53
 
 
54
  private:
 
55
 
 
56
    struct TransformParameters
 
57
    {
 
58
      double angle;
 
59
      double x0;
 
60
      double y0;
 
61
    };
 
62
 
 
63
    bool openSrcDSAndGetWarpOpt( const QString &input, const QString &output,
 
64
                                 const ResamplingMethod &resampling, const GDALTransformerFunc &pfnTransform,
 
65
                                 GDALDatasetH &hSrcDS, GDALWarpOptions *&psWarpOptions );
 
66
 
 
67
    static int transform( void *pTransformerArg, int bDstToSrc, int nPointCount,
 
68
                          double *x, double *y, double *z, int *panSuccess );
 
69
 
 
70
    double mAngle;
 
71
 
38
72
};
39
73
 
40
74