GeoDesk for C++
Fast and storage-efficient spatial database engine for OpenStreetMap features
Loading...
Searching...
No Matches
Features.h
Go to the documentation of this file.
1// Copyright (c) 2024 Clarisma / GeoDesk contributors
2// SPDX-License-Identifier: LGPL-3.0-only
3
4#pragma once
5
6#ifndef GEODESK_DOXYGEN
7
8#include "FeaturesBase.h"
9#include "Nodes.h"
10#include "Ways.h"
11#include "Relations.h"
12
13namespace geodesk {
14
15class Features : public FeaturesBase<Feature>
16{
17public:
18 using FeaturesBase::FeaturesBase;
19 Features(const char* golFile) :
20 FeaturesBase(rootView(golFile))
21 {
22 }
23
24 template <typename T>
25 Features(const FeaturesBase<T>& other) :
26 FeaturesBase(other.view_)
27 {
28 }
29
33 Nodes nodes() const { return Nodes(view_ & FeatureTypes::NODES); };
34
41 Nodes nodes(const char* query) const
42 {
43 return Nodes(view_.withQuery(query, FeatureTypes::NODES));
44 }
45 Ways ways() const { return Ways(view_ & FeatureTypes::WAYS); }
46 Ways ways(const char* query) const
47 {
48 return Ways(view_.withQuery(query, FeatureTypes::WAYS));
49 }
50 Relations relations() const { return Relations(view_ & FeatureTypes::RELATIONS); }
51 Relations relations(const char* query) const
52 {
53 return Relations(view_.withQuery(query, FeatureTypes::RELATIONS));
54 }
55
56 template<typename P>
57 Nodes nodesOf(FeatureBase<P>) const;
58
59 template<typename P>
60 FeaturesBase parentsOf(FeatureBase<P> feature) const
61 {
62 if(view_.types() & (FeatureTypes::WAYS | FeatureTypes::RELATIONS))
63 {
64 // TODO
65 }
66 return FeaturesBase(empty());
67 }
68
69};
70
71} // namespace geodesk
72
73#endif
Features(const char *golFile)
Creates a collection that contains all features in the given Geographic Object Library.
Ways ways() const
Only ways.
Features nodesOf(const Feature &feature) const
Only nodes that belong to the given Way.
Relations relations() const
Only relations.
Features parentsOf(const Feature &feature) const
Only features that are parent relations of the given Feature (or parent ways of the given Node).
Nodes nodes() const
Only nodes.
Definition Features.h:12