KOSMIndoorMap

pathutil.h
1 /*
2  SPDX-FileCopyrightText: 2020 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef OSM_PATHUTIL_H
8 #define OSM_PATHUTIL_H
9 
10 #include <kosm_export.h>
11 
12 #include "datatypes.h"
13 
14 #include <vector>
15 
16 namespace OSM {
17 
18 class Element;
19 
20 /** Appends the nodes referenced by @p nodesBegin and @pnodesEnd into @p nodes.
21  * This would typically be iterators on OSM::Way::nodes.
22  */
23 template <typename Iter>
24 static void appendNodesFromWay(const DataSet &dataSet, std::vector<const Node*> &nodes, const Iter& nodeBegin, const Iter &nodeEnd)
25 {
26  nodes.reserve(nodes.size() + std::distance(nodeBegin, nodeEnd));
27  for (auto it = nodeBegin; it != nodeEnd; ++it) {
28  if (auto node = dataSet.node((*it))) {
29  nodes.push_back(node);
30  }
31  }
32 }
33 
34 /** Assemble a continuous path into @p path from the given @p ways. */
35 KOSM_EXPORT void assemblePath(const DataSet &dataSet, std::vector<const Way*> &&ways, std::vector<const Node*> &path);
36 KOSM_EXPORT void assemblePath(const DataSet &dataSet, const std::vector<OSM::Element> &ways, std::vector<const Node*> &path);
37 
38 }
39 
40 #endif // OSM_PATHUTIL_H
KOSM_EXPORT void assemblePath(const DataSet &dataSet, std::vector< const Way * > &&ways, std::vector< const Node * > &path)
Assemble a continuous path into path from the given ways.
Definition: pathutil.cpp:42
static void appendNodesFromWay(const DataSet &dataSet, std::vector< const Node * > &nodes, const Iter &nodeBegin, const Iter &nodeEnd)
Appends the nodes referenced by nodesBegin and into nodes.
Definition: pathutil.h:24
A set of nodes, ways and relations.
Definition: datatypes.h:283
Low-level types and functions to work with raw OSM data as efficiently as possible.
const Node * node(Id id) const
Find a node by its id.
Definition: datatypes.cpp:37
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Oct 25 2021 23:04:00 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.