KOSMIndoorMap

oscparser.h
1/*
2 SPDX-FileCopyrightText: 2024 Volker Krause <vkrause@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6#ifndef OSM_OSCPARSER_H
7#define OSM_OSCPARSER_H
8
9#include "xmlparser.h"
10#include "datatypes.h"
11
12#include <unordered_map>
13
14namespace OSM {
15
16/** Parser for the OSM change format.
17 * @see https://wiki.openstreetmap.org/wiki/OsmChange
18 */
19class OscParser : public XmlParser
20{
21public:
22 explicit OscParser(DataSet *dataSet);
23
24private:
25 void readFromIODevice(QIODevice *io) override;
26 void parseCreate(QXmlStreamReader &reader);
27 void parseModify(QXmlStreamReader &reader);
28 void parseDelete(QXmlStreamReader &reader);
29
30 template <typename T>
31 void assignNewId(T &elem, std::unordered_map<OSM::Id, OSM::Id> &idMap);
32 [[nodiscard]] static OSM::Id mapId(OSM::Id id, const std::unordered_map<OSM::Id, OSM::Id> &idMap);
33 /** Remap all way node ids. */
34 void mapNodeIds(OSM::Way &way) const;
35 /** Remap all member ids. */
36 void mapMemberIds(OSM::Relation &rel) const;
37
38 std::unordered_map<OSM::Id, OSM::Id> m_nodeIdMap;
39 std::unordered_map<OSM::Id, OSM::Id> m_wayIdMap;
40 std::unordered_map<OSM::Id, OSM::Id> m_relIdMap;
41};
42
43}
44
45#endif // OSM_OSCPARSER_P_H
A set of nodes, ways and relations.
Definition datatypes.h:346
Parser for the OSM change format.
Definition oscparser.h:20
An OSM relation.
Definition datatypes.h:316
An OSM way.
Definition datatypes.h:232
Low-level types and functions to work with raw OSM data as efficiently as possible.
int64_t Id
OSM element identifier.
Definition datatypes.h:30
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:17:55 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.