Marble

KmlPolygonTagWriter.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2012 Shou Ya <shouyatf@gmail.com>
4// SPDX-FileCopyrightText: 2014 Marek Hakala <hakala.marek@gmail.com>
5//
6
7#include "KmlPolygonTagWriter.h"
8
9#include "GeoDataPolygon.h"
10#include "GeoDataLinearRing.h"
11#include "GeoDataTypes.h"
12#include "GeoWriter.h"
13#include "KmlElementDictionary.h"
14#include "KmlObjectTagWriter.h"
15
16namespace Marble
17{
18
19static GeoTagWriterRegistrar s_writerLookAt(
20 GeoTagWriter::QualifiedName( GeoDataTypes::GeoDataPolygonType,
21 kml::kmlTag_nameSpaceOgc22 ),
22 new KmlPolygonTagWriter);
23
24bool KmlPolygonTagWriter::write( const GeoNode *node, GeoWriter& writer ) const
25{
26 const GeoDataPolygon *polygon = static_cast<const GeoDataPolygon*>( node );
27
28 writer.writeStartElement( kml::kmlTag_Polygon );
29 KmlObjectTagWriter::writeIdentifiers( writer, polygon );
30 writer.writeOptionalElement( kml::kmlTag_extrude, QString::number( polygon->extrude() ), "0" );
31
32 writer.writeStartElement( "outerBoundaryIs" );
33 writeElement( &polygon->outerBoundary(), writer );
34 writer.writeEndElement();
35
36 const QVector<GeoDataLinearRing>& linearRings = polygon->innerBoundaries();
37 if (linearRings.size() > 0) {
38 writer.writeStartElement( "innerBoundaryIs" );
39 for ( int i = 0; i < linearRings.size(); ++i ) {
40 const GeoDataLinearRing& ring = linearRings[i];
41 writeElement( &ring, writer );
42 }
43 writer.writeEndElement();
44 }
45
46 writer.writeEndElement();
47
48 return true;
49
50}
51
52}
53
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.
qsizetype size() const const
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 21 2024 12:00:07 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.