Marble

KmlHrefTagHandler.cpp
1/*
2 SPDX-FileCopyrightText: 2008 Patrick Spendrin <ps_ml@gmx.de>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "KmlHrefTagHandler.h"
8
9#include "MarbleDebug.h"
10#include "KmlElementDictionary.h"
11#include "GeoDataIconStyle.h"
12#include "GeoDataGroundOverlay.h"
13#include "GeoDataLink.h"
14#include "GeoDataPhotoOverlay.h"
15#include "GeoDataScreenOverlay.h"
16#include "GeoDataSoundCue.h"
17#include "GeoDataItemIcon.h"
18#include "GeoParser.h"
19
20namespace Marble
21{
22namespace kml
23{
24KML_DEFINE_TAG_HANDLER( href )
25
26GeoNode* KmlhrefTagHandler::parse( GeoParser& parser ) const
27{
28 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(kmlTag_href)));
29
30 GeoStackItem parentItem = parser.parentElement();
31
32 QString content = parser.readElementText().trimmed();
33
34 if ( parentItem.represents( kmlTag_Icon ) ) {
35 // we need a more elaborate version of this part
36 if ( parentItem.is<GeoDataIconStyle>() ) {
37 parentItem.nodeAs<GeoDataIconStyle>()->setIconPath( content );
38 } else if ( parentItem.is<GeoDataGroundOverlay>() ) {
39 parentItem.nodeAs<GeoDataGroundOverlay>()->setIconFile( content );
40 } else if ( parentItem.is<GeoDataPhotoOverlay>() ) {
41 parentItem.nodeAs<GeoDataPhotoOverlay>()->setIconFile( content );
42 } else if ( parentItem.is<GeoDataScreenOverlay>() ) {
43 parentItem.nodeAs<GeoDataScreenOverlay>()->setIconFile( content );
44 }
45 } else if ( parentItem.represents( kmlTag_ItemIcon ) ) {
46 parentItem.nodeAs<GeoDataItemIcon>()->setIconPath( content );
47 } else if ( parentItem.is<GeoDataLink>() ) {
48 parentItem.nodeAs<GeoDataLink>()->setHref( content );
49 } else if ( parentItem.is<GeoDataSoundCue>() ) {
50 parentItem.nodeAs<GeoDataSoundCue>()->setHref( content );
51 }
52
53 return nullptr;
54}
55
56}
57}
Binds a QML item to a specific geodetic location in screen coordinates.
QString trimmed() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:57:57 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.