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 "GeoDataFlyTo.h"
10#include "GeoDataTypes.h"
11#include "GeoDataAbstractView.h"
12#include "GeoDataLookAt.h"
13#include "GeoDataCamera.h"
14#include "GeoWriter.h"
15#include "KmlElementDictionary.h"
16
17namespace Marble
18{
19
20static GeoTagWriterRegistrar s_writerFlyTo(
21 GeoTagWriter::QualifiedName( GeoDataTypes::GeoDataFlyToType,
22 kml::kmlTag_nameSpaceOgc22 ),
23 new KmlFlyToTagWriter );
24
25bool KmlFlyToTagWriter::write( const GeoNode *node, GeoWriter& writer ) const
26{
27 const GeoDataFlyTo *flyTo = static_cast<const GeoDataFlyTo*>( node );
28 writer.writeStartElement( kml::kmlTag_nameSpaceGx22, kml::kmlTag_FlyTo );
29 writer.writeElement( kml::kmlTag_nameSpaceGx22, kml::kmlTag_duration, QString::number( flyTo->duration()) );
30 if ( flyTo->flyToMode() == GeoDataFlyTo::Smooth ) {
31 // two values, smooth and bounce, bounce is default and can hence be omitted
32 writer.writeElement( kml::kmlTag_nameSpaceGx22, kml::kmlTag_flyToMode, "smooth" );
33 }
34 if ( flyTo->view() ) {
35 GeoDataLookAt const * lookAt = dynamic_cast<const GeoDataLookAt*>( flyTo->view() );
36 if ( lookAt ) {
37 writeElement( lookAt, writer );
38 }
39 GeoDataCamera const * camera = dynamic_cast<const GeoDataCamera*>( flyTo->view() );
40 if ( camera ) {
41 writeElement( camera, writer );
42 }
43 }
44 writer.writeEndElement();
45 return true;
46}
47
48}
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 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 Jun 14 2024 11:54:17 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.