/***************************************************************************
coords.h - lass for handling coordinates
-------------------
begin : Thu Jun 24 1999
copyright : (C) 1999 by Heiner Lamprecht
email : heiner@kijumfo.de
***************************************************************************/
/***************************************************************************
* *
* 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; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef COORDS_H
#define COORDS_H
#include <qobject.h>
#include <qlist.h>
#include <qpointarray.h>
#include <mapobject.h>
/**
* This class provides basic functions for handling the different
* coordinates.
* @author Heiner Lamprecht
*/
class Coords : public QObject {
public:
Coords();
Coords(long latitude, long longitude);
~Coords();
/** set the type of projection either to "Lambert" or to "Mercator" */
void setProjection(const char* procType);
/** returns TRUE, if current projectiontype ist Lambert */
bool isLambert();
/** returns TRUE, if current projectiontype ist Mercator */
bool isMercator();
/**
* Converts the longitute or latitute into the internal format
* suitable for the Location-class. "degree" is a string in the
* format: [g]gg.mm'ss"X where g,m,s are any digits from 0 to 9
* and X is one of N, S, E, W
*/
long degreeToNum (const char* degree);
/** Convert internal representation to radians. */
double numToRad(long internal);
long radToNum(double radial);
/** Calculates the coordinates for drawing. */
long calc_X_Y();
/** Returns the x-coordinate for the Lambert-projection */
double calc_X_Lambert(double latitude, double longitude);
/** Returns the y-coordinate for the Lambert-projection */
double calc_Y_Lambert(double latitude, double longitude);
/** Returns the x-coordinates for the Mercator-projection. */
double calc_X_Mercator(double latitude, double longitude);
/**
* Returns the y-coordinates for the Mercator-projection.
*
* Note: We return negative values, because the the point (0/0) is
* the upper left corner of the painter. Therefore we must mirror
* the coordinates.
*/
double calc_Y_Mercator(double latitude, double longitude);
void map2Lambert(double x, double y, Location* loc);
void map2Mercator(double x, double y, Location* loc);
/** Converts radians to degree. */
double deg(double rad);
/** Converts degree to radians. */
double rad(double deg);
/** Returns the pointlist */
void pointList(QPainter* painter);
private:
/** pi is pi ;-) */
const static double pi = 3.141592654;
/**
* The earth's radius used for calculation.
* NOTE: We use the earth as a sphere, not as a spheroid! */
const static double radius = 6370.289509;
// Wieso klappt das mit den static-Variablen nicht???
double mercatorScale;
/** standard parallels for conical projection */
double v1;
/** The second standard parallel. It doesn't matter which one is which. */
double v2;
/** contains the current projectiontype */
char* projectionType;
QList<QPoint> punktListe;
// QList<Location> locListe;
QPointArray coordList;
};
#endif
Documentation generated by heiner@Tharbad on Mon Jul 5 21:28:49 CEST 1999