Пример #1
0
 point_type create_point(const osmium::NodeRef& node_ref) {
     try {
         return create_point(node_ref.location());
     } catch (osmium::geometry_error& e) {
         e.set_id("node", node_ref.ref());
         throw;
     }
 }
Пример #2
0
 /***
  * Search given node in the error_map. Traced nodes are either flagged as
  * mouth or deleted from the map and inserted as normal node.
  */
 void check_node(const osmium::NodeRef& node) {
     osmium::object_id_type node_id = node.ref();
     auto error_node = ds.error_map.find(node_id);
     if (error_node != ds.error_map.end()) {
         ErrorSum *sum = error_node->second;
         delete_error_node(node_id, sum);
     }
 }
 void report_ring_not_closed(const osmium::NodeRef& nr, const osmium::Way* way = nullptr) override {
     header("ring not closed");
     *m_out << "node_id=" << nr.ref() << " location=" << nr.location();
     if (way) {
         *m_out << " on way " << way->id();
     }
     *m_out << "\n";
 }
Пример #4
0
 void write_field_ref(const osmium::NodeRef& node_ref) {
     write_field_int('n', node_ref.ref());
     *m_out += 'x';
     if (node_ref.location()) {
         node_ref.location().as_string(std::back_inserter(*m_out), 'y');
     } else {
         *m_out += 'y';
     }
 }
 void report_duplicate_segment(const osmium::NodeRef& nr1, const osmium::NodeRef& nr2) override {
     header("duplicate segment");
     *m_out << "node_id1=" << nr1.ref() << " location1=" << nr1.location()
            << " node_id2=" << nr2.ref() << " location2=" << nr2.location() << "\n";
 }
Пример #6
0
#include "catch.hpp"

#include <osmium/osm/node_ref.hpp>

TEST_CASE("NodeRef") {

SECTION("instantiation_with_default_parameters") {
    osmium::NodeRef node_ref;
    REQUIRE(node_ref.ref() == 0);
//    REQUIRE(!node_ref.has_location());
}

SECTION("instantiation_with_id") {
    osmium::NodeRef node_ref(7);
    REQUIRE(node_ref.ref() == 7);
}

SECTION("equality") {
    osmium::NodeRef node_ref1(7, { 1.2, 3.4 });
    osmium::NodeRef node_ref2(7, { 1.4, 3.1 });
    osmium::NodeRef node_ref3(9, { 1.2, 3.4 });
    REQUIRE(node_ref1 == node_ref2);
    REQUIRE(node_ref1 != node_ref3);
    REQUIRE(!osmium::location_equal()(node_ref1, node_ref2));
    REQUIRE(!osmium::location_equal()(node_ref2, node_ref3));
    REQUIRE(osmium::location_equal()(node_ref1, node_ref3));
}

SECTION("set_location") {
    osmium::NodeRef node_ref(7);
    REQUIRE(!node_ref.location().valid());