QGIS API Documentation
2.0.1-Dufour
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
src
core
raster
qgsrasterprojector.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsrasterprojector.h - Raster projector
3
--------------------------------------
4
Date : Jan 16, 2011
5
Copyright : (C) 2005 by Radim Blazek
6
email : radim dot blazek 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
/* This code takes ideas from WarpBuilder in Geotools.
19
* Thank to Ing. Andrea Aime, Ing. Simone Giannecchini and GeoSolutions S.A.S.
20
* See : http://geo-solutions.blogspot.com/2011/01/developers-corner-improving.html
21
*/
22
23
#ifndef QGSRASTERPROJECTOR_H
24
#define QGSRASTERPROJECTOR_H
25
26
#include <QVector>
27
#include <QList>
28
29
#include "
qgsrectangle.h
"
30
#include "
qgscoordinatereferencesystem.h
"
31
#include "
qgscoordinatetransform.h
"
32
#include "
qgsrasterinterface.h
"
33
34
#include <cmath>
35
36
class
QgsPoint
;
37
38
class
CORE_EXPORT
QgsRasterProjector
:
public
QgsRasterInterface
39
{
40
public
:
45
QgsRasterProjector
(
46
QgsCoordinateReferenceSystem
theSrcCRS,
47
QgsCoordinateReferenceSystem
theDestCRS,
48
QgsRectangle
theDestExtent,
49
int
theDestRows,
int
theDestCols,
50
double
theMaxSrcXRes,
double
theMaxSrcYRes,
51
QgsRectangle
theExtent
52
);
53
QgsRasterProjector
(
54
QgsCoordinateReferenceSystem
theSrcCRS,
55
QgsCoordinateReferenceSystem
theDestCRS,
56
double
theMaxSrcXRes,
double
theMaxSrcYRes,
57
QgsRectangle
theExtent
58
);
59
QgsRasterProjector
();
61
// To avoid synthesized which fails on copy of QgsCoordinateTransform
62
// (QObject child) in Python bindings
63
QgsRasterProjector
(
const
QgsRasterProjector
&projector );
64
66
~
QgsRasterProjector
();
67
68
QgsRasterProjector
& operator=(
const
QgsRasterProjector
&projector );
69
70
QgsRasterInterface
*
clone
()
const
;
71
72
int
bandCount
()
const
;
73
74
QGis::DataType
dataType
(
int
bandNo )
const
;
75
77
void
setCRS(
const
QgsCoordinateReferenceSystem
& theSrcCRS,
const
QgsCoordinateReferenceSystem
& theDestCRS );
78
80
QgsCoordinateReferenceSystem
srcCrs
()
const
{
return
mSrcCRS; }
81
83
QgsCoordinateReferenceSystem
destCrs
()
const
{
return
mDestCRS; }
84
86
void
setMaxSrcRes(
double
theMaxSrcXRes,
double
theMaxSrcYRes )
87
{
88
mMaxSrcXRes = theMaxSrcXRes; mMaxSrcYRes = theMaxSrcYRes;
89
}
90
91
QgsRasterBlock
*
block
(
int
bandNo,
const
QgsRectangle
& extent,
int
width,
int
height );
92
93
private
:
95
QgsRectangle
srcExtent
() {
return
mSrcExtent; }
96
98
int
srcRows
() {
return
mSrcRows; }
99
int
srcCols
() {
return
mSrcCols; }
100
void
setSrcRows
(
int
theRows ) { mSrcRows = theRows; mSrcXRes = mSrcExtent.height() / mSrcRows; }
101
void
setSrcCols
(
int
theCols ) { mSrcCols = theCols; mSrcYRes = mSrcExtent.width() / mSrcCols; }
102
104
void
srcRowCol(
int
theDestRow,
int
theDestCol,
int
*theSrcRow,
int
*theSrcCol );
105
106
int
dstRows
()
const
{
return
mDestRows; }
107
int
dstCols
()
const
{
return
mDestCols; }
108
110
void
destPointOnCPMatrix(
int
theRow,
int
theCol,
double
*theX,
double
*theY );
111
113
int
matrixRow(
int
theDestRow );
114
int
matrixCol(
int
theDestCol );
115
117
QgsPoint
srcPoint(
int
theRow,
int
theCol );
118
120
inline
void
preciseSrcRowCol(
int
theDestRow,
int
theDestCol,
int
*theSrcRow,
int
*theSrcCol );
121
123
inline
void
approximateSrcRowCol(
int
theDestRow,
int
theDestCol,
int
*theSrcRow,
int
*theSrcCol );
124
126
void
calc();
127
129
void
insertRows();
130
132
void
insertCols();
133
134
/* calculate single control point in current matrix */
135
void
calcCP(
int
theRow,
int
theCol );
136
138
bool
calcRow(
int
theRow );
139
141
bool
calcCol(
int
theCol );
142
144
void
calcSrcExtent();
145
147
void
calcSrcRowsCols();
148
151
bool
checkCols();
152
155
bool
checkRows();
156
158
void
calcHelper(
int
theMatrixRow,
QgsPoint
*thePoints );
159
161
void
nextHelper();
162
164
QString cpToString();
165
167
QgsCoordinateReferenceSystem
mSrcCRS
;
168
170
QgsCoordinateReferenceSystem
mDestCRS
;
171
173
QgsCoordinateTransform
mCoordinateTransform
;
174
176
QgsRectangle
mDestExtent
;
177
179
QgsRectangle
mSrcExtent
;
180
182
QgsRectangle
mExtent
;
183
185
int
mDestRows
;
186
188
int
mDestCols
;
189
191
double
mDestXRes
;
192
194
double
mDestYRes
;
195
197
int
mSrcRows
;
198
200
int
mSrcCols
;
201
203
double
mSrcXRes
;
204
206
double
mSrcYRes
;
207
209
double
mDestRowsPerMatrixRow
;
210
212
double
mDestColsPerMatrixCol
;
213
215
QList< QList<QgsPoint> >
mCPMatrix
;
216
218
/* Same size as mCPMatrix */
219
QList< QList<bool> >
mCPLegalMatrix
;
220
222
/* Warning: using QList is slow on access */
223
QgsPoint
*
pHelperTop
;
224
226
/* Warning: using QList is slow on access */
227
QgsPoint
*
pHelperBottom
;
228
230
int
mHelperTopRow
;
231
233
int
mCPCols
;
235
int
mCPRows
;
236
238
double
mSqrTolerance
;
239
241
double
mMaxSrcXRes
;
242
double
mMaxSrcYRes
;
243
245
bool
mApproximate
;
246
};
247
248
#endif
249
Generated on Tue Sep 24 2013 14:41:48 for QGIS API Documentation by
1.8.1.2