[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/marble/src/lib/geodata/handlers/kml
From:       Patrick Spendrin <ps_ml () gmx ! de>
Date:       2009-04-02 23:40:14
Message-ID: 1238715614.451740.17134.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 948418 by sengels:

work around a bug in the vancouver kml
this means that all three, vancouver, app-trail and us_states are now parseable again \
(doesn't mean they will get displayed correctly)

 M  +22 -3     KmlDocumentTagHandler.cpp  


--- trunk/KDE/kdeedu/marble/src/lib/geodata/handlers/kml/KmlDocumentTagHandler.cpp \
#948417:948418 @@ -25,6 +25,7 @@
 
 #include "KmlElementDictionary.h"
 #include "GeoDataDocument.h"
+#include "GeoDataFolder.h"
 #include "GeoDataParser.h"
 
 namespace Marble
@@ -37,11 +38,29 @@
 {
     Q_ASSERT(parser.isStartElement() && parser.isValidElement(kmlTag_Document));
 
-    GeoDataDocument* doc = geoDataDoc( parser );
+    GeoStackItem parentItem = parser.parentElement();
+    if( !(parentItem.first.first.isNull() && parentItem.first.second.isNull()) ) {
+        // this happens if there is a parent element to the Document tag. We can \
work around that and simply expect that +        // the new Document tag works like a \
Folder +        if( parentItem.represents( kmlTag_Folder ) || parentItem.represents( \
kmlTag_Document ) ) { +            GeoDataDocument document;
+            parentItem.nodeAs<GeoDataContainer>()->append( document );
+
 #ifdef DEBUG_TAGS
-    qDebug() << "Parsed <" << kmlTag_Document << "> document: " << doc;
+            qDebug() << "Parsed <" << kmlTag_Document << "> containing: " << \
&parentItem.nodeAs<GeoDataContainer>()->last() +                     << " parent item \
name: " << parentItem.qualifiedName().first; +#endif // DEBUG_TAGS
+            return static_cast<GeoDataDocument*>(&parentItem.nodeAs<GeoDataContainer>()->last());
 +        } else {
+            return 0;
+        }
+    } else {
+        GeoDataDocument* doc = geoDataDoc( parser );
+#ifdef DEBUG_TAGS
+        qDebug() << "Parsed <" << kmlTag_Document << "> document: " << doc;
 #endif
-    return doc;
+        return doc;
+    }
 }
 
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic