multi_point_concept.hpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. // This file was modified by Oracle on 2020-2021.
  6. // Modifications copyright (c) 2020-2021 Oracle and/or its affiliates.
  7. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  8. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  9. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  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. #ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POINT_CONCEPT_HPP
  14. #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POINT_CONCEPT_HPP
  15. #include <boost/concept_check.hpp>
  16. #include <boost/range/concepts.hpp>
  17. #include <boost/range/value_type.hpp>
  18. #include <boost/geometry/core/mutable_range.hpp>
  19. #include <boost/geometry/geometries/concepts/concept_type.hpp>
  20. #include <boost/geometry/geometries/concepts/point_concept.hpp>
  21. namespace boost { namespace geometry { namespace concepts
  22. {
  23. template <typename Geometry>
  24. class MultiPoint
  25. {
  26. #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
  27. typedef typename boost::range_value<Geometry>::type point_type;
  28. BOOST_CONCEPT_ASSERT( (concepts::Point<point_type>) );
  29. BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
  30. public :
  31. BOOST_CONCEPT_USAGE(MultiPoint)
  32. {
  33. Geometry* mp = 0;
  34. traits::clear<Geometry>::apply(*mp);
  35. traits::resize<Geometry>::apply(*mp, 0);
  36. point_type* point = 0;
  37. traits::push_back<Geometry>::apply(*mp, *point);
  38. }
  39. #endif
  40. };
  41. /*!
  42. \brief concept for multi-point (const version)
  43. \ingroup const_concepts
  44. */
  45. template <typename Geometry>
  46. class ConstMultiPoint
  47. {
  48. #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
  49. typedef typename boost::range_value<Geometry>::type point_type;
  50. BOOST_CONCEPT_ASSERT( (concepts::ConstPoint<point_type>) );
  51. BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
  52. public :
  53. BOOST_CONCEPT_USAGE(ConstMultiPoint)
  54. {
  55. }
  56. #endif
  57. };
  58. template <typename Geometry>
  59. struct concept_type<Geometry, multi_point_tag>
  60. {
  61. using type = MultiPoint<Geometry>;
  62. };
  63. template <typename Geometry>
  64. struct concept_type<Geometry const, multi_point_tag>
  65. {
  66. using type = ConstMultiPoint<Geometry>;
  67. };
  68. }}} // namespace boost::geometry::concepts
  69. #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POINT_CONCEPT_HPP