summaryrefslogtreecommitdiff
path: root/boost/geometry/multi/algorithms/centroid.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/geometry/multi/algorithms/centroid.hpp')
-rw-r--r--boost/geometry/multi/algorithms/centroid.hpp156
1 files changed, 0 insertions, 156 deletions
diff --git a/boost/geometry/multi/algorithms/centroid.hpp b/boost/geometry/multi/algorithms/centroid.hpp
index 855ed22fda..1c9902f2bf 100644
--- a/boost/geometry/multi/algorithms/centroid.hpp
+++ b/boost/geometry/multi/algorithms/centroid.hpp
@@ -15,163 +15,7 @@
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_CENTROID_HPP
-#include <boost/range.hpp>
-
#include <boost/geometry/algorithms/centroid.hpp>
-#include <boost/geometry/multi/core/point_type.hpp>
-#include <boost/geometry/multi/algorithms/num_points.hpp>
-
-
-namespace boost { namespace geometry
-{
-
-
-#ifndef DOXYGEN_NO_DETAIL
-namespace detail { namespace centroid
-{
-
-
-/*!
- \brief Building block of a multi-point, to be used as Policy in the
- more generec centroid_multi
-*/
-template
-<
- typename Point,
- typename Strategy
->
-struct centroid_multi_point_state
-{
- static inline void apply(Point const& point,
- Strategy const& strategy, typename Strategy::state_type& state)
- {
- strategy.apply(point, state);
- }
-};
-
-
-
-/*!
- \brief Generic implementation which calls a policy to calculate the
- centroid of the total of its single-geometries
- \details The Policy is, in general, the single-version, with state. So
- detail::centroid::centroid_polygon_state is used as a policy for this
- detail::centroid::centroid_multi
-
-*/
-template
-<
- typename Multi,
- typename Point,
- typename Strategy,
- typename Policy
->
-struct centroid_multi
-{
- static inline void 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::num_points(multi) == 0)
- {
- throw centroid_exception();
- }
-#endif
-
- 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, strategy, state);
- }
- Strategy::result(state, centroid);
- }
-};
-
-
-
-}} // namespace detail::centroid
-#endif // DOXYGEN_NO_DETAIL
-
-
-
-#ifndef DOXYGEN_NO_DISPATCH
-namespace dispatch
-{
-
-template
-<
- typename MultiLinestring,
- typename Point,
- typename Strategy
->
-struct centroid<multi_linestring_tag, MultiLinestring, Point, Strategy>
- : detail::centroid::centroid_multi
- <
- MultiLinestring,
- Point,
- Strategy,
- detail::centroid::centroid_range_state
- <
- typename boost::range_value<MultiLinestring>::type,
- closed,
- Strategy
- >
- >
-{};
-
-template
-<
- typename MultiPolygon,
- typename Point,
- typename Strategy
->
-struct centroid<multi_polygon_tag, MultiPolygon, Point, Strategy>
- : detail::centroid::centroid_multi
- <
- MultiPolygon,
- Point,
- Strategy,
- detail::centroid::centroid_polygon_state
- <
- typename boost::range_value<MultiPolygon>::type,
- Strategy
- >
- >
-{};
-
-
-template
-<
- typename MultiPoint,
- typename Point,
- typename Strategy
->
-struct centroid<multi_point_tag, MultiPoint, Point, Strategy>
- : detail::centroid::centroid_multi
- <
- MultiPoint,
- Point,
- Strategy,
- detail::centroid::centroid_multi_point_state
- <
- typename boost::range_value<MultiPoint>::type,
- Strategy
- >
- >
-{};
-
-
-} // namespace dispatch
-#endif
-
-
-}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_CENTROID_HPP