1 // Boost.Geometry (aka GGL, Generic Geometry Library) 2 3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. 4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. 5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. 6 7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library 8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. 9 10 // Use, modification and distribution is subject to the Boost Software License, 11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 12 // http://www.boost.org/LICENSE_1_0.txt) 13 14 #ifndef BOOST_GEOMETRY_STRATEGIES_CONCEPTS_CENTROID_CONCEPT_HPP 15 #define BOOST_GEOMETRY_STRATEGIES_CONCEPTS_CENTROID_CONCEPT_HPP 16 17 18 19 #include <boost/concept_check.hpp> 20 #include <boost/core/ignore_unused.hpp> 21 22 namespace boost { namespace geometry { namespace concepts 23 { 24 25 26 /*! 27 \brief Checks strategy for centroid 28 \ingroup centroid 29 */ 30 template <typename Strategy> 31 class CentroidStrategy 32 { 33 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS 34 35 // 1) must define state_type, 36 typedef typename Strategy::state_type state_type; 37 38 // 2) must define point_type, 39 typedef typename Strategy::point_type point_type; 40 41 // 3) must define point_type, of polygon (segments) 42 typedef typename Strategy::segment_point_type spoint_type; 43 44 struct check_methods 45 { applyboost::geometry::concepts::CentroidStrategy::check_methods46 static void apply() 47 { 48 Strategy *str = 0; 49 state_type *st = 0; 50 51 // 4) must implement a static method apply, 52 // getting two segment-points 53 spoint_type const* sp = 0; 54 str->apply(*sp, *sp, *st); 55 56 // 5) must implement a static method result 57 // getting the centroid 58 point_type *c = 0; 59 bool r = str->result(*st, *c); 60 61 boost::ignore_unused(str, r); 62 } 63 }; 64 65 public : BOOST_CONCEPT_USAGE(CentroidStrategy)66 BOOST_CONCEPT_USAGE(CentroidStrategy) 67 { 68 check_methods::apply(); 69 } 70 #endif 71 }; 72 73 74 }}} // namespace boost::geometry::concepts 75 76 77 #endif // BOOST_GEOMETRY_STRATEGIES_CONCEPTS_CENTROID_CONCEPT_HPP 78