libosmscout 1.1.1
Loading...
Searching...
No Matches
GenAreaAreaIndex.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_IMPORT_GENAREAAREAINDEX_H
2#define OSMSCOUT_IMPORT_GENAREAAREAINDEX_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 <map>
24#include <set>
25
26#include <osmscout/Area.h>
27#include <osmscout/Pixel.h>
28
31
34
36
37namespace osmscout {
38
39 class AreaAreaIndexGenerator CLASS_FINAL : public ImportModule
40 {
41 public:
42 static const char* AREAADDRESS_DAT;
43
44 private:
45 struct Entry
46 {
47 FileOffset offset;
49 };
50
51 struct AreaLeaf
52 {
53 std::list<Entry> areas;
54 };
55
56 using Level = std::map<Pixel, AreaLeaf>;
57
58 private:
59 std::list<SortDataGenerator<Area>::ProcessingFilterRef> filters;
60
61 private:
62 size_t CalculateLevel(const ImportParameter& parameter,
63 const GeoBox& boundingBox) const;
64
65 void EnrichLevels(std::vector<Level>& levels);
66
67 bool CopyData(const TypeConfig& typeConfig,
68 Progress& progress,
69 FileScanner& scanner,
70 FileWriter& dataWriter,
71 FileWriter& mapWriter,
72 const std::list<FileOffset>& srcOffsets,
73 FileOffset& dataStartOffset,
74 uint32_t& dataWrittenCount);
75
76 bool WriteChildCells(const TypeConfig& typeConfig,
77 Progress& progress,
78 const ImportParameter& parameter,
79 FileScanner& scanner,
80 FileWriter& indexWriter,
81 FileWriter& dataWriter,
82 FileWriter& mapWriter,
83 const std::vector<Level>& levels,
84 size_t level,
85 const Pixel& pixel,
86 FileOffset& offset,
87 uint32_t& dataWrittenCount);
88
89 bool WriteCell(const TypeConfig& typeConfig,
90 Progress& progress,
91 const ImportParameter& parameter,
92 FileScanner& scanner,
93 FileWriter& indexWriter,
94 FileWriter& dataWriter,
95 FileWriter& mapWriter,
96 const std::vector<Level>& levels,
97 size_t level,
98 const Pixel& pixel,
99 const AreaLeaf& leaf,
100 FileOffset& dataStartOffset,
101 uint32_t& dataWrittenCount);
102
103 bool BuildInMemoryIndex(const TypeConfigRef& typeConfig,
104 const ImportParameter& parameter,
105 Progress& progress,
106 FileScanner& scanner,
107 std::vector<Level>& levels);
108
109 bool ImportInternal(const TypeConfigRef& typeConfig,
110 const ImportParameter& parameter,
111 Progress& progress);
112
113 public:
115
116 void GetDescription(const ImportParameter& parameter,
117 ImportModuleDescription& description) const override;
118
119 bool Import(const TypeConfigRef& typeConfig,
120 const ImportParameter& parameter,
121 Progress& progress) override;
122 };
123}
124
125#endif
Definition Area.h:88
void GetDescription(const ImportParameter &parameter, ImportModuleDescription &description) const override
static const char * AREAADDRESS_DAT
Definition GenAreaAreaIndex.h:42
bool Import(const TypeConfigRef &typeConfig, const ImportParameter &parameter, Progress &progress) override
Type type
The type of the cell.
Definition GroundTile.h:92
Definition ImportModule.h:101
uint16_t TypeId
Definition OSMScoutTypes.h:52
uint64_t FileOffset
Definition OSMScoutTypes.h:46
std::shared_ptr< TypeConfig > TypeConfigRef
Definition TypeConfig.h:1396
Definition Area.h:39