Marble

DgmlMapTagHandler.cpp
1/*
2 SPDX-FileCopyrightText: 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 SPDX-FileCopyrightText: 2008 Torsten Rahn <tackat@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#include "DgmlMapTagHandler.h"
9
10#include <QColor>
11
12#include "DgmlAttributeDictionary.h"
13#include "DgmlElementDictionary.h"
14#include "GeoParser.h"
15#include "GeoSceneDocument.h"
16#include "GeoSceneMap.h"
17
18namespace Marble
19{
20namespace dgml
21{
22DGML_DEFINE_TAG_HANDLER(Map)
23
24GeoNode *DgmlMapTagHandler::parse(GeoParser &parser) const
25{
26 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(dgmlTag_Map)));
27
28 QColor labelColor = parser.attribute(dgmlAttr_labelColor).trimmed();
29
30 if (!labelColor.isValid())
31 labelColor = Qt::black;
32
33 QColor highlightBrushColor = QColor(parser.attribute(dgmlAttr_highlightBrush).trimmed());
34 QColor highlightPenColor = QColor(parser.attribute(dgmlAttr_highlightPen).trimmed());
35
36 GeoSceneMap *map = nullptr;
37
38 // Checking for parent item
39 GeoStackItem parentItem = parser.parentElement();
40 if (parentItem.represents(dgmlTag_Document)) {
41 map = parentItem.nodeAs<GeoSceneDocument>()->map();
42 map->setBackgroundColor(QColor(parser.attribute(dgmlAttr_bgcolor).trimmed()));
43 map->setLabelColor(labelColor);
44 map->setHighlightBrushColor(highlightBrushColor);
45 map->setHighlightPenColor(highlightPenColor);
46 }
47
48 return map;
49}
50
51}
52}
Binds a QML item to a specific geodetic location in screen coordinates.
bool isValid() const const
QFuture< void > map(Iterator begin, Iterator end, MapFunctor &&function)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.