File indexing completed on 2025-01-05 03:59:13
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2013 Mayank Madan <maddiemadan@gmail.com> 0004 // 0005 0006 #include "KmlLatLonQuadWriter.h" 0007 0008 #include "GeoDataLatLonQuad.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_writerLatLonQuad( 0018 GeoTagWriter::QualifiedName( QString::fromUtf8(GeoDataTypes::GeoDataLatLonQuadType), 0019 QString::fromUtf8(kml::kmlTag_nameSpaceOgc22) ), 0020 new KmlLatLonQuadWriter ); 0021 0022 bool KmlLatLonQuadWriter::write( const GeoNode *node, 0023 GeoWriter& writer ) const 0024 { 0025 const GeoDataLatLonQuad *latLonQuad = static_cast<const GeoDataLatLonQuad*>( node ); 0026 0027 if ( latLonQuad->isValid() ) { 0028 writer.writeStartElement( QString::fromUtf8(kml::kmlTag_nameSpaceGx22), QString::fromUtf8(kml::kmlTag_LatLonQuad) ); 0029 KmlObjectTagWriter::writeIdentifiers( writer, latLonQuad ); 0030 0031 writer.writeStartElement( QString::fromUtf8(kml::kmlTag_coordinates) ); 0032 0033 writer.writeCharacters( QString::number( latLonQuad->bottomLeftLongitude( GeoDataCoordinates::Degree ) ) ); 0034 writer.writeCharacters( QString::fromUtf8( "," ) ); 0035 writer.writeCharacters( QString::number( latLonQuad->bottomLeftLatitude( GeoDataCoordinates::Degree ) ) ); 0036 writer.writeCharacters( QString::fromUtf8( " " ) ); 0037 0038 writer.writeCharacters( QString::number( latLonQuad->bottomRightLongitude( GeoDataCoordinates::Degree ) ) ); 0039 writer.writeCharacters( QString::fromUtf8( "," ) ); 0040 writer.writeCharacters( QString::number( latLonQuad->bottomRightLatitude( GeoDataCoordinates::Degree ) ) ); 0041 writer.writeCharacters( QString::fromUtf8( " " ) ); 0042 0043 writer.writeCharacters( QString::number( latLonQuad->topRightLongitude( GeoDataCoordinates::Degree ) ) ); 0044 writer.writeCharacters( QString::fromUtf8( "," ) ); 0045 writer.writeCharacters( QString::number( latLonQuad->topRightLatitude( GeoDataCoordinates::Degree ) ) ); 0046 writer.writeCharacters( QString::fromUtf8( " " ) ); 0047 0048 writer.writeCharacters( QString::number( latLonQuad->topLeftLongitude( GeoDataCoordinates::Degree ) ) ); 0049 writer.writeCharacters( QString::fromUtf8( "," ) ); 0050 writer.writeCharacters( QString::number( latLonQuad->topLeftLatitude( GeoDataCoordinates::Degree ) ) ); 0051 0052 writer.writeEndElement(); 0053 0054 writer.writeEndElement(); 0055 } 0056 0057 return true; 0058 } 0059 0060 }