libosmscout 1.1.1
Loading...
Searching...
No Matches
Node.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_NODE_H
2#define OSMSCOUT_NODE_H
3
4/*
5 This source is part of the libosmscout library
6 Copyright (C) 2009 Tim Teulings
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 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 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
23#include <memory>
24#include <vector>
25
26#include <osmscout/GeoCoord.h>
27#include <osmscout/Tag.h>
28#include <osmscout/TypeConfig.h>
29
32
34
36
37namespace osmscout {
38
39 class OSMSCOUT_API Node CLASS_FINAL
40 {
41 private:
42 FeatureValueBuffer featureValueBuffer;
43
44 FileOffset fileOffset=0;
45 FileOffset nextFileOffset=0;
46
47 GeoCoord coords;
48
49 public:
50 Node() = default;
51
53 {
54 return fileOffset;
55 }
56
58 {
59 return nextFileOffset;
60 }
61
63 {
64 return ObjectFileRef(fileOffset,refNode);
65 }
66
68 {
69 return featureValueBuffer.GetType();
70 }
71
72 const GeoCoord& GetCoords() const
73 {
74 return coords;
75 }
76
85 bool Intersects(const GeoBox& boundingBox) const
86 {
87 return boundingBox.Includes(coords);
88 }
89
90 size_t GetFeatureCount() const
91 {
92 return featureValueBuffer.GetType()->GetFeatureCount();
93 }
94
95 bool HasFeature(size_t idx) const
96 {
97 return featureValueBuffer.HasFeature(idx);
98 }
99
100 const FeatureInstance& GetFeature(size_t idx) const
101 {
102 return featureValueBuffer.GetType()->GetFeature(idx);
103 }
104
105 void UnsetFeature(size_t idx)
106 {
107 featureValueBuffer.FreeValue(idx);
108 }
109
111 {
112 return featureValueBuffer;
113 }
114
118
119 void Read(const TypeConfig& typeConfig,
120 FileScanner& scanner);
121 void Write(const TypeConfig& typeConfig,
122 FileWriter& writer) const;
123 };
124
125 using NodeRef = std::shared_ptr<Node>;
126}
127
128#endif
#define OSMSCOUT_API
Definition CoreImportExport.h:45
Definition Area.h:88
void UnsetFeature(size_t idx)
Definition Node.h:105
TypeInfoRef GetType() const
Definition Node.h:67
void SetCoords(const GeoCoord &coords)
std::vector< Coord > coords
Optional coordinates for coastline.
Definition GroundTile.h:99
bool Intersects(const GeoBox &boundingBox) const
Definition Node.h:85
void Write(const TypeConfig &typeConfig, FileWriter &writer) const
FileOffset GetFileOffset() const
Definition Node.h:52
bool HasFeature(size_t idx) const
Definition Node.h:95
ObjectFileRef GetObjectFileRef() const
Definition Node.h:62
FileOffset GetNextFileOffset() const
Definition Node.h:57
const GeoCoord & GetCoords() const
Definition Node.h:72
void SetFeatures(const FeatureValueBuffer &buffer)
const FeatureValueBuffer & GetFeatureValueBuffer() const
Definition Node.h:110
Type type
The type of the cell.
Definition GroundTile.h:92
void SetType(const TypeInfoRef &type)
Vertex2D * buffer
Definition Transformation.h:343
FeatureValueBuffer()=default
const FeatureInstance & GetFeature(size_t idx) const
Definition Node.h:100
void Read(const TypeConfig &typeConfig, FileScanner &scanner)
size_t GetFeatureCount() const
Definition Node.h:90
uint64_t FileOffset
Definition OSMScoutTypes.h:46
Definition Area.h:39
@ refNode
Definition ObjectRef.h:141
std::shared_ptr< TypeInfo > TypeInfoRef
Definition TypeConfig.h:61
std::shared_ptr< Node > NodeRef
Definition Node.h:125