File indexing completed on 2024-06-02 03:51:03

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2009 Bastian Holst <bastianholst@gmx.de>
0004 //
0005 
0006 #include "KmlMaxAltitudeTagHandler.h"
0007 
0008 #include "MarbleDebug.h"
0009 
0010 #include "KmlElementDictionary.h"
0011 #include "GeoDataLatLonAltBox.h"
0012 #include "GeoParser.h"
0013 
0014 namespace Marble
0015 {
0016 namespace kml
0017 {
0018 KML_DEFINE_TAG_HANDLER( maxAltitude )
0019 
0020 GeoNode* KmlmaxAltitudeTagHandler::parse( GeoParser& parser ) const
0021 {
0022     Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(kmlTag_maxAltitude)));
0023 
0024     GeoStackItem parentItem = parser.parentElement();
0025 
0026     if( parentItem.represents( kmlTag_LatLonAltBox ) ) {
0027         float maxAltitude = parser.readElementText().trimmed().toFloat();
0028 
0029         parentItem.nodeAs<GeoDataLatLonAltBox>()->setMaxAltitude( maxAltitude );
0030     }
0031 
0032     return nullptr;
0033 }
0034 
0035 }
0036 }