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";
 }
Beispiel #2
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;
     }
 }
Beispiel #3
0
 explicit NodeRefSegment(const osmium::NodeRef& nr1, const osmium::NodeRef& nr2, const char* role, const osmium::Way* way) :
     m_first(nr1),
     m_second(nr2),
     m_role(role),
     m_way(way) {
     if (nr2.location() < nr1.location()) {
         swap_locations();
     }
 }
 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';
     }
 }
 NodeRefSegment(const osmium::NodeRef& nr1, const osmium::NodeRef& nr2, role_type role, const osmium::Way* way) noexcept :
     m_first(nr1),
     m_second(nr2),
     m_way(way),
     m_role(role) {
     if (nr2.location() < nr1.location()) {
         using std::swap;
         swap(m_first, m_second);
     }
 }
 /***
  * 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);
     }
 }
Beispiel #7
0
 point_type create_point(const osmium::NodeRef& node_ref) {
     return create_point(node_ref.location());
 }
Beispiel #8
0
 constexpr explicit vec(const osmium::NodeRef& nr) noexcept :
     x(nr.x()),
     y(nr.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";
 }
Beispiel #10
0
int tav(osmium::NodeRef a,osmium::NodeRef b)
{
    return sqrt(std::pow(a.x()-b.x(),2)+std::pow(a.y()-b.y(),2));

}
Beispiel #11
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());