Rev 158 | Blame | Compare with Previous | Last modification | View Log | RSS feed
/***************************************************************************
* Copyright (C) 2007, 2008 by Andreas Theofilu *
* andreas@theosys.at *
* *
* 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 version 3 of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _TRANSFORM_H
#define _TRANSFORM_H
#include <math.h>
#define DEGREES 180.0
#define SEMICIRCLES 0x80000000
#define SEMI2DEG(a) (double)(a) * DEGREES / SEMICIRCLES
#define DEG2SEMI(a) rint((double)(a) * SEMICIRCLES / DEGREES)
#define DEG2RAD(a) (a) * M_PI / DEGREES
#define RAD2DEG(a) (a) * DEGREES / M_PI
class transform
{
public:
transform(double _llat, double _llon, double _rlat, double _rlon);
~transform();
void setDimensions(int _width, int _height);
void setScale(double scx, double scy);
void getScale(double *scx, double *scy);
bool latLonToPix(double plat, double plon, int *px, int *py);
long getOffset(double plat, double plon);
bool cutImage(double _llat, double _llon, double _rlat, double _rlon, QString fName);
private:
double llat, llon, rlat, rlon;
double xscale, yscale;
int width, height;
int MapXCtr;
int MapYCtr;
int PixPerLatDeg;
int PixPerLonDeg;
double MapLatCtr;
double MapLonCtr;
};
#endif