Marble

KmlPlacemarkTagWriter.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2009 Andrew Manson <[email protected]>
4 //
5 
6 #include "KmlPlacemarkTagWriter.h"
7 
8 #include "KmlElementDictionary.h"
9 #include "GeoDataPlacemark.h"
10 #include "GeoDataExtendedData.h"
11 #include "GeoDataTimeStamp.h"
12 #include "GeoDataTypes.h"
13 #include "GeoDataPolygon.h"
14 #include "GeoWriter.h"
15 #include "GeoDataStyle.h"
16 
17 namespace Marble
18 {
19 
20 //needs to handle a specific doctype. different versions different writer classes?
21 //don't use the tag dictionary for tag names, because with the writer we are using
22 // the object type strings instead
23 //FIXME: USE object strings provided by idis
24 static GeoTagWriterRegistrar s_writerPlacemark( GeoTagWriter::QualifiedName(GeoDataTypes::GeoDataPlacemarkType,
25  kml::kmlTag_nameSpaceOgc22), new KmlPlacemarkTagWriter() );
26 
27 bool KmlPlacemarkTagWriter::writeMid( const GeoNode *node, GeoWriter& writer ) const
28 {
29  const GeoDataPlacemark *placemark = static_cast<const GeoDataPlacemark*>(node);
30 
31  writer.writeOptionalElement( kml::kmlTag_styleUrl, placemark->styleUrl() );
32  if ( placemark->styleUrl().isEmpty() && placemark->customStyle() ) {
33  writeElement( placemark->customStyle().data(), writer );
34  }
35 
36  if( placemark->geometry() ) {
37  writeElement( placemark->geometry(), writer );
38  }
39 
40  if( placemark->isBalloonVisible() ){
41  QString string;
42  string.setNum( 1 );
43  writer.writeElement( kml::kmlTag_nameSpaceGx22, kml::kmlTag_balloonVisibility, string );
44  }
45 
46  return true;
47 }
48 
49 KmlPlacemarkTagWriter::KmlPlacemarkTagWriter() :
50  KmlFeatureTagWriter( kml::kmlTag_Placemark )
51 {
52  // nothing to do
53 }
54 
55 }
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
QString & setNum(short n, int base)
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 Thu Sep 21 2023 04:12:27 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.