libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout
include
osmscout
db
AreaIndex.h
Go to the documentation of this file.
1
#ifndef LIBOSMSCOUT_AREAYINDEX_H
2
#define LIBOSMSCOUT_AREAYINDEX_H
3
/*
4
This source is part of the libosmscout library
5
Copyright (C) 2011 Tim Teulings
6
7
This library is free software; you can redistribute it and/or
8
modify it under the terms of the GNU Lesser General Public
9
License as published by the Free Software Foundation; either
10
version 2.1 of the License, or (at your option) any later version.
11
12
This library is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
Lesser General Public License for more details.
16
17
You should have received a copy of the GNU Lesser General Public
18
License along with this library; if not, write to the Free Software
19
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
*/
21
22
#include <memory>
23
#include <mutex>
24
#include <unordered_set>
25
#include <vector>
26
27
#include <
osmscout/TypeConfig.h
>
28
#include <
osmscout/TypeInfoSet.h
>
29
30
#include <
osmscout/io/FileScanner.h
>
31
32
#include <
osmscout/util/TileId.h
>
33
34
namespace
osmscout
{
35
40
class
OSMSCOUT_API
AreaIndex
41
{
42
protected
:
43
struct
TypeData
44
{
45
TypeInfoRef
type
;
46
MagnificationLevel
indexLevel
;
47
48
uint8_t
dataOffsetBytes
;
49
FileOffset
bitmapOffset
;
50
51
TileIdBox
tileBox
;
52
53
GeoBox
boundingBox
;
54
55
TypeData
();
56
57
FileOffset
GetDataOffset
()
const
;
58
FileOffset
GetCellOffset
(
size_t
x,
size_t
y)
const
;
59
};
60
61
private
:
62
std::string indexFileName;
63
std::string fullIndexFileName;
64
65
std::vector<TypeData> typeData;
66
67
mutable
std::mutex lookupMutex;
68
69
protected
:
70
mutable
FileScanner
scanner
;
71
72
protected
:
73
void
GetOffsets
(
const
TypeData
& typeData,
74
const
GeoBox& boundingBox,
75
std::unordered_set<FileOffset>& offsets)
const
;
76
77
explicit
AreaIndex
(
const
std::string &indexFileName);
78
79
virtual
void
ReadTypeData
(
const
TypeConfigRef
& typeConfig,
80
TypeData
&data) = 0;
81
82
public
:
83
AreaIndex
() =
default
;
84
85
// disable copy and move
86
AreaIndex
(
const
AreaIndex
&) =
delete
;
87
AreaIndex
(
AreaIndex
&&) =
delete
;
88
AreaIndex
&
operator=
(
const
AreaIndex
&) =
delete
;
89
AreaIndex
&
operator=
(
AreaIndex
&&) =
delete
;
90
91
virtual
~AreaIndex
();
92
93
void
Close
();
94
bool
Open
(
const
TypeConfigRef
& typeConfig,
95
const
std::string& path,
96
bool
memoryMappedData);
97
98
bool
IsOpen
()
const
99
{
100
return
scanner
.IsOpen();
101
}
102
103
std::string
GetFilename
()
const
104
{
105
return
fullIndexFileName;
106
}
107
108
bool
GetOffsets
(
const
GeoBox& boundingBox,
109
const
TypeInfoSet& types,
110
std::vector<FileOffset>& offsets,
111
TypeInfoSet& loadedTypes)
const
;
112
};
113
}
114
115
#endif
//LIBOSMSCOUT_AREAYINDEX_H
OSMSCOUT_API
#define OSMSCOUT_API
Definition
CoreImportExport.h:45
FileScanner.h
TileId.h
TypeConfig.h
TypeInfoSet.h
osmscout::AreaIndex::AreaIndex
AreaIndex(const AreaIndex &)=delete
osmscout::AreaIndex::scanner
FileScanner scanner
Scanner instance for reading this file.
Definition
AreaIndex.h:70
osmscout::AreaIndex::GetFilename
std::string GetFilename() const
Definition
AreaIndex.h:103
osmscout::AreaIndex::AreaIndex
AreaIndex()=default
osmscout::AreaIndex::ReadTypeData
virtual void ReadTypeData(const TypeConfigRef &typeConfig, TypeData &data)=0
osmscout::AreaIndex::operator=
AreaIndex & operator=(const AreaIndex &)=delete
osmscout::AreaIndex::~AreaIndex
virtual ~AreaIndex()
osmscout::AreaIndex::Close
void Close()
osmscout::AreaIndex::IsOpen
bool IsOpen() const
Definition
AreaIndex.h:98
osmscout::AreaIndex::AreaIndex
AreaIndex(const std::string &indexFileName)
osmscout::AreaIndex::AreaIndex
AreaIndex(AreaIndex &&)=delete
osmscout::AreaIndex::Open
bool Open(const TypeConfigRef &typeConfig, const std::string &path, bool memoryMappedData)
osmscout::AreaIndex::operator=
AreaIndex & operator=(AreaIndex &&)=delete
osmscout::AreaIndex::GetOffsets
bool GetOffsets(const GeoBox &boundingBox, const TypeInfoSet &types, std::vector< FileOffset > &offsets, TypeInfoSet &loadedTypes) const
osmscout::AreaIndex::GetOffsets
void GetOffsets(const TypeData &typeData, const GeoBox &boundingBox, std::unordered_set< FileOffset > &offsets) const
osmscout::FileOffset
uint64_t FileOffset
Definition
OSMScoutTypes.h:46
osmscout::TypeConfigRef
std::shared_ptr< TypeConfig > TypeConfigRef
Definition
TypeConfig.h:1396
osmscout
Definition
Area.h:39
osmscout::TypeInfoRef
std::shared_ptr< TypeInfo > TypeInfoRef
Definition
TypeConfig.h:61
osmscout::AreaIndex::TypeData
Definition
AreaIndex.h:44
osmscout::AreaIndex::TypeData::GetDataOffset
FileOffset GetDataOffset() const
osmscout::AreaIndex::TypeData::GetCellOffset
FileOffset GetCellOffset(size_t x, size_t y) const
osmscout::AreaIndex::TypeData::dataOffsetBytes
uint8_t dataOffsetBytes
Definition
AreaIndex.h:48
osmscout::AreaIndex::TypeData::type
TypeInfoRef type
Definition
AreaIndex.h:45
osmscout::AreaIndex::TypeData::indexLevel
MagnificationLevel indexLevel
Definition
AreaIndex.h:46
osmscout::AreaIndex::TypeData::boundingBox
GeoBox boundingBox
Definition
AreaIndex.h:53
osmscout::AreaIndex::TypeData::bitmapOffset
FileOffset bitmapOffset
Definition
AreaIndex.h:49
osmscout::AreaIndex::TypeData::tileBox
TileIdBox tileBox
Definition
AreaIndex.h:51
osmscout::AreaIndex::TypeData::TypeData
TypeData()
Generated by
1.17.0