Marble

DgmlSourceDirTagHandler.cpp
1 /*
2  SPDX-FileCopyrightText: 2007, 2008 Nikolas Zimmermann <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "DgmlSourceDirTagHandler.h"
8 
9 #include "DgmlElementDictionary.h"
10 #include "DgmlAttributeDictionary.h"
11 #include "GeoParser.h"
12 #include "GeoSceneTileDataset.h"
13 
14 namespace Marble
15 {
16 namespace dgml
17 {
18 DGML_DEFINE_TAG_HANDLER(SourceDir)
19 
20 GeoNode* DgmlSourceDirTagHandler::parse(GeoParser& parser) const
21 {
22  // Check whether the tag is valid
23  Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(dgmlTag_SourceDir)));
24 
25  QString format = parser.attribute(dgmlAttr_format).trimmed();
26 
27  // Checking for parent item
28  GeoStackItem parentItem = parser.parentElement();
29  if (parentItem.represents(dgmlTag_Texture) || parentItem.represents(dgmlTag_Vectortile) ) {
30  GeoSceneTileDataset *texture = parentItem.nodeAs<GeoSceneTileDataset>();
31  texture->setSourceDir( parser.readElementText().trimmed() );
32  texture->setFileFormat(format);
33  }
34 
35  return nullptr;
36 }
37 
38 }
39 }
QString trimmed() const const
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Sep 25 2023 03:50:18 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.