autogcp.patch

Patch file to add AutoGCP library to QGIS. Execute from root sources (qgis/) directory - jamesm6162 -, 2010-09-08 01:39 AM

Download (219 KB)

View differences:

python/autogcp/qgsgcpdataset.sip (revision 0)
1
/***************************************************************************
2
qgsgcpdataset.cpp - This is a container class that represents an entire set of
3
 GCP's associated with a specific reference model or a specific extraction
4
 and cross-referencing operation.
5
--------------------------------------
6
Date : 07-May-2010
7
Copyright : (C) 2010 by FoxHat Solutions
8
Author: Christoph Stallmann (FoxHat Solutions)
9
Email : [email protected]
10
/***************************************************************************
11
* *
12
* This program is free software; you can redistribute it and/or modify *
13
* it under the terms of the GNU General Public License as published by *
14
* the Free Software Foundation; either version 2 of the License, or *
15
* (at your option) any later version. *
16
* *
17
***************************************************************************/
18
%Import QtCore/QtCoremod.sip 
19
class QgsGCPDataSet
20
{
21

  
22
%TypeHeaderCode
23
#include <qgsgcpdataset.h>
24
%End
25

  
26
public:
27
  QgsGCPDataSet();
28
  virtual ~QgsGCPDataSet();
29
  void addGcp(QgsGCP* point);
30
  void updateGcp(QgsGCP* oldPoint, QgsGCP* newPoint);
31
  void removeGcp(QgsGCP* point);  
32
  void clear();
33
  int size() const;   
34
  const QList<QgsGCP*>& constList() const;
35
  QList<QgsGCP*> list();
36
};
37

  
python/autogcp/qgselevationmanager.sip (revision 0)
1
/***************************************************************************
2
qgselevationmanager.sip - The ElevationManager contains a Digital Elevation
3
 Model of a specific reference image and allows sampling of the ground
4
 elevation at different coordinates. This DEM is used in the orthorectification
5
 process as well as chip projection.
6
--------------------------------------
7
Date : 07-May-2010
8
Copyright : (C) 2010 by FoxHat Solutions
9
Author: Christoph Stallmann (FoxHat Solutions)
10
Email : [email protected]
11
/***************************************************************************
12
* *
13
* This program is free software; you can redistribute it and/or modify *
14
* it under the terms of the GNU General Public License as published by *
15
* the Free Software Foundation; either version 2 of the License, or *
16
* (at your option) any later version. *
17
* *
18
***************************************************************************/
19

  
20
class QgsElevationManager
21
{
22

  
23
%TypeHeaderCode
24
#include <qgselevationmanager.h>
25
%End
26

  
27
public:
28
    QgsElevationManager();
29
    double sampleHeight(int,int);
30
    void openDEMFile(QString);
31
    virtual ~QgsElevationManager();
32

  
33
};
34

  
python/autogcp/qgsimagechip.sip (revision 0)
1
/***************************************************************************
2
qgsgcp.sip - A Ground Control Point (GCP) abstraction contains information about
3
 a specific GCP such as the reference and associated raw coordinates of this
4
 GCP, as well as additional elevation and other information. This object is
5
 also the container for the GCP chip data.
6
--------------------------------------
7
Date : 07-May-2010
8
Copyright : (C) 2010 by FoxHat Solutions
9
Author: James Meyer
10
Email : [email protected]
11
E
12
/***************************************************************************
13
* *
14
* This program is free software; you can redistribute it and/or modify *
15
* it under the terms of the GNU General Public License as published by *
16
* the Free Software Foundation; either version 2 of the License, or *
17
* (at your option) any later version. *
18
* *
19
***************************************************************************/
20

  
21
class QgsImageChip : QgsImageDataSet
22
{
23

  
24
%TypeHeaderCode
25
#include <qgsimagechip.h>
26
#include <qgsimagedataset.h>
27
%End
28

  
29
public:
30

  
31
//   static QgsImageChip* createImageChip(int width, int height, int type,  int bands = 3);
32
  ~QgsImageChip();
33
  QgsImageChip(const QgsImageChip& other);
34
  
35
  void* data();
36
};
37

  
38

  
python/autogcp/qgscrosscorrelator.sip (revision 0)
1
/***************************************************************************
2
qgscrosscorrelator.cpp - This class handles the cross correlation of two
3
subimages.
4
--------------------------------------
5
Date : 12-July-2010
6
Copyright : (C) 2010 by FoxHat Solutions
7
Email : [email protected]
8
/***************************************************************************
9
* *
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
14
* *
15
***************************************************************************/
16

  
17
class QgsCrossCorrelator
18
{
19

  
20
%TypeHeaderCode
21
#include <qgscrosscorrelator.h>
22
%End
23

  
24
public:
25
       /**\brief QgsCrossCorrelator Constructor
26
       Constructs the correlator with the given chip images
27
	   */
28
       QgsCrossCorrelator(QgsImageDataSet* ref, QgsImageDataSet* raw);
29
       /**\brief QgsCrossCorrelator Destructor
30
	   Destroys the QgsCrossCorrelator instance, releasing any owned resources.
31
	   */
32
       virtual ~QgsCrossCorrelator();
33
       
34
       double correlationValue();
35
  
36
}; 
python/autogcp/autogcp.sip (revision 0)
1

  
2
%Module qgis.autogcp 0
3

  
4
%Import QtCore/QtCoremod.sip
5
%Import QtGui/QtGuimod.sip
6
%Import QtXml/QtXmlmod.sip
7

  
8
%Import core/core.sip
9

  
10
%Include qgsautogcpmanager.sip
11
%Include qgsdatarow.sip
12
%Include qgselevationmanager.sip
13
%Include qgsgcp.sip
14
%Include qgsgcpdataset.sip
15
%Include qgsimageanalyzer.sip
16
%Include qgsimagedataset.sip
17
%Include qgsorthorectification.sip
18
%Include qgswaveletextractor.sip
19
%Include qgssalientpoint.sip
20
%Include qgsimagechip.sip
21
%Include qgsprojectionmanager.sip
22
%Include qgscrosscorrelator.sip
23

  
python/autogcp/qgsimageanalyzer.sip (revision 0)
1
/***************************************************************************
2
qgsimageanalyzer.sip - The ImageAnalyzer class is responsible for the physical
3
 analysis and processing of image data. This included detecting and extracting
4
 GCP's and GCP chips from images, as well as searching for these reference
5
 GCP chips on a raw image.
6
--------------------------------------
7
Date : 07-May-2010
8
Copyright : (C) 2010 by FoxHat Solutions
9
Author: Christoph Stallmann (FoxHat Solutions)
10
Email : [email protected]
11
/***************************************************************************
12
* *
13
* This program is free software; you can redistribute it and/or modify *
14
* it under the terms of the GNU General Public License as published by *
15
* the Free Software Foundation; either version 2 of the License, or *
16
* (at your option) any later version. *
17
* *
18
***************************************************************************/
19

  
20
class QgsImageAnalyzer
21
{
22

  
23
%TypeHeaderCode
24
#include <qgsimageanalyzer.h>
25
%End
26

  
27
public:
28
  /*! \brief QgsImageAnalyzer Constructor
29
  Constructs an analyzer for the supplied image, ready to perform processing on this image.
30
  */
31
	QgsImageAnalyzer(QgsImageDataSet* image = 0);
32
  /*! \brief Extracts ground control points from the assigned image.
33
  This method allocates a new QgsGCPDataSet and transfers ownership to the caller.
34
  The GCP's contained in this set will have geographic reference coordinates and a usable Chip for matching.
35
  If this method fails it returns an ampty set.
36
  */
37
	QgsGCPDataSet* extractGcps(int amount);
38
  /*! \brief Matches the supplied GCP set to the image dataset, using the GCP chips.
39
  If the method was successful the supplied GCP set will have it's raw coordinates updated.
40
  \param A pointer to the GCP set to use and update.
41
  \return A pointer to the supplied GCP set, with updated coordinates, or NULL on failure
42
  */
43
	QgsGCPDataSet* matchGcps(QgsGCPDataSet* gcpSet);
44
  /*! \brief Sets the image dataset of this analyzer.
45
  This can be used to change the image between operations, to enable reuse of the same QgsImageAnalyzer object.
46
  */
47
	void setImage(QgsImageDataSet* image);
48
  /*! \brief QgsImageAnalyzer Destructor
49
  */
50
	virtual ~QgsImageAnalyzer();
51
};
52

  
python/autogcp/qgsimagedataset.sip (revision 0)
1
/***************************************************************************
2
qgsimagedataset.sip - This class contains all external data related to an image
3
 including the sensor model associated to the particular image.
4
--------------------------------------
5
Date : 07-May-2010
6
Copyright : (C) 2010 by FoxHat Solutions
7
Author: Christoph Stallmann (FoxHat Solutions)
8
Email : [email protected]
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
class GDALDataset;
18
class QgsImageDataSet
19
{
20

  
21
%TypeHeaderCode
22
#include <qgsimagedataset.h>
23
%End
24

  
25
public:
26
    QgsImageDataSet(QString path);
27
    QgsImageDataSet(GDALDataset* path);
28
    virtual ~QgsImageDataSet();
29
    	/**\brief Returns a pointer to the internal GDALDataset instance or NULL if initialization failed*/
30
	//GDALDataset* gdalDataset();
31
	/**\brief Returns true if this object failed to initialize with the given file*/
32
	bool failed() const;
33
	/**\brief Returns the same as failed()*/
34
//	bool operator!() const;
35
  /*!\brief Gets the width and height of the raster image in pixels
36
  Returns the width through the xSize reference parameter and the height through ySize.
37
  If the image did not load or initialize correctly it does nothing.
38
  Use failed() to check validity of the object.
39
**/
40
  void imageSize(int& xSize, int& ySize) const;
41
  int imageXSize() const;
42
  int imageYSize() const;
43
  /*! \brief Gets the number of raster bands in the image.
44
  Returns the number of rasterbands in the image or 0 if it hasn't been initialized.
45
  */
46
  int rasterBands();
47
  
48
  /*! \brief Reads the value of the image at a specified point  
49
  */
50
  double readValue(int band, int xPixel, int yLine);
51
};
52

  
python/autogcp/qgsconnector.sip (revision 0)
1
/***************************************************************************
2
qgsgcpconnector.sip - This is an abstract class that provides an interface for
3
 dealing directly with the underlying database. This includes methods for
4
 creating, reading, updating and deleting data. This class must be extended
5
 for specific database engines. Two included specialisations are planned,
6
 namely the PostgreSQLConnector and the SQLiteConnector.
7
--------------------------------------
8
Date : 07-May-2010
9
Copyright : (C) 2010 by FoxHat Solutions
10
Author: Christoph Stallmann (FoxHat Solutions)
11
Email : [email protected]
12
/***************************************************************************
13
* *
14
* This program is free software; you can redistribute it and/or modify *
15
* it under the terms of the GNU General Public License as published by *
16
* the Free Software Foundation; either version 2 of the License, or *
17
* (at your option) any later version. *
18
* *
19
***************************************************************************/
20

  
21
class QgsGCPConnector
22
{
23

  
24
%TypeHeaderCode
25
#include <qgsconnector.h>
26
%End
27

  
28
public:
29
    QgsGCPConnector();
30
    virtual void insertRow(QgsDataRow);
31
    virtual void updateRow(QgsDataRow);
32
    virtual void selectRow(QgsDataRow);
33
    virtual void deleteRow(QgsDataRow);
34

  
35
};
python/autogcp/qgsautogcpmanager.sip (revision 0)
1
/***************************************************************************
2
qgsautogcpmanager.sip - This class manages the operations that need to be performed by
3
 the plug-in interface. Due to the clear separation of the core analysis
4
 classes and the plugin-specific user interface classes, a bridge is required
5
 between these different libraries. This class acts as the bridge, and removes
6
 any business logic from the presentational duties of the UI classes. This is
7
 done by delegating more specific operations to dedicated classes in the core
8
 package.
9
--------------------------------------
10
Date : 07-May-2010
11
Copyright : (C) 2010 by FoxHat Solutions
12
Author: Christoph Stallmann (FoxHat Solutions)
13
Email : [email protected]
14
Last Modified: 25/07/2010
15
/***************************************************************************
16
* *
17
* This program is free software; you can redistribute it and/or modify *
18
* it under the terms of the GNU General Public License as published by *
19
* the Free Software Foundation; either version 2 of the License, or *
20
* (at your option) any later version. *
21
* *
22
***************************************************************************/
23

  
24
struct IMAGE_INFO
25
{
26
%TypeHeaderCode
27
#include <qgsautogcpmanager.h>
28
%End
29
  QString pFileName;
30
  QString pFilePath;
31
  QString pFileFormat;
32
  QString pFileSize;
33
  QString pRasterWidth;
34
  QString pRasterHeight;
35
  QString pOriginCoordinates;
36
  QString pPixelSize;
37
  QDateTime pDateCreated;
38
  QDateTime pDateModified;
39
  QDateTime pDateRead;
40
  QString pRasterBands;
41
  QString pProjectionInfo;
42
};
43

  
44
class QgsAutoGCPManager
45
{
46

  
47
%TypeHeaderCode
48
#include <qgsautogcpmanager.h>
49
%End
50

  
51
public:
52
  QgsAutoGCPManager();
53
  /*! \brief  Opens the sensed (raw) image to use
54
  */
55
  bool openSensedImage(QString path);
56
  /*! \brief  Opens the reference (control) image to use
57
  */
58
  bool openReferenceImage(QString path);
59
  /*! \brief  Sets the Sensor model string
60
  The actual sensor model will be loaded from the registry using this string.
61
  */
62
  void setSensorModel(QString sensorModel);
63
  /*! \brief  Sets the amount of GCP's to extract from the reference image.
64
  */
65
  void setGcpCount(int count);
66
  void clearGcpSet();
67
  /*! \brief  Performs the extraction of Ground Control Points from the reference image.
68
  This class is the owner of the returned dataset and destroys it when itself is destroyed.
69
  \return A pointer to the managed GCP set.
70
  */
71
  QgsGCPDataSet* extractControlPoints();
72
  /*! \brief  Matches the current set of owned GCP's to the raw image
73
  This class is the owner of the returned dataset and destroys it when itself is destroyed.
74
  \return A pointer to the managed GCP set, or NULL if the operation failed.
75
  */
76
  QgsGCPDataSet* matchControlPoints();
77
  /*! \brief  Gets a pointer to the managed GCP set
78
  This class is the owner of the returned dataset and destroys it when itself is destroyed.
79
  \return A pointer to the managed GCP set.
80
  */
81
  QgsGCPDataSet* gcpSet();
82
   /*! \brief  Returns the raw image. 
83
  Return a pointer to the QgsImageDataSet containing the raw image dataset.
84
  */
85
  QgsImageDataSet* rawImage();
86
  /*! \brief  Returns the reference image. 
87
  Return a pointer to the QgsImageDataSet containing the reference image dataset.
88
  */
89
  QgsImageDataSet* referenceImage();
90
  /*! \brief  QgsAutoGCPManager destructor. 
91
  Deallocates all datasets created from any operations.
92
  */
93
  virtual ~QgsAutoGCPManager();
94

  
95
  void projectGCPs();
96
  bool setProjection(QgsImageDataSet *imageDataset, PROJ_INFO *projectionInfo);
97
  
98
  bool exportGcpSet(QString path);
99
  bool exportGcpSet(QgsGCPDataSet *gcpSet, QString path);
100
  void addGcp(QgsGCP *gcp);
101
  void updateGcp(QgsGCP *gcp);
102
  void removeGcp(QgsGCP *gcp);
103
  IMAGE_INFO imageInfo(QString path);
104
};
105

  
python/autogcp/qgsorthorectification.sip (revision 0)
1
/***************************************************************************
2
qgsorthorectification.sip - This class is used to perform actual ortho-correction on images using
3
 a supplied GCPSet, a SensorModel and, optionally, a Digital Elevation Model
4
(DEM).
5
--------------------------------------
6
Date : 07-May-2010
7
Copyright : (C) 2010 by FoxHat Solutions
8
Author: Christoph Stallmann (FoxHat Solutions)
9
Email : [email protected]
10
/***************************************************************************
11
* *
12
* This program is free software; you can redistribute it and/or modify *
13
* it under the terms of the GNU General Public License as published by *
14
* the Free Software Foundation; either version 2 of the License, or *
15
* (at your option) any later version. *
16
* *
17
***************************************************************************/
18

  
19
class QgsOrthorectification
20
{
21

  
22
%TypeHeaderCode
23
#include <qgsorthorectification.h>
24
%End
25

  
26
public:
27
    QgsOrthorectification();
28
    QgsImageDataSet* orthorectify();
29
    ~QgsOrthorectification();
30
};
31

  
python/autogcp/qgsdatarow.sip (revision 0)
1
/***************************************************************************
2
qgsdatarow.sip - Represents each row of data stored in the Postgre and SQLite
3
--------------------------------------
4
Date : 07-May-2010
5
Copyright : (C) 2010 by FoxHat Solutions
6
Author: Christoph Stallmann (FoxHat Solutions)
7
Email : [email protected]
8
/***************************************************************************
9
* *
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
14
* *
15
***************************************************************************/
16

  
17
class QgsDataRow
18
{
19
  
20
%TypeHeaderCode
21
#include <qgsdatarow.h>
22
%End
23

  
24
public:
25
    QgsDataRow();
26
    QMap<QString,QString>* values;
27
    virtual  ~QgsDataRow();
28
};
29

  
python/autogcp/qgswaveletextractor.sip (revision 0)
1
/***************************************************************************
2
qgsgcp.sip - A Ground Control Point (GCP) abstraction contains information about
3
 a specific GCP such as the reference and associated raw coordinates of this
4
 GCP, as well as additional elevation and other information. This object is
5
 also the container for the GCP chip data.
6
--------------------------------------
7
Date : 07-May-2010
8
Copyright : (C) 2010 by FoxHat Solutions
9
Author: James Meyer (FoxHat Solutions)
10
Email : [email protected]
11
/***************************************************************************
12
* *
13
* This program is free software; you can redistribute it and/or modify *
14
* it under the terms of the GNU General Public License as published by *
15
* the Free Software Foundation; either version 2 of the License, or *
16
* (at your option) any later version. *
17
* *
18
***************************************************************************/
19
%Import QtCore/QtCoremod.sip 
20
class QgsWaveletExtractor
21
{
22
%TypeHeaderCode
23
#include <qgswaveletextractor.h>
24
%End
25

  
26
public:
27
  /*! \brief QgsWaveletExtractor Constructor.
28
  Performs initialization.
29
  */
30
	QgsWaveletExtractor(QgsImageDataSet* image, double threshold = 1.0);
31
  QgsWaveletExtractor(QgsImageDataSet* image, int featureXSize, int featureYSize, double threshold = 1.0);
32
	/*!
33
  \brief QgsWaveletExtractor destructor
34
  This does not free the QgsImageDataSet object or any GCP data retrieved.
35
  */
36
	~QgsWaveletExtractor();
37
  /*! \brief performs the extraction of GCP's from the image
38
  This method is guaranteed to extract at least the number of GCP's required, but will likely extract more.
39
  The GCP's are ordered in decreasing order of saliency value (i.e. Sharpest points are first).
40
  The caller of this function is responsible for dealocating the data.
41
  */
42
	QList<QgsSalientPoint>* extractFeatures();
43
  /*! \brief Checks wether this extractor initialized correctly and is ready for extraction.
44
  If this method returns false, a likely reason is that the underlying image is invalid.
45
  */
46
  bool initialized();
47
};
python/autogcp/qgsprojectionmanager.sip (revision 0)
1
/***************************************************************************
2
qgsprojectionmanager.cpp - The ProjectionManager class is responsible for the
3
projection of GCPs using the projection information either contained within the
4
Metadata of the image, or as specified by the user.
5
This class uses the GDAL Warp library to perform the projection on the provided
6
GCP chip.
7
--------------------------------------
8
Date : 07-May-2010
9
Copyright : (C) 2010 by FoxHat Solutions
10
Email : [email protected]
11
Author: Francois Maass
12
/***************************************************************************
13
* *
14
* This program is free software; you can redistribute it and/or modify *
15
* it under the terms of the GNU General Public License as published by *
16
* the Free Software Foundation; either version 2 of the License, or *
17
* (at your option) any later version. *
18
* *
19
***************************************************************************/
20
class GDALWarpOptions;
21

  
22
struct PROJ_INFO
23
{
24

  
25
%TypeHeaderCode
26
#include <qgsprojectionmanager.h>
27
%End
28
  QString pGeographicCSName;
29
  QString pProjectedCSName;
30
  QString pVariantName;
31
  QString pGeogName;
32
  QString pDatumName;
33
  QString pSpheroidName;
34
  QString pPMName;
35
  QString pAngularUnits;
36
  double pStdP1;
37
  double pStdP2;
38
  double pCenterLat;
39
  double pCenterLong;
40
  double pFalseEasting;
41
  double pFalseNorthing;
42
  double pStandardParallel;
43
  double pCentralMeridian;
44
  double pPseudoStdParallelLat;
45
  double pPseudoStdParallel1;
46
  double pSatelliteHeight;
47
  double pScale;
48
  double pAzimuth;
49
  double pRectToSkew;
50
  double pLat1;
51
  double pLong1;
52
  double pLat2;
53
  double pLong2;
54
  double pLatitudeOfOrigin;
55
  double pSemiMajor;
56
  double pInvFlattening;
57
  double pPMOffset;
58
  double pConvertToRadians;
59
  int pVariation;
60
  int pZone;
61
  int pNorth;
62
  
63
};
64

  
65

  
66
class QgsProjectionManager
67
{
68
%TypeHeaderCode
69
#include <qgsprojectionmanager.h>
70
%End
71

  
72
public:
73

  
74
  /*! \brief QgsProjectionManager Constructor
75
  Constructs a projection manager that will handle all projection related processes.
76
  \param A pointer to the GDAL reference image dataset.
77
  \param A pointer to the GDAL raw image dataset.
78
  */
79
        QgsProjectionManager(QgsImageDataSet *refImageDataset, QgsImageDataSet *rawImageDataset);
80
  /*! \brief QgsProjectionManager Constructor
81
  Constructs a projection manager that will handle all projection related processes.
82
  */
83
        QgsProjectionManager();
84
  /*! \brief Set the reference image dataset
85
  Sets the reference image to be used for the projection as a QgsImageDataSet
86
  \param A pointer to the GDAL reference image dataset.
87
  */
88
        void setReferenceImage(QgsImageDataSet *refImageDataset);
89
  /*! \brief Set the raw image dataset
90
  Sets the raw image to be used for the projection as a QgsImageDataSet
91
  \param A pointer to the GDAL raw image dataset.
92
  */
93
        void setRawImage(QgsImageDataSet *rawImageDataset);
94
  
95
  /*! \brief Get the reference image dataset
96
  Gets the reference image to be used for the projection as a QgsImageDataSet
97
  */
98
        QgsImageDataSet* referenceImage();
99
  /*! \brief Get the reference image dataset
100
  Gets the reference image to be used for the projection as a QgsImageDataSet
101
  */
102
        QgsImageDataSet* rawImage();
103
  /*! \brief Static initializer for projection manager
104
  Initializes the required projected- and geographic- Coordinate System data.  
105
  */     
106
        void initializeMaps();
107
  /*! \brief QgsProjectionManager Destructor
108
  */
109
        ~QgsProjectionManager();
110
  /*! \brief Notifier for error messages.
111
  Notifies QGSLogger of error that occured.
112
  \param The message describing the error.
113
  */
114
        void notifyFailure(QString message);
115
	
116
  /*! \brief Project a single GCP between coordinate systems
117
  A single GCP is projected between two defined coordinate systems as retrieved from
118
  the raw- and reference image dataset provided with the constructor. This function handles
119
  all the processes required to fully project the provided GCP chip.
120
  Note: It is assumed that both datasets have valid projection definitions when called.
121
  To check projection information, see QgsProjectionManager::checkProjectionInformation(...).
122
  \param A pointer to the QgsImageDataSet containing the chip.
123
  \param A pointer to the QgsImageDataSet in which the chip is to be returned
124
  */	
125
	bool projectGCPChip(QgsImageDataSet* chipIn, QgsImageDataSet* chipOut);
126

  
127
  /*! \brief Project a single GCP between coordinate systems
128
  A single GCP is projected between two defined coordinate systems as retrieved from
129
  the raw- and reference image dataset provided with the constructor. This function handles
130
  all the processes required to fully project the provided GCP chip.
131
  Note: It is assumed that both datasets have valid projection definitions when called.
132
  To check projection information, see QgsProjectionManager::checkProjectionInformation(...).
133
  \param A pointer to the QgsGCP object containing the extracted GCP chip.
134
  */
135
        void projectGCP(QgsGCP *originalGCP);
136
  /*! \brief Defines the warp options for projections
137
  Warp Options are defined based on information extracted from the source and destination
138
  datasets.
139
  \param The source GDAL dataset (original coordinate system)
140
  \param The destination GDAL dataset (desired coordinate system)
141
  \param True if a GDAL progress bar should be printed to standard output.
142
  */
143
        GDALWarpOptions* getWarpOptions(GDALDataset *srcDataset, GDALDataset *dstDataset, bool progressBar);
144
  /*! \brief Warp operation that handles projection
145
  The provided dataset is warped/projected using the projection options provided as well as
146
  information extracted from the GDAL raw- and reference image datasets.
147
  \param The warp options as defined by QgsProjectionManager::getWarpOptions(...).
148
  \param The dataset to be projected
149
  */
150
        void warpDatasets(GDALWarpOptions *pswops, GDALDataset *dstDataset);
151
  /*! \brief Warp data destroyer
152
  Cleans up all the additional data created for the projection process
153
  \param The warp options as defined by QgsProjectionManager::getWarpOptions(...).
154
  */
155
        void destroyWarpData(GDALWarpOptions *pswops);
156
  /*! \brief Checks for availability and validity of projection definition strings.
157
  The provided dataset is checked to see if it contains the projection definition string.
158
  \param The dataset to be checked.
159
  */
160
        bool checkProjectionInformation(QgsImageDataSet *imageDataset);
161
  /*! \brief Sets the projection definition string
162
  The projection definition string is derived from information contained in the projectionInfo
163
  container based on the options provided, and assigned to the dataset.
164
  \param The dataset to which the projection definition string is to be assigned.
165
  \param The projection Information container.
166
  */
167
    bool setProjectionInformation(QgsImageDataSet *imageDataset, PROJ_INFO *projectionInfo);
168
};
169

  
python/autogcp/qgsgcp.sip (revision 0)
1
/***************************************************************************
2
qgsgcp.sip - A Ground Control Point (GCP) abstraction contains information about
3
 a specific GCP such as the reference and associated raw coordinates of this
4
 GCP, as well as additional elevation and other information. This object is
5
 also the container for the GCP chip data.
6
--------------------------------------
7
Date : 07-May-2010
8
Copyright : (C) 2010 by FoxHat Solutions
9
Author: Christoph Stallmann (FoxHat Solutions)
10
Email : [email protected]
11
/***************************************************************************
12
* *
13
* This program is free software; you can redistribute it and/or modify *
14
* it under the terms of the GNU General Public License as published by *
15
* the Free Software Foundation; either version 2 of the License, or *
16
* (at your option) any later version. *
17
* *
18
***************************************************************************/
19

  
20
class QgsGCP
21
{
22

  
23
%TypeHeaderCode
24
#include <qgsgcp.h>
25
%End
26

  
27
public:
28
  QgsGCP();
29
  ~QgsGCP();
30
  bool operator==(const QgsGCP& other) const;
31
  double refX() const;
32
  void setRefX(double value);
33
  double refY() const;
34
  void setRefY(double value);
35
  double refZ() const;
36
  void setRefZ(double value);
37
  double rawX() const;
38
  void setRawX(double value);
39
  double rawY() const;
40
  void setRawY(double value);
41
  
42
  QgsImageDataSet* gcpChip() const;
43
  void setGcpChip(QgsImageDataSet* value);
44
};
45

  
46

  
python/autogcp/qgssalientpoint.sip (revision 0)
1
/**************************************************************************
2
qgsgcp.cpp - A Ground Control Point (GCP) abstraction contains information about
3
 a specific GCP such as the reference and associated raw coordinates of this
4
 GCP, as well as additional elevation and other information. This object is
5
 also the container for the GCP chip data.
6
--------------------------------------
7
Date : 07-May-2010
8
Copyright : (C) 2010 by FoxHat Solutions
9
Author: James Meyer
10
Email : [email protected]
11
/***************************************************************************
12
* *
13
* This program is free software; you can redistribute it and/or modify *
14
* it under the terms of the GNU General Public License as published by *
15
* the Free Software Foundation; either version 2 of the License, or *
16
* (at your option) any later version. *
17
* *
18
***************************************************************************/
19

  
20

  
21

  
22
/*!
23
  This class represents any point of interest on a two-dimensional raster image.
24
*/
25
class QgsSalientPoint : QgsPoint
26
{
27
%TypeHeaderCode
28
#include <qgssalientpoint.h>
29
#include <qgspoint.h>
30
%End
31
  public:
32
    /*! \brief QgsFeature constructor
33
    constructs a feature point at the given x, y coordinates and optionally a saliency value.
34
  */
35
    QgsSalientPoint(double x = 0, double y = 0, double theSaliency = 0);
36
    
37
    /*! \brief Gets the Saliency value of this feature.
38
    */
39
    double saliency()const;
40
    
41
    /*! \brief Sets the Saliency value of this feature.
42
    */
43
    void setSaliency(double value);
44
};
45

  
46

  
python/CMakeLists.txt (working copy)
35 35
  ADD_DEFINITIONS(-DNOMINMAX)
36 36
ENDIF(MSVC)
37 37

  
38
IF(PYQT4_VERSION_NUM LESS 263680)	# 0x040600
39
  SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} PROXY_FACTORY)
40
ENDIF(PYQT4_VERSION_NUM LESS 263680)
41 38

  
42 39
# core module
43 40
FILE(GLOB sip_files_core core/*.sip)
......
69 66
set(SIP_EXTRA_FILES_DEPEND ${sip_files_core} ${sip_files_analysis})
70 67
ADD_SIP_PYTHON_MODULE(qgis.analysis analysis/analysis.sip qgis_core qgis_analysis)
71 68

  
69
# additional autogcp includes
70
INCLUDE_DIRECTORIES(
71
    ../src/autogcp
72
    ${CMAKE_BINARY_DIR}/src/autogcp
73
)
72 74

  
75
# autogcp module
76
FILE(GLOB sip_files_autogcp autogcp/*.sip)
77
set(SIP_EXTRA_FILES_DEPEND ${sip_files_core} ${sip_files_autogcp})
78
ADD_SIP_PYTHON_MODULE(qgis.autogcp autogcp/autogcp.sip qgis_core qgis_autogcp)
79

  
80

  
73 81
SET (QGIS_PYTHON_DIR ${PYTHON_SITE_PACKAGES_DIR}/qgis)
74 82

  
75 83
ADD_CUSTOM_TARGET(compile_python_files ALL)
src/autogcp/qgselevationmanager.h (revision 0)
1
/***************************************************************************
2
qgselevationmanager.cpp - The ElevationManager contains a Digital Elevation
3
 Model of a specific reference image and allows sampling of the ground
4
 elevation at different coordinates. This DEM is used in the orthorectification
5
 process as well as chip projection.
6
--------------------------------------
7
Date : 07-May-2010
8
Copyright : (C) 2010 by FoxHat Solutions
9
Email : [email protected]
10
/***************************************************************************
11
* *
12
* This program is free software; you can redistribute it and/or modify *
13
* it under the terms of the GNU General Public License as published by *
14
* the Free Software Foundation; either version 2 of the License, or *
15
* (at your option) any later version. *
16
* *
17
***************************************************************************/
18

  
19
#ifndef QGSELEVATIONMANAGER_H
20
#define QGSELEVATIONMANAGER_H
21
#include <QString>
22
#include <QVector>
23

  
24
class QgsElevationManager
25
{
26
public:
27
    QgsElevationManager();
28
    double sampleHeight(int,int);
29
    void openDEMFile(QString);
30
    virtual ~QgsElevationManager();
31
private:
32
    QVector<double>* mElevation;
33
};
34

  
35
#endif // QGSELEVATIONMANAGER_H
src/autogcp/qgscrosscorrelator.cpp (revision 0)
1
/***************************************************************************
2
qgscrosscorrelator.cpp - This class handles the cross correlation of two
3
subimages.
4
--------------------------------------
5
Date : 12-July-2010
6
Copyright : (C) 2010 by FoxHat Solutions
7
Email : [email protected]
8
/***************************************************************************
9
* *
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
14
* *
15
***************************************************************************/
16

  
17
#include "qgscrosscorrelator.h"
18
#include "qgsimagedataset.h"
19
#include <math.h>
20
#include <iostream>
21
#include <ios>
22

  
23
QgsCrossCorrelator::QgsCrossCorrelator(QgsImageDataSet* ref,  QgsImageDataSet* raw)
24
{
25
    refChip = ref;
26
    rawChip = raw;
27
}
28

  
29
QgsCrossCorrelator::~QgsCrossCorrelator()
30
{
31
}
32

  
33
double QgsCrossCorrelator::correlationValue()
34
{
35
    //find the band(s) with which to calculate each distinct image's grey level:
36
    int refbands = refChip->rasterBands();
37
    for (int i = 0; i < refbands; i++)
38
    {
39
	    
40
        GDALRasterBand* band = refChip->gdalDataset()->GetRasterBand(1);
41
        GDALColorInterp color = band->GetColorInterpretation();
42

  
43
        switch ( color )
44
        {
45
            case GCI_GrayIndex:
46
            { greyRefBand = i+1; refConvert = GREY; }
47
            break;
48
            case GCI_RedBand:
49
            { redRefBand = i+1; refConvert = RGB; }
50
            break;
51
            case GCI_GreenBand:
52
            { greenRefBand = i+1; refConvert = RGB; }
53
            break;
54
            case GCI_BlueBand:
55
            { blueRefBand = i+1; refConvert = RGB; }
56
            break;
57
            case GCI_CyanBand:
58
            { cyanRefBand = i+1; refConvert = CMYK; }
59
            break;
60
            case GCI_MagentaBand:
61
            { magentaRefBand = i+1; refConvert = CMYK; }
62
            break;
63
            case GCI_YellowBand:
64
            { yellowRefBand = i+1;  refConvert = CMYK; }
65
            break;
66
            case GCI_BlackBand:
67
            { blackRefBand = i+1;  refConvert = CMYK; }
68
            break;
69
            default:
70
	    { 
71
		    if (refbands < 3)
72
		    {
73
			    greyRefBand = 1; refConvert = GREY;
74
		    }
75
		    else
76
		    {
77
			    redRefBand = 1; greenRefBand =  2; blueRefBand = 3; refConvert = RGB; 
78
		    }
79
	    }
80
	    break; //ASSUME RGB
81
        }
82
        if (color == GCI_GrayIndex) break;
83
    }
84

  
85
    int rawbands = rawChip->rasterBands();
86
    for (int j = 0; j < rawbands; j++)
87
    {
88
        GDALRasterBand* band = rawChip->gdalDataset()->GetRasterBand(j+1);
89
        GDALColorInterp color = band->GetColorInterpretation();
90

  
91
        switch ( color )
92
        {
93
            case GCI_GrayIndex:
94
            { greyRawBand = j+1; rawConvert = GREY; }
95
            break;
96
            case GCI_RedBand:
97
            { redRawBand = j+1; rawConvert = RGB; }
98
            break;
99
            case GCI_GreenBand:
100
            { greenRawBand = j+1; rawConvert = RGB; }
101
            break;
102
            case GCI_BlueBand:
103
            { blueRawBand = j+1; rawConvert = RGB; }
104
            break;
105
            case GCI_CyanBand:
106
            { cyanRawBand = j+1; rawConvert = CMYK; }
107
            break;
108
            case GCI_MagentaBand:
109
            { magentaRawBand = j+1; rawConvert = CMYK; }
110
            break;
111
            case GCI_YellowBand:
112
            { yellowRawBand = j+1; rawConvert = CMYK; }
113
            break;
114
            case GCI_BlackBand:
115
            { blackRawBand = j+1; rawConvert = CMYK; }
116
            break;
117
            default:
118
	    { 
119
		    if (rawbands < 3)
120
		    {
121
			    greyRawBand = 1; rawConvert = GREY;
122
		    }
123
		    else
124
		    {
125
			    redRawBand = 1; greenRawBand =  2; blueRawBand = 3; rawConvert = RGB; 
126
		    }
127
	    }
128
	    break; //ASSUME RGB
129
        }
130
        if (color == GCI_GrayIndex) break;
131
    }
132
    calculateAverages();
133
    return calculateCC();
134
}
135

  
136
//assumes that bands and Schemes have been set
137
void QgsCrossCorrelator::calculateAverages()
138
{
139
    refAvg = 0;
140
    rawAvg = 0;
141
    for (int i = 0; i < refChip->imageXSize(); i++)
142
    {
143
	
144
        for (int j = 0; j < refChip->imageYSize(); j++)
145
        {
146
		refAvg += greyLevel(true, i, j);
147
        }
148
    }
149
    refAvg = refAvg/(refChip->imageXSize()*refChip->imageYSize());
150
    
151
    for (int i = 0; i < rawChip->imageXSize(); i++)
152
    {
153
	
154
        for (int j = 0; j < rawChip->imageYSize(); j++)
155
        {
156
		rawAvg += greyLevel(false, i, j);
157
        }
158
    }
159
    rawAvg = rawAvg/(rawChip->imageXSize()*rawChip->imageYSize());
160
}
161

  
162
double QgsCrossCorrelator::calculateCC()
163
{
164
    double num = 0.0;
165
    double a = 0.0;
166
    double b = 0.0;
167
    for (int i = 0; i < refChip->imageXSize(); i++)
168
    {
169
        for (int j = 0; j < refChip->imageYSize(); j++)
170
        {
171
            //(ref's gray level - ref's avg gray level)*(raw's gray level - raw's avg gray level)
172
            num += (greyLevel(true,i,j) - refAvg)*(greyLevel(false,i,j) - rawAvg);
173
            //(ref's gray level - ref's avg gray level)
174
            a += pow((greyLevel(true,i,j) - refAvg),2);
175
            //(raw's gray level - raw's avg gray level)
176
            b += pow((greyLevel(false,i,j) - rawAvg),2);
177
        }
178
    }
179
    
180
    double denom = pow((a*b),0.5);
181
    return num/denom;
182
}
183

  
184
double QgsCrossCorrelator::greyLevel(bool isRef, int x, int y)
185
{
186
    if (isRef)
187
    {
188
	
189
        if (refConvert == GREY) return refChip->readValue(greyRefBand, x, y);
190

  
191
        if (refConvert == RGB)
192
        {
193
            return (refChip->readValue(redRefBand,x,y)*0.299 + refChip->readValue(greenRefBand,x,y)*0.587 + refChip->readValue(blueRefBand,x,y)*0.114);
194
        }
195
        else if (refConvert == CMYK)
196
        {
197
            return (refChip->readValue(cyanRefBand,x,y)*0.299 + refChip->readValue(magentaRefBand,x,y)*0.587 + refChip->readValue(yellowRefBand,x,y)*0.114 + refChip->readValue(blackRefBand,x,y));
198
        }
199
    }
200

  
201
    else
202
    {
203
	   
204
        if (rawConvert == GREY) return rawChip->readValue(greyRawBand, x, y);
205

  
206
        if (rawConvert == RGB)
207
        {
208
            return (rawChip->readValue(redRawBand,x,y)*0.299 + rawChip->readValue(greenRawBand,x,y)*0.587 + rawChip->readValue(blueRawBand,x,y)*0.114);
209
        }
210
        else if (rawConvert == CMYK)
211
        {
212
            return (rawChip->readValue(cyanRawBand,x,y)*0.299 + rawChip->readValue(magentaRawBand,x,y)*0.587 + rawChip->readValue(yellowRawBand,x,y)*0.114 + rawChip->readValue(blackRawBand,x,y));
213
        }
214
	else return 0.0;
215
    }
216
}
217

  
218

  
src/autogcp/qgsfeatureextractor.cpp (revision 0)
1
#include "qgsfeatureextractor.h"
2

  
3
QgsFeatureExtractor::QgsFeatureExtractor()
4
{
5
}
6

  
7
QgsFeatureExtractor::~QgsFeatureExtractor()
8
{
9
}
10

  
11

  
12

  
src/autogcp/qgsimagedataset.cpp (revision 0)
1
/***************************************************************************
2
qgsimagedataset.cpp - This class contains all external data related to an image
3
 including the sensor model associated to the particular image.
4
--------------------------------------
5
Date : 07-May-2010
6
Copyright : (C) 2010 by FoxHat Solutions
7
Email : [email protected]
8
/***************************************************************************
9
* *
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
14
* *
15
***************************************************************************/
16

  
17
#include "qgsimagedataset.h"
18
#include "qgslogger.h"
19
#include <iostream>
20
#include <cstdlib>
21
QgsImageDataSet::QgsImageDataSet(QString path): 
22
  mFilePath(path),
23
  mBuffers(0),
24
  mDataset(0)
25
{
26
	if (!initialize())
27
	{
28
		mFail  = true;
29
    QgsLogger::debug("QgsImageDataSet::initialize() failed.");
30
	}else
31
	{
32
	  mFail = false;
33
	}
34
}
35

  
36
QgsImageDataSet::QgsImageDataSet(GDALDataset* dataset)
37
{
38
  if(!dataset)
39
  {
40
    mFail  = true;
41
    QgsLogger::debug("QgsImageDataSet::initialize() failed.");
42
    
43
  } else {
44
    mDataset = dataset;  
45
    mXSize = mDataset->GetRasterXSize();
46
    mYSize = mDataset->GetRasterYSize();   
47
    //Create Buffers
48
    int bandCount = mDataset->GetRasterCount();    
49
    mBuffers = new DataBuffer<mBufferCount>[bandCount];   
50
    mFail = false;
51
  }
52
}
53

  
54
bool QgsImageDataSet::initialize()
55
{
56

  
57
  registerGdalDrivers();
58
  
59
  const char* filename = mFilePath.toLatin1().data();
60
  GDALDatasetH handle =  GDALOpen(filename,GA_ReadOnly);
61
  if (handle)
62
  {
63

  
64
		mDataset = (GDALDataset*) handle;    
65
    mXSize = mDataset->GetRasterXSize();
66
    mYSize = mDataset->GetRasterYSize();   
67
    //Create Buffers
68
    int bandCount = mDataset->GetRasterCount();    
69
    mBuffers = new DataBuffer<mBufferCount>[bandCount];
70
    
71
    return true;
72
	}
73
	else
74
	{
75
    QgsLogger::debug(QString("Failed to open Image dataset. File path=")+mFilePath,1, "qgsimagedataset.cpp");
76
		return false;
77
	}
78
}//bool QgsImageDataSet::initialize()
79

  
80

  
81

  
82
QgsImageDataSet::~QgsImageDataSet()
83
{
84
  //printf("Deleting ImageDS\n");
85
    //delete mSensor;
86
	if (mDataset)
87
	{
88
    //printf("Closing GDAL DS\n");
89
    GDALClose((GDALDatasetH)mDataset);
90
    //printf("Closed GDAL DS\n");
91
	}
92
  finalize();
93
}
94

  
95
GDALDataset* QgsImageDataSet::gdalDataset()
96
{
97
	return mDataset;
98
}
99

  
100

  
101
void QgsImageDataSet::registerGdalDrivers()
102
{
103
	if (0 == GDALGetDriverCount())
104
	{
105
		GDALAllRegister();
106
	}
107
}//void QgsImageDataSet::registerGdalDrivers()
108

  
109
bool QgsImageDataSet::failed() const
110
{
111
	return mFail;
112
}
113

  
114
//Wrapper for failed()
115
bool QgsImageDataSet::operator!() const
116
{
117
	return failed();
118
}
119

  
120
QgsImageDataSet::operator bool() const
121
{
122
  return !failed();
123
}
124

  
125
void QgsImageDataSet::imageSize(int& xSize, int& ySize) const
126
{
127
  if (!failed())
128
  {
129
    xSize = mXSize;
130
    ySize = mYSize;
131
  }
132
}//bool QgsImageDataSet::operator!() const
133

  
134
int QgsImageDataSet::imageXSize() const
135
{
136
  return mXSize;
137
}
138
int QgsImageDataSet::imageYSize() const
139
{
140
  return mYSize;
141
}
142

  
143
void* QgsImageDataSet::readLine(int theBand, int line)
144
{  
145
  char message[100];
146
 //printf("READING BAND %d, line %d\n",theBand, line);
147
  if (theBand > mDataset->GetRasterCount() || theBand < 1)
148
  {
149
    //Log debug message
150
    return 0;
151
  } 
152
 
153
  DataBuffer<mBufferCount>& buffer = mBuffers[theBand - 1];
154
  for (int i = 0; i < mBufferCount; i++)
155
  {
156
    
157
   
158
    if (line ==buffer.line[i] && buffer.data[i])
159
    {//Has this line in the buffer already    
160
      sprintf(message, "In buffer: %d %d",line,i);
161
     // QgsLogger::debug(message,1,"QgsImageDataSet::readLine()");
162
      return buffer.data[i];
163
    }
164
  }
165
  //ELSE**************************************************
166
 //QgsLogger::debug(QString("Not Cached"));
167
  GDALRasterBand* band = mDataset->GetRasterBand(theBand);
168
  GDALDataType type = band->GetRasterDataType();
169
  //printf("%p \n", band);
170
  int blockX,blockY;
171
  if (line >= mYSize)
172
  {
173
    return 0;
174
  }
175
  
176
  band->GetBlockSize(&blockX,&blockY);
177
 // QgsLogger::debug(QString("is good "));
178
  int blocksToRead = mXSize / blockX; //Usually just one.  
179
  int yBlock = line / blockY; //Which block will be read
180
 // int toAlloc = blocksToRead * blockX * blockY * GDALGetDataTypeSize(band->GetRasterDataType());
181
  int toAlloc = 1 * mXSize * (GDALGetDataTypeSize(type) / 8);
182
  int curbuf = buffer.currentBuffer;
183
 //QgsLogger::debug(QString("TO Alloc:")+QString::number(toAlloc));
184
  
185
  if (!buffer.data[curbuf])
186
  {
187
    buffer.data[curbuf] = VSIMalloc(toAlloc);
188
  }
189
//QgsLogger::debug("Allocated Data",1,"QgsImageDataSet::readLine()");
190
  void* start;
191
  CPLErr result;
192
 /* for (int i = 0; i < blocksToRead; ++i)
193
  {
194
    start = dataIndex(buffer.data[curbuf], theBand, i * blockX); //Where to start reading data into
195
    result = band->ReadBlock(i,yBlock,start);    
196
  }*/
197
  band->RasterIO(GF_Read, 0, line, mXSize, 1, buffer.data[curbuf], mXSize, 1, type,0,0 );
198
  
199
 // QgsLogger::debug("Not in buffer");
200
  
201
  
202
  buffer.currentBuffer = ( curbuf  + 1) % mBufferCount;
203
  buffer.line[curbuf]  = line;
204
  
205
  return buffer.data[curbuf];  
206
}//void* QgsImageDataSet::readLine(int iband, int line)
207

  
208

  
209
/*WARNING does NO bounds checking.
210
Gets a pointer to the index'th element in the array pointed to by data.
211
*/
212
void* QgsImageDataSet::dataIndex(void* data,int band, int index)
213
{
214
  GDALDataType type = dataType(band);
215
  switch ( type )
216
  {
217
    case GDT_Byte:
218
      return ( void* ) &(( GByte * )data )[index];
219
      break;
220
    case GDT_UInt16:
221
      return ( void* ) &(( GUInt16 * )data )[index];
222
      break;
223
    case GDT_Int16:
224
      return ( void* ) &(( GInt16 * )data )[index];
225
      break;
226
    case GDT_UInt32:
227
      return ( void* ) &(( GUInt32 * )data )[index];
228
      break;
229
    case GDT_Int32:
230
      return ( void* ) &(( GInt32 * )data )[index];
231
      break;
232
    case GDT_Float32:
233
      return ( void* ) &(( float * )data )[index];
234
      break;
235
    case GDT_Float64:
236
    //  val = (( double * )data )[index];
237
      return ( void* ) &(( double * )data )[index];
238
      break;
239
    default:;
240
   //   QgsLogger::warning( "GDAL data type is not supported" );
241
  }
242
}//void* QgsWaveletExtractor::dataIndex(void* data, int index)
243

  
244
int QgsImageDataSet::rasterBands()
245
{
246
  if (mDataset)
247
  {
248
    return mDataset->GetRasterCount();
249
  } else 
250
  {
251
    return 0;
252
  }
253
}
254

  
255
double QgsImageDataSet::readValue(int band, int xPixel, int yLine)
256
{
257
  if (xPixel < 0 
258
    || xPixel >= mXSize 
259
    || yLine < 0
260
    || yLine >= mYSize) //Bounds check
261
  {
262
    return 0.0;
263
  }
264
  double value;
265
  void* data = readLine(band, yLine);
266
 // char message[100];
267
 // sprintf(message, "Data: %p", data);
268
 // QgsLogger::debug(message,1,"QgsImageDataSet::readValue()");
269
  
270
  GDALDataType type = dataType(band);
271
  //printf("Data TYPE: %s\n", GDALGetDataTypeName(type));
272
  switch ( type )
273
  {
274
    case GDT_Byte:
... This diff was truncated because it exceeds the maximum size that can be displayed.