map2d_widget
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
src
internals
pointlatlng.h
Go to the documentation of this file.
1
12
/*
13
* This program is free software; you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License as published by
15
* the Free Software Foundation; either version 3 of the License, or
16
* (at your option) any later version.
17
*
18
* This program is distributed in the hope that it will be useful, but
19
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21
* for more details.
22
*
23
* You should have received a copy of the GNU General Public License along
24
* with this program; if not, write to the Free Software Foundation, Inc.,
25
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
*/
27
#ifndef POINTLATLNG_H
28
#define POINTLATLNG_H
29
30
#include <QHash>
31
#include <QString>
32
#include "
sizelatlng.h
"
33
34
namespace
internals
{
35
struct
PointLatLng
36
{
37
//friend uint qHash(PointLatLng const& point);
38
friend
bool
operator==
(
PointLatLng
const
& lhs,
PointLatLng
const
& rhs);
39
friend
bool
operator!=
(
PointLatLng
const
& left,
PointLatLng
const
& right);
40
friend
PointLatLng
operator+
(
PointLatLng
pt,
SizeLatLng
sz);
41
friend
PointLatLng
operator-
(
PointLatLng
pt,
SizeLatLng
sz);
42
43
//TODO Sizelatlng friend PointLatLng operator+(PointLatLng pt, SizeLatLng sz);
44
45
private
:
46
double
lat;
47
double
lng;
48
bool
empty;
49
public
:
50
PointLatLng
();
51
52
53
static
PointLatLng
Empty
;
54
55
PointLatLng
(
const
double
&lat,
const
double
&lng)
56
{
57
this->lat = lat;
58
this->lng = lng;
59
empty=
false
;
60
}
61
62
bool
IsEmpty
()
63
{
64
return
empty;
65
}
66
67
double
Lat
()
const
68
{
69
return
this->lat;
70
}
71
72
void
SetLat
(
const
double
&value)
73
{
74
this->lat = value;
75
empty=
false
;
76
}
77
78
79
double
Lng
()
const
80
{
81
return
this->lng;
82
}
83
void
SetLng
(
const
double
&value)
84
{
85
this->lng = value;
86
empty=
false
;
87
}
88
89
90
91
92
93
static
PointLatLng
Add
(
PointLatLng
const
& pt,
SizeLatLng
const
& sz)
94
{
95
return
PointLatLng
(pt.
Lat
() - sz.
HeightLat
(), pt.
Lng
() + sz.
WidthLng
());
96
}
97
98
static
PointLatLng
Subtract
(
PointLatLng
const
& pt,
SizeLatLng
const
& sz)
99
{
100
return
PointLatLng
(pt.
Lat
() + sz.
HeightLat
(), pt.
Lng
() - sz.
WidthLng
());
101
}
102
103
104
void
Offset
(
PointLatLng
const
& pos)
105
{
106
this->
Offset
(pos.
Lat
(), pos.
Lng
());
107
}
108
109
void
Offset
(
double
const
& lat,
double
const
& lng)
110
{
111
this->lng += lng;
112
this->lat -= lat;
113
}
114
115
116
QString
ToString
()
const
117
{
118
return
QString(
"{Lat=%1, Lng=%2}"
).arg(this->lat).arg(this->lng);
119
}
120
125
};
126
127
128
//
129
}
130
#endif // POINTLATLNG_H
internals::PointLatLng::IsEmpty
bool IsEmpty()
Definition:
pointlatlng.h:62
internals::PointLatLng::Offset
void Offset(PointLatLng const &pos)
Definition:
pointlatlng.h:104
sizelatlng.h
internals::PointLatLng::Lng
double Lng() const
Definition:
pointlatlng.h:79
internals::PointLatLng::Lat
double Lat() const
Definition:
pointlatlng.h:67
internals::SizeLatLng
Definition:
sizelatlng.h:36
internals::PointLatLng
Definition:
pointlatlng.h:35
internals::PointLatLng::SetLat
void SetLat(const double &value)
Definition:
pointlatlng.h:72
internals::PointLatLng::Offset
void Offset(double const &lat, double const &lng)
Definition:
pointlatlng.h:109
internals::SizeLatLng::HeightLat
double HeightLat() const
Definition:
sizelatlng.h:84
internals
Definition:
copyrightstrings.h:33
internals::PointLatLng::operator-
friend PointLatLng operator-(PointLatLng pt, SizeLatLng sz)
Definition:
pointlatlng.cpp:51
internals::PointLatLng::operator+
friend PointLatLng operator+(PointLatLng pt, SizeLatLng sz)
Definition:
pointlatlng.cpp:46
internals::PointLatLng::PointLatLng
PointLatLng(const double &lat, const double &lng)
Definition:
pointlatlng.h:55
internals::PointLatLng::SetLng
void SetLng(const double &value)
Definition:
pointlatlng.h:83
internals::SizeLatLng::WidthLng
double WidthLng() const
Definition:
sizelatlng.h:74
internals::PointLatLng::PointLatLng
PointLatLng()
Definition:
pointlatlng.cpp:32
internals::PointLatLng::Subtract
static PointLatLng Subtract(PointLatLng const &pt, SizeLatLng const &sz)
Definition:
pointlatlng.h:98
internals::PointLatLng::Empty
static PointLatLng Empty
Definition:
pointlatlng.h:53
internals::PointLatLng::operator==
friend bool operator==(PointLatLng const &lhs, PointLatLng const &rhs)
Definition:
pointlatlng.cpp:37
internals::PointLatLng::Add
static PointLatLng Add(PointLatLng const &pt, SizeLatLng const &sz)
Definition:
pointlatlng.h:93
internals::PointLatLng::ToString
QString ToString() const
Definition:
pointlatlng.h:116
internals::PointLatLng::operator!=
friend bool operator!=(PointLatLng const &left, PointLatLng const &right)
Definition:
pointlatlng.cpp:42
Generated by
1.8.11