libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout
include
osmscout
db
WaterIndex.h
Go to the documentation of this file.
1
#ifndef OSMSCOUT_WATERINDEX_H
2
#define OSMSCOUT_WATERINDEX_H
3
4
/*
5
This source is part of the libosmscout library
6
Copyright (C) 2010 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 <list>
24
#include <memory>
25
#include <mutex>
26
#include <string>
27
#include <vector>
28
29
#include <
osmscout/GroundTile.h
>
30
#include <
osmscout/OSMScoutTypes.h
>
31
32
#include <
osmscout/util/Magnification.h
>
33
34
#include <
osmscout/io/FileScanner.h
>
35
36
namespace
osmscout
{
37
41
class
OSMSCOUT_API
WaterIndex
final
42
{
43
public
:
44
static
const
char
*
const
WATER_IDX
;
45
46
private
:
47
struct
Level
48
{
49
// Transient
50
double
cellWidth;
51
double
cellHeight;
52
uint32_t cellXCount;
53
uint32_t cellYCount;
54
FileOffset
dataOffset;
55
56
// Persistent
57
58
bool
hasCellData;
59
uint8_t dataOffsetBytes;
60
GroundTile::Type defaultCellData;
61
FileOffset
indexDataOffset;
62
63
uint32_t cellXStart;
64
uint32_t cellXEnd;
65
uint32_t cellYStart;
66
uint32_t cellYEnd;
67
};
68
69
private
:
70
std::string datafilename;
71
mutable
FileScanner scanner;
72
73
uint32_t waterIndexMinMag;
74
uint32_t waterIndexMaxMag;
75
std::vector<Level> levels;
76
77
mutable
std::mutex lookupMutex;
78
79
private
:
80
void
GetGroundTileByDefault(
const
Level& level,
81
uint32_t cx1,
82
uint32_t cx2,
83
uint32_t cy1,
84
uint32_t cy2,
85
std::list<GroundTile>& tiles)
const
;
86
void
GetGroundTileFromData(
const
Level& level,
87
uint32_t cx1,
88
uint32_t cx2,
89
uint32_t cy1,
90
uint32_t cy2,
91
std::list<GroundTile>& tiles)
const
;
92
93
public
:
94
WaterIndex
() =
default
;
95
virtual
~WaterIndex
();
96
97
bool
Open
(
const
std::string& path,
bool
memoryMappedData);
98
void
Close
();
99
100
bool
GetRegions
(
const
GeoBox& boundingBox,
101
const
Magnification& magnification,
102
std::list<GroundTile>& tiles)
const
;
103
104
void
DumpStatistics
();
105
};
106
107
using
WaterIndexRef
= std::shared_ptr<WaterIndex>;
108
}
109
110
#endif
OSMSCOUT_API
#define OSMSCOUT_API
Definition
CoreImportExport.h:45
FileScanner.h
GroundTile.h
Magnification.h
OSMScoutTypes.h
osmscout::WaterIndex::DumpStatistics
void DumpStatistics()
osmscout::WaterIndex::WATER_IDX
static const char *const WATER_IDX
Definition
WaterIndex.h:44
osmscout::WaterIndex::~WaterIndex
virtual ~WaterIndex()
osmscout::WaterIndex::Close
void Close()
osmscout::WaterIndex::Open
bool Open(const std::string &path, bool memoryMappedData)
osmscout::WaterIndex::GetRegions
bool GetRegions(const GeoBox &boundingBox, const Magnification &magnification, std::list< GroundTile > &tiles) const
osmscout::WaterIndex::WaterIndex
WaterIndex()=default
osmscout::FileOffset
uint64_t FileOffset
Definition
OSMScoutTypes.h:46
osmscout
Definition
Area.h:39
osmscout::WaterIndexRef
std::shared_ptr< WaterIndex > WaterIndexRef
Definition
WaterIndex.h:107
Generated by
1.17.0