File indexing completed on 2024-06-02 03:51:06
0001 /* 0002 SPDX-FileCopyrightText: 2008 Patrick Spendrin <ps_ml@gmx.de> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "KmlTessellateTagHandler.h" 0008 0009 #include "MarbleDebug.h" 0010 0011 #include "KmlElementDictionary.h" 0012 0013 #include "GeoDataLinearRing.h" 0014 #include "GeoDataPolygon.h" 0015 #include "GeoDataGeometry.h" 0016 #include "GeoDataPoint.h" 0017 0018 #include "GeoParser.h" 0019 0020 namespace Marble 0021 { 0022 namespace kml 0023 { 0024 KML_DEFINE_TAG_HANDLER( tessellate ) 0025 0026 GeoNode* KmltessellateTagHandler::parse( GeoParser& parser ) const 0027 { 0028 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(kmlTag_tessellate))); 0029 0030 GeoStackItem parentItem = parser.parentElement(); 0031 0032 QString content = parser.readElementText().trimmed(); 0033 0034 if( parentItem.is<GeoDataLineString>() ) { 0035 GeoDataLineString* lineString = parentItem.nodeAs<GeoDataLineString>(); 0036 0037 const bool tesselate = (content == QLatin1String("1")); 0038 lineString->setTessellate(tesselate); 0039 0040 } else if( parentItem.is<GeoDataLinearRing>() ) { 0041 GeoDataLinearRing* linearRing = parentItem.nodeAs<GeoDataLinearRing>(); 0042 0043 const bool tesselate = (content == QLatin1String("1")); 0044 linearRing->setTessellate(tesselate); 0045 0046 } else if( parentItem.is<GeoDataPolygon>() ) { 0047 GeoDataPolygon* polygon = parentItem.nodeAs<GeoDataPolygon>(); 0048 0049 const bool tesselate = (content == QLatin1String("1")); 0050 polygon->setTessellate(tesselate); 0051 } 0052 0053 return nullptr; 0054 } 0055 0056 } 0057 }