libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout
include
osmscout
db
AreaNodeIndex.h
Go to the documentation of this file.
1
#ifndef OSMSCOUT_AREANODEINDEX_H
2
#define OSMSCOUT_AREANODEINDEX_H
3
4
/*
5
This source is part of the libosmscout library
6
Copyright (C) 2011 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 <map>
24
#include <memory>
25
#include <mutex>
26
#include <vector>
27
28
#include <
osmscout/TypeConfig.h
>
29
#include <
osmscout/TypeInfoSet.h
>
30
31
#include <
osmscout/io/FileScanner.h
>
32
33
#include <
osmscout/util/TileId.h
>
34
35
namespace
osmscout
{
36
45
class
OSMSCOUT_API
AreaNodeIndex
46
{
47
public
:
48
static
const
char
*
const
AREA_NODE_IDX
;
49
50
private
:
51
struct
ListTile
52
{
53
FileOffset
fileOffset;
54
uint16_t entryCount;
55
bool
storeGeoCoord;
56
};
57
58
struct
BitmapTile
59
{
60
FileOffset
fileOffset;
61
uint8_t dataOffsetBytes;
62
MagnificationLevel magnification;
63
};
64
65
struct
TypeData
66
{
67
bool
isComplex;
68
GeoBox boundingBox;
69
FileOffset indexOffset=0;
70
uint16_t entryCount=0;
71
72
std::map<TileId,ListTile> listTiles;
73
std::map<TileId,BitmapTile> bitmapTiles;
74
};
75
76
private
:
77
mutable
FileScanner scanner;
79
80
MagnificationLevel gridMag;
81
std::vector<TypeData> nodeTypeData;
82
83
mutable
std::mutex lookupMutex;
84
85
private
:
86
bool
GetOffsetsList(
const
TypeData& typeData,
87
const
GeoBox& boundingBox,
88
std::vector<FileOffset>& offsets)
const
;
89
90
bool
GetOffsetsTileList(
const
TypeData& typeData,
91
const
GeoBox& boundingBox,
92
std::vector<FileOffset>& offsets)
const
;
93
94
bool
GetOffsetsBitmap(
const
TypeData& typeData,
95
const
GeoBox& boundingBox,
96
std::vector<FileOffset>& offsets)
const
;
97
98
public
:
99
AreaNodeIndex
() =
default
;
100
101
void
Close
();
102
bool
Open
(
const
std::string& path,
103
bool
memoryMappedData);
104
105
inline
bool
IsOpen
()
const
106
{
107
return
scanner.IsOpen();
108
}
109
110
inline
std::string
GetFilename
()
const
111
{
112
return
scanner.GetFilename();
113
}
114
115
bool
GetOffsets
(
const
GeoBox& boundingBox,
116
const
TypeInfoSet& requestedTypes,
117
std::vector<FileOffset>& offsets,
118
TypeInfoSet& loadedTypes)
const
;
119
};
120
121
using
AreaNodeIndexRef
= std::shared_ptr<AreaNodeIndex>;
122
}
123
124
#endif
OSMSCOUT_API
#define OSMSCOUT_API
Definition
CoreImportExport.h:45
FileScanner.h
TileId.h
TypeConfig.h
TypeInfoSet.h
osmscout::AreaNodeIndex::IsOpen
bool IsOpen() const
Definition
AreaNodeIndex.h:105
osmscout::AreaNodeIndex::GetFilename
std::string GetFilename() const
Definition
AreaNodeIndex.h:110
osmscout::AreaNodeIndex::Close
void Close()
osmscout::AreaNodeIndex::GetOffsets
bool GetOffsets(const GeoBox &boundingBox, const TypeInfoSet &requestedTypes, std::vector< FileOffset > &offsets, TypeInfoSet &loadedTypes) const
osmscout::AreaNodeIndex::AREA_NODE_IDX
static const char *const AREA_NODE_IDX
Definition
AreaNodeIndex.h:48
osmscout::AreaNodeIndex::Open
bool Open(const std::string &path, bool memoryMappedData)
osmscout::AreaNodeIndex::AreaNodeIndex
AreaNodeIndex()=default
osmscout::FileOffset
uint64_t FileOffset
Definition
OSMScoutTypes.h:46
osmscout
Definition
Area.h:39
osmscout::AreaNodeIndexRef
std::shared_ptr< AreaNodeIndex > AreaNodeIndexRef
Definition
AreaNodeIndex.h:121
Generated by
1.17.0