-
Notifications
You must be signed in to change notification settings - Fork 0
/
locator.h
78 lines (61 loc) · 3.16 KB
/
locator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/***************************************************************************
locator.h - description
-------------------
begin : vie feb 7 2003
copyright : (C) 2003 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLuster. *
* *
* KLuster 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 3 of the License, or *
* (at your option) any later version. *
* *
* KLuster 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 KLuster. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#ifndef LOCATOR_H
#define LOCATOR_H
#include <math.h>
#include <QString>
const double PI = 3.141592654; //http://en.wikipedia.org/wiki/Pi
const bool LATITUDE = false;
const bool LONGITUDE = true;
const double EARTH_RADIUS = 6371; //http://en.wikipedia.org/wiki/Earth_radius
const bool RADIAN = 180.0/PI;
const double DEG_TO_RAD = PI/180.0;
const double KM_IN_A_MILE = 1.609344;
class Locator{
public:
Locator();
~Locator();
bool isValidLocator(const QString& tlocator);
double getLat(const QString& tlocator);
double getLon(const QString& tlocator);
QString getLocator(const double lon1, const double lat1) const;
int getBeam(const double lon1, const double lat1, const double lon2, const double lat2);
int getBeamBetweenLocators (const QString& tlocator1, const QString& tlocator2);
int getDistance(const double lon1, const double lat1, const double lon2, const double lat2, const bool _imperialSystem);
int getDistanceBetweenLocators (const QString& tlocator1, const QString& tlocator2, const bool _imperialSystem);
//int getDistanceMilles(const double lon1, const double lat1, const double lon2, const double lat2);
void degTodms(const double deg);
double dmsTodeg (int deg, int min, int sec);
bool checkCoords(const double lon1, const double lat1);
private:
bool valid;
QString myLocator;
QString testLocator;
QString otherLocator;
QChar theChar;
double my_lon, my_lat, other_lon, other_lat, beam, testNumb;
int ideg, imin, isec;
};
#endif