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


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

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


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

示例1: relation

    // - walk over all relations-versions
    //   - walk over all relations-nodes
    //     - Adds the nodes and ways that aren't in node-tracker to a vector
    //     - if node or way is in the box hit becames true
    //   - if hit is true and the vector is not empty (it means their are nodes or ways that belong to a relation that has at least one node or way inside the box)
    //     - Records the id of node or way to outside_node_tracker or outside_way_tracker
    void relation(const osmium::Relation& relation) {
	
    	bool hit = false;

        if (debug) {
            std::cerr << "cut_administrative relation " << relation.id() << " v" << relation.version() << "\n";
        }
    	
        std::vector<const osmium::RelationMember*> members;
        std::vector<const osmium::TagList*> tags;

        for (auto& tag : relation.tags()) {
            if (strcmp(tag.key(), "boundary") == 0 && strcmp(tag.value(), "administrative") == 0)
                hit = true;
        }

    	for (const auto& extract : info->extracts) {
            if (hit){
                if(!extract->relation_tracker.get(relation.id())){
                    extract->relation_tracker.set(relation.id());
                }
                //Add only the nodes and ways that were not yet in the respective trackers if hit is true
                for (const auto& member : relation.members()) {
                    if (member.type() == osmium::item_type::way && !extract->way_tracker.get(member.ref())){
                            extract->way_tracker.set(member.ref());
                    } 
                }
            }
        }
    }
开发者ID:NDrive,项目名称:osm-history-splitter,代码行数:36,代码来源:cut_administrative.hpp

示例2: relation

 void relation(const osmium::Relation& relation) {
     if (m_max_relation_id == relation.id()) {
         throw out_of_order_error{"Relation ID twice in input. Maybe you are using a history or change file?", relation.id()};
     }
     if (id_order{}(relation.id(), m_max_relation_id)) {
         throw out_of_order_error{"Relation IDs out of order.", relation.id()};
     }
     m_max_relation_id = relation.id();
 }
开发者ID:openstreetmap,项目名称:osm2pgsql,代码行数:9,代码来源:check_order.hpp

示例3: relation

    // - walk over all relation-versions
    //   - walk over all bboxes
    //     - if the relation-id is recorded in the bboxes relation-tracker
    //       - send the relation to the bboxes writer
    void relation(const osmium::Relation& relation) {
        if (debug) {
            std::cerr << "softcut relation " << relation.id() << " v" << relation.version() << "\n";
        }

        for (const auto& extract : info->extracts) {
            if (extract->relation_tracker.get(relation.id())) {
                extract->write(relation);
            }
        }
    }
开发者ID:NDrive,项目名称:osm-history-splitter,代码行数:15,代码来源:softcut.hpp

示例4: relation

void parse_osmium_t::relation(osmium::Relation& rel)
{
    if (rel.deleted()) {
        m_data->relation_delete(rel.id());
    } else {
        if (m_append) {
            m_data->relation_modify(rel);
        } else {
            m_data->relation_add(rel);
        }
    }
    m_stats.add_rel(rel.id());
}
开发者ID:tomhughes,项目名称:osm2pgsql,代码行数:13,代码来源:parse-osmium.cpp

示例5: relation

    void relation(const osmium::Relation& relation) {
        m_check_order.relation(relation);

        if (m_relation_count == 0) {
            m_progress_bar.remove();
            m_vout << "Reading relations...\n";
        }
        ++m_relation_count;

        if (m_check_relations) {
            set(osmium::item_type::relation, relation.id());
            for (const auto& member : relation.members()) {
                switch (member.type()) {
                    case osmium::item_type::node:
                        if (!get(osmium::item_type::node, member.ref())) {
                            ++m_missing_nodes_in_relations;
                            set(osmium::item_type::node, member.ref());
                            if (m_show_ids) {
                                std::cout << "n" << member.ref() << " in r" << relation.id() << "\n";
                            }
                        }
                        break;
                    case osmium::item_type::way:
                        if (!get(osmium::item_type::way, member.ref())) {
                            ++m_missing_ways_in_relations;
                            set(osmium::item_type::way, member.ref());
                            if (m_show_ids) {
                                std::cout << "w" << member.ref() << " in r" << relation.id() << "\n";
                            }
                        }
                        break;
                    case osmium::item_type::relation:
                        if (member.ref() > relation.id() || !get(osmium::item_type::relation, member.ref())) {
                            m_relation_refs.emplace_back(member.ref(), relation.id());
                        }
                        break;
                    default:
                        break;
                }
            }
        }
    }
开发者ID:tomhughes,项目名称:osmium-tool,代码行数:42,代码来源:command_check_refs.cpp

示例6: relation_modify

int output_pgsql_t::relation_modify(osmium::Relation const &rel)
{
    if( !m_options.slim )
    {
        fprintf( stderr, "Cannot apply diffs unless in slim mode\n" );
        util::exit_nicely();
    }
    relation_delete(rel.id());
    relation_add(rel);
    return 0;
}
开发者ID:openstreetmap,项目名称:osm2pgsql,代码行数:11,代码来源:output-pgsql.cpp

示例7: relation

 void relation(const osmium::Relation& rel) {
     ++rels;
     if (!matches_user_filter(rel)) return;
     ++urels;
     if (rel.visible()==false) {
         m_relfile <<
             rel.id() << "\t" <<
             rel.version() << "\t" <<
             rel.changeset() << "\t" <<
             rel.timestamp().to_iso() << "\t" <<
             rel.uid() << std::endl;
     }
 }
开发者ID:dekstop,项目名称:osm-history-parser,代码行数:13,代码来源:user_deletion_history.cpp

示例8: operator

            /**
             * Assemble an area from the given relation and its members.
             * The resulting area is put into the out_buffer.
             *
             * @returns false if there was some kind of error building the
             *          area(s), true otherwise.
             */
            bool operator()(const osmium::Relation& relation, const std::vector<const osmium::Way*>& members, osmium::memory::Buffer& out_buffer) {
                if (!config().create_new_style_polygons) {
                    return true;
                }

                assert(relation.cmembers().size() >= members.size());

                if (config().problem_reporter) {
                    config().problem_reporter->set_object(osmium::item_type::relation, relation.id());
                }

                if (relation.members().empty()) {
                    ++stats().no_way_in_mp_relation;
                    return false;
                }

                ++stats().from_relations;
                stats().invalid_locations = segment_list().extract_segments_from_ways(config().problem_reporter,
                                                                                      stats().duplicate_nodes,
                                                                                      stats().duplicate_ways,
                                                                                      relation,
                                                                                      members);
                if (!config().ignore_invalid_locations && stats().invalid_locations > 0) {
                    return false;
                }
                stats().member_ways = members.size();

                if (stats().member_ways == 1) {
                    ++stats().single_way_in_mp_relation;
                }

                if (config().debug_level > 0) {
                    std::cerr << "\nAssembling relation " << relation.id() << " containing " << members.size() << " way members with " << segment_list().size() << " nodes\n";
                }

                // Now create the Area object and add the attributes and tags
                // from the relation.
                bool okay = create_area(out_buffer, relation, members);
                if (okay) {
                    out_buffer.commit();
                } else {
                    out_buffer.rollback();
                }

                return okay;
            }
开发者ID:Project-OSRM,项目名称:osrm-backend,代码行数:53,代码来源:assembler.hpp

示例9: relations_set

void middle_ram_t::relations_set(osmium::Relation const &rel)
{
    rels.set(rel.id(), new ramRel(rel, out_options->extra_attributes));
}
开发者ID:alex85k,项目名称:osm2pgsql,代码行数:4,代码来源:middle-ram.cpp

示例10: relation

 void relation(const osmium::Relation& relation) {
     if (m_max_relation_id >= relation.id()) {
         throw std::runtime_error("Relation IDs out of order.");
     }
     m_max_relation_id = relation.id();
 }
开发者ID:Pdegoffau,项目名称:libosmium,代码行数:6,代码来源:check_order.hpp

示例11: pgsql_process_relation

/* This is the workhorse of pgsql_add_relation, split out because it is used as the callback for iterate relations */
int output_pgsql_t::pgsql_process_relation(osmium::Relation const &rel)
{
    taglist_t prefiltered_tags;
    if (m_tagtransform->filter_tags(rel, nullptr, nullptr, prefiltered_tags)) {
        return 1;
    }

    idlist_t xid2;
    for (auto const &m : rel.members()) {
        /* Need to handle more than just ways... */
        if (m.type() == osmium::item_type::way) {
            xid2.push_back(m.ref());
        }
    }

    buffer.clear();
    rolelist_t xrole;
    auto num_ways = m_mid->rel_way_members_get(rel, &xrole, buffer);

    if (num_ways == 0)
        return 0;

  int roads = 0;
  int make_polygon = 0;
  int make_boundary = 0;
  taglist_t outtags;

  // If it's a route relation make_boundary and make_polygon will be false
  // otherwise one or the other will be true.
  if (m_tagtransform->filter_rel_member_tags(prefiltered_tags, buffer, xrole,
                                             &make_boundary, &make_polygon,
                                             &roads, outtags)) {
      return 0;
  }

  for (auto &w : buffer.select<osmium::Way>()) {
      m_mid->nodes_get_list(&(w.nodes()));
  }

  // linear features and boundaries
  // Needs to be done before the polygon treatment below because
  // for boundaries the way_area tag may be added.
  if (!make_polygon) {
      double const split_at = m_options.projection->target_latlon() ? 1 : 100 * 1000;
      auto wkbs = m_builder.get_wkb_multiline(buffer, split_at);
      for (auto const &wkb : wkbs) {
          expire.from_wkb(wkb.c_str(), -rel.id());
          m_tables[t_line]->write_row(-rel.id(), outtags, wkb);
          if (roads)
              m_tables[t_roads]->write_row(-rel.id(), outtags, wkb);
      }
  }

  // multipolygons and boundaries
  if (make_boundary || make_polygon) {
      auto wkbs = m_builder.get_wkb_multipolygon(rel, buffer);

      char tmp[32];
      for (auto const &wkb : wkbs) {
          expire.from_wkb(wkb.c_str(), -rel.id());
          if (m_enable_way_area) {
              auto const area =
                  m_options.reproject_area
                      ? ewkb::parser_t(wkb).get_area<reprojection>(
                            m_options.projection.get())
                      : ewkb::parser_t(wkb)
                            .get_area<osmium::geom::IdentityProjection>();
              snprintf(tmp, sizeof(tmp), "%g", area);
              outtags.push_override(tag_t("way_area", tmp));
          }
          m_tables[t_poly]->write_row(-rel.id(), outtags, wkb);
      }
  }

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

示例12: relation_add

 int relation_add(osmium::Relation const &r) override {
     assert(r.id() > 0);
     ++rel.added;
     return 0;
 }
开发者ID:openstreetmap,项目名称:osm2pgsql,代码行数:5,代码来源:test-parse-diff.cpp

示例13: relations

 void relations(const osmium::Relation& relation) {
     id_check(relation.id(), 900, 999);
     --m_num_relations;
 }
开发者ID:7890,项目名称:osrm-backend,代码行数:4,代码来源:check_basics_handler.hpp


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