Mercurial > hg > vamp-build-and-test
diff DEPENDENCIES/generic/include/boost/geometry/algorithms/area.hpp @ 101:c530137014c0
Update Boost headers (1.58.0)
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:12:49 +0100 |
parents | 2665513ce2d3 |
children |
line wrap: on
line diff
--- a/DEPENDENCIES/generic/include/boost/geometry/algorithms/area.hpp Fri Sep 04 12:01:02 2015 +0100 +++ b/DEPENDENCIES/generic/include/boost/geometry/algorithms/area.hpp Mon Sep 07 11:12:49 2015 +0100 @@ -18,21 +18,25 @@ #include <boost/mpl/if.hpp> #include <boost/range/functions.hpp> #include <boost/range/metafunctions.hpp> + +#include <boost/variant/apply_visitor.hpp> #include <boost/variant/static_visitor.hpp> -#include <boost/variant/apply_visitor.hpp> #include <boost/variant/variant_fwd.hpp> #include <boost/geometry/core/closure.hpp> #include <boost/geometry/core/exterior_ring.hpp> #include <boost/geometry/core/interior_rings.hpp> #include <boost/geometry/core/point_order.hpp> +#include <boost/geometry/core/point_type.hpp> #include <boost/geometry/core/ring_type.hpp> +#include <boost/geometry/core/tags.hpp> #include <boost/geometry/geometries/concepts/check.hpp> #include <boost/geometry/algorithms/detail/calculate_null.hpp> #include <boost/geometry/algorithms/detail/calculate_sum.hpp> // #include <boost/geometry/algorithms/detail/throw_on_empty_input.hpp> +#include <boost/geometry/algorithms/detail/multi_sum.hpp> #include <boost/geometry/strategies/area.hpp> #include <boost/geometry/strategies/default_area_result.hpp> @@ -87,7 +91,7 @@ // 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)) + if (boost::size(ring) < core_detail::closure::minimum_ring_size<Closure>::value) { return typename Strategy::return_type(); @@ -176,19 +180,41 @@ }; +template <typename MultiGeometry> +struct area<MultiGeometry, multi_polygon_tag> : detail::multi_sum +{ + template <typename Strategy> + static inline typename Strategy::return_type + apply(MultiGeometry const& multi, Strategy const& strategy) + { + return multi_sum::apply + < + typename Strategy::return_type, + area<typename boost::range_value<MultiGeometry>::type> + >(multi, strategy); + } +}; + + +} // namespace dispatch +#endif // DOXYGEN_NO_DISPATCH + + +namespace resolve_variant { + template <typename Geometry> -struct devarianted_area +struct area { template <typename Strategy> static inline typename Strategy::return_type apply(Geometry const& geometry, Strategy const& strategy) { - return area<Geometry>::apply(geometry, strategy); + return dispatch::area<Geometry>::apply(geometry, strategy); } }; template <BOOST_VARIANT_ENUM_PARAMS(typename T)> -struct devarianted_area<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> > +struct area<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> > { template <typename Strategy> struct visitor: boost::static_visitor<typename Strategy::return_type> @@ -200,7 +226,7 @@ template <typename Geometry> typename Strategy::return_type operator()(Geometry const& geometry) const { - return devarianted_area<Geometry>::apply(geometry, m_strategy); + return area<Geometry>::apply(geometry, m_strategy); } }; @@ -213,10 +239,7 @@ } }; - -} // namespace dispatch -#endif // DOXYGEN_NO_DISPATCH - +} // namespace resolve_variant /*! @@ -245,6 +268,8 @@ { concept::check<Geometry const>(); + // TODO put this into a resolve_strategy stage + // (and take the return type from resolve_variant) typedef typename point_type<Geometry>::type point_type; typedef typename strategy::area::services::default_strategy < @@ -253,8 +278,8 @@ >::type strategy_type; // detail::throw_on_empty_input(geometry); - - return dispatch::devarianted_area<Geometry>::apply(geometry, strategy_type()); + + return resolve_variant::area<Geometry>::apply(geometry, strategy_type()); } /*! @@ -288,8 +313,8 @@ concept::check<Geometry const>(); // detail::throw_on_empty_input(geometry); - - return dispatch::devarianted_area<Geometry>::apply(geometry, strategy); + + return resolve_variant::area<Geometry>::apply(geometry, strategy); }