File indexing completed on 2025-01-05 03:59:02

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2011 Guillaume Martres <smarter@ubuntu.com>
0004 //
0005 
0006 #include "GeoTrackGraphicsItem.h"
0007 
0008 #include "GeoDataLineString.h"
0009 #include "GeoDataPlacemark.h"
0010 #include "GeoDataTrack.h"
0011 #include "StyleBuilder.h"
0012 
0013 #include "digikam_debug.h"
0014 
0015 using namespace Marble;
0016 
0017 GeoTrackGraphicsItem::GeoTrackGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataTrack *track) :
0018     GeoLineStringGraphicsItem(placemark, track->lineString())
0019 {
0020     setTrack( track );
0021     if (placemark) {
0022         QString const paintLayer = QLatin1String("Track/") + StyleBuilder::visualCategoryName(placemark->visualCategory());
0023         setPaintLayers(QStringList() << paintLayer);
0024     }
0025 }
0026 
0027 void GeoTrackGraphicsItem::setTrack( const GeoDataTrack* track )
0028 {
0029     m_track = track;
0030     update();
0031 }
0032 
0033 void GeoTrackGraphicsItem::paint(GeoPainter *painter, const ViewportParams *viewport , const QString &layer, int tileZoomLevel)
0034 {
0035     Q_UNUSED(layer);
0036     Q_UNUSED(tileZoomLevel);
0037     update();
0038     GeoLineStringGraphicsItem::paint(painter, viewport, layer, tileZoomLevel);
0039 }
0040 
0041 void GeoTrackGraphicsItem::update()
0042 {
0043     setLineString( m_track->lineString() );
0044 }