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 "GeoDataLineString.h"
9#include "GeoDataPlacemark.h"
10#include "GeoDataTrack.h"
11#include "MarbleDebug.h"
12#include "StyleBuilder.h"
13
14using namespace Marble;
15
16GeoTrackGraphicsItem::GeoTrackGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataTrack *track) :
17 GeoLineStringGraphicsItem(placemark, track->lineString())
18{
19 setTrack( track );
20 if (placemark) {
21 QString const paintLayer = QLatin1String("Track/") + StyleBuilder::visualCategoryName(placemark->visualCategory());
22 setPaintLayers(QStringList() << paintLayer);
23 }
24}
25
26void GeoTrackGraphicsItem::setTrack( const GeoDataTrack* track )
27{
28 m_track = track;
29 update();
30}
31
32void GeoTrackGraphicsItem::paint(GeoPainter *painter, const ViewportParams *viewport , const QString &layer, int tileZoomLevel)
33{
34 Q_UNUSED(layer);
35 Q_UNUSED(tileZoomLevel);
36 update();
37 GeoLineStringGraphicsItem::paint(painter, viewport, layer, tileZoomLevel);
38}
39
40void GeoTrackGraphicsItem::update()
41{
42 setLineString( m_track->lineString() );
43}
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:89
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 Jun 14 2024 11:54:16 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.