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