Exemplo n.º 1
0
inline boost::asynchronous::detail::callback_continuation<Fct,Job>
parallel_select_rings(Geometry1 geometry1, Geometry2 geometry2,
                      RingTurnInfoMap turn_info_per_ring,
                      long cutoff)
{
    typedef typename geometry::tag<Geometry1>::type tag1;
    typedef typename geometry::tag<Geometry2>::type tag2;
    std::shared_ptr<RingPropertyMap> map_with_all(std::make_shared<RingPropertyMap>());
    dispatch::select_rings<tag1, Geometry1>::apply(geometry1, geometry2,
                ring_identifier(0, -1, -1), *map_with_all);
    dispatch::select_rings<tag2, Geometry2>::apply(geometry2, geometry1,
                ring_identifier(1, -1, -1), *map_with_all);
    return update_selection_map<OverlayType,Fct,Job>(std::move(geometry1), std::move(geometry2), std::move(turn_info_per_ring),map_with_all,cutoff);
}
Exemplo n.º 2
0
inline void select_rings(Geometry1 const& geometry1, Geometry2 const& geometry2,
                         RingTurnInfoMap const& turn_info_per_ring,
                         RingPropertyMap& selected_ring_properties)
{
    typedef typename geometry::tag<Geometry1>::type tag1;
    typedef typename geometry::tag<Geometry2>::type tag2;

    RingPropertyMap all_ring_properties;
    dispatch::select_rings<tag1, Geometry1>::apply(geometry1, geometry2,
            ring_identifier(0, -1, -1), all_ring_properties);
    dispatch::select_rings<tag2, Geometry2>::apply(geometry2, geometry1,
            ring_identifier(1, -1, -1), all_ring_properties);

    update_ring_selection<OverlayType>(geometry1, geometry2, turn_info_per_ring,
                                       all_ring_properties, selected_ring_properties);
}
Exemplo n.º 3
0
inline void select_rings(Geometry1 const& geometry1, Geometry2 const& geometry2,
            RingTurnInfoMap const& turn_info_per_ring,
            RingPropertyMap& selected_ring_properties,
            Strategy const& strategy)
{
    typedef typename geometry::tag<Geometry1>::type tag1;
    typedef typename geometry::tag<Geometry2>::type tag2;
    typedef typename geometry::point_type<Geometry1>::type point1_type;
    typedef typename geometry::point_type<Geometry2>::type point2_type;

    RingPropertyMap all_ring_properties;
    dispatch::select_rings<tag1, Geometry1>::apply(geometry1, geometry2,
                ring_identifier(0, -1, -1), all_ring_properties,
                strategy.template get_area_strategy<point1_type>());
    dispatch::select_rings<tag2, Geometry2>::apply(geometry2, geometry1,
                ring_identifier(1, -1, -1), all_ring_properties,
                strategy.template get_area_strategy<point2_type>());

    update_ring_selection<OverlayType>(geometry1, geometry2, turn_info_per_ring,
                all_ring_properties, selected_ring_properties,
                strategy);
}
Exemplo n.º 4
0
inline boost::asynchronous::detail::callback_continuation<Fct,Job>
parallel_select_rings(Geometry& geometry,
             IntersectionMap intersection_map,
             bool midpoint, long cutoff)
{
    typedef typename geometry::tag<Geometry>::type tag;

    std::shared_ptr<SelectionMap> map_with_all(std::make_shared<SelectionMap>());
    dispatch::select_rings<tag, Geometry>::apply(geometry,
                ring_identifier(0, -1, -1), *map_with_all, midpoint);

    return update_selection_map<OverlayType,Fct,Job>(geometry, geometry, std::move(intersection_map),map_with_all,cutoff);
}
inline void aggregate_operations(Sbs const& sbs, std::vector<rank_with_rings>& aggregation,
                                 Turns const& turns,
                                 operation_type target_operation)
{
    typedef typename boost::range_value<Turns>::type turn_type;
    typedef typename turn_type::turn_operation_type turn_operation_type;

    aggregation.clear();
    for (std::size_t i = 0; i < sbs.m_ranked_points.size(); i++)
    {
        typename Sbs::rp const& ranked_point = sbs.m_ranked_points[i];

        turn_type const& turn = turns[ranked_point.turn_index];

        turn_operation_type const& op = turn.operations[ranked_point.operation_index];

        if (! ((target_operation == operation_union && ranked_point.rank == 0)
               || op.operation == target_operation
               || op.operation == operation_continue
               || (op.operation == operation_blocked && ranked_point.direction == dir_from)))
        {
            // Always take rank 0 (because self-turns are blocked)
            // Don't consider union/blocked (aggregate is only used for intersections)
            // Blocked is allowed for from
            continue;
        }

        if (aggregation.empty() || aggregation.back().rank != ranked_point.rank)
        {
            rank_with_rings current;
            current.rank = ranked_point.rank;
            aggregation.push_back(current);
        }

        ring_with_direction rwd;
        segment_identifier const& sid = ranked_point.seg_id;

        rwd.ring_id = ring_identifier(sid.source_index, sid.multi_index, sid.ring_index);
        rwd.direction = ranked_point.direction;
        rwd.turn_index = ranked_point.turn_index;
        rwd.operation_index = ranked_point.operation_index;
        rwd.operation = op.operation;
        rwd.region_id = op.enriched.region_id;
        rwd.isolated = op.enriched.isolated;

        aggregation.back().rings.insert(rwd);
    }
}