Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/output-flex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1997,14 +1997,15 @@ output_flex_t::clone(std::shared_ptr<middle_query_t> const &mid,
return std::make_shared<output_flex_t>(this, mid, copy_thread);
}

output_flex_t::output_flex_t(
std::shared_ptr<middle_query_t> const &mid,
std::shared_ptr<thread_pool_t> thread_pool, options_t const &o,
std::shared_ptr<db_copy_thread_t> const &copy_thread)
: output_t(mid, std::move(thread_pool), o), m_copy_thread(copy_thread),
m_expire(o.expire_tiles_zoom, o.expire_tiles_max_bbox, o.projection)
{
init_lua(get_options()->style);
output_flex_t::output_flex_t(std::shared_ptr<middle_query_t> const &mid,
std::shared_ptr<thread_pool_t> thread_pool,
options_t const &options)
: output_t(mid, std::move(thread_pool), options),
m_copy_thread(std::make_shared<db_copy_thread_t>(options.conninfo)),
m_expire(options.expire_tiles_zoom, options.expire_tiles_max_bbox,
options.projection)
{
init_lua(options.style);

// If the osm2pgsql.select_relation_members() Lua function is defined
// it means we need two-stage processing which in turn means we need
Expand Down
7 changes: 3 additions & 4 deletions src/output-flex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,9 @@ class output_flex_t : public output_t
{
public:
/// Constructor for new objects
output_flex_t(
std::shared_ptr<middle_query_t> const &mid,
std::shared_ptr<thread_pool_t> thread_pool, options_t const &options,
std::shared_ptr<db_copy_thread_t> const &copy_thread);
output_flex_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_flex_t(output_flex_t const *other,
Expand Down
6 changes: 3 additions & 3 deletions src/output-gazetteer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class output_gazetteer_t : public output_t
/// Constructor for new objects
output_gazetteer_t(std::shared_ptr<middle_query_t> const &mid,
std::shared_ptr<thread_pool_t> thread_pool,
options_t const &options,
std::shared_ptr<db_copy_thread_t> const &copy_thread)
: output_t(mid, std::move(thread_pool), options), m_copy(copy_thread),
options_t const &options)
: output_t(mid, std::move(thread_pool), options),
m_copy(std::make_shared<db_copy_thread_t>(options.conninfo)),
m_proj(options.projection)
{
m_style.load_style(options.style);
Expand Down
31 changes: 16 additions & 15 deletions src/output-pgsql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,23 +418,25 @@ std::shared_ptr<output_t> output_pgsql_t::clone(
return std::make_shared<output_pgsql_t>(this, mid, copy_thread);
}

output_pgsql_t::output_pgsql_t(
std::shared_ptr<middle_query_t> const &mid,
std::shared_ptr<thread_pool_t> thread_pool, options_t const &o,
std::shared_ptr<db_copy_thread_t> const &copy_thread)
: output_t(mid, std::move(thread_pool), o), m_proj(o.projection),
m_expire(o.expire_tiles_zoom, o.expire_tiles_max_bbox, o.projection),
output_pgsql_t::output_pgsql_t(std::shared_ptr<middle_query_t> const &mid,
std::shared_ptr<thread_pool_t> thread_pool,
options_t const &options)
: output_t(mid, std::move(thread_pool), options), m_proj(options.projection),
m_expire(options.expire_tiles_zoom, options.expire_tiles_max_bbox,
options.projection),
m_buffer(32768, osmium::memory::Buffer::auto_grow::yes),
m_rels_buffer(1024, osmium::memory::Buffer::auto_grow::yes)
{
log_debug("Using projection SRS {} ({})", o.projection->target_srs(),
o.projection->target_desc());
log_debug("Using projection SRS {} ({})", options.projection->target_srs(),
options.projection->target_desc());

export_list exlist;

m_enable_way_area = read_style_file(get_options()->style, &exlist);
m_enable_way_area = read_style_file(options.style, &exlist);

m_tagtransform = tagtransform_t::make_tagtransform(&options, exlist);

m_tagtransform = tagtransform_t::make_tagtransform(get_options(), exlist);
auto copy_thread = std::make_shared<db_copy_thread_t>(options.conninfo);

//for each table
for (size_t i = 0; i < t_MAX; ++i) {
Expand All @@ -444,7 +446,7 @@ output_pgsql_t::output_pgsql_t(
(i == t_point) ? osmium::item_type::node : osmium::item_type::way);

//figure out what name we are using for this and what type
std::string name = get_options()->prefix;
std::string name = options.prefix;
std::string type;
switch (i) {
case t_point:
Expand All @@ -469,10 +471,9 @@ output_pgsql_t::output_pgsql_t(
}

m_tables[i] = std::make_unique<table_t>(
name, type, columns, get_options()->hstore_columns,
get_options()->projection->target_srs(), get_options()->append,
get_options()->hstore_mode, copy_thread,
get_options()->output_dbschema);
name, type, columns, options.hstore_columns,
options.projection->target_srs(), options.append,
options.hstore_mode, copy_thread, options.output_dbschema);
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/output-pgsql.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ class output_pgsql_t : public output_t
/// 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,
std::shared_ptr<db_copy_thread_t> const &copy_thread);
options_t const &options);

/// Constructor for cloned objects
output_pgsql_t(output_pgsql_t const *other,
Expand Down
8 changes: 3 additions & 5 deletions src/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,21 @@ output_t::create_output(std::shared_ptr<middle_query_t> const &mid,
std::shared_ptr<thread_pool_t> thread_pool,
options_t const &options)
{
auto copy_thread = std::make_shared<db_copy_thread_t>(options.conninfo);

if (options.output_backend == "pgsql") {
return std::make_shared<output_pgsql_t>(mid, std::move(thread_pool),
options, copy_thread);
options);
}

#ifdef HAVE_LUA
if (options.output_backend == "flex") {
return std::make_shared<output_flex_t>(mid, std::move(thread_pool),
options, copy_thread);
options);
}
#endif

if (options.output_backend == "gazetteer") {
return std::make_shared<output_gazetteer_t>(mid, std::move(thread_pool),
options, copy_thread);
options);
}

if (options.output_backend == "null") {
Expand Down