-
-
Notifications
You must be signed in to change notification settings - Fork 477
Expand file tree
/
Copy pathgeom-area-assembler.cpp
More file actions
59 lines (48 loc) · 1.59 KB
/
geom-area-assembler.cpp
File metadata and controls
59 lines (48 loc) · 1.59 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
/**
* 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.
*/
#include "geom-area-assembler.hpp"
#include <osmium/builder/osm_object_builder.hpp>
namespace geom {
osmium::area::AssemblerConfig const AREA_CONFIG;
area_assembler_t::area_assembler_t(osmium::memory::Buffer *buffer)
: osmium::area::detail::BasicAssembler(AREA_CONFIG), m_buffer(buffer)
{
}
bool area_assembler_t::make_area()
{
if (!create_rings()) {
return false;
}
m_buffer->clear();
{
osmium::builder::AreaBuilder builder{*m_buffer};
add_rings_to_area(builder);
}
m_buffer->commit();
return true;
}
bool area_assembler_t::operator()(osmium::Way const &way)
{
segment_list().extract_segments_from_way(nullptr, stats().duplicate_nodes,
way);
return make_area();
}
// Currently the relation is not needed for assembling the area, because
// the roles on the members are ignored. In the future we might want to use
// the roles, so we leave the function signature as it is.
bool area_assembler_t::operator()(osmium::Relation const & /*relation*/,
osmium::memory::Buffer const &ways_buffer)
{
for (auto const &way : ways_buffer.select<osmium::Way>()) {
segment_list().extract_segments_from_way(nullptr,
stats().duplicate_nodes, way);
}
return make_area();
}
} // namespace geom