libosmscout 1.1.1
Loading...
Searching...
No Matches
ImportParameter.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_IMPORTPARAMETER_H
2#define OSMSCOUT_IMPORTPARAMETER_H
3
4/*
5 This source is part of the libosmscout library
6 Copyright (C) 2009 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
26
27#include <memory>
28
29namespace osmscout {
30
31class Preprocessor;
33
35{
36public:
37 virtual ~PreprocessorFactory() = default;
38
39 virtual std::unique_ptr<Preprocessor> GetProcessor(const std::string& filename,
40 PreprocessorCallback& callback) const = 0;
41};
42
43using PreprocessorFactoryRef = std::shared_ptr<PreprocessorFactory>;
44
52class OSMSCOUT_IMPORT_API ImportParameter CLASS_FINAL
53{
54public:
59 {
60 private:
61 VehicleMask vehicleMask;
62 std::string filenamebase;
63
64 public:
65 Router(VehicleMask vehicleMask,
66 const std::string& filenamebase);
67
69 {
70 return vehicleMask;
71 }
72
73 inline std::string GetFilenamebase() const
74 {
75 return filenamebase;
76 }
77
78 inline std::string GetDataFilename() const
79 {
80 return filenamebase+".dat";
81 }
82
83 inline std::string GetVariantFilename() const
84 {
85 return filenamebase+"2.dat";
86 }
87
88 inline std::string GetIndexFilename() const
89 {
90 return filenamebase+".idx";
91 }
92 };
93
94 using RouterRef = std::shared_ptr<Router>;
95
96 enum class AssumeLandStrategy : std::uint8_t
97 {
98 disable = 0, // disable land detection by db objects
99 enable = 1, // enable land detection
100 automatic = 2, // disable land detection when data polygon is known
101 };
102
103 enum class TextIndexVariant : std::uint8_t
104 {
105 original = 0, // store original names
106 transliterate = 1, // store transliterated form of names
107 both = 2, // store original and transliterated form of names
108 };
109
110private:
111 std::list<std::string> mapfiles; //<! Name of the files containing map data (either *.osm or *.osm.pbf)
112 std::string typefile; //<! Name and path ff type definition file (map.ost.xml)
113 std::string destinationDirectory; //<! Name of the destination directory
114
115 ImportErrorReporterRef errorReporter; //<! Class for reporting certain import errors to
116
117 size_t startStep; //<! Starting step for import
118 size_t endStep; //<! End step for import
119 std::string boundingPolygonFile; //<! Polygon file containing the bounding polygon of the current import
120 bool eco; //<! Eco modus, deletes temporary files ASAP
121 std::list<Router> router; //<! Definition of router
122
123 bool strictAreas; //<! Assure that areas conform to "simple" definition
124
125 bool sortObjects; //<! Sort all objects
126 size_t sortBlockSize; //<! Number of entries loaded in one sort iteration
127 size_t sortTileMag; //<! Zoom level for individual sorting cells
128
129 size_t processingQueueSize;
130
131 size_t numericIndexPageSize; //<! Size of an numeric index page in bytes
132
133 size_t rawCoordBlockSize; //<! Number of raw coords loaded during import in one go
134
135 bool rawNodeDataMemoryMaped; //<! Use memory mapping for raw node data file access
136
137 bool rawWayIndexMemoryMaped; //<! Use memory mapping for raw way index file access
138 bool rawWayDataMemoryMaped; //<! Use memory mapping for raw way data file access
139 size_t rawWayIndexCacheSize; //<! Size of the raw way index cache
140 size_t rawWayBlockSize; //<! Number of ways loaded during import until nodes get resolved
141
142 bool coordDataMemoryMaped; //<! Use memory mapping for coord data file access
143 size_t coordIndexCacheSize; //<! Size of the coord index cache
144 size_t coordBlockSize; //<! Maximum number of node ids we resolve in one go
145
146 size_t relMaxWays; //<! Maximum number of ways allowed to resolve a relation
147 size_t relMaxCoords; //<! Maximum number of coords allowed to resolve a relation
148
149 bool areaDataMemoryMaped; //<! Use memory mapping for area data file access
150 size_t areaDataCacheSize; //<! Size of the area data cache
151
152 bool wayDataMemoryMaped; //<! Use memory mapping for way data file access
153 size_t wayDataCacheSize; //<! Size of the way data cache
154
155 size_t areaAreaIndexMaxMag; //<! Maximum depth of the index generated
156
157 MagnificationLevel areaNodeGridMag; //<! Magnification level for the index grid
158 uint16_t areaNodeSimpleListLimit; //<! If a type has less entries, we just store them plain
159 uint16_t areaNodeTileListLimit; //<! If a type has less entries in a tile, we store it as list
160 uint16_t areaNodeTileListCoordLimit;//<! If a type has less entries we store the coord in tile lists
161 MagnificationLevel areaNodeBitmapMaxMag; //<! Maximum Magnification level for bitmap index
162 uint16_t areaNodeBitmapLimit; //<! All cells must have less entries for a given zoom level
163
164 MagnificationLevel areaWayIndexMinMag; //<! Minimum magnification of index for individual type
165 MagnificationLevel areaWayIndexMaxMag; //<! Maximum zoom level for area way index bitmap
166
167 MagnificationLevel areaRouteIndexMinMag; //<! Minimum magnification of index for individual type
168 MagnificationLevel areaRouteIndexMaxMag; //<! Maximum zoom level for area route index bitmap
169
170 uint32_t waterIndexMinMag; //<! Minimum level of the generated water index
171 uint32_t waterIndexMaxMag; //<! Maximum level of the generated water index
172
173 size_t optimizationMaxWayCount; //<! Maximum number of ways for one iteration
174 MagnificationLevel optimizationMaxMag; //<! Maximum magnification for optimization
175 MagnificationLevel optimizationMinMag; //<! Minimum magnification of index for individual type
176 size_t optimizationCellSizeAverage; //<! Average entries per index cell
177 size_t optimizationCellSizeMax; //<! Maximum number of entries per index cell
178 TransPolygon::OptimizeMethod optimizationWayMethod; //<! what method to use to optimize ways
179
180 size_t routeNodeBlockSize; //<! Number of route nodes loaded during import until ways get resolved
181 uint32_t routeNodeTileMag; //<! Size of a routing tile
182
183 AssumeLandStrategy assumeLand; //<! During sea/land detection,we either trust coastlines only or make some
184 //<! assumptions which tiles are sea and which are land.
185 std::vector<std::string> langOrder; //<! languages used when parsing name[:lang] and
186 //<! place_name[:lang] tags
187 std::vector<std::string> altLangOrder; //<! the same as langOrder but for a alt (second) lang
188
189 size_t maxAdminLevel; //<! Maximum admin level that gets evaluated
190
191 OSMId firstFreeOSMId; //<! first id available for synthetic objects (parsed polygon files)
192 size_t fillWaterArea; //<! count of tiles around coastlines flooded by water
193
194 PreprocessorFactoryRef preprocessorFactory; //<! Optional preprocessor factory to inject custom preprocessors
195
196 TextIndexVariant textIndexVariant;
197
198public:
201
202 const std::list<std::string>& GetMapfiles() const;
203 std::string GetTypefile() const;
204 std::string GetDestinationDirectory() const;
205 std::string GetBoundingPolygonFile() const;
206
208
209 size_t GetStartStep() const;
210 size_t GetEndStep() const;
211 bool IsEco() const;
212
213 const std::list<Router>& GetRouter() const;
214
215 bool GetStrictAreas() const;
216
217 bool GetSortObjects() const;
218 size_t GetSortBlockSize() const;
219 size_t GetSortTileMag() const;
220
222
224
225 size_t GetRawCoordBlockSize() const;
226
228
232 size_t GetRawWayBlockSize() const;
233
236
237 size_t GetCoordBlockSize() const;
238
239 size_t GetRelMaxWays() const;
240 size_t GetRelMaxCoords() const;
241
243 size_t GetAreaDataCacheSize() const;
244
246 size_t GetWayDataCacheSize() const;
247
250 uint16_t GetAreaNodeTileListLimit() const;
253 uint16_t GetAreaNodeBitmapLimit() const;
254
257
260
262
263 uint32_t GetWaterIndexMinMag() const;
264 uint32_t GetWaterIndexMaxMag() const;
265
271 TransPolygon::OptimizeMethod GetOptimizationWayMethod() const;
272
273 size_t GetRouteNodeBlockSize() const;
274 uint32_t GetRouteNodeTileMag() const;
275
277
279
280 const std::vector<std::string>& GetLangOrder () const;
281 const std::vector<std::string>& GetAltLangOrder () const;
282
283 size_t GetMaxAdminLevel() const;
284
285 void SetMapfiles(const std::list<std::string>& mapfile);
286 void SetTypefile(const std::string& typefile);
287 void SetDestinationDirectory(const std::string& destinationDirectory);
288 void SetBoundingPolygonFile(const std::string& boundingPolygonFile);
289
290 void SetErrorReporter(const ImportErrorReporterRef& errorReporter);
291
292 void SetStartStep(size_t startStep);
293 void SetSteps(size_t startStep, size_t endStep);
294 void SetEco(bool eco);
295
297 void AddRouter(const Router& router);
298
299 void SetStrictAreas(bool strictAreas);
300
301 void SetSortObjects(bool sortObjects);
302 void SetSortBlockSize(size_t sortBlockSize);
303 void SetSortTileMag(size_t sortTileMag);
304
305 void SetProcessingQueueSize(size_t processingQueueSize);
306
307 void SetNumericIndexPageSize(size_t numericIndexPageSize);
308
309 void SetRawCoordBlockSize(size_t blockSize);
310
311 void SetRawNodeDataMemoryMaped(bool memoryMaped);
312
313 void SetRawWayIndexMemoryMaped(bool memoryMaped);
314 void SetRawWayDataMemoryMaped(bool memoryMaped);
315 void SetRawWayIndexCacheSize(size_t wayIndexCacheSize);
316 void SetRawWayBlockSize(size_t blockSize);
317
318 void SetCoordDataMemoryMaped(bool memoryMaped);
319 void SetCoordIndexCacheSize(size_t coordIndexCacheSize);
320
321 void SetCoordBlockSize(size_t coordBlockSize);
322
323 void SetRelMaxWays(size_t relMaxWays);
324 void SetRelMaxCoords(size_t relMaxCoords);
325
326 void SetAreaDataMemoryMaped(bool memoryMaped);
327 void SetAreaDataCacheSize(size_t areaDataCacheSize);
328
329 void SetWayDataMemoryMaped(bool memoryMaped);
330 void SetWayDataCacheSize(size_t wayDataCacheSize);
331
332 void SetAreaAreaIndexMaxMag(size_t areaAreaIndexMaxMag);
333
335 void SetAreaNodeSimpleListLimit(uint16_t areaNodeSimpleListLimit);
336 void SetAreaNodeTileListLimit(uint16_t areaNodeTileListLimit);
337 void SetAreaNodeTileListCoordLimit(uint16_t areaNodeTileListCoordLimit);
338 void SetAreaNodeBitmapMaxMag(const MagnificationLevel& areaNodeBitmapMaxMag);
339 void SetAreaNodeBitmapLimit(uint16_t areaNodeBitmapLimit);
340
343
344 void SetAreaRouteIndexMinMag(MagnificationLevel areaRouteIndexMinMag);
345 void SetAreaRouteIndexMaxMag(MagnificationLevel areaRouteIndexMaxMag);
346
347 void SetWaterIndexMinMag(uint32_t waterIndexMinMag);
348 void SetWaterIndexMaxMag(uint32_t waterIndexMaxMag);
349
350 void SetOptimizationMaxWayCount(size_t optimizationMaxWayCount);
353 void SetOptimizationCellSizeAverage(size_t optimizationCellSizeAverage);
354 void SetOptimizationCellSizeMax(size_t optimizationCellSizeMax);
355 void SetOptimizationWayMethod(TransPolygon::OptimizeMethod optimizationWayMethod);
356
357 void SetRouteNodeBlockSize(size_t blockSize);
358 void SetRouteNodeTileMag(uint32_t routeNodeTileMag);
359
361
362 void SetLangOrder(const std::vector<std::string>& langOrder);
363 void SetAltLangOrder(const std::vector<std::string>& altLangOrder);
364
365 void SetMaxAdminLevel(size_t maxAdminLevel);
366
368
369 void SetFillWaterArea(size_t fillWaterArea);
370 size_t GetFillWaterArea() const;
371
373
374 std::unique_ptr<Preprocessor> GetPreprocessor(const std::string& filename,
375 PreprocessorCallback& callback) const;
376
377 void SetTextIndexVariant(TextIndexVariant textIndexVariant);
379
380 static size_t GetDefaultStartStep();
381 static size_t GetDefaultEndStep();
382};
383
384}
385
386#endif //OSMSCOUT_IMPORTPARAMETER_H
#define OSMSCOUT_IMPORT_API
Definition ImportImportExport.h:45
Definition Area.h:88
size_t GetAreaAreaIndexMaxMag() const
void SetSortObjects(bool sortObjects)
MagnificationLevel GetAreaRouteIndexMinMag() const
void SetProcessingQueueSize(size_t processingQueueSize)
std::shared_ptr< Router > RouterRef
Definition ImportParameter.h:94
void SetFirstFreeOSMId(OSMId id)
bool GetRawNodeDataMemoryMaped() const
std::unique_ptr< Preprocessor > GetPreprocessor(const std::string &filename, PreprocessorCallback &callback) const
size_t GetMaxAdminLevel() const
size_t GetRawWayBlockSize() const
uint16_t GetAreaNodeTileListCoordLimit() const
void SetTextIndexVariant(TextIndexVariant textIndexVariant)
void SetErrorReporter(const ImportErrorReporterRef &errorReporter)
void SetDestinationDirectory(const std::string &destinationDirectory)
size_t GetOptimizationCellSizeAverage() const
uint32_t GetWaterIndexMinMag() const
static size_t GetDefaultEndStep()
MagnificationLevel GetOptimizationMinMag() const
std::string GetDestinationDirectory() const
TransPolygon::OptimizeMethod GetOptimizationWayMethod() const
void SetRouteNodeTileMag(uint32_t routeNodeTileMag)
MagnificationLevel GetAreaRouteIndexMaxMag() const
bool GetWayDataMemoryMaped() const
void SetRelMaxWays(size_t relMaxWays)
void SetAreaNodeTileListCoordLimit(uint16_t areaNodeTileListCoordLimit)
void SetStrictAreas(bool strictAreas)
size_t GetFillWaterArea() const
void SetAreaNodeSimpleListLimit(uint16_t areaNodeSimpleListLimit)
void SetWayDataMemoryMaped(bool memoryMaped)
MagnificationLevel GetOptimizationMaxMag() const
bool GetStrictAreas() const
void SetSteps(size_t startStep, size_t endStep)
void SetBoundingPolygonFile(const std::string &boundingPolygonFile)
void SetSortTileMag(size_t sortTileMag)
void SetRouteNodeBlockSize(size_t blockSize)
void SetAreaNodeTileListLimit(uint16_t areaNodeTileListLimit)
void SetRawWayBlockSize(size_t blockSize)
void SetSortBlockSize(size_t sortBlockSize)
void SetFillWaterArea(size_t fillWaterArea)
void SetAreaDataCacheSize(size_t areaDataCacheSize)
void SetOptimizationWayMethod(TransPolygon::OptimizeMethod optimizationWayMethod)
size_t GetRelMaxWays() const
uint16_t GetAreaNodeSimpleListLimit() const
bool GetAreaDataMemoryMaped() const
std::string GetTypefile() const
void SetAreaDataMemoryMaped(bool memoryMaped)
void SetTypefile(const std::string &typefile)
void SetEco(bool eco)
size_t GetSortTileMag() const
void SetCoordBlockSize(size_t coordBlockSize)
bool GetSortObjects() const
std::string GetBoundingPolygonFile() const
void SetCoordDataMemoryMaped(bool memoryMaped)
size_t GetRawCoordBlockSize() const
void SetRawWayIndexMemoryMaped(bool memoryMaped)
size_t GetWayDataCacheSize() const
TextIndexVariant GetTextIndexVariant() const
const std::list< std::string > & GetMapfiles() const
MagnificationLevel GetAreaNodeBitmapMaxMag() const
static size_t GetDefaultStartStep()
size_t GetCoordIndexCacheSize() const
size_t GetOptimizationCellSizeMax() const
void SetAreaNodeGridMag(MagnificationLevel areaNodeGridMag)
size_t GetEndStep() const
AssumeLandStrategy
Definition ImportParameter.h:97
OSMId GetFirstFreeOSMId() const
void SetAreaNodeBitmapMaxMag(const MagnificationLevel &areaNodeBitmapMaxMag)
void SetWaterIndexMaxMag(uint32_t waterIndexMaxMag)
TextIndexVariant
Definition ImportParameter.h:104
MagnificationLevel GetAreaNodeGridMag() const
void SetAltLangOrder(const std::vector< std::string > &altLangOrder)
void SetAreaWayIndexMaxMag(MagnificationLevel areaWayIndexMaxMag)
void SetNumericIndexPageSize(size_t numericIndexPageSize)
AssumeLandStrategy GetAssumeLand() const
MagnificationLevel GetAreaWayIndexMinMag() const
void SetRawNodeDataMemoryMaped(bool memoryMaped)
void SetAreaNodeBitmapLimit(uint16_t areaNodeBitmapLimit)
MagnificationLevel GetAreaWayIndexMaxMag() const
void SetRelMaxCoords(size_t relMaxCoords)
void SetWayDataCacheSize(size_t wayDataCacheSize)
void SetOptimizationMinMag(MagnificationLevel optimizationMinMag)
void SetCoordIndexCacheSize(size_t coordIndexCacheSize)
size_t GetNumericIndexPageSize() const
size_t GetStartStep() const
size_t GetRawWayIndexCacheSize() const
const std::vector< std::string > & GetAltLangOrder() const
uint32_t GetWaterIndexMaxMag() const
void SetAreaAreaIndexMaxMag(size_t areaAreaIndexMaxMag)
void SetMapfiles(const std::list< std::string > &mapfile)
void SetRawWayIndexCacheSize(size_t wayIndexCacheSize)
void SetMaxAdminLevel(size_t maxAdminLevel)
const std::list< Router > & GetRouter() const
virtual ~ImportParameter()
ImportErrorReporterRef GetErrorReporter() const
bool GetRawWayIndexMemoryMaped() const
size_t GetSortBlockSize() const
MagnificationLevel()=default
void SetStartStep(size_t startStep)
size_t GetAreaDataCacheSize() const
void SetLangOrder(const std::vector< std::string > &langOrder)
size_t GetProcessingQueueSize() const
void SetPreprocessorFactory(const PreprocessorFactoryRef &factory)
void SetRawCoordBlockSize(size_t blockSize)
void SetRawWayDataMemoryMaped(bool memoryMaped)
void AddRouter(const Router &router)
size_t GetOptimizationMaxWayCount() const
void SetOptimizationCellSizeAverage(size_t optimizationCellSizeAverage)
size_t GetCoordBlockSize() const
void SetOptimizationMaxWayCount(size_t optimizationMaxWayCount)
void SetAreaRouteIndexMinMag(MagnificationLevel areaRouteIndexMinMag)
uint16_t GetAreaNodeTileListLimit() const
void SetOptimizationMaxMag(MagnificationLevel optimizationMaxMag)
const std::vector< std::string > & GetLangOrder() const
bool GetRawWayDataMemoryMaped() const
uint16_t GetAreaNodeBitmapLimit() const
size_t GetRelMaxCoords() const
void SetAssumeLand(AssumeLandStrategy assumeLand)
void SetAreaRouteIndexMaxMag(MagnificationLevel areaRouteIndexMaxMag)
void SetWaterIndexMinMag(uint32_t waterIndexMinMag)
void SetOptimizationCellSizeMax(size_t optimizationCellSizeMax)
bool GetCoordDataMemoryMaped() const
size_t GetRouteNodeBlockSize() const
uint32_t GetRouteNodeTileMag() const
void SetAreaWayIndexMinMag(MagnificationLevel areaWayIndexMinMag)
Definition Preprocessor.h:36
Definition ImportParameter.h:35
virtual ~PreprocessorFactory()=default
virtual std::unique_ptr< Preprocessor > GetProcessor(const std::string &filename, PreprocessorCallback &callback) const =0
Definition Preprocessor.h:86
Definition Router.h:50
int64_t OSMId
Definition OSMScoutTypes.h:33
Definition Area.h:39
uint8_t VehicleMask
Definition OSMScoutTypes.h:61
std::shared_ptr< PreprocessorFactory > PreprocessorFactoryRef
Definition ImportParameter.h:43
std::shared_ptr< ImportErrorReporter > ImportErrorReporterRef
Definition ImportErrorReporter.h:137
std::string GetVariantFilename() const
Definition ImportParameter.h:83
Router(VehicleMask vehicleMask, const std::string &filenamebase)
std::string GetIndexFilename() const
Definition ImportParameter.h:88
std::string GetDataFilename() const
Definition ImportParameter.h:78
std::string GetFilenamebase() const
Definition ImportParameter.h:73
VehicleMask GetVehicleMask() const
Definition ImportParameter.h:68