Marble

KmlFlyToTagWriter.cpp
1
2// SPDX-License-Identifier: LGPL-2.1-or-later
3//
4// SPDX-FileCopyrightText: 2013 Mayank Madan <maddiemadan@gmail.com>
5//
6
7#include "KmlFlyToTagWriter.h"
8
9#include "GeoDataAbstractView.h"
10#include "GeoDataCamera.h"
11#include "GeoDataFlyTo.h"
12#include "GeoDataLookAt.h"
13#include "GeoDataTypes.h"
14#include "GeoWriter.h"
15#include "KmlElementDictionary.h"
16
17namespace Marble
18{
19
20static GeoTagWriterRegistrar s_writerFlyTo(GeoTagWriter::QualifiedName(QString::fromLatin1(GeoDataTypes::GeoDataFlyToType),
21 QString::fromLatin1(kml::kmlTag_nameSpaceOgc22)),
22 new KmlFlyToTagWriter);
23
24bool KmlFlyToTagWriter::write(const GeoNode *node, GeoWriter &writer) const
25{
26 const auto flyTo = static_cast<const GeoDataFlyTo *>(node);
27 writer.writeStartElement(QString::fromUtf8(kml::kmlTag_nameSpaceGx22), QString::fromUtf8(kml::kmlTag_FlyTo));
28 writer.writeElement(QString::fromLatin1(kml::kmlTag_nameSpaceGx22), QString::fromLatin1(kml::kmlTag_duration), QString::number(flyTo->duration()));
29 if (flyTo->flyToMode() == GeoDataFlyTo::Smooth) {
30 // two values, smooth and bounce, bounce is default and can hence be omitted
31 writer.writeElement(QString::fromLatin1(kml::kmlTag_nameSpaceGx22), QString::fromLatin1(kml::kmlTag_flyToMode), QStringLiteral("smooth"));
32 }
33 if (flyTo->view()) {
34 auto const *lookAt = dynamic_cast<const GeoDataLookAt *>(flyTo->view());
35 if (lookAt) {
36 writeElement(lookAt, writer);
37 }
38 auto const *camera = dynamic_cast<const GeoDataCamera *>(flyTo->view());
39 if (camera) {
40 writeElement(camera, writer);
41 }
42 }
43 writer.writeEndElement();
44 return true;
45}
46
47}
QPair< QString, QString > QualifiedName
Object Name and Namespace Pair This type is intended to be used in a similar way to.
Q_SCRIPTABLE QString camera()
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.