libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout
include
osmscout
db
OptimizeWaysLowZoom.h
Go to the documentation of this file.
1
#ifndef OSMSCOUT_OPTIMIZEWAYSLOWZOOM_H
2
#define OSMSCOUT_OPTIMIZEWAYSLOWZOOM_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 <set>
27
#include <string>
28
29
#include <
osmscout/TypeInfoSet.h
>
30
31
#include <
osmscout/Way.h
>
32
33
#include <
osmscout/io/FileScanner.h
>
34
35
#include <
osmscout/util/Magnification.h
>
36
37
namespace
osmscout
{
38
39
class
OSMSCOUT_API
OptimizeWaysLowZoom
40
{
41
public
:
42
static
const
char
*
const
FILE_WAYSOPT_DAT
;
43
44
private
:
45
struct
TypeData
46
{
47
uint32_t optLevel;
48
uint32_t indexLevel;
49
50
uint32_t cellXStart;
51
uint32_t cellXEnd;
52
uint32_t cellYStart;
53
uint32_t cellYEnd;
54
55
FileOffset
bitmapOffset;
56
uint8_t dataOffsetBytes;
57
58
uint32_t cellXCount;
59
uint32_t cellYCount;
60
61
double
cellWidth;
62
double
cellHeight;
63
64
double
minLon;
65
double
maxLon;
66
double
minLat;
67
double
maxLat;
68
};
69
70
private
:
71
TypeConfigRef
typeConfig;
72
std::string datafilename;
73
mutable
FileScanner scanner;
74
75
double
magnification;
76
std::map<TypeInfoRef,std::list<TypeData> > wayTypesData;
77
78
mutable
std::mutex lookupMutex;
79
80
private
:
81
void
ReadTypeData(FileScanner& scanner,
82
TypeData& data);
83
84
void
GetOffsets(
const
TypeData& typeData,
85
const
GeoBox& boundingBox,
86
std::set<FileOffset>& offsets)
const
;
87
88
void
LoadData(std::set<FileOffset>& offsets,
89
std::vector<WayRef>& ways)
const
;
90
91
public
:
92
OptimizeWaysLowZoom
();
93
virtual
~OptimizeWaysLowZoom
();
94
95
bool
Open
(
const
TypeConfigRef
& typeConfig,
96
const
std::string& path,
97
bool
memoryMappedData);
98
bool
Close
();
99
100
bool
HasOptimizations
(
double
magnification)
const
;
101
102
void
GetTypes
(
const
Magnification& magnification,
103
const
TypeInfoSet& wayTypes,
104
TypeInfoSet& availableWayTypes)
const
;
105
bool
GetWays
(
const
GeoBox& boundingBox,
106
const
Magnification& magnification,
107
const
TypeInfoSet& wayTypes,
108
std::vector<WayRef>& ways,
109
TypeInfoSet& loadedWayTypes)
const
;
110
};
111
112
using
OptimizeWaysLowZoomRef
= std::shared_ptr<OptimizeWaysLowZoom>;
113
}
114
115
#endif
OSMSCOUT_API
#define OSMSCOUT_API
Definition
CoreImportExport.h:45
FileScanner.h
Magnification.h
TypeInfoSet.h
Way.h
osmscout::OptimizeWaysLowZoom::GetWays
bool GetWays(const GeoBox &boundingBox, const Magnification &magnification, const TypeInfoSet &wayTypes, std::vector< WayRef > &ways, TypeInfoSet &loadedWayTypes) const
osmscout::OptimizeWaysLowZoom::Open
bool Open(const TypeConfigRef &typeConfig, const std::string &path, bool memoryMappedData)
osmscout::OptimizeWaysLowZoom::FILE_WAYSOPT_DAT
static const char *const FILE_WAYSOPT_DAT
Definition
OptimizeWaysLowZoom.h:42
osmscout::OptimizeWaysLowZoom::OptimizeWaysLowZoom
OptimizeWaysLowZoom()
osmscout::OptimizeWaysLowZoom::~OptimizeWaysLowZoom
virtual ~OptimizeWaysLowZoom()
osmscout::OptimizeWaysLowZoom::HasOptimizations
bool HasOptimizations(double magnification) const
osmscout::OptimizeWaysLowZoom::Close
bool Close()
osmscout::OptimizeWaysLowZoom::GetTypes
void GetTypes(const Magnification &magnification, const TypeInfoSet &wayTypes, TypeInfoSet &availableWayTypes) 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::OptimizeWaysLowZoomRef
std::shared_ptr< OptimizeWaysLowZoom > OptimizeWaysLowZoomRef
Definition
OptimizeWaysLowZoom.h:112
Generated by
1.17.0