1// Boost.Geometry (aka GGL, Generic Geometry Library)
2// Unit Test
3
4// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
5
6// This file was modified by Oracle on 2020.
7// Modifications copyright (c) 2020 Oracle and/or its affiliates.
8// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
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 GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_POLYGON_HPP
15#define GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_POLYGON_HPP
16
17#include <cstddef>
18
19#include <boost/geometry/core/mutable_range.hpp>
20#include <boost/geometry/core/tag.hpp>
21#include <boost/geometry/core/tags.hpp>
22
23#include <test_geometries/all_custom_container.hpp>
24#include <test_geometries/all_custom_ring.hpp>
25
26
27template <typename P>
28class all_custom_polygon
29{
30public :
31 typedef all_custom_ring<P> custom_ring_type;
32 typedef all_custom_container<custom_ring_type> custom_int_type;
33
34 custom_ring_type& custom_ext() { return m_ext; }
35 custom_int_type& custom_int() { return m_int; }
36
37 custom_ring_type const& custom_ext() const { return m_ext; }
38 custom_int_type const& custom_int() const { return m_int; }
39
40private :
41 custom_ring_type m_ext;
42 custom_int_type m_int;
43};
44
45
46
47namespace boost { namespace geometry
48{
49
50namespace traits
51{
52
53
54
55template <typename Point>
56struct tag<all_custom_polygon<Point> >
57{
58 typedef polygon_tag type;
59};
60
61template <typename Point>
62struct ring_const_type<all_custom_polygon<Point> >
63{
64 typedef typename all_custom_polygon<Point>::custom_ring_type const& type;
65};
66
67template <typename Point>
68struct ring_mutable_type<all_custom_polygon<Point> >
69{
70 typedef typename all_custom_polygon<Point>::custom_ring_type& type;
71};
72
73
74template <typename Point>
75struct interior_const_type<all_custom_polygon<Point> >
76{
77 typedef typename all_custom_polygon<Point>::custom_int_type const& type;
78};
79
80template <typename Point>
81struct interior_mutable_type<all_custom_polygon<Point> >
82{
83 typedef typename all_custom_polygon<Point>::custom_int_type& type;
84};
85
86
87
88template <typename Point>
89struct exterior_ring<all_custom_polygon<Point> >
90{
91 typedef all_custom_polygon<Point> polygon_type;
92 typedef typename polygon_type::custom_ring_type ring_type;
93
94 static inline ring_type& get(polygon_type& p)
95 {
96 return p.custom_ext();
97 }
98
99 static inline ring_type const& get(polygon_type const& p)
100 {
101 return p.custom_ext();
102 }
103};
104
105template <typename Point>
106struct interior_rings<all_custom_polygon<Point> >
107{
108 typedef all_custom_polygon<Point> polygon_type;
109 typedef typename polygon_type::custom_int_type int_type;
110
111 static inline int_type& get(polygon_type& p)
112 {
113 return p.custom_int();
114 }
115
116 static inline int_type const& get(polygon_type const& p)
117 {
118 return p.custom_int();
119 }
120};
121
122
123} // namespace traits
124
125}} // namespace boost::geometry
126
127
128
129
130
131#endif // GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_POLYGON_HPP
132

source code of boost/libs/geometry/test/test_geometries/all_custom_polygon.hpp