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

C++ slist_type类代码示例

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

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



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

示例1: find_intersections

                /**
                 * Find intersection between segments.
                 *
                 * @param problem_reporter Any intersections found are reported to this object.
                 * @returns true if there are intersections.
                 */
                bool find_intersections(osmium::area::ProblemReporter* problem_reporter) const {
                    if (m_segments.empty()) {
                        return false;
                    }

                    bool found_intersections = false;

                    for (auto it1 = m_segments.begin(); it1 != m_segments.end()-1; ++it1) {
                        const NodeRefSegment& s1 = *it1;
                        for (auto it2 = it1+1; it2 != m_segments.end(); ++it2) {
                            const NodeRefSegment& s2 = *it2;

                            assert(s1 != s2); // erase_duplicate_segments() should have made sure of that

                            if (outside_x_range(s2, s1)) {
                                break;
                            }

                            if (y_range_overlap(s1, s2)) {
                                osmium::Location intersection = calculate_intersection(s1, s2);
                                if (intersection) {
                                    found_intersections = true;
                                    if (m_debug) {
                                        std::cerr << "  segments " << s1 << " and " << s2 << " intersecting at " << intersection << "\n";
                                    }
                                    if (problem_reporter) {
                                        problem_reporter->report_intersection(s1.way()->id(), s1.first().location(), s1.second().location(), s2.way()->id(), s2.first().location(), s2.second().location(), intersection);
                                    }
                                }
                            }
                        }
                    }

                    return found_intersections;
                }
开发者ID:AFDudley,项目名称:osm2pgsql,代码行数:41,代码来源:segment_list.hpp


示例2: erase_duplicate_segments

                /**
                 * Find duplicate segments (ie same start and end point) in the
                 * list and remove them. This will always remove pairs of the
                 * same segment. So if there are three, for instance, two will
                 * be removed and one will be left.
                 */
                uint32_t erase_duplicate_segments(osmium::area::ProblemReporter* problem_reporter) {
                    uint32_t duplicate_segments = 0;

                    while (true) {
                        auto it = std::adjacent_find(m_segments.begin(), m_segments.end());
                        if (it == m_segments.end()) {
                            break;
                        }
                        if (m_debug) {
                            std::cerr << "  erase duplicate segment: " << *it << "\n";
                        }

                        // Only count and report duplicate segments if they
                        // belong to the same way or if they don't both have
                        // the role "inner". Those cases are definitely wrong.
                        // If the duplicate segments belong to different
                        // "inner" ways, they could be touching inner rings
                        // which are perfectly okay. Note that for this check
                        // the role has to be correct in the member data.
                        if (it->way() == std::next(it)->way() || !it->role_inner() || !std::next(it)->role_inner()) {
                            ++duplicate_segments;
                            if (problem_reporter) {
                                problem_reporter->report_duplicate_segment(it->first(), it->second());
                            }
                        }
                        m_segments.erase(it, it+2);
                    }

                    return duplicate_segments;
                }
开发者ID:hydrays,项目名称:osrm-backend,代码行数:36,代码来源:segment_list.hpp


示例3: erase_duplicate_segments

 /**
  * Find duplicate segments (ie same start and end point) in the
  * list and remove them. This will always remove pairs of the same
  * segment. So if there are three, for instance, two will be
  * removed and one will be left.
  */
 void erase_duplicate_segments() {
     while (true) {
         auto it = std::adjacent_find(m_segments.begin(), m_segments.end());
         if (it == m_segments.end()) {
             return;
         }
         if (m_debug) {
             std::cerr << "  erase duplicate segment: " << *it << "\n";
         }
         m_segments.erase(it, it+2);
     }
 }
开发者ID:AFDudley,项目名称:osm2pgsql,代码行数:18,代码来源:segment_list.hpp


示例4: extract_segments_from_way_impl

                uint32_t extract_segments_from_way_impl(osmium::area::ProblemReporter* problem_reporter, uint64_t& duplicate_nodes, const osmium::Way& way, role_type role) {
                    uint32_t invalid_locations = 0;

                    osmium::NodeRef previous_nr;
                    for (const osmium::NodeRef& nr : way.nodes()) {
                        if (!nr.location().valid()) {
                            ++invalid_locations;
                            if (problem_reporter) {
                                problem_reporter->report_invalid_location(way.id(), nr.ref());
                            }
                            continue;
                        }
                        if (previous_nr.location()) {
                            if (previous_nr.location() != nr.location()) {
                                m_segments.emplace_back(previous_nr, nr, role, &way);
                            } else {
                                ++duplicate_nodes;
                                if (problem_reporter) {
                                    problem_reporter->report_duplicate_node(previous_nr.ref(), nr.ref(), nr.location());
                                }
                            }
                        }
                        previous_nr = nr;
                    }

                    return invalid_locations;
                }
开发者ID:alex85k,项目名称:osm2pgsql,代码行数:27,代码来源:segment_list.hpp


示例5: extract_segments_from_way

 /**
  * Extract segments from given way and add them to the list.
  *
  * Segments connecting two nodes with the same location (ie
  * same node or different nodes with same location) are
  * removed after reporting the duplicate node.
  */
 uint32_t extract_segments_from_way(osmium::area::ProblemReporter* problem_reporter, const osmium::Way& way) {
     if (way.nodes().empty()) {
         return 0;
     }
     m_segments.reserve(way.nodes().size() - 1);
     return extract_segments_from_way_impl(problem_reporter, way, role_type::outer);
 }
开发者ID:hydrays,项目名称:osrm-backend,代码行数:14,代码来源:segment_list.hpp


示例6: extract_segments_from_way

 /**
  * Extract segments from given way and add them to the list.
  *
  * Segments connecting two nodes with the same location (ie same
  * node or different node with same location) are removed.
  *
  * XXX should two nodes with same location be reported?
  */
 void extract_segments_from_way(const osmium::Way& way, const char* role) {
     osmium::NodeRef last_nr;
     for (const osmium::NodeRef& nr : way.nodes()) {
         if (last_nr.location() && last_nr.location() != nr.location()) {
             m_segments.emplace_back(last_nr, nr, role, &way);
         }
         last_nr = nr;
     }
 }
开发者ID:AFDudley,项目名称:osm2pgsql,代码行数:17,代码来源:segment_list.hpp


示例7: extract_segments_from_ways

                /**
                 * Extract all segments from all ways that make up this
                 * multipolygon relation and add them to the list.
                 */
                uint32_t extract_segments_from_ways(osmium::area::ProblemReporter* problem_reporter, const osmium::Relation& relation, const std::vector<const osmium::Way*>& members) {
                    assert(relation.members().size() >= members.size());

                    const size_t num_segments = get_num_segments(members);
                    if (problem_reporter) {
                        problem_reporter->set_nodes(num_segments);
                    }
                    m_segments.reserve(num_segments);

                    uint32_t duplicate_nodes = 0;
                    for_each_member(relation, members, [this, &problem_reporter, &duplicate_nodes](const osmium::RelationMember& member, const osmium::Way& way) {
                        duplicate_nodes += extract_segments_from_way_impl(problem_reporter, way, parse_role(member.role()));
                    });

                    return duplicate_nodes;
                }
开发者ID:hydrays,项目名称:osrm-backend,代码行数:20,代码来源:segment_list.hpp


示例8: extract_segments_from_ways

                /**
                 * Extract all segments from all ways that make up this
                 * multipolygon relation and add them to the list.
                 */
                uint32_t extract_segments_from_ways(osmium::area::ProblemReporter* problem_reporter, uint64_t& duplicate_nodes, const osmium::Relation& relation, const std::vector<const osmium::Way*>& members) {
                    assert(relation.members().size() >= members.size());

                    const size_t num_segments = get_num_segments(members);
                    if (problem_reporter) {
                        problem_reporter->set_nodes(num_segments);
                    }
                    m_segments.reserve(num_segments);

                    uint32_t invalid_locations = 0;
                    for_each_member(relation, members, [&](const osmium::RelationMember& member, const osmium::Way& way) {
                        const auto role = parse_role(member.role());
                        invalid_locations += extract_segments_from_way_impl(problem_reporter, duplicate_nodes, way, role);
                    });

                    return invalid_locations;
                }
开发者ID:alex85k,项目名称:osm2pgsql,代码行数:21,代码来源:segment_list.hpp


示例9: sort

 /// Sort the list of segments.
 void sort() {
     std::sort(m_segments.begin(), m_segments.end());
 }
开发者ID:hydrays,项目名称:osrm-backend,代码行数:4,代码来源:segment_list.hpp


示例10: end

 const_iterator end() const noexcept {
     return m_segments.end();
 }
开发者ID:hydrays,项目名称:osrm-backend,代码行数:3,代码来源:segment_list.hpp


示例11: begin

 const_iterator begin() const noexcept {
     return m_segments.begin();
 }
开发者ID:hydrays,项目名称:osrm-backend,代码行数:3,代码来源:segment_list.hpp


示例12: back

 NodeRefSegment& back() {
     return m_segments.back();
 }
开发者ID:hydrays,项目名称:osrm-backend,代码行数:3,代码来源:segment_list.hpp


示例13: empty

 /// Is the segment list empty?
 bool empty() const noexcept {
     return m_segments.empty();
 }
开发者ID:hydrays,项目名称:osrm-backend,代码行数:4,代码来源:segment_list.hpp


示例14: size

 /// The number of segments in the list.
 size_t size() const noexcept {
     return m_segments.size();
 }
开发者ID:hydrays,项目名称:osrm-backend,代码行数:4,代码来源:segment_list.hpp


示例15: size

 /// The number of segments in the list.
 size_t size() const {
     return m_segments.size();
 }
开发者ID:natsumiirimura,项目名称:libosmium,代码行数:4,代码来源:segment_list.hpp


示例16: empty

 bool empty() const {
     return m_segments.empty();
 }
开发者ID:natsumiirimura,项目名称:libosmium,代码行数:3,代码来源:segment_list.hpp


示例17: assert

 NodeRefSegment& operator[](size_t n) noexcept {
     assert(n < m_segments.size());
     return m_segments[n];
 }
开发者ID:hydrays,项目名称:osrm-backend,代码行数:4,代码来源:segment_list.hpp


示例18: front

 NodeRefSegment& front() {
     return m_segments.front();
 }
开发者ID:hydrays,项目名称:osrm-backend,代码行数:3,代码来源:segment_list.hpp


示例19: clear

 /// Clear the list of segments. All segments are removed.
 void clear() {
     m_segments.clear();
 }
开发者ID:AFDudley,项目名称:osm2pgsql,代码行数:4,代码来源:segment_list.hpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ slot_visitor类代码示例发布时间:2022-05-31
下一篇:
C++ slist_iterator类代码示例发布时间: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