Moved files to make zouba the only project.
[ptas] / src / location.h
1 #ifndef LOCATION_H
2 #define LOCATION_H
3
4 #include "location_p.h"
5
6 #include <QString>
7 #include <QObject>
8 #include <QNetworkAccessManager>
9 #include <QNetworkReply>
10 #include <QGeoPositionInfo>
11 #include <math.h>
12
13 QTM_USE_NAMESPACE
14
15 class Location : public QObject
16 {
17 Q_OBJECT
18
19 public:
20   Location( const QString &x, const QString &y, const QString &label=QString() );
21   Location( const QGeoPositionInfo &positionInfo, const QString &label=QString() );
22   Location( const Location &from );
23   Location &operator=( const Location &from );
24   Location( const QString &label=QString() );
25
26   ~Location();
27
28   QString x() const;
29
30   QString y() const;
31
32   void setLocation( const QGeoPositionInfo &positionInfo );
33
34   void setAddress( const QString &address ) const;
35   QString address() const;
36
37   void setLabel( const QString &label ) const;
38   QString label() const;
39
40   bool isValid() const;
41
42 public Q_SLOTS:
43   void resolveAddress( const QString &address );
44
45 Q_SIGNALS:
46   void becomeValid();
47   void becomeInValid();
48   void busy( bool busy );
49
50 private Q_SLOTS:
51   void replyFinished( QNetworkReply * reply );
52
53 private:
54
55   LocationPrivate *q;
56   QNetworkAccessManager *manager;
57
58   typedef uint KKJ;
59
60   /**
61    * Transformes WGS84 longitude/latitude coordinates to KKJ x/y coordinates.
62    * @param longitude the input longitude in degrees
63    * @param latitude the input latitude in degrees
64    * @param outX the result x (easting)
65    * @param outY the result y (northing)
66    */
67   void WGS84lola_to_KKJxy(double longitude, double latitude, KKJ *outX, KKJ *outY);
68
69   /**
70    * Transformes KKJ x/y coordinates to WGS84 longitude/latitude coordinates.
71    * @param x the input x (easting)
72    * @param y the input y (northing)
73    * @param outLongitude the result longitude in degrees
74    * @param outLatitude the result latitude in degrees
75    */
76   void KKJxy_to_WGS84lola(KKJ x, KKJ y, double *outLongitude, double *outLatitude);
77
78   // Degrees to radians
79   double radians(double deg);
80
81   // Radians to degrees
82   double degrees(double rad);
83
84   // Constants
85   // Longitude0 and Center meridian of KKJ bands
86   static const double KkjZoneInfo[][2];
87
88   // Function:  KKJ_Zone_I
89   int KKJ_Zone_I(KKJ easting);
90
91   // Function:  KKJ_Zone_Lo
92   int KKJ_Zone_Lo(double kkjlo);
93
94   // Function:  KKJlalo_to_WGS84lalo
95   void KKJlola_to_WGS84lola(double kkjlo, double kkjla, double *outLongitude, double *outLatitude);
96
97   // Function:  WGS84lalo_to_KKJlalo
98   void WGS84lola_to_KKJlola(double longitude, double latitude, double *outLongitude, double *outLatitude);
99
100   // Function:  KKJlalo_to_KKJxy
101   void KKJlola_to_KKJxy(double lon, double lat, int zoneNumber, KKJ *outX, KKJ *outY);
102
103   // Function:  KKJxy_to_KKJlalo
104   void KKJxy_to_KKJlola(KKJ x, KKJ y, double *outLongitude, double *outLatitude);
105
106 };
107
108 #endif // LOCATION_H