libosmscout  1.1.1
Preprocessor.h
Go to the documentation of this file.
1 #ifndef OSMSCOUT_IMPORT_PREPROCESSOR_H
2 #define OSMSCOUT_IMPORT_PREPROCESSOR_H
3 
4 /*
5  This source is part of the libosmscout library
6  Copyright (C) 2015 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 <unordered_map>
24 
25 #include <osmscout/Tag.h>
26 #include <osmscout/TypeConfig.h>
27 #include <osmscout/OSMScoutTypes.h>
28 #include <osmscout/util/Progress.h>
29 
30 #include <osmscout/import/Import.h>
32 
33 namespace osmscout {
34 
36  {
37  public:
38  struct RawNodeData
39  {
41  GeoCoord coord;
43 
44  RawNodeData() = default;
45 
47  const GeoCoord& coord)
48  : id(id),
49  coord(coord)
50  {
51  // no code
52  }
53  };
54 
55  struct RawWayData
56  {
59  std::vector<OSMId> nodes;
60  };
61 
63  {
66  std::vector<RawRelation::Member> members;
67  };
68 
69  struct RawBlockData
70  {
71  std::vector<RawNodeData> nodeData;
72  std::vector<RawWayData> wayData;
73  std::vector<RawRelationData> relationData;
74  };
75 
76  // Should be unique_ptr but I get compiler errors if passing it to the WriteWorkerQueue
77  using RawBlockDataRef = std::shared_ptr<RawBlockData>;
78 
79  public:
80  virtual ~PreprocessorCallback() = default;
81 
82  virtual void ProcessBlock(RawBlockDataRef data) = 0;
83  };
84 
86  {
87  public:
88  virtual ~Preprocessor() = default;
89 
90  virtual bool Import(const TypeConfigRef& typeConfig,
91  const ImportParameter& parameter,
92  Progress& progress,
93  const std::string& filename) = 0;
94 
95  };
96 }
97 
98 #endif
Definition: Preprocessor.h:55
OSMId id
Definition: Preprocessor.h:57
std::shared_ptr< RawBlockData > RawBlockDataRef
Definition: Preprocessor.h:77
Definition: Preprocessor.h:85
int64_t OSMId
Definition: OSMScoutTypes.h:34
std::vector< RawNodeData > nodeData
Definition: Preprocessor.h:71
#define OSMSCOUT_IMPORT_API
Definition: ImportImportExport.h:45
GeoCoord coord
Definition: Preprocessor.h:41
TagMap tags
Definition: Preprocessor.h:42
OSMId id
Definition: Preprocessor.h:40
TagMap tags
Definition: Preprocessor.h:65
Definition: Area.h:38
std::vector< RawRelation::Member > members
Definition: Preprocessor.h:66
Definition: Preprocessor.h:35
Definition: Preprocessor.h:38
OSMId id
Definition: Preprocessor.h:64
std::vector< RawWayData > wayData
Definition: Preprocessor.h:72
std::unordered_map< TagId, std::string > TagMap
Definition: Tag.h:41
Definition: Progress.h:34
std::vector< OSMId > nodes
Definition: Preprocessor.h:59
TagMap tags
Definition: Preprocessor.h:58
std::shared_ptr< TypeConfig > TypeConfigRef
Definition: TypeConfig.h:1227
std::vector< RawRelationData > relationData
Definition: Preprocessor.h:73
RawNodeData(OSMId id, const GeoCoord &coord)
Definition: Preprocessor.h:46