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


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

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


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

示例1: 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

示例2: node

    void node(const osmium::Node& node) {
        const char* label = node.tags().get_value_by_key("label");
        if (label) {
            OGRFeature* feature = OGRFeature::CreateFeature(m_layer_labels->GetLayerDefn());
            std::unique_ptr<OGRPoint> ogr_point = m_factory.create_point(node);
            feature->SetGeometry(ogr_point.get());
            feature->SetField("id", static_cast<double>(node.id()));
            feature->SetField("label", label);

            if (m_layer_labels->CreateFeature(feature) != OGRERR_NONE) {
                std::cerr << "Failed to create feature.\n";
                exit(1);
            }

            OGRFeature::DestroyFeature(feature);
        } else {
            OGRFeature* feature = OGRFeature::CreateFeature(m_layer_nodes->GetLayerDefn());
            std::unique_ptr<OGRPoint> ogr_point = m_factory.create_point(node);
            feature->SetGeometry(ogr_point.get());
            feature->SetField("id", static_cast<double>(node.id()));

            if (m_layer_nodes->CreateFeature(feature) != OGRERR_NONE) {
                std::cerr << "Failed to create feature.\n";
                exit(1);
            }
            OGRFeature::DestroyFeature(feature);
        }
    }
开发者ID:7890,项目名称:osrm-backend,代码行数:28,代码来源:testdata-overview.cpp

示例3: node

 // - walk over all node-versions
 //   - walk over all bboxes
 //     - if the node-id is recorded in the bboxes node-trackers
 //       - send the node to the bboxes writer
 void node(const osmium::Node& node) {
     if (debug) {
         std::cerr << "cut_administrative node " << node.id() << " v" << node.version() << "\n";
     }
     for (const auto& extract : info->extracts) {
         if (extract->node_tracker.get(node.id())){
             extract->write(node);
         }
     }
 }
开发者ID:NDrive,项目名称:osm-history-splitter,代码行数:14,代码来源:cut_administrative.hpp

示例4: node

        void node(const osmium::Node& node) {
            if (m_max_way_id > 0) {
                throw std::runtime_error("Found a node after a way.");
            }
            if (m_max_relation_id > 0) {
                throw std::runtime_error("Found a node after a relation.");
            }

            if (m_max_node_id >= node.id()) {
                throw std::runtime_error("Node IDs out of order.");
            }
            m_max_node_id = node.id();
        }
开发者ID:Pdegoffau,项目名称:libosmium,代码行数:13,代码来源:check_order.hpp

示例5: node

    // - walk over all node-versions
    //   - walk over all bboxes
    //     - if the current node-version is inside the bbox
    //       - record its id in the bboxes node-tracker
    void node(const osmium::Node& node) {
        if (debug) {
            std::cerr << "softcut node " << node.id() << " v" << node.version() << "\n";
        }

        for (const auto& extract : info->extracts) {
            if (extract->contains(node)) {
                if (debug) std::cerr << "node is in extract, recording in node_tracker\n";

                extract->node_tracker.set(node.id());
            }
        }
    }
开发者ID:NDrive,项目名称:osm-history-splitter,代码行数:17,代码来源:softcut.hpp

示例6: 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

示例7: 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

示例8: 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

示例9: node_modify

int osmdata_t::node_modify(osmium::Node const &node)
{
    slim_middle_t *slim = dynamic_cast<slim_middle_t *>(mid.get());

    slim->nodes_delete(node.id());
    slim->nodes_set(node);

    int status = 0;
    for (auto& out: outs) {
        status |= out->node_modify(node);
    }

    slim->node_changed(node.id());

    return status;
}
开发者ID:tomhughes,项目名称:osm2pgsql,代码行数:16,代码来源:osmdata.cpp

示例10: node

 void node(const osmium::Node& node) {
     if (m_cfg.add_untagged_nodes || !node.tags().empty()) {
         gdalcpp::Feature feature{m_layer_point, m_factory.create_point(node)};
         feature.set_field("id", double(node.id()));
         add_feature(feature, node);
     }
 }
开发者ID:osmcode,项目名称:osm-gis-export,代码行数:7,代码来源:osm_gis_export_overview.cpp

示例11: 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

示例12: node

 /**
  * Store the location of the node in the storage.
  */
 void node(const osmium::Node& node) {
     m_must_sort = true;
     const osmium::object_id_type id = node.id();
     if (id >= 0) {
         m_storage_pos.set(static_cast<osmium::unsigned_object_id_type>( id), node.location());
     } else {
         m_storage_neg.set(static_cast<osmium::unsigned_object_id_type>(-id), node.location());
     }
 }
开发者ID:Gozhack,项目名称:osrm-backend,代码行数:12,代码来源:node_locations_for_ways.hpp

示例13: 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

示例14: node_modify

/* Modify is slightly trickier. The basic idea is we simply delete the
 * object and create it with the new parameters. Then we need to mark the
 * objects that depend on this one */
int output_pgsql_t::node_modify(osmium::Node const &node)
{
    if (!m_options.slim) {
        fprintf(stderr, "Cannot apply diffs unless in slim mode\n");
        util::exit_nicely();
    }
    node_delete(node.id());
    node_add(node);
    return 0;
}
开发者ID:openstreetmap,项目名称:osm2pgsql,代码行数:13,代码来源:output-pgsql.cpp

示例15: 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


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