Marble

VisiblePlacemark.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2006-2007 Torsten Rahn <tackat@kde.org>
4// SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org>
5//
6
7//
8// VisiblePlacemarks are those Placemarks which become visible on the map
9//
10
11#ifndef MARBLE_VISIBLEPLACEMARK_H
12#define MARBLE_VISIBLEPLACEMARK_H
13
14#include <QObject>
15#include <QPixmap>
16#include <QPoint>
17#include <QRectF>
18
19#include <GeoDataCoordinates.h>
20#include <GeoDataStyle.h>
21
22namespace Marble
23{
24
25class GeoDataPlacemark;
26
27static const qreal s_labelOutlineWidth = 2.5;
28
29/**
30 * @short A class which represents the visible place marks on a map.
31 *
32 * This class is used by PlacemarkLayout to pass the visible place marks
33 * to the PlacemarkPainter.
34 */
36{
38
39public:
40 explicit VisiblePlacemark(const GeoDataPlacemark *placemark, const GeoDataCoordinates &coordinates, const GeoDataStyle::ConstPtr &style);
41
42 /**
43 * Returns the index of the place mark model which
44 * is associated with this visible place mark.
45 */
46 const GeoDataPlacemark *placemark() const;
47
48 /**
49 * Returns the pixmap of the place mark symbol.
50 */
51 const QPixmap &symbolPixmap() const;
52
53 /**
54 * Returns the id for the place mark symbol.
55 */
56 const QString &symbolId() const;
57
58 /**
59 * Returns the state of the place mark.
60 */
61 bool selected() const;
62
63 /**
64 * Sets the state of the place mark.
65 */
66 void setSelected(bool selected);
67
68 /**
69 * Returns the position of the place mark symbol on the map.
70 */
71 const QPointF &symbolPosition() const;
72
73 /**
74 * Returns the top left corner of the place mark symbol's hot spot
75 */
76 const QPointF hotSpot() const;
77
78 /**
79 * Sets the @p position of the place mark symbol on the map.
80 */
81 void setSymbolPosition(const QPointF &position);
82
83 /**
84 * Returns the pixmap of the place mark name label.
85 */
86 const QPixmap &labelPixmap();
87
88 /**
89 * Returns the area covered by the place mark name label on the map.
90 */
91 const QRectF &labelRect() const;
92
93 /**
94 * Sets the @p area covered by the place mark name label on the map.
95 */
96 void setLabelRect(const QRectF &area);
97
98 enum LabelStyle {
99 Normal = 0,
100 Glow,
101 Selected
102 };
103
104 void setStyle(const GeoDataStyle::ConstPtr &style);
105
106 GeoDataStyle::ConstPtr style() const;
107
108 QRectF symbolRect() const;
109
110 QRectF boundingBox() const;
111
112 const GeoDataCoordinates &coordinates() const;
113
115 void updateNeeded();
116
117private Q_SLOTS:
118 void setSymbolPixmap();
119
120private:
121 static void drawLabelText(QPainter &labelPainter, const QString &text, const QFont &labelFont, LabelStyle labelStyle, const QColor &color);
122 void drawLabelPixmap();
123
124 const GeoDataPlacemark *m_placemark;
125
126 // View stuff
127 QPointF m_symbolPosition; // position of the placemark's symbol
128 bool m_selected; // state of the placemark
129 QPixmap m_labelPixmap; // the text label (most often name)
130 bool m_labelDirty;
131 QRectF m_labelRect; // bounding box of label
132
134 GeoDataCoordinates m_coordinates;
135
136 mutable QPixmap m_symbolPixmap; // cached value
137 QString m_symbolId;
138};
139
140}
141
142#endif
A 3d point representation.
a class representing a point of interest on the map
A class which represents the visible place marks on a map.
const QPointF & symbolPosition() const
Returns the position of the place mark symbol on the map.
const QPixmap & labelPixmap()
Returns the pixmap of the place mark name label.
const QString & symbolId() const
Returns the id for the place mark symbol.
void setSelected(bool selected)
Sets the state of the place mark.
const GeoDataPlacemark * placemark() const
Returns the index of the place mark model which is associated with this visible place mark.
const QPointF hotSpot() const
Returns the top left corner of the place mark symbol's hot spot.
void setLabelRect(const QRectF &area)
Sets the area covered by the place mark name label on the map.
bool selected() const
Returns the state of the place mark.
void setSymbolPosition(const QPointF &position)
Sets the position of the place mark symbol on the map.
const QPixmap & symbolPixmap() const
Returns the pixmap of the place mark symbol.
const QRectF & labelRect() const
Returns the area covered by the place mark name label on the map.
Binds a QML item to a specific geodetic location in screen coordinates.
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:08:53 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.