Marble

DgmlTargetTagHandler.cpp
1 /*
2  SPDX-FileCopyrightText: 2008 Nikolas Zimmermann <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "DgmlTargetTagHandler.h"
8 
9 #include "DgmlElementDictionary.h"
10 #include "DgmlAttributeDictionary.h"
11 #include "GeoParser.h"
12 #include "GeoSceneHead.h"
13 #include "GeoSceneLayer.h"
14 #include "GeoSceneMap.h"
15 
16 namespace Marble
17 {
18 namespace dgml
19 {
20 DGML_DEFINE_TAG_HANDLER(Target)
21 
22 GeoNode* DgmlTargetTagHandler::parse(GeoParser& parser) const
23 {
24  // Check whether the tag is valid
25  Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(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 }
QString trimmed() const const
bool isEmpty() const const
Binds a QML item to a specific geodetic location in screen coordinates.
double toDouble(bool *ok) const const
void setTarget(const SkyPoint &targetCoord)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 21 2023 04:12:25 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.