libosmscout 1.1.1
Loading...
Searching...
No Matches
GenWayWayDat.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_IMPORT_GENWAYWAYDAT_H
2#define OSMSCOUT_IMPORT_GENWAYWAYDAT_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
23#include <osmscoutimport/ImportFeatures.h>
24
25#include <map>
26#include <unordered_map>
27
28#include <osmscout/Way.h>
29
31
33
35
37
40
42
43namespace osmscout {
44
45 class WayWayDataGenerator CLASS_FINAL : public ImportModule
46 {
47 public:
48 static const char* const WAYWAY_TMP;
49 static const char* const TURNRESTR_DAT;
50
51 private:
52 struct RestrictionData
53 {
54 std::multimap<OSMId,TurnRestrictionRef> restrictions;
55 };
56
57 using RouteMemberData = std::multimap<OSMId,OSMId>; // key is way id, values are route ids
58 using WayList = std::list<RawWayRef>;
59 using WayListPtr = WayList::iterator;
60 using WayListPtrList = std::list<WayListPtr>;
61 using WaysByNodeMap = std::unordered_map<OSMId, WayListPtrList>;
62
63 bool ReadRouteMemberData(const ImportParameter& parameter,
64 const TypeConfig& typeConfig,
65 Progress& progress,
66 RouteMemberData& routeMembers);
67
68 bool ReadTurnRestrictions(const ImportParameter& parameter,
69 Progress& progress,
70 RestrictionData& restrictions);
71
72 bool WriteTurnRestrictions(const ImportParameter& parameter,
73 Progress& progress,
74 const RestrictionData& restrictions);
75
76 bool GetWays(const ImportParameter& parameter,
77 Progress& progress,
78 const TypeConfig& typeConfig,
79 TypeInfoSet& types,
80 FileScanner& scanner,
81 std::vector<std::list<RawWayRef> >& ways);
82
83 void UpdateRestrictions(RestrictionData& restrictions,
84 OSMId oldId,
85 OSMId newId);
86
87 bool IsRestricted(const RestrictionData& restrictions,
88 OSMId wayId,
89 OSMId nodeId) const;
90
91 bool MergeWays(Progress& progress,
92 std::list<RawWayRef>& ways,
93 RestrictionData& restrictions,
94 RouteMemberData& routeMembers);
95
96 bool SplitLongWays(Progress& progress,
97 std::list<RawWayRef>& ways,
98 CoordDataFile::ResultMap& coordsMap);
99
100 void WriteWay(Progress& progress,
101 const TypeConfig& typeConfig,
102 FileWriter& writer,
103 uint32_t& writtenWayCount,
104 const CoordDataFile::ResultMap& coordsMap,
105 const RawWay& rawWay);
106
107 bool HandleLowMemoryFallback(Progress& progress,
108 const TypeConfig& typeConfig,
109 FileScanner& scanner,
110 const TypeInfoSet& types,
111 FileWriter& writer,
112 uint32_t& writtenWayCount,
113 const CoordDataFile& coordDataFile);
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
void GetDescription(const ImportParameter &parameter, ImportModuleDescription &description) const override
static const char *const TURNRESTR_DAT
Definition GenWayWayDat.h:49
bool Import(const TypeConfigRef &typeConfig, const ImportParameter &parameter, Progress &progress) override
static const char *const WAYWAY_TMP
Definition GenWayWayDat.h:48
Definition CoordDataFile.h:34
std::unordered_map< OSMId, Point > ResultMap
Definition CoordDataFile.h:42
Definition ImportModule.h:101
Definition Progress.h:34
int64_t OSMId
Definition OSMScoutTypes.h:33
std::shared_ptr< TypeConfig > TypeConfigRef
Definition TypeConfig.h:1396
Definition Area.h:39