libosmscout 1.1.1
Loading...
Searching...
No Matches
GenAreaNodeIndex.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_IMPORT_GENAREANODEINDEX_H
2#define OSMSCOUT_IMPORT_GENAREANODEINDEX_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 <set>
25#include <vector>
26
28
30
32
33namespace osmscout {
34
38 class AreaNodeIndexGenerator CLASS_FINAL : public ImportModule
39 {
40 public:
44 enum class IndexType : uint8_t
45 {
46 IndexTypeBitmap = uint8_t(1),
47 IndexTypeList = uint8_t(2)
48 };
49
51 {
52 TypeId nodeId; //<! node id of the type
53 TypeInfoRef type; //<! The node type itself
54 bool isComplex; //<! Index is complex
55 GeoBox boundingBox; //<! Bounding box of the data
56 size_t fillCount; //<! Number of entries of this type over all
57 std::map<TileId,size_t> tileFillCount; //<! Number of entries of this type per tile
58 std::set<TileId> listTiles; //<! Tiles with list index
59 std::set<TileId> bitmapTiles; //<! Tiles with bitmap index
60
61 inline bool HasNoData() const
62 {
63 return fillCount==0;
64 }
65
66 inline bool IsComplexIndex() const
67 {
68 return isComplex;
69 }
70 };
71
72 private:
73 bool AnalyseDistribution(const TypeConfigRef& typeConfig,
74 const ImportParameter& parameter,
75 Progress& progress,
76 std::vector<DistributionData>& data);
77 void DumpDistribution(Progress& progress,
78 const std::vector<DistributionData>& data);
79
80 std::vector<FileOffset> WriteListIndex(Progress& progress,
81 const std::vector<DistributionData>& data,
82 FileWriter& writer);
83
84 std::vector<std::map<TileId,FileOffset>> WriteTileListIndex(Progress& progress,
85 const std::vector<DistributionData>& data,
86 FileWriter& writer);
87
88 std::vector<std::map<TileId,FileOffset>> WriteBitmapIndex(Progress& progress,
89 const std::vector<DistributionData>& data,
90 FileWriter& writer);
91
92 void WriteListData(Progress& progress,
93 const std::vector<DistributionData>& data,
94 const std::vector<std::list<std::pair<GeoCoord,FileOffset>>>& listData,
95 const std::vector<FileOffset>& listIndexOffsets,
96 FileWriter& writer);
97
98 void WriteTileListData(const ImportParameter& parameter,
99 const DistributionData& distributionData,
100 const std::list<std::pair<GeoCoord,FileOffset>>& tileData,
101 const FileOffset& tileIndexOffset,
102 FileWriter& writer);
103
104 void WriteBitmapData(const ImportParameter& parameter,
105 const TileId& tileId,
106 const std::list<std::pair<GeoCoord,FileOffset>>& bitmapData,
107 const FileOffset& bitmapIndexOffset,
108 FileWriter& writer);
109
110 bool WriteData(const TypeConfigRef& typeConfig,
111 const ImportParameter& parameter,
112 Progress& progress,
113 const std::vector<DistributionData>& data);
114
115 public:
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
IndexType
Definition GenAreaNodeIndex.h:45
void GetDescription(const ImportParameter &parameter, ImportModuleDescription &description) const override
bool Import(const TypeConfigRef &typeConfig, const ImportParameter &parameter, Progress &progress) override
Definition ImportModule.h:101
Definition Progress.h:34
Definition TileId.h:46
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
std::shared_ptr< TypeInfo > TypeInfoRef
Definition TypeConfig.h:61
Definition GenAreaNodeIndex.h:51
TypeId nodeId
Definition GenAreaNodeIndex.h:52
std::set< TileId > listTiles
Definition GenAreaNodeIndex.h:58
std::map< TileId, size_t > tileFillCount
Definition GenAreaNodeIndex.h:57
bool IsComplexIndex() const
Definition GenAreaNodeIndex.h:66
bool isComplex
Definition GenAreaNodeIndex.h:54
TypeInfoRef type
Definition GenAreaNodeIndex.h:53
GeoBox boundingBox
Definition GenAreaNodeIndex.h:55
size_t fillCount
Definition GenAreaNodeIndex.h:56
bool HasNoData() const
Definition GenAreaNodeIndex.h:61
std::set< TileId > bitmapTiles
Definition GenAreaNodeIndex.h:59