Marble

DgmlMapTagWriter.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 "DgmlMapTagWriter.h"
7
8#include "GeoSceneTypes.h"
9#include "GeoWriter.h"
10#include "GeoSceneMap.h"
11#include "GeoSceneLayer.h"
12#include "DgmlElementDictionary.h"
13
14#include <QColor>
15
16namespace Marble
17{
18
19static GeoTagWriterRegistrar s_writerMap( GeoTagWriter::QualifiedName( GeoSceneTypes::GeoSceneMapType, dgml::dgmlTag_nameSpace20 ),
20 new DgmlMapTagWriter() );
21
22bool DgmlMapTagWriter::write(const GeoNode *node, GeoWriter& writer) const
23{
24 const GeoSceneMap *map = static_cast<const GeoSceneMap*>( node );
25 writer.writeStartElement( dgml::dgmlTag_Map );
26 writer.writeAttribute( "bgcolor", map->backgroundColor().name() );
27 writer.writeAttribute( "labelColor", map->labelColor().name() );
28
29 writer.writeStartElement( "canvas" );
30 writer.writeEndElement();
31
32 if (!map->center().isEmpty()) {
33 if (map->center().count() == 2) {
34 writer.writeElement(dgml::dgmlTag_Center,
35 map->center().at(0).toString() + ","
36 + map->center().at(1).toString());
37 }
38 else if (map->center().count() == 4) {
39 writer.writeElement(dgml::dgmlTag_Center,
40 map->center().at(0).toString() + ","
41 + map->center().at(1).toString() + ","
42 + map->center().at(2).toString() + ","
43 + map->center().at(3).toString());
44 }
45 }
46
47 writer.writeStartElement( dgml::dgmlTag_Target);
48 writer.writeEndElement();
49
50 for( int i = 0; i < map->layers().count(); ++i )
51 {
52 writeElement( map->layers().at( i ), writer );
53 }
54
55 writer.writeEndElement();
56 return true;
57}
58
59}
QPair< QString, QString > QualifiedName
Object Name and Namespace Pair This type is intended to be used in a similar way to.
Binds a QML item to a specific geodetic location in screen coordinates.
QFuture< void > map(Iterator begin, Iterator end, MapFunctor &&function)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:18:17 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.