Moved scheduler settings out of connection section (it is valid for the whole agent...
[public/netxms.git] / include / geolocation.h
CommitLineData
e2babedf
VK
1/*
2** NetXMS - Network Management System
68f384ea 3** Copyright (C) 2003-2010 Victor Kirhenshtein
e2babedf
VK
4**
5** This program is free software; you can redistribute it and/or modify
68f384ea
VK
6** it under the terms of the GNU Lesser General Public License as published by
7** the Free Software Foundation; either version 3 of the License, or
e2babedf
VK
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
68f384ea 15** You should have received a copy of the GNU Lesser General Public License
e2babedf
VK
16** along with this program; if not, write to the Free Software
17** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18**
19** File: geolocation.h
20**
21**/
22
23#ifndef _geolocation_h_
24#define _geolocation_h_
25
26#include <nms_util.h>
40bd1038 27#include <nxcpapi.h>
e2babedf
VK
28
29
30//
31// Location types
32//
33
34#define GL_UNSET 0
35#define GL_MANUAL 1
36#define GL_GPS 2
37
38
39//
40// Geo location class
41//
42
43class LIBNETXMS_EXPORTABLE GeoLocation
44{
45private:
46 int m_type;
47 double m_lat;
48 double m_lon;
49 TCHAR m_latStr[20];
50 TCHAR m_lonStr[20];
51 bool m_isValid;
52
53 void posToString(bool isLat, double pos);
54
55 static int getIntegerDegree(double pos);
56 static int getIntegerMinutes(double pos);
57 static double getDecimalSeconds(double pos);
58
59 static double parse(const TCHAR *str, bool isLat, bool *isValid);
60 bool parseLatitude(const TCHAR *lat);
61 bool parseLongitude(const TCHAR *lon);
62
63public:
64 GeoLocation();
65 GeoLocation(int type, double lat, double lon);
66 GeoLocation(int type, const TCHAR *lat, const TCHAR *lon);
0322eed7 67 GeoLocation(const GeoLocation &src);
40bd1038 68 GeoLocation(CSCPMessage &msg);
e2babedf
VK
69 ~GeoLocation();
70
71 GeoLocation& operator =(const GeoLocation &src);
72
73 int getType() { return m_type; }
74 double getLatitude() { return m_lat; }
75 double getLongitude() { return m_lon; }
76 const TCHAR *getLatitudeAsString() { return m_latStr; }
77 const TCHAR *getLongitudeAsString() { return m_lonStr; }
78 bool isValid() { return m_isValid; }
40bd1038
VK
79
80 void fillMessage(CSCPMessage &msg);
e2babedf
VK
81};
82
83
84#endif