multi_polygon_concept.hpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
  4. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
  5. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  6. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  7. // Use, modification and distribution is subject to the Boost Software License,
  8. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. #ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POLYGON_CONCEPT_HPP
  11. #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POLYGON_CONCEPT_HPP
  12. #include <boost/concept_check.hpp>
  13. #include <boost/range/concepts.hpp>
  14. #include <boost/range/metafunctions.hpp>
  15. #include <boost/geometry/geometries/concepts/polygon_concept.hpp>
  16. namespace boost { namespace geometry { namespace concepts
  17. {
  18. /*!
  19. \brief multi-polygon concept
  20. \ingroup concepts
  21. \par Formal definition:
  22. The multi polygon concept is defined as following:
  23. - there must be a specialization of traits::tag defining multi_polygon_tag
  24. as type
  25. - it must behave like a Boost.Range
  26. - its range value must fulfil the Polygon concept
  27. */
  28. template <typename Geometry>
  29. class MultiPolygon
  30. {
  31. #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
  32. typedef typename boost::range_value<Geometry>::type polygon_type;
  33. BOOST_CONCEPT_ASSERT( (concepts::Polygon<polygon_type>) );
  34. BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
  35. public :
  36. BOOST_CONCEPT_USAGE(MultiPolygon)
  37. {
  38. Geometry* mp = 0;
  39. traits::clear<Geometry>::apply(*mp);
  40. traits::resize<Geometry>::apply(*mp, 0);
  41. polygon_type* poly = 0;
  42. traits::push_back<Geometry>::apply(*mp, *poly);
  43. }
  44. #endif
  45. };
  46. /*!
  47. \brief concept for multi-polygon (const version)
  48. \ingroup const_concepts
  49. */
  50. template <typename Geometry>
  51. class ConstMultiPolygon
  52. {
  53. #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
  54. typedef typename boost::range_value<Geometry>::type polygon_type;
  55. BOOST_CONCEPT_ASSERT( (concepts::ConstPolygon<polygon_type>) );
  56. BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
  57. public :
  58. BOOST_CONCEPT_USAGE(ConstMultiPolygon)
  59. {
  60. }
  61. #endif
  62. };
  63. }}} // namespace boost::geometry::concepts
  64. #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POLYGON_CONCEPT_HPP