示例#1
0
void apply_with_area(osmium::io::Reader &r,
                     osmium::area::MultipolygonCollector<osmium::area::Assembler> &collector) {

    IDX index;
    osmium::handler::NodeLocationsForWays<IDX> location_handler(index);
    location_handler.ignore_errors();

    osmium::apply(r, location_handler, *this,
                  collector.handler([this](const osmium::memory::Buffer& area_buffer) {
                       osmium::apply(area_buffer, *this);
                  })
                 );
}
示例#2
0
    osmium::memory::Buffer read() {
        osmium::memory::Buffer buffer = m_reader.read();

        if (buffer) {
            if (m_with_areas) {
                std::vector<osmium::memory::Buffer> area_buffers;
                osmium::apply(buffer, m_location_handler, m_collector.handler([&area_buffers](osmium::memory::Buffer&& area_buffer) {
                    area_buffers.push_back(std::move(area_buffer));
                }));
                for (const osmium::memory::Buffer& b : area_buffers) {
                    buffer.add_buffer(b);
                    buffer.commit();
                }
            } else if (m_entities & (osmium::osm_entity_bits::node | osmium::osm_entity_bits::way)) {
                osmium::apply(buffer, m_location_handler);
            }
        }

        return buffer;
    }