• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ osmium::Node类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Node类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
        }
    }
开发者ID:7890,项目名称:osrm-backend,代码行数:28,代码来源:testdata-overview.cpp


示例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);
     }
 }
开发者ID:osmcode,项目名称:osm-gis-export,代码行数:7,代码来源:osm_gis_export_overview.cpp


示例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;
		}
		
	}
开发者ID:djjoe,项目名称:University-projects,代码行数:8,代码来源:malvin.cpp


示例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;
     }
 }
开发者ID:hydrays,项目名称:osrm-backend,代码行数:8,代码来源:factory.hpp


示例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;
 }
开发者ID:knowname,项目名称:libosmium,代码行数:9,代码来源:test_reader.cpp


示例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());
     }
 }
开发者ID:daniel-j-h,项目名称:libosmium,代码行数:9,代码来源:osmium_amenity_list.cpp


示例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;
         }
     }
 }
开发者ID:rnorris,项目名称:osmium-contrib,代码行数:9,代码来源:pub_names.cpp


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


示例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);
         }
     }
 }
开发者ID:NDrive,项目名称:osm-history-splitter,代码行数:14,代码来源:cut_administrative.hpp


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


示例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;
         }
     }
 }
开发者ID:harpbold,项目名称:prog2vedes4_fp_hpba,代码行数:10,代码来源:malvin_details.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: 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);
            }
        }
    }
开发者ID:joto,项目名称:osm-history-splitter,代码行数:16,代码来源:softcut.hpp


示例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();
        }
开发者ID:Pdegoffau,项目名称:libosmium,代码行数:13,代码来源:check_order.hpp


示例16: node

            /**
             * Store the location of the node in the storage.
             */
            void node(const osmium::Node& node) {
                if (node.positive_id() < m_last_id) {
                    m_must_sort = true;
                }
                m_last_id = node.positive_id();

                const auto 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:KnockSoftware,项目名称:osrm-backend,代码行数:16,代码来源:node_locations_for_ways.hpp


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


示例18: node

    void node(const osmium::Node& node) {
        const char* amenity = node.tags()["amenity"];
        if (amenity && !strcmp(amenity, "post_box")) {
            OGRFeature* feature = OGRFeature::CreateFeature(m_layer_point->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("operator", node.tags()["operator"]);

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

            OGRFeature::DestroyFeature(feature);
        }
    }
开发者ID:ipaddr,项目名称:omim,代码行数:17,代码来源:osmium_toogr2_exp.cpp


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


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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ osmium::OSMObject类代码示例发布时间:2022-05-31
下一篇:
C++ osmium::Location类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap