Marble

GeoTrackGraphicsItem.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2011 Guillaume Martres <smarter@ubuntu.com>
4//
5
6#include "GeoTrackGraphicsItem.h"
7
8#include "GeoDataPlacemark.h"
9#include "GeoDataTrack.h"
10#include "StyleBuilder.h"
11
12using namespace Marble;
13
14GeoTrackGraphicsItem::GeoTrackGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataTrack *track)
15 : GeoLineStringGraphicsItem(placemark, track->lineString())
16{
17 setTrack(track);
18 if (placemark) {
19 QString const paintLayer = QLatin1StringView("Track/") + StyleBuilder::visualCategoryName(placemark->visualCategory());
20 setPaintLayers(QStringList() << paintLayer);
21 }
22}
23
24void GeoTrackGraphicsItem::setTrack(const GeoDataTrack *track)
25{
26 m_track = track;
27 update();
28}
29
30void GeoTrackGraphicsItem::paint(GeoPainter *painter, const ViewportParams *viewport, const QString &layer, int tileZoomLevel)
31{
32 Q_UNUSED(layer);
33 Q_UNUSED(tileZoomLevel);
34 update();
35 GeoLineStringGraphicsItem::paint(painter, viewport, layer, tileZoomLevel);
36}
37
38void GeoTrackGraphicsItem::update()
39{
40 setLineString(m_track->lineString());
41}
a class representing a point of interest on the map
GeoDataVisualCategory visualCategory() const
Return the symbol index of the placemark.
A geometry for tracking objects made of (time, coordinates) pairs.
const GeoDataLineString * lineString() const
Return the GeoDataLineString representing the current track.
A painter that allows to draw geometric primitives on the map.
Definition GeoPainter.h:86
A public class that controls what is visible in the viewport of a Marble map.
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 12:02:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.