1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
7 // This file was modified by Oracle on 2014.
8 // Modifications copyright (c) 2014 Oracle and/or its affiliates.
10 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
12 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
13 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
15 // Use, modification and distribution is subject to the Boost Software License,
16 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
17 // http://www.boost.org/LICENSE_1_0.txt)
19 #ifndef BOOST_GEOMETRY_CORE_POINT_ORDER_HPP
20 #define BOOST_GEOMETRY_CORE_POINT_ORDER_HPP
23 #include <boost/mpl/assert.hpp>
24 #include <boost/range/value_type.hpp>
26 #include <boost/geometry/core/ring_type.hpp>
27 #include <boost/geometry/core/tag.hpp>
28 #include <boost/geometry/core/tags.hpp>
29 #include <boost/geometry/util/bare_type.hpp>
31 namespace boost { namespace geometry
35 \brief Enumerates options for the order of points within polygons
37 \details The enumeration order_selector describes options for the order of
38 points within a polygon. Polygons can be ordered either clockwise or
39 counterclockwise. The specific order of a polygon type is defined by the
40 point_order metafunction. The point_order metafunction defines a value,
41 which is one of the values enumerated in the order_selector
45 [link geometry.reference.core.point_order The point_order metafunction]
50 /// Points are ordered clockwise
52 /// Points are ordered counter clockwise
54 /// Points might be stored in any order, algorithms will determine it on the
55 /// fly (not yet supported)
56 order_undetermined = 0
63 \brief Traits class indicating the order of contained points within a
64 ring or (multi)polygon, clockwise, counter clockwise or not known.
68 template <typename Ring>
71 static const order_selector value = clockwise;
78 #ifndef DOXYGEN_NO_DETAIL
79 namespace detail { namespace point_order
84 static const order_selector value = geometry::clockwise;
88 }} // namespace detail::point_order
89 #endif // DOXYGEN_NO_DETAIL
93 #ifndef DOXYGEN_NO_DISPATCH
94 namespace core_dispatch
97 template <typename Tag, typename Geometry>
102 false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
107 template <typename Point>
108 struct point_order<point_tag, Point>
109 : public detail::point_order::clockwise {};
111 template <typename Segment>
112 struct point_order<segment_tag, Segment>
113 : public detail::point_order::clockwise {};
116 template <typename Box>
117 struct point_order<box_tag, Box>
118 : public detail::point_order::clockwise {};
120 template <typename LineString>
121 struct point_order<linestring_tag, LineString>
122 : public detail::point_order::clockwise {};
125 template <typename Ring>
126 struct point_order<ring_tag, Ring>
128 static const order_selector value
129 = geometry::traits::point_order<Ring>::value;
132 // Specialization for polygon: the order is the order of its rings
133 template <typename Polygon>
134 struct point_order<polygon_tag, Polygon>
136 static const order_selector value = core_dispatch::point_order
139 typename ring_type<polygon_tag, Polygon>::type
143 template <typename MultiPoint>
144 struct point_order<multi_point_tag, MultiPoint>
145 : public detail::point_order::clockwise {};
147 template <typename MultiLinestring>
148 struct point_order<multi_linestring_tag, MultiLinestring>
149 : public detail::point_order::clockwise {};
152 // Specialization for multi_polygon: the order is the order of its polygons
153 template <typename MultiPolygon>
154 struct point_order<multi_polygon_tag, MultiPolygon>
156 static const order_selector value = core_dispatch::point_order
159 typename boost::range_value<MultiPolygon>::type
163 } // namespace core_dispatch
164 #endif // DOXYGEN_NO_DISPATCH
168 \brief \brief_meta{value, point order (clockwise\, counterclockwise),
170 \tparam Geometry \tparam_geometry
173 \qbk{[include reference/core/point_order.qbk]}
175 template <typename Geometry>
178 static const order_selector value = core_dispatch::point_order
180 typename tag<Geometry>::type,
181 typename util::bare_type<Geometry>::type
185 }} // namespace boost::geometry
187 #endif // BOOST_GEOMETRY_CORE_POINT_ORDER_HPP