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