本文整理汇总了C++中osmium::Node类的典型用法代码示例。如果您正苦于以下问题:C++ Node类的具体用法?C++ Node怎么用?C++ Node使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Node类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: 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);
}
}
示例3: node
void node( osmium::Node& node ) {
const char* value= node.tags().get_value_by_key("highway");
const char* name = node.tags().get_value_by_key("name");
if(name && value && !strcmp(value, "bus_stop")){
map[node.positive_id()] = name;
}
}
示例4: 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;
}
}
示例5: 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;
}
示例6: 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());
}
}
示例7: node
void node(const osmium::Node& node) {
const char* amenity = node.tags().get_value_by_key("amenity");
if (amenity && !strcmp(amenity, "pub")) {
const char* name = node.tags().get_value_by_key("name");
if (name) {
std::cout << name << std::endl;
}
}
}
示例8: node
void node(const osmium::Node& node) {
try {
add_location(m_old_index.get(node.id()));
} catch (...) {
}
try {
add_location(node.location());
} catch (...) {
}
}
示例9: 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);
}
}
}
示例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});
}
示例11: 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});
}
示例12: node
void node(osmium::Node& node) {
const char* type = node.tags()["highway"];
if(type)
if (!strcmp(type, "bus_stop")) {
const char* name = node.tags()["name"];
if (name) {
nodes[node.id()] = name;
}
}
}
示例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;
}
示例14: node
// - walk over all node-versions
// - walk over all bboxes
// - if the node-id is recorded in the bboxes node-tracker or in the extra-node-tracker
// - send the node to the bboxes writer
void node(const osmium::Node& node) {
if (debug) {
std::cerr << "softcut node " << node.positive_id() << " v" << node.version() << "\n";
}
for (const auto& extract : info->extracts) {
if (extract->node_tracker.get(node.positive_id()) ||
extract->extra_node_tracker.get(node.positive_id())) {
extract->write(node);
}
}
}
示例15: 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();
}