• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • lib
  • marble
  • geodata
  • handlers
  • dgml
DgmlFilterTagHandler.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
3  Copyright (C) 2008 Torsten Rahn <tackat@kde.org>
4  Copyright (C) 2008 Henry de Valence <hdevalence@gmail.com>
5 
6  This file is part of the KDE project
7 
8  This library is free software you can redistribute it and/or
9  modify it under the terms of the GNU Library General Public
10  License as published by the Free Software Foundation either
11  version 2 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU Library General Public License
19  aint with this library see the file COPYING.LIB. If not, write to
20  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  Boston, MA 02110-1301, USA.
22 */
23 
24 #include "DgmlFilterTagHandler.h"
25 
26 #include "MarbleDebug.h"
27 
28 #include "DgmlElementDictionary.h"
29 #include "DgmlAttributeDictionary.h"
30 #include "DgmlAuxillaryDictionary.h"
31 #include "GeoParser.h"
32 #include "GeoSceneLayer.h"
33 #include "GeoSceneMap.h"
34 #include "GeoSceneFilter.h"
35 
36 namespace Marble
37 {
38 namespace dgml
39 {
40 DGML_DEFINE_TAG_HANDLER(Filter)
41 
42 GeoNode* DgmlFilterTagHandler::parse(GeoParser& parser) const
43 {
44  // Check whether the tag is valid
45  Q_ASSERT(parser.isStartElement() && parser.isValidElement(dgmlTag_Filter));
46 
47  QString name = parser.attribute(dgmlAttr_name).trimmed();
48  QString type = parser.attribute(dgmlAttr_type).toLower().trimmed();
49 
50  GeoSceneFilter *filter = 0;
51 
52  // Checking for parent layer
53  GeoStackItem parentItem = parser.parentElement();
54  GeoStackItem grandParentItem = parser.parentElement(1);
55  if (parentItem.represents(dgmlTag_Layer) &&
56  grandParentItem.represents(dgmlTag_Map) ) {
57 
58  filter = new GeoSceneFilter( name );
59  filter->setType( type );
60  parentItem.nodeAs<GeoSceneLayer>()->addFilter( filter );
61  grandParentItem.nodeAs<GeoSceneMap>()->addFilter( filter );
62  }
63 
64  return filter;
65 }
66 
67 }
68 }
DgmlAttributeDictionary.h
Marble::dgml::DgmlFilterTagHandler
Definition: DgmlFilterTagHandler.h:34
DGML_DEFINE_TAG_HANDLER
#define DGML_DEFINE_TAG_HANDLER(Name)
Definition: DgmlElementDictionary.h:85
Marble::GeoStackItem::nodeAs
T * nodeAs()
Definition: GeoParser.h:120
DgmlFilterTagHandler.h
DgmlAuxillaryDictionary.h
Marble::GeoNode
A shared base class for all classes that are mapped to a specific tag (ie.
Definition: GeoDocument.h:60
GeoParser.h
Marble::GeoSceneMap
Map layer structure of a GeoScene document.
Definition: GeoSceneMap.h:44
Marble::dgml::dgmlAttr_name
const char * dgmlAttr_name
Definition: DgmlAttributeDictionary.cpp:54
MarbleDebug.h
Marble::GeoParser
Definition: GeoParser.h:40
Marble::GeoStackItem::represents
bool represents(const char *tagName) const
Definition: GeoParser.h:113
Marble::dgml::dgmlTag_Filter
const char * dgmlTag_Filter
Definition: DgmlElementDictionary.cpp:45
Marble::GeoSceneLayer
Layer of a GeoScene document.
Definition: GeoSceneLayer.h:43
GeoSceneFilter.h
QString::trimmed
QString trimmed() const
Marble::GeoSceneFilter::setType
void setType(const QString &type)
Definition: GeoSceneFilter.cpp:55
DgmlElementDictionary.h
Marble::GeoStackItem
Definition: GeoParser.h:97
QString
Marble::dgml::dgmlTag_Map
const char * dgmlTag_Map
Definition: DgmlElementDictionary.cpp:56
QString::toLower
QString toLower() const
Marble::GeoSceneFilter
Filter of a GeoScene document.
Definition: GeoSceneFilter.h:39
Marble::dgml::dgmlAttr_type
const char * dgmlAttr_type
Definition: DgmlAttributeDictionary.cpp:69
Marble::dgml::dgmlTag_Layer
const char * dgmlTag_Layer
Definition: DgmlElementDictionary.cpp:53
GeoSceneMap.h
GeoSceneLayer.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:38 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal