libosmscout  1.1.1
GenWayAreaDat.h
Go to the documentation of this file.
1 #ifndef OSMSCOUT_IMPORT_GENWAYAREADAT_H
2 #define OSMSCOUT_IMPORT_GENWAYAREADAT_H
3 
4 /*
5  This source is part of the libosmscout library
6  Copyright (C) 2013 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 <osmscout/import/ImportFeatures.h>
24 
25 #include <tuple>
26 #include <unordered_set>
27 
28 #include <osmscout/Area.h>
29 
30 #include <osmscout/CoordDataFile.h>
31 #include <osmscout/NumericIndex.h>
32 
33 #include <osmscout/TypeInfoSet.h>
34 
36 
37 #include <osmscout/import/Import.h>
38 #include <osmscout/import/RawWay.h>
39 
41 
42 namespace osmscout {
43 
44  class WayAreaDataGenerator CLASS_FINAL : public ImportModule
45  {
46  public:
47  static const char* WAYAREA_TMP;
48 
49  private:
50  struct Distribution
51  {
52  uint32_t nodeCount;
53  uint32_t wayCount;
54  uint32_t areaCount;
55 
56  Distribution();
57  };
58 
59  using BlacklistSet = std::unordered_set<OSMId>;
60  using WayList = std::list<RawWayRef>;
61 
62  std::tuple<BlacklistSet,bool> ReadWayBlacklist(const ImportParameter& parameter,
63  Progress& progress) const;
64 
65  void WriteArea(const ImportParameter& parameter,
66  Progress& progress,
67  const TypeConfig& typeConfig,
68  FileWriter& writer,
69  uint32_t& writtenWayCount,
70  const CoordDataFile::ResultMap& coordsMap,
71  const RawWay& rawWay);
72 
73  public:
74  void GetDescription(const ImportParameter& parameter,
75  ImportModuleDescription& description) const override;
76 
77  bool Import(const TypeConfigRef& typeConfig,
78  const ImportParameter& parameter,
79  Progress& progress) override;
80  };
81 }
82 
83 #endif
static const char * WAYAREA_TMP
Definition: GenWayAreaDat.h:47
Definition: Area.h:38
#define CLASS_FINAL
Definition: Compiler.h:26
Definition: Progress.h:34
std::shared_ptr< TypeConfig > TypeConfigRef
Definition: TypeConfig.h:1227
std::unordered_map< OSMId, Point > ResultMap
Definition: CoordDataFile.h:42