Marble

DgmlHeadTagWriter.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2011 Utku Aydın <utkuaydin34@gmail.com>
4//
5
6#include "DgmlHeadTagWriter.h"
7
8#include "GeoSceneTypes.h"
9#include "GeoWriter.h"
10#include "GeoSceneHead.h"
11#include "GeoSceneIcon.h"
12#include "GeoSceneZoom.h"
13#include "DgmlElementDictionary.h"
14
15namespace Marble
16{
17
18static GeoTagWriterRegistrar s_writerHead( GeoTagWriter::QualifiedName( GeoSceneTypes::GeoSceneHeadType, dgml::dgmlTag_nameSpace20 ),
19 new DgmlHeadTagWriter() );
20
21bool DgmlHeadTagWriter::write( const GeoNode *node, GeoWriter& writer ) const
22{
23 const GeoSceneHead *head = static_cast<const GeoSceneHead*>( node );
24 writer.writeStartElement( dgml::dgmlTag_Head );
25 writer.writeElement( "name", head->name() );
26 writer.writeElement( "target", head->target() );
27 writer.writeElement( "theme", head->theme() );
28 writer.writeElement( "visible", head->visible() ? "true" : "false" );
29 writer.writeStartElement( "description" );
30 writer.writeCDATA( head->description() );
31 writer.writeEndElement();
32
33 const GeoSceneIcon &icon = static_cast<const GeoSceneIcon&>( *head->icon() );
34 writer.writeStartElement( dgml::dgmlTag_Icon );
35 writer.writeAttribute( "pixmap", icon.pixmap() );
36 writer.writeEndElement();
37
38 const GeoSceneZoom &zoom = static_cast<const GeoSceneZoom&>( *head->zoom() );
39 writer.writeStartElement( dgml::dgmlTag_Zoom );
40 writer.writeElement( "discrete", zoom.discrete() ? "true" : "false" );
41 writer.writeTextElement( "minimum", QString::number( zoom.minimum() ) );
42 writer.writeTextElement( "maximum", QString::number( zoom.maximum() ) );
43 writer.writeEndElement();
44
45 writer.writeEndElement();
46
47 return true;
48}
49
50}
QPair< QString, QString > QualifiedName
Object Name and Namespace Pair This type is intended to be used in a similar way to.
QAction * zoom(const QObject *recvr, const char *slot, QObject *parent)
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 7 2024 12:03:13 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.