1 // Boost.Geometry (aka GGL, Generic Geometry Library)
4 // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
6 // Use, modification and distribution is subject to the Boost Software License,
7 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
10 #ifndef GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_POLYGON_HPP
11 #define GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_POLYGON_HPP
15 #include <boost/range.hpp>
18 #include <boost/geometry/core/mutable_range.hpp>
19 #include <boost/geometry/core/tag.hpp>
20 #include <boost/geometry/core/tags.hpp>
22 #include <test_geometries/all_custom_container.hpp>
23 #include <test_geometries/all_custom_ring.hpp>
27 class all_custom_polygon
30 typedef all_custom_ring<P> custom_ring_type;
31 typedef all_custom_container<custom_ring_type> custom_int_type;
33 custom_ring_type& custom_ext() { return m_ext; }
34 custom_int_type& custom_int() { return m_int; }
36 custom_ring_type const& custom_ext() const { return m_ext; }
37 custom_int_type const& custom_int() const { return m_int; }
40 custom_ring_type m_ext;
41 custom_int_type m_int;
46 namespace boost { namespace geometry
54 template <typename Point>
55 struct tag<all_custom_polygon<Point> >
57 typedef polygon_tag type;
60 template <typename Point>
61 struct ring_const_type<all_custom_polygon<Point> >
63 typedef typename all_custom_polygon<Point>::custom_ring_type const& type;
66 template <typename Point>
67 struct ring_mutable_type<all_custom_polygon<Point> >
69 typedef typename all_custom_polygon<Point>::custom_ring_type& type;
73 template <typename Point>
74 struct interior_const_type<all_custom_polygon<Point> >
76 typedef typename all_custom_polygon<Point>::custom_int_type const& type;
79 template <typename Point>
80 struct interior_mutable_type<all_custom_polygon<Point> >
82 typedef typename all_custom_polygon<Point>::custom_int_type& type;
87 template <typename Point>
88 struct exterior_ring<all_custom_polygon<Point> >
90 typedef all_custom_polygon<Point> polygon_type;
91 typedef typename polygon_type::custom_ring_type ring_type;
93 static inline ring_type& get(polygon_type& p)
95 return p.custom_ext();
98 static inline ring_type const& get(polygon_type const& p)
100 return p.custom_ext();
104 template <typename Point>
105 struct interior_rings<all_custom_polygon<Point> >
107 typedef all_custom_polygon<Point> polygon_type;
108 typedef typename polygon_type::custom_int_type int_type;
110 static inline int_type& get(polygon_type& p)
112 return p.custom_int();
115 static inline int_type const& get(polygon_type const& p)
117 return p.custom_int();
122 } // namespace traits
124 }} // namespace boost::geometry
130 #endif // GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_POLYGON_HPP