10 #include "common/hash.h"
11 #include "common/coordinates.h"
18 Waypoint() : _elevation(NAN
) {}
19 Waypoint(const Coordinates
&coordinates
)
20 : _coordinates(coordinates
), _elevation(NAN
) {}
22 const Coordinates
&coordinates() const {return _coordinates
;}
23 Coordinates
&rcoordinates() {return _coordinates
;}
24 const QString
&name() const {return _name
;}
25 const QString
&description() const {return _description
;}
26 const QString
&comment() const {return _comment
;}
27 const QString
&address() const {return _address
;}
28 const QString
&phone() const {return _phone
;}
29 const QString
&symbol() const {return _symbol
;}
30 const QVector
<QString
> &images() const {return _images
;}
31 const QVector
<Link
> &links() const {return _links
;}
32 const QDateTime
×tamp() const {return _timestamp
;}
33 qreal
elevation() const {return _elevation
;}
34 const PointStyle
&style() const {return _style
;}
36 QPair
<qreal
, qreal
> elevations() const;
38 void setCoordinates(const Coordinates
&coordinates
)
39 {_coordinates
= coordinates
;}
40 void setName(const QString
&name
) {_name
= name
;}
41 void setDescription(const QString
&description
)
42 {_description
= description
;}
43 void setComment(const QString
&comment
) {_comment
= comment
;}
44 void setAddress(const QString
&address
) {_address
= address
;}
45 void setPhone(const QString
&phone
) {_phone
= phone
;}
46 void setSymbol(const QString
&symbol
) {_symbol
= symbol
;}
47 void setTimestamp(const QDateTime
×tamp
) {_timestamp
= timestamp
;}
48 void setElevation(qreal elevation
) {_elevation
= elevation
;}
49 void addImage(const QString
&path
) {_images
.append(path
);}
50 void addLink(const Link
&link
) {_links
.append(link
);}
51 void setStyle(const PointStyle
&style
) {_style
= style
;}
53 bool hasElevation() const {return !std::isnan(_elevation
);}
55 bool operator==(const Waypoint
&other
) const
56 {return this->_name
== other
._name
57 && this->_coordinates
== other
._coordinates
;}
59 static void useDEM(bool use
) {_useDEM
= use
;}
60 static void showSecondaryElevation(bool show
)
61 {_show2ndElevation
= show
;}
63 static const QPixmap
*symbolIcon(const QString
&symbol
);
64 static void loadSymbolIcons(const QString
&dir
);
67 Coordinates _coordinates
;
74 QVector
<QString
> _images
;
81 static bool _show2ndElevation
;
82 static QHash
<QString
, QPixmap
> _symbolIcons
;
85 inline HASH_T
qHash(const Waypoint
&key
)
87 return ::qHash(key
.name());
91 inline QDebug
operator<<(QDebug dbg
, const Waypoint
&waypoint
)
93 dbg
.nospace() << "Waypoint(" << waypoint
.coordinates() << ", "
94 << waypoint
.name() << ")";