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 "GeoDataGroundOverlay.h"
10#include "GeoDataIconStyle.h"
11#include "GeoDataItemIcon.h"
12#include "GeoDataLink.h"
13#include "GeoDataPhotoOverlay.h"
14#include "GeoDataScreenOverlay.h"
15#include "GeoDataSoundCue.h"
16#include "GeoParser.h"
17#include "KmlElementDictionary.h"
18
19namespace Marble
20{
21namespace kml
22{
23KML_DEFINE_TAG_HANDLER(href)
24
25GeoNode *KmlhrefTagHandler::parse(GeoParser &parser) const
26{
27 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(kmlTag_href)));
28
29 GeoStackItem parentItem = parser.parentElement();
30
31 QString content = parser.readElementText().trimmed();
32
33 if (parentItem.represents(kmlTag_Icon)) {
34 // we need a more elaborate version of this part
35 if (parentItem.is<GeoDataIconStyle>()) {
36 parentItem.nodeAs<GeoDataIconStyle>()->setIconPath(content);
37 } else if (parentItem.is<GeoDataGroundOverlay>()) {
38 parentItem.nodeAs<GeoDataGroundOverlay>()->setIconFile(content);
39 } else if (parentItem.is<GeoDataPhotoOverlay>()) {
40 parentItem.nodeAs<GeoDataPhotoOverlay>()->setIconFile(content);
41 } else if (parentItem.is<GeoDataScreenOverlay>()) {
42 parentItem.nodeAs<GeoDataScreenOverlay>()->setIconFile(content);
43 }
44 } else if (parentItem.represents(kmlTag_ItemIcon)) {
45 parentItem.nodeAs<GeoDataItemIcon>()->setIconPath(content);
46 } else if (parentItem.is<GeoDataLink>()) {
47 parentItem.nodeAs<GeoDataLink>()->setHref(content);
48 } else if (parentItem.is<GeoDataSoundCue>()) {
49 parentItem.nodeAs<GeoDataSoundCue>()->setHref(content);
50 }
51
52 return nullptr;
53}
54
55}
56}
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 Dec 27 2024 11:50:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.