Marble

Kml_scaleTagHandler.cpp
1 /*
2  SPDX-FileCopyrightText: 2008 Patrick Spendrin <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 // be aware that there is another Tag called Scale which uses the name KmlscaleTagHandler.h
8 // as it is impossible to use the name KmlscaleTagHandler then, use an underscore
9 // to mark the lower case variant
10 
11 #include "Kml_scaleTagHandler.h"
12 
13 #include "MarbleDebug.h"
14 
15 #include "KmlElementDictionary.h"
16 #include "GeoDataIconStyle.h"
17 #include "GeoDataLabelStyle.h"
18 #include "GeoParser.h"
19 
20 namespace Marble
21 {
22 namespace kml
23 {
24 KML_DEFINE_TAG_HANDLER( scale )
25 
26 GeoNode* KmlscaleTagHandler::parse( GeoParser& parser ) const
27 {
28  Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(kmlTag_scale)));
29 
30  GeoStackItem parentItem = parser.parentElement();
31 
32  if ( parentItem.represents( kmlTag_IconStyle ) ) {
33  parentItem.nodeAs<GeoDataIconStyle>()->setScale(
34  parser.readElementText().trimmed().toFloat() );
35  } else if( parentItem.represents( kmlTag_LabelStyle ) ) {
36  parentItem.nodeAs<GeoDataLabelStyle>()->setScale(
37  parser.readElementText().trimmed().toFloat() );
38  }
39  return nullptr;
40 }
41 
42 }
43 }
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Oct 4 2023 04:09:42 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.