当前位置: 首页>>代码示例>>C++>>正文


C++ Node::location方法代码示例

本文整理汇总了C++中osmium::Node::location方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::location方法的具体用法?C++ Node::location怎么用?C++ Node::location使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在osmium::Node的用法示例。


在下文中一共展示了Node::location方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: node

                void node(const osmium::Node& node) {
                    if (m_write_change_ops) {
                        open_close_op_tag(node.visible() ? (node.version() == 1 ? operation::op_create : operation::op_modify) : operation::op_delete);
                    }

                    write_prefix();
                    m_out += "<node";

                    write_meta(node);

                    if (node.location()) {
                        m_out += " lat=\"";
                        osmium::util::double2string(std::back_inserter(m_out), node.location().lat_without_check(), 7);
                        m_out += "\" lon=\"";
                        osmium::util::double2string(std::back_inserter(m_out), node.location().lon_without_check(), 7);
                        m_out += "\"";
                    }

                    if (node.tags().empty()) {
                        m_out += "/>\n";
                        return;
                    }

                    m_out += ">\n";

                    write_tags(node.tags());

                    write_prefix();
                    m_out += "</node>\n";
                }
开发者ID:Gozhack,项目名称:osrm-backend,代码行数:30,代码来源:xml_output_format.hpp

示例2: node

void parse_osmium_t::node(osmium::Node& node)
{
    if (node.deleted()) {
        m_data->node_delete(node.id());
    } else {
        // if the node is not valid, then node.location.lat/lon() can throw.
        // we probably ought to treat invalid locations as if they were
        // deleted and ignore them.
        if (!node.location().valid()) {
          fprintf(stderr, "WARNING: Node %" PRIdOSMID " (version %ud) has an invalid "
                  "location and has been ignored. This is not expected to happen with "
                  "recent planet files, so please check that your input is correct.\n",
                  node.id(), node.version());

          return;
        }

        if (!m_bbox || m_bbox->contains(node.location())) {
            if (m_append) {
                m_data->node_modify(node);
            } else {
                m_data->node_add(node);
            }
            m_stats.add_node(node.id());
        }
    }
}
开发者ID:tomhughes,项目名称:osm2pgsql,代码行数:27,代码来源:parse-osmium.cpp

示例3: node

 void node(osmium::Node &n) {
     // no nodes in the history file have a zero location, and
     // no visible nodes should have an undefined location.
     if ((n.location() == zero) ||
         (n.visible() && !n.location())) {
         ++count;
     }
     ++total_count;
 }
开发者ID:knowname,项目名称:libosmium,代码行数:9,代码来源:test_reader.cpp

示例4: ProcessNode

/**
 * Takes the node position from osmium and the filtered properties from the lua
 * profile and saves them to external memory.
 *
 * warning: caller needs to take care of synchronization!
 */
void ExtractorCallbacks::ProcessNode(const osmium::Node &input_node,
                                     const ExtractionNode &result_node)
{
    external_memory.all_nodes_list.push_back(
        {util::toFixed(util::FloatLongitude{input_node.location().lon()}),
         util::toFixed(util::FloatLatitude{input_node.location().lat()}),
         OSMNodeID{static_cast<std::uint64_t>(input_node.id())},
         result_node.barrier,
         result_node.traffic_lights});
}
开发者ID:Anjmao,项目名称:osrm-backend,代码行数:16,代码来源:extractor_callbacks.cpp

示例5: node

 void node(osmium::Node& node) {
     if (node.id() == 101000) {
         assert(node.version() == 1);
         assert(node.location().lon() == 1.12);
         assert(node.location().lat() == 1.02);
     } else if (node.id() == 101001) {
         assert(node.version() == 1);
         assert(node.location().lon() == 1.12);
         assert(node.location().lat() == 1.03);
     } else if (node.id() == 101002) {
     } else if (node.id() == 101003) {
     } else {
         throw std::runtime_error("Unknown ID");
     }
 }
开发者ID:natsumiirimura,项目名称:libosmium,代码行数:15,代码来源:test-101.hpp

示例6: check_node_2

void check_node_2(osmium::Node& node) {
    BOOST_CHECK_EQUAL(2, node.id());
    BOOST_CHECK_EQUAL(3, node.version());
    BOOST_CHECK_EQUAL(true, node.visible());
    BOOST_CHECK_EQUAL(333, node.changeset());
    BOOST_CHECK_EQUAL(21, node.uid());
    BOOST_CHECK_EQUAL(123, node.timestamp());
    BOOST_CHECK_EQUAL(osmium::Location(3.5, 4.7), node.location());
    BOOST_CHECK_EQUAL("testuser", node.user());

    for (osmium::memory::Item& item : node) {
        BOOST_CHECK_EQUAL(osmium::item_type::tag_list, item.type());
    }

    BOOST_CHECK(!node.tags().empty());
    BOOST_CHECK_EQUAL(2, std::distance(node.tags().begin(), node.tags().end()));

    int n = 0;
    for (osmium::Tag& tag : node.tags()) {
        switch (n) {
            case 0:
                BOOST_CHECK_EQUAL("amenity", tag.key());
                BOOST_CHECK_EQUAL("bank", tag.value());
                break;
            case 1:
                BOOST_CHECK_EQUAL("name", tag.key());
                BOOST_CHECK_EQUAL("OSM Savings", tag.value());
                break;
        }
        ++n;
    }
    BOOST_CHECK_EQUAL(2, n);
}
开发者ID:jokoala,项目名称:libosmium,代码行数:33,代码来源:test_buffer_node.cpp

示例7: check_node_2

void check_node_2(osmium::Node& node) {
    REQUIRE(2 == node.id());
    REQUIRE(3 == node.version());
    REQUIRE(true == node.visible());
    REQUIRE(333 == node.changeset());
    REQUIRE(21 == node.uid());
    REQUIRE(123 == node.timestamp());
    REQUIRE(osmium::Location(3.5, 4.7) == node.location());
    REQUIRE(std::string("testuser") == node.user());

    for (osmium::memory::Item& item : node) {
        REQUIRE(osmium::item_type::tag_list == item.type());
    }

    REQUIRE(!node.tags().empty());
    REQUIRE(2 == std::distance(node.tags().begin(), node.tags().end()));

    int n = 0;
    for (const osmium::Tag& tag : node.tags()) {
        switch (n) {
            case 0:
                REQUIRE(std::string("amenity") == tag.key());
                REQUIRE(std::string("bank") == tag.value());
                break;
            case 1:
                REQUIRE(std::string("name") == tag.key());
                REQUIRE(std::string("OSM Savings") == tag.value());
                break;
        }
        ++n;
    }
    REQUIRE(2 == n);
}
开发者ID:thomersch,项目名称:libosmium,代码行数:33,代码来源:test_buffer_node.cpp

示例8: create_point

 point_type create_point(const osmium::Node& node) {
     try {
         return create_point(node.location());
     } catch (osmium::geometry_error& e) {
         e.set_id("node", node.id());
         throw;
     }
 }
开发者ID:hydrays,项目名称:osrm-backend,代码行数:8,代码来源:factory.hpp

示例9: node

 void node(const osmium::Node& node) {
     // Getting a tag value can be expensive, because a list of tags has
     // to be gone through and each tag has to be checked. So we store the
     // result and reuse it.
     const char* amenity = node.tags()["amenity"];
     if (amenity) {
         print_amenity(amenity, node.tags()["name"], node.location());
     }
 }
开发者ID:daniel-j-h,项目名称:libosmium,代码行数:9,代码来源:osmium_amenity_list.cpp

示例10: ProcessNode

/** warning: caller needs to take care of synchronization! */
void ExtractorCallbacks::ProcessNode(const osmium::Node &input_node,
                                     const ExtractionNode &result_node)
{
    external_memory.all_nodes_list.push_back(
        {static_cast<int>(input_node.location().lat() * COORDINATE_PRECISION),
         static_cast<int>(input_node.location().lon() * COORDINATE_PRECISION),
         static_cast<NodeID>(input_node.id()),
         result_node.barrier,
         result_node.traffic_lights});
}
开发者ID:DINKIN,项目名称:omim,代码行数:11,代码来源:extractor_callbacks.cpp

示例11: node

 void node(const osmium::Node& node) {
     try {
         add_location(m_old_index.get(node.id()));
     } catch (...) {
     }
     try {
         add_location(node.location());
     } catch (...) {
     }
 }
开发者ID:mapbox,项目名称:minjur,代码行数:10,代码来源:minjur-generate-tilelist.cpp

示例12: node

 void node(const osmium::Node& node) {
     int x = in_range(0, static_cast<int>((180 + node.location().lon()) * m_factor), m_xsize - 1);
     int y = in_range(0, static_cast<int>(( 90 - node.location().lat()) * m_factor), m_ysize - 1);
     int n = y * m_xsize + x;
     if (m_node_count[n] < std::numeric_limits<node_count_type>::max() - 1) {
         ++m_node_count[n];
     }
     if (m_node_count[n] > m_max_count) {
         m_max_count = m_node_count[n];
     }
 }
开发者ID:rnorris,项目名称:osmium-contrib,代码行数:11,代码来源:node_density.cpp

示例13: node_add

int output_pgsql_t::node_add(osmium::Node const &node)
{
    taglist_t outtags;
    if (m_tagtransform->filter_tags(node, nullptr, nullptr, outtags))
        return 1;

    auto wkb = m_builder.get_wkb_node(node.location());
    expire.from_wkb(wkb.c_str(), node.id());
    m_tables[t_point]->write_row(node.id(), outtags, wkb);

    return 0;
}
开发者ID:openstreetmap,项目名称:osm2pgsql,代码行数:12,代码来源:output-pgsql.cpp

示例14: print_location

            void print_location(const osmium::Node& node) {
                const osmium::Location& location = node.location();

                m_out << m_prefix
                      << "  lon="
                      << std::fixed
                      << std::setprecision(7)
                      << location.lon()
                      << "\n";
                m_out << m_prefix
                      << "  lat="
                      << std::fixed
                      << std::setprecision(7)
                      << location.lat()
                      << "\n";
            }
开发者ID:jokoala,项目名称:libosmium,代码行数:16,代码来源:dump.hpp

示例15: check_node_1

void check_node_1(osmium::Node& node) {
    REQUIRE(1 == node.id());
    REQUIRE(3 == node.version());
    REQUIRE(true == node.visible());
    REQUIRE(333 == node.changeset());
    REQUIRE(21 == node.uid());
    REQUIRE(123 == node.timestamp());
    REQUIRE(osmium::Location(3.5, 4.7) == node.location());
    REQUIRE(std::string("testuser") == node.user());

    for (osmium::memory::Item& item : node) {
        REQUIRE(osmium::item_type::tag_list == item.type());
    }

    REQUIRE(node.tags().begin() == node.tags().end());
    REQUIRE(node.tags().empty());
    REQUIRE(0 == std::distance(node.tags().begin(), node.tags().end()));
}
开发者ID:thomersch,项目名称:libosmium,代码行数:18,代码来源:test_buffer_node.cpp


注:本文中的osmium::Node::location方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。