158 |
andreas |
1 |
/***************************************************************************
|
|
|
2 |
* Copyright (C) 2007, 2008 by Andreas Theofilu *
|
|
|
3 |
* andreas@theosys.at *
|
|
|
4 |
* *
|
|
|
5 |
* This program is free software; you can redistribute it and/or modify *
|
|
|
6 |
* it under the terms of the GNU General Public License as published by *
|
|
|
7 |
* the Free Software Foundation version 3 of the License. *
|
|
|
8 |
* *
|
|
|
9 |
* This program is distributed in the hope that it will be useful, *
|
|
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
12 |
* GNU General Public License for more details. *
|
|
|
13 |
* *
|
|
|
14 |
* You should have received a copy of the GNU General Public License *
|
|
|
15 |
* along with this program; if not, write to the *
|
|
|
16 |
* Free Software Foundation, Inc., *
|
|
|
17 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
|
18 |
***************************************************************************/
|
|
|
19 |
|
|
|
20 |
#ifndef _TRANSFORM_H
|
|
|
21 |
#define _TRANSFORM_H
|
|
|
22 |
|
|
|
23 |
#include <math.h>
|
|
|
24 |
|
|
|
25 |
#define DEGREES 180.0
|
|
|
26 |
#define SEMICIRCLES 0x80000000
|
|
|
27 |
|
|
|
28 |
#define SEMI2DEG(a) (double)(a) * DEGREES / SEMICIRCLES
|
|
|
29 |
#define DEG2SEMI(a) rint((double)(a) * SEMICIRCLES / DEGREES)
|
|
|
30 |
|
|
|
31 |
#define DEG2RAD(a) (a) * M_PI / DEGREES
|
|
|
32 |
#define RAD2DEG(a) (a) * DEGREES / M_PI
|
|
|
33 |
|
|
|
34 |
class transform
|
|
|
35 |
{
|
|
|
36 |
public:
|
|
|
37 |
transform(double _llat, double _llon, double _rlat, double _rlon);
|
|
|
38 |
~transform();
|
|
|
39 |
|
|
|
40 |
void setDimensions(int _width, int _height);
|
|
|
41 |
void setScale(double scx, double scy);
|
|
|
42 |
void getScale(double *scx, double *scy);
|
|
|
43 |
bool latLonToPix(double plat, double plon, int *px, int *py);
|
|
|
44 |
long getOffset(double plat, double plon);
|
159 |
andreas |
45 |
bool cutImage(double _llat, double _llon, double _rlat, double _rlon, QString fName);
|
158 |
andreas |
46 |
|
|
|
47 |
private:
|
|
|
48 |
double llat, llon, rlat, rlon;
|
|
|
49 |
double xscale, yscale;
|
|
|
50 |
int width, height;
|
|
|
51 |
int MapXCtr;
|
|
|
52 |
int MapYCtr;
|
|
|
53 |
int PixPerLatDeg;
|
|
|
54 |
int PixPerLonDeg;
|
|
|
55 |
double MapLatCtr;
|
|
|
56 |
double MapLonCtr;
|
|
|
57 |
|
|
|
58 |
};
|
|
|
59 |
|
|
|
60 |
#endif
|