-
-
Notifications
You must be signed in to change notification settings - Fork 477
Expand file tree
/
Copy pathoutput-pgsql.hpp
More file actions
117 lines (91 loc) · 3.44 KB
/
output-pgsql.hpp
File metadata and controls
117 lines (91 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#ifndef OSM2PGSQL_OUTPUT_PGSQL_HPP
#define OSM2PGSQL_OUTPUT_PGSQL_HPP
/**
* SPDX-License-Identifier: GPL-2.0-or-later
*
* This file is part of osm2pgsql (https://osm2pgsql.org/).
*
* Copyright (C) 2006-2026 by the osm2pgsql developer community.
* For a full list of authors see the git log.
*/
/* Implements the output-layer processing for osm2pgsql
* storing the data in several PostgreSQL tables
* with the final PostGIS geometries for each entity
*/
#include "db-copy.hpp"
#include "expire-tiles.hpp"
#include "output.hpp"
#include "reprojection.hpp"
#include "table.hpp"
#include "tagtransform.hpp"
#include <array>
#include <cstdint>
#include <memory>
class output_pgsql_t : public output_t
{
public:
enum table_id : std::uint8_t
{
t_point = 0,
t_line,
t_poly,
t_roads,
t_MAX
};
/// Constructor for new objects
output_pgsql_t(std::shared_ptr<middle_query_t> const &mid,
std::shared_ptr<thread_pool_t> thread_pool,
options_t const &options);
/// Constructor for cloned objects
output_pgsql_t(output_pgsql_t const *other,
std::shared_ptr<middle_query_t> const &mid,
std::shared_ptr<db_copy_thread_t> const ©_thread);
output_pgsql_t(output_pgsql_t const &) = delete;
output_pgsql_t &operator=(output_pgsql_t const &) = delete;
output_pgsql_t(output_pgsql_t &&) = delete;
output_pgsql_t &operator=(output_pgsql_t &&) = delete;
~output_pgsql_t() override;
std::shared_ptr<output_t>
clone(std::shared_ptr<middle_query_t> const &mid,
std::shared_ptr<db_copy_thread_t> const ©_thread) const override;
void start() override;
void stop() override;
void sync() override;
void wait() override;
void pending_way(osmid_t id) override;
void pending_relation(osmid_t id) override;
void node_add(osmium::Node const &node) override;
void way_add(osmium::Way *way) override;
void relation_add(osmium::Relation const &rel) override;
void node_modify(osmium::Node const &node) override;
void way_modify(osmium::Way *way) override;
void relation_modify(osmium::Relation const &rel) override;
void node_delete(osmium::Node const &node) override;
void way_delete(osmium::Way *way) override;
void relation_delete(osmium::Relation const &rel) override;
private:
void pgsql_out_way(osmium::Way const &way, taglist_t *tags, bool polygon,
bool roads);
void pgsql_process_relation(osmium::Relation const &rel);
/**
* Delete all objects with specified id from all output tables and mark
* their geometries for expire.
*/
void delete_from_output_and_expire(osmid_t id);
void pgsql_delete_way_from_output(osmid_t osm_id);
void pgsql_delete_relation_from_output(osmid_t osm_id);
std::unique_ptr<tagtransform_t> m_tagtransform;
//enable output of a generated way_area tag to either hstore or its own column
bool m_enable_way_area;
// handle objects without tags as if they were not there
bool m_ignore_untagged_objects;
std::array<std::unique_ptr<table_t>, t_MAX> m_tables;
std::shared_ptr<reprojection_t> m_proj;
expire_config_t m_expire_config;
expire_output_t m_expire_output;
expire_tiles_t m_expire;
osmium::memory::Buffer m_buffer;
osmium::memory::Buffer m_rels_buffer;
osmium::memory::Buffer m_area_buffer;
};
#endif // OSM2PGSQL_OUTPUT_PGSQL_HPP