本文整理汇总了C++中Strategy::result方法的典型用法代码示例。如果您正苦于以下问题:C++ Strategy::result方法的具体用法?C++ Strategy::result怎么用?C++ Strategy::result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Strategy
的用法示例。
在下文中一共展示了Strategy::result方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: centroid_exception
static inline bool apply(Multi const& multi,
Point& centroid,
Strategy const& strategy)
{
#if ! defined(BOOST_GEOMETRY_CENTROID_NO_THROW)
// If there is nothing in any of the ranges, it is not possible
// to calculate the centroid
if (geometry::is_empty(multi))
{
throw centroid_exception();
}
#endif
// prepare translation transformer
translating_transformer<Multi> transformer(multi);
typename Strategy::state_type state;
for (typename boost::range_iterator<Multi const>::type
it = boost::begin(multi);
it != boost::end(multi);
++it)
{
Policy::apply(*it, transformer, strategy, state);
}
if ( strategy.result(state, centroid) )
{
// translate the result back
transformer.apply_reverse(centroid);
return true;
}
return false;
}
示例2: rev_view
static inline int apply(Point const& point, Ring const& ring,
Strategy const& strategy)
{
if (boost::size(ring)
< core_detail::closure::minimum_ring_size<Closure>::value)
{
return -1;
}
typedef typename reversible_view<Ring const, Direction>::type rev_view_type;
typedef typename closeable_view
<
rev_view_type const, Closure
>::type cl_view_type;
typedef typename boost::range_iterator<cl_view_type const>::type iterator_type;
rev_view_type rev_view(ring);
cl_view_type view(rev_view);
typename Strategy::state_type state;
iterator_type it = boost::begin(view);
iterator_type end = boost::end(view);
bool stop = false;
for (iterator_type previous = it++;
it != end && ! stop;
++previous, ++it)
{
if (! strategy.apply(point, *previous, *it, state))
{
stop = true;
}
}
return strategy.result(state);
}
示例3: 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;
}
示例4: apply
static inline void apply(Polygon const& poly, Point& centroid,
Strategy const& strategy)
{
if (range_ok(exterior_ring(poly), centroid))
{
typename Strategy::state_type state;
centroid_polygon_state::apply(poly, strategy, state);
strategy.result(state, centroid);
}
}
示例5: 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);
}
示例6: return_type
static inline typename Strategy::return_type
apply(Ring const& ring, Strategy const& strategy)
{
BOOST_CONCEPT_ASSERT( (geometry::concept::AreaStrategy<Strategy>) );
assert_dimension<Ring, 2>();
// Ignore warning (because using static method sometimes) on strategy
boost::ignore_unused_variable_warning(strategy);
// An open ring has at least three points,
// A closed ring has at least four points,
// if not, there is no (zero) area
if (int(boost::size(ring))
< core_detail::closure::minimum_ring_size<Closure>::value)
{
return typename Strategy::return_type();
}
typedef typename reversible_view<Ring const, Direction>::type rview_type;
typedef typename closeable_view
<
rview_type const, Closure
>::type view_type;
typedef typename boost::range_iterator<view_type const>::type iterator_type;
rview_type rview(ring);
view_type view(rview);
typename Strategy::state_type state;
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);
}
return strategy.result(state);
}
示例7: apply
static inline bool apply(Polygon const& poly, Point& centroid,
Strategy const& strategy)
{
if (range_ok(exterior_ring(poly), centroid))
{
// prepare translation transformer
translating_transformer<Polygon>
transformer(*boost::begin(exterior_ring(poly)));
typename Strategy::state_type state;
centroid_polygon_state::apply(poly, transformer, strategy, state);
if ( strategy.result(state, centroid) )
{
// translate the result back
transformer.apply_reverse(centroid);
return true;
}
}
return false;
}