File indexing completed on 2025-01-05 03:59:13

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2012 Shou Ya <shouyatf@gmail.com>
0004 //
0005 
0006 #include "KmlLatLonBoxWriter.h"
0007 
0008 #include "GeoDataLatLonBox.h"
0009 #include "GeoDataTypes.h"
0010 #include "GeoWriter.h"
0011 #include "KmlElementDictionary.h"
0012 #include "KmlObjectTagWriter.h"
0013 
0014 namespace Marble
0015 {
0016 
0017 static GeoTagWriterRegistrar s_writerLookAt(
0018     GeoTagWriter::QualifiedName( QString::fromUtf8(GeoDataTypes::GeoDataLatLonBoxType),
0019                  QString::fromUtf8(kml::kmlTag_nameSpaceOgc22) ),
0020     new KmlLatLonBoxWriter );
0021 
0022 bool KmlLatLonBoxWriter::write( const GeoNode *node,
0023                  GeoWriter& writer ) const
0024 {
0025     const GeoDataLatLonBox *lat_lon_box =
0026     static_cast<const GeoDataLatLonBox*>( node );
0027 
0028     writer.writeStartElement( QString::fromUtf8(kml::kmlTag_LatLonBox) );
0029     KmlObjectTagWriter::writeIdentifiers( writer, lat_lon_box );
0030 
0031     writer.writeTextElement( QString::fromUtf8("north"),
0032                  QString::number(lat_lon_box->north( GeoDataCoordinates::Degree )) );
0033     writer.writeTextElement( QString::fromUtf8("south"),
0034                  QString::number(lat_lon_box->south( GeoDataCoordinates::Degree )) );
0035     writer.writeTextElement( QString::fromUtf8("east"),
0036                  QString::number(lat_lon_box->east( GeoDataCoordinates::Degree )) );
0037     writer.writeTextElement( QString::fromUtf8("west"),
0038                  QString::number(lat_lon_box->west( GeoDataCoordinates::Degree )) );
0039     writer.writeOptionalElement( QString::fromUtf8("rotation"),
0040                              QString::number(lat_lon_box->rotation( GeoDataCoordinates::Degree )), QString::fromUtf8("0") );
0041 
0042     writer.writeEndElement();
0043 
0044     return true;
0045 }
0046 
0047 }
0048 
0049