7#include "KmlLinearRingTagHandler.h"
9#include "MarbleDebug.h"
11#include "GeoDataLinearRing.h"
12#include "GeoDataMultiGeometry.h"
13#include "GeoDataPlacemark.h"
14#include "GeoDataPolygon.h"
15#include "KmlElementDictionary.h"
16#include "KmlObjectTagHandler.h"
24KML_DEFINE_TAG_HANDLER(LinearRing)
26GeoNode *KmlLinearRingTagHandler::parse(GeoParser &parser)
const
28 Q_ASSERT(parser.isStartElement() && parser.isValidElement(
QLatin1StringView(kmlTag_LinearRing)));
30 GeoStackItem parentItem = parser.parentElement();
32 if (parentItem.represents(kmlTag_outerBoundaryIs)) {
33 GeoDataLinearRing linearRing;
34 KmlObjectTagHandler::parseIdentifiers(parser, &linearRing);
35 parentItem.nodeAs<GeoDataPolygon>()->setOuterBoundary(linearRing);
36 return &parentItem.nodeAs<GeoDataPolygon>()->outerBoundary();
38 }
else if (parentItem.represents(kmlTag_innerBoundaryIs)) {
39 GeoDataLinearRing linearRing;
40 KmlObjectTagHandler::parseIdentifiers(parser, &linearRing);
41 parentItem.nodeAs<GeoDataPolygon>()->appendInnerBoundary(linearRing);
42 return &parentItem.nodeAs<GeoDataPolygon>()->innerBoundaries().last();
44 }
else if (parentItem.represents(kmlTag_Placemark)) {
45 auto linearRing =
new GeoDataLinearRing;
46 KmlObjectTagHandler::parseIdentifiers(parser, linearRing);
47 auto placemark = parentItem.nodeAs<GeoDataPlacemark>();
48 placemark->setGeometry(linearRing);
49 return placemark->geometry();
51 }
else if (parentItem.is<GeoDataMultiGeometry>()) {
52 auto linearRing =
new GeoDataLinearRing;
53 KmlObjectTagHandler::parseIdentifiers(parser, linearRing);
54 parentItem.nodeAs<GeoDataMultiGeometry>()->append(linearRing);
Binds a QML item to a specific geodetic location in screen coordinates.