Marble

KmlPlacemarkTagWriter.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2009 Andrew Manson <g.real.ate@gmail.com>
4//
5
6#include "KmlPlacemarkTagWriter.h"
7
8#include "GeoDataPlacemark.h"
9#include "GeoDataPolygon.h"
10#include "GeoDataStyle.h"
11#include "GeoDataTypes.h"
12#include "GeoWriter.h"
13#include "KmlElementDictionary.h"
14
15namespace Marble
16{
17
18// needs to handle a specific doctype. different versions different writer classes?
19// don't use the tag dictionary for tag names, because with the writer we are using
20// the object type strings instead
21// FIXME: USE object strings provided by idis
22static GeoTagWriterRegistrar s_writerPlacemark(GeoTagWriter::QualifiedName(QString::fromLatin1(GeoDataTypes::GeoDataPlacemarkType),
23 QString::fromLatin1(kml::kmlTag_nameSpaceOgc22)),
24 new KmlPlacemarkTagWriter());
25
26bool KmlPlacemarkTagWriter::writeMid(const GeoNode *node, GeoWriter &writer) const
27{
28 const auto placemark = static_cast<const GeoDataPlacemark *>(node);
29
30 writer.writeOptionalElement(QLatin1String(kml::kmlTag_styleUrl), placemark->styleUrl());
31 if (placemark->styleUrl().isEmpty() && placemark->customStyle()) {
32 writeElement(placemark->customStyle().data(), writer);
33 }
34
35 if (placemark->geometry()) {
36 writeElement(placemark->geometry(), writer);
37 }
38
39 if (placemark->isBalloonVisible()) {
40 QString string;
41 string.setNum(1);
42 writer.writeElement(QString::fromLatin1(kml::kmlTag_nameSpaceGx22), QString::fromLatin1(kml::kmlTag_balloonVisibility), string);
43 }
44
45 return true;
46}
47
48KmlPlacemarkTagWriter::KmlPlacemarkTagWriter()
49 : KmlFeatureTagWriter(QString::fromLatin1(kml::kmlTag_Placemark))
50{
51 // nothing to do
52}
53
54}
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.
QString fromLatin1(QByteArrayView str)
QString & setNum(double n, char format, int precision)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:37:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.