Marble

DgmlTargetTagHandler.cpp
1/*
2 SPDX-FileCopyrightText: 2008 Nikolas Zimmermann <zimmermann@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "DgmlTargetTagHandler.h"
8
9#include "DgmlAttributeDictionary.h"
10#include "DgmlElementDictionary.h"
11#include "GeoParser.h"
12#include "GeoSceneHead.h"
13#include "GeoSceneLayer.h"
14#include "GeoSceneMap.h"
15
16namespace Marble
17{
18namespace dgml
19{
20DGML_DEFINE_TAG_HANDLER(Target)
21
22GeoNode *DgmlTargetTagHandler::parse(GeoParser &parser) const
23{
24 // Check whether the tag is valid
25 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(dgmlTag_Target)));
26
27 QString const targetRadius = parser.attribute(dgmlAttr_radius).trimmed();
28
29 // Checking for parent item
30 GeoStackItem parentItem = parser.parentElement();
31 if (parentItem.represents(dgmlTag_Head)) {
32 parentItem.nodeAs<GeoSceneHead>()->setTarget(parser.readElementText().trimmed());
33 if (!targetRadius.isEmpty()) {
34 parentItem.nodeAs<GeoSceneHead>()->setRadius(targetRadius.toDouble());
35 }
36 }
37
38 if (parentItem.represents(dgmlTag_Map)) {
39 /* GeoSceneLayer *layer = new GeoSceneLayer( "$MARBLETARGET$" );
40 parentItem.nodeAs<GeoSceneMap>()->addLayer( layer );*/
41 }
42
43 return nullptr;
44}
45
46}
47}
void setTarget(const SkyPoint &targetCoord)
Binds a QML item to a specific geodetic location in screen coordinates.
bool isEmpty() const const
double toDouble(bool *ok) const const
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.