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