Marble

DgmlItemTagWriter.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2011 Utku Aydın <[email protected]>
4 //
5 
6 #include "DgmlItemTagWriter.h"
7 
8 #include "GeoSceneTypes.h"
9 #include "GeoWriter.h"
10 #include "GeoSceneSection.h"
11 #include "GeoSceneItem.h"
12 #include "GeoSceneIcon.h"
13 #include "DgmlElementDictionary.h"
14 
15 namespace Marble
16 {
17 
18 static GeoTagWriterRegistrar s_writerItem( GeoTagWriter::QualifiedName( GeoSceneTypes::GeoSceneItemType, dgml::dgmlTag_nameSpace20 ),
19  new DgmlItemTagWriter() );
20 
21 bool DgmlItemTagWriter::write(const GeoNode *node, GeoWriter& writer) const
22 {
23  const GeoSceneItem *item = static_cast<const GeoSceneItem*>( node );
24 
25  writer.writeStartElement( dgml::dgmlTag_Item );
26  writer.writeAttribute( "name", item->name() );
27 
28  writer.writeStartElement( dgml::dgmlTag_Icon );
29  if( !item->icon()->pixmap().isEmpty() ) {
30  writer.writeAttribute( "pixmap", item->icon()->pixmap() );
31  } else if (item->icon()->color().isValid()) {
32  writer.writeAttribute( "color", item->icon()->color().name() );
33  }
34  writer.writeEndElement();
35  writer.writeElement( "text", item->text() );
36 
37  writer.writeEndElement();
38  return true;
39 }
40 
41 }
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:07 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.