Marble

KmlFlyToTagWriter.cpp
1 
2 // SPDX-License-Identifier: LGPL-2.1-or-later
3 //
4 // SPDX-FileCopyrightText: 2013 Mayank Madan <[email protected]>
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 
17 namespace Marble
18 {
19 
20 static GeoTagWriterRegistrar s_writerFlyTo(
21  GeoTagWriter::QualifiedName( GeoDataTypes::GeoDataFlyToType,
22  kml::kmlTag_nameSpaceOgc22 ),
23  new KmlFlyToTagWriter );
24 
25 bool 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 }
Q_SCRIPTABLE QString camera()
QString number(int n, int base)
QPair< QString, QString > QualifiedName
Object Name and Namespace Pair This type is intended to be used in a similar way to.
Definition: GeoTagWriter.h:44
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Oct 2 2023 03:52:08 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.