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


C++ Strategy::apply方法代码示例

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


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

示例1: apply

    static inline OutputIterator apply(Geometry const& geometry,
            OutputIterator out, Strategy const& strategy)
    {
        typename Strategy::state_type state;

        strategy.apply(geometry, state);
        strategy.result(state, out, Order == clockwise);
        return out;
    }
开发者ID:1050676515,项目名称:ZeusMud,代码行数:9,代码来源:convex_hull.hpp

示例2: apply

 static inline typename default_length_result<Segment>::type apply(
         Segment const& segment, Strategy const& strategy)
 {
     typedef typename point_type<Segment>::type point_type;
     point_type p1, p2;
     geometry::detail::assign_point_from_index<0>(segment, p1);
     geometry::detail::assign_point_from_index<1>(segment, p2);
     return strategy.apply(p1, p2);
 }
开发者ID:aashish24,项目名称:PDAL,代码行数:9,代码来源:length.hpp

示例3: apply

 static inline typename return_type<Strategy>::type apply(Point const& point,
             Segment const& segment, Strategy const& strategy)
 {
     
     typename point_type<Segment>::type p[2];
     geometry::detail::assign_point_from_index<0>(segment, p[0]);
     geometry::detail::assign_point_from_index<1>(segment, p[1]);
     return strategy.apply(point, p[0], p[1]);
 }
开发者ID:AngelBerihuete,项目名称:stan,代码行数:9,代码来源:distance.hpp

示例4: apply

 static inline void apply(Point const& point,
                          PointTransformer const& transformer,
                          Strategy const& strategy,
                          typename Strategy::state_type& state)
 {
     geofeatures_boost::ignore_unused(strategy);
     strategy.apply(static_cast<Point const&>(transformer.apply(point)),
                    state);
 }
开发者ID:Niko-r,项目名称:geofeatures,代码行数:9,代码来源:centroid.hpp

示例5: apply

    static inline void apply(Point const& point, Segment const& segment,
                    Strategy const& strategy, Result& result)
    {
       
        typename point_type<Segment>::type p[2];
        geometry::detail::assign_point_from_index<0>(segment, p[0]);
        geometry::detail::assign_point_from_index<1>(segment, p[1]);

        strategy.apply(point, p[0], p[1], result);
    }
开发者ID:AlexMioMio,项目名称:boost,代码行数:10,代码来源:distance_info.hpp

示例6: apply

    static inline bool apply(Geometry1 const& source, Geometry2& target,
                Strategy const& strategy)
    {
        typedef typename point_type<Geometry1>::type point_type1;
        typedef typename point_type<Geometry2>::type point_type2;

        point_type1 source_point[2];
        geometry::detail::assign_point_from_index<0>(source, source_point[0]);
        geometry::detail::assign_point_from_index<1>(source, source_point[1]);

        point_type2 target_point[2];
        if (strategy.apply(source_point[0], target_point[0])
            && strategy.apply(source_point[1], target_point[1]))
        {
            geometry::detail::assign_point_to_index<0>(target_point[0], target);
            geometry::detail::assign_point_to_index<1>(target_point[1], target);
            return true;
        }
        return false;
    }
开发者ID:Degot,项目名称:Las-Vegas-Reconstruction,代码行数:20,代码来源:transform.hpp

示例7: apply

 static inline typename strategy::distance::services::return_type
     <
         Strategy,
         typename point_type<Box1>::type,
         typename point_type<Box2>::type
     >::type
 apply(Box1 const& box1, Box2 const& box2, Strategy const& strategy)
 {
     boost::ignore_unused(strategy);
     return strategy.apply(box1, box2);
 }
开发者ID:ArthurHenriqueDellaFraga,项目名称:INE5426.Compiladores,代码行数:11,代码来源:box_to_box.hpp

示例8: apply

        static void apply(ApplyMethod)
        {
            // 1: inspect and define both arguments of apply
            typedef typename parameter_type_of
                <
                    ApplyMethod, 0
                >::type ptype1;

            typedef typename parameter_type_of
                <
                    ApplyMethod, 1
                >::type ptype2;

            // 2) must define meta-function return_type
            typedef typename strategy::distance::services::return_type
                <
                    Strategy, ptype1, ptype2
                >::type rtype;

            // 3) must define meta-function "comparable_type"
            typedef typename strategy::distance::services::comparable_type
                <
                    Strategy
                >::type ctype;

            // 4) must define meta-function "tag"
            typedef typename strategy::distance::services::tag
                <
                    Strategy
                >::type tag;

            // 5) must implement apply with arguments
            Strategy* str = 0;
            ptype1 *p1 = 0;
            ptype2 *p2 = 0;
            rtype r = str->apply(*p1, *p2);

            // 6) must define (meta)struct "get_comparable" with apply
            ctype c = strategy::distance::services::get_comparable
                <
                    Strategy
                >::apply(*str);

            // 7) must define (meta)struct "result_from_distance" with apply
            r = strategy::distance::services::result_from_distance
                <
                    Strategy,
                    ptype1, ptype2
                >::apply(*str, 1.0);

            boost::ignore_unused_variable_warning(str);
            boost::ignore_unused_variable_warning(c);
            boost::ignore_unused_variable_warning(r);
        }
开发者ID:7modelsan,项目名称:kbengine,代码行数:54,代码来源:distance_concept.hpp

示例9: apply

 static inline void apply(Range const& range, OutputIterator out,
                          Distance const& max_distance, Strategy const& strategy)
 {
     if (pdalboost::size(range) <= 2 || max_distance < 0)
     {
         std::copy(pdalboost::begin(range), pdalboost::end(range), out);
     }
     else
     {
         strategy.apply(range, out, max_distance);
     }
 }
开发者ID:PAV38,项目名称:PDAL,代码行数:12,代码来源:simplify.hpp

示例10: apply

    static inline OutputIterator apply(UniqueSubRange1 const& range_p,
                UniqueSubRange2 const& range_q,
                TurnInfo const& ,
                Strategy const& strategy,
                RobustPolicy const& robust_policy,
                OutputIterator out)
    {
        typedef typename TurnInfo::point_type turn_point_type;

        typedef policies::relate::segments_intersection_points
            <
                segment_intersection_points
                    <
                        turn_point_type,
                        typename geometry::segment_ratio_type
                            <
                                turn_point_type, RobustPolicy
                            >::type
                    >
            > policy_type;

        typedef model::referring_segment<Point1 const> segment_type1;
        typedef model::referring_segment<Point2 const> segment_type2;
        Point1 const& pi = range_p.at(0);
        Point1 const& pj = range_p.at(1);
        Point2 const& qi = range_q.at(0);
        Point2 const& qj = range_q.at(1);
        segment_type1 p1(pi, pj);
        segment_type2 q1(qi, qj);

        typedef typename geometry::robust_point_type
            <
                Point1, RobustPolicy
            >::type robust_point_type;

        robust_point_type pi_rob, pj_rob, qi_rob, qj_rob;
        geometry::recalculate(pi_rob, pi, robust_policy);
        geometry::recalculate(pj_rob, pj, robust_policy);
        geometry::recalculate(qi_rob, qi, robust_policy);
        geometry::recalculate(qj_rob, qj, robust_policy);
        typename policy_type::return_type result
            = strategy.apply(p1, q1, policy_type(), robust_policy,
                             pi_rob, pj_rob, qi_rob, qj_rob);

        for (std::size_t i = 0; i < result.count; i++)
        {
            TurnInfo tp;
            geometry::convert(result.intersections[i], tp.point);
            *out++ = tp;
        }

        return out;
    }
开发者ID:boostorg,项目名称:geometry,代码行数:53,代码来源:get_intersection_points.hpp

示例11: apply

        static void apply(ApplyMethod)
        {
            // 1) inspect and define both arguments of apply
            typedef typename parameter_type_of
                <
                    ApplyMethod, 0
                >::type ptype;

            typedef typename parameter_type_of
                <
                    ApplyMethod, 1
                >::type sptype;

            namespace services = strategy::distance::services;
            // 2) must define meta-function "tag"
            typedef typename services::tag<Strategy>::type tag;

            BOOST_MPL_ASSERT_MSG
                ((boost::is_same
                      <
                          tag, strategy_tag_distance_point_segment
                      >::value),
                 INCORRECT_STRATEGY_TAG,
                 (types<tag>));

            // 3) must define meta-function "return_type"
            typedef typename services::return_type
                <
                    Strategy, ptype, sptype
                >::type rtype;

            // 4) must define meta-function "comparable_type"
            typedef typename services::comparable_type<Strategy>::type ctype;

            // 5) must implement apply with arguments
            Strategy *str = 0;
            ptype *p = 0;
            sptype *sp1 = 0;
            sptype *sp2 = 0;

            rtype r = str->apply(*p, *sp1, *sp2);

            // 6) must define (meta-)struct "get_comparable" with apply
            ctype cstrategy = services::get_comparable<Strategy>::apply(*str);

            // 7) must define (meta-)struct "result_from_distance" with apply
            r = services::result_from_distance
                <
                    Strategy, ptype, sptype
                >::apply(*str, rtype(1.0));

            boost::ignore_unused(str, r, cstrategy);
        }
开发者ID:AbhinavJain13,项目名称:turicreate,代码行数:53,代码来源:distance_concept.hpp

示例12: rtree

    static inline
    typename distance_result
        <
            typename point_type<Range1>::type,
            typename point_type<Range2>::type,
            Strategy
        >::type
    apply(Range1 const& r1, Range2 const& r2, Strategy const& strategy)
    {

        typedef typename distance_result
            <
                typename point_type<Range1>::type,
                typename point_type<Range2>::type,
                Strategy
            >::type result_type;

        typedef typename boost::range_size<Range1>::type size_type;

        boost::geometry::detail::throw_on_empty_input(r1);
        boost::geometry::detail::throw_on_empty_input(r2);

        size_type const n = boost::size(r1);
        result_type dis_max = 0;

#ifdef BOOST_GEOMETRY_ENABLE_SIMILARITY_RTREE
        namespace bgi = boost::geometry::index;
        typedef typename point_type<Range1>::type point_t;
        typedef bgi::rtree<point_t, bgi::linear<4> > rtree_type;
        rtree_type rtree(boost::begin(r2), boost::end(r2));
        point_t res;
#endif

        for (size_type i = 0 ; i < n ; i++)
        {
#ifdef BOOST_GEOMETRY_ENABLE_SIMILARITY_RTREE
            size_type found = rtree.query(bgi::nearest(range::at(r1, i), 1), &res);
            result_type dis_min = strategy.apply(range::at(r1,i), res);
#else
            result_type dis_min = point_range::apply(range::at(r1, i), r2, strategy);
#endif
            if (dis_min > dis_max )
            {
                dis_max = dis_min;
            }
        }
        return dis_max;
    }
开发者ID:boostorg,项目名称:geometry,代码行数:48,代码来源:discrete_hausdorff_distance.hpp

示例13: point_in_range

inline bool point_in_range(Strategy& strategy, State& state,
        Point const& point, Iterator begin, Iterator end)
{
    boost::ignore_unused(strategy);

    Iterator it = begin;
    for (Iterator previous = it++; it != end; ++previous, ++it)
    {
        if (! strategy.apply(point, *previous, *it, state))
        {
            // We're probably on the boundary
            return false;
        }
    }
    return true;
}
开发者ID:ArthurHenriqueDellaFraga,项目名称:INE5426.Compiladores,代码行数:16,代码来源:turn_in_original_visitor.hpp

示例14: apply

        static void apply()
        {
            Strategy *str = 0;
            state_type *st = 0;

            // 4) must implement a static method apply,
            // getting two segment-points
            spoint_type const* sp = 0;
            str->apply(*sp, *sp, *st);

            // 5) must implement a static method result
            //  getting the centroid
            point_type *c = 0;
            bool r = str->result(*st, *c);

            boost::ignore_unused_variable_warning(str);
            boost::ignore_unused_variable_warning(r);
        }
开发者ID:AbhinavJain13,项目名称:turicreate,代码行数:18,代码来源:centroid_concept.hpp

示例15: view

    static inline void apply(Ring const& ring,
            Strategy const& strategy, typename Strategy::state_type& state)
    {
        typedef typename closeable_view<Ring const, Closure>::type view_type;

        typedef typename boost::range_iterator<view_type const>::type iterator_type;

        view_type view(ring);
        iterator_type it = boost::begin(view);
        iterator_type end = boost::end(view);

        for (iterator_type previous = it++;
            it != end;
            ++previous, ++it)
        {
            strategy.apply(*previous, *it, state);
        }
    }
开发者ID:13609594236,项目名称:ph-open,代码行数:18,代码来源:centroid.hpp


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