PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/libs/geometry/test/test_geometries/all_custom_polygon.hpp

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