Marble

KmlLatLonQuadWriter.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2013 Mayank Madan <maddiemadan@gmail.com>
4//
5
6#include "KmlLatLonQuadWriter.h"
7
8#include "GeoDataLatLonQuad.h"
9#include "GeoDataTypes.h"
10#include "GeoWriter.h"
11#include "KmlElementDictionary.h"
12#include "KmlObjectTagWriter.h"
13
14namespace Marble
15{
16
17static GeoTagWriterRegistrar s_writerLatLonQuad(GeoTagWriter::QualifiedName(QString::fromLatin1(GeoDataTypes::GeoDataLatLonQuadType),
18 QString::fromLatin1(kml::kmlTag_nameSpaceOgc22)),
19 new KmlLatLonQuadWriter);
20
21bool KmlLatLonQuadWriter::write(const GeoNode *node, GeoWriter &writer) const
22{
23 const auto latLonQuad = static_cast<const GeoDataLatLonQuad *>(node);
24
25 if (latLonQuad->isValid()) {
26 writer.writeStartElement(QString::fromUtf8(kml::kmlTag_nameSpaceGx22), QString::fromUtf8(kml::kmlTag_LatLonQuad));
27 KmlObjectTagWriter::writeIdentifiers(writer, latLonQuad);
28
29 writer.writeStartElement(QString::fromUtf8(kml::kmlTag_coordinates));
30
31 writer.writeCharacters(QString::number(latLonQuad->bottomLeftLongitude(GeoDataCoordinates::Degree)));
32 writer.writeCharacters(QLatin1Char(','));
33 writer.writeCharacters(QString::number(latLonQuad->bottomLeftLatitude(GeoDataCoordinates::Degree)));
34 writer.writeCharacters(QLatin1Char(' '));
35
36 writer.writeCharacters(QString::number(latLonQuad->bottomRightLongitude(GeoDataCoordinates::Degree)));
37 writer.writeCharacters(QLatin1Char(','));
38 writer.writeCharacters(QString::number(latLonQuad->bottomRightLatitude(GeoDataCoordinates::Degree)));
39 writer.writeCharacters(QLatin1Char(' '));
40
41 writer.writeCharacters(QString::number(latLonQuad->topRightLongitude(GeoDataCoordinates::Degree)));
42 writer.writeCharacters(QLatin1Char(','));
43 writer.writeCharacters(QString::number(latLonQuad->topRightLatitude(GeoDataCoordinates::Degree)));
44 writer.writeCharacters(QLatin1Char(' '));
45
46 writer.writeCharacters(QString::number(latLonQuad->topLeftLongitude(GeoDataCoordinates::Degree)));
47 writer.writeCharacters(QLatin1Char(','));
48 writer.writeCharacters(QString::number(latLonQuad->topLeftLatitude(GeoDataCoordinates::Degree)));
49
50 writer.writeEndElement();
51
52 writer.writeEndElement();
53 }
54
55 return true;
56}
57
58}
QPair< QString, QString > QualifiedName
Object Name and Namespace Pair This type is intended to be used in a similar way to.
Binds a QML item to a specific geodetic location in screen coordinates.
QString fromLatin1(QByteArrayView str)
QString fromUtf8(QByteArrayView str)
QString number(double n, char format, int precision)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 12:02:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.