Marble

KmlPointTagHandler.cpp
1/*
2 SPDX-FileCopyrightText: 2008 Patrick Spendrin <ps_ml@gmx.de>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "KmlPointTagHandler.h"
8
9#include "MarbleDebug.h"
10
11#include "KmlElementDictionary.h"
12#include "KmlObjectTagHandler.h"
13#include "GeoDataPlacemark.h"
14#include "GeoDataPoint.h"
15#include "GeoDataMultiGeometry.h"
16#include "GeoDataPhotoOverlay.h"
17#include "GeoParser.h"
18
19namespace Marble
20{
21namespace kml
22{
23KML_DEFINE_TAG_HANDLER( Point )
24
25GeoNode* KmlPointTagHandler::parse( GeoParser& parser ) const
26{
27 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(kmlTag_Point)));
28 // FIXME: there needs to be a check that a coordinates subtag is contained
29
30 GeoStackItem parentItem = parser.parentElement();
31 if( parentItem.represents( kmlTag_Placemark ) ) {
32 return parentItem.nodeAs<GeoDataPlacemark>();
33
34 } else if( parentItem.represents( kmlTag_MultiGeometry ) ) {
35 GeoDataPoint *point = new GeoDataPoint;
36 KmlObjectTagHandler::parseIdentifiers( parser, point );
37 parentItem.nodeAs<GeoDataMultiGeometry>()->append( point );
38 return point;
39 } else if( parentItem.represents( kmlTag_PhotoOverlay ) ) {
40 GeoDataPoint *point = &parentItem.nodeAs<GeoDataPhotoOverlay>()->point();
41 KmlObjectTagHandler::parseIdentifiers( parser, point );
42 return point;
43 }
44 return nullptr;
45}
46
47}
48}
Binds a QML item to a specific geodetic location in screen coordinates.
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.