annotate DEPENDENCIES/generic/include/boost/geometry/geometries/polygon.hpp @ 46:d572322e2efe

Fix to .cat file check (was susceptible to DOS line-endings) and subrepo update
author Chris Cannam
date Thu, 07 Aug 2014 14:39:38 +0100
parents 2665513ce2d3
children c530137014c0
rev   line source
Chris@16 1 // Boost.Geometry (aka GGL, Generic Geometry Library)
Chris@16 2
Chris@16 3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
Chris@16 4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
Chris@16 5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Chris@16 6
Chris@16 7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
Chris@16 8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
Chris@16 9
Chris@16 10 // Use, modification and distribution is subject to the Boost Software License,
Chris@16 11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 12 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 13
Chris@16 14 #ifndef BOOST_GEOMETRY_GEOMETRIES_POLYGON_HPP
Chris@16 15 #define BOOST_GEOMETRY_GEOMETRIES_POLYGON_HPP
Chris@16 16
Chris@16 17 #include <memory>
Chris@16 18 #include <vector>
Chris@16 19
Chris@16 20 #include <boost/concept/assert.hpp>
Chris@16 21
Chris@16 22 #include <boost/geometry/core/exterior_ring.hpp>
Chris@16 23 #include <boost/geometry/core/interior_rings.hpp>
Chris@16 24 #include <boost/geometry/core/point_type.hpp>
Chris@16 25 #include <boost/geometry/core/ring_type.hpp>
Chris@16 26 #include <boost/geometry/geometries/concepts/point_concept.hpp>
Chris@16 27 #include <boost/geometry/geometries/ring.hpp>
Chris@16 28
Chris@16 29 namespace boost { namespace geometry
Chris@16 30 {
Chris@16 31
Chris@16 32 namespace model
Chris@16 33 {
Chris@16 34
Chris@16 35 /*!
Chris@16 36 \brief The polygon contains an outer ring and zero or more inner rings.
Chris@16 37 \ingroup geometries
Chris@16 38 \tparam Point point type
Chris@16 39 \tparam ClockWise true for clockwise direction,
Chris@16 40 false for CounterClockWise direction
Chris@16 41 \tparam Closed true for closed polygons (last point == first point),
Chris@16 42 false open points
Chris@16 43 \tparam PointList container type for points,
Chris@16 44 for example std::vector, std::list, std::deque
Chris@16 45 \tparam RingList container type for inner rings,
Chris@16 46 for example std::vector, std::list, std::deque
Chris@16 47 \tparam PointAlloc container-allocator-type, for the points
Chris@16 48 \tparam RingAlloc container-allocator-type, for the rings
Chris@16 49 \note The container collecting the points in the rings can be different
Chris@16 50 from the container collecting the inner rings. They all default to vector.
Chris@16 51
Chris@16 52 \qbk{before.synopsis,
Chris@16 53 [heading Model of]
Chris@16 54 [link geometry.reference.concepts.concept_polygon Polygon Concept]
Chris@16 55 }
Chris@16 56
Chris@16 57
Chris@16 58 */
Chris@16 59 template
Chris@16 60 <
Chris@16 61 typename Point,
Chris@16 62 bool ClockWise = true,
Chris@16 63 bool Closed = true,
Chris@16 64 template<typename, typename> class PointList = std::vector,
Chris@16 65 template<typename, typename> class RingList = std::vector,
Chris@16 66 template<typename> class PointAlloc = std::allocator,
Chris@16 67 template<typename> class RingAlloc = std::allocator
Chris@16 68 >
Chris@16 69 class polygon
Chris@16 70 {
Chris@16 71 BOOST_CONCEPT_ASSERT( (concept::Point<Point>) );
Chris@16 72
Chris@16 73 public:
Chris@16 74
Chris@16 75 // Member types
Chris@16 76 typedef Point point_type;
Chris@16 77 typedef ring<Point, ClockWise, Closed, PointList, PointAlloc> ring_type;
Chris@16 78 typedef RingList<ring_type , RingAlloc<ring_type > > inner_container_type;
Chris@16 79
Chris@16 80 inline ring_type const& outer() const { return m_outer; }
Chris@16 81 inline inner_container_type const& inners() const { return m_inners; }
Chris@16 82
Chris@16 83 inline ring_type& outer() { return m_outer; }
Chris@16 84 inline inner_container_type & inners() { return m_inners; }
Chris@16 85
Chris@16 86 /// Utility method, clears outer and inner rings
Chris@16 87 inline void clear()
Chris@16 88 {
Chris@16 89 m_outer.clear();
Chris@16 90 m_inners.clear();
Chris@16 91 }
Chris@16 92
Chris@16 93 private:
Chris@16 94
Chris@16 95 ring_type m_outer;
Chris@16 96 inner_container_type m_inners;
Chris@16 97 };
Chris@16 98
Chris@16 99
Chris@16 100 } // namespace model
Chris@16 101
Chris@16 102
Chris@16 103 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
Chris@16 104 namespace traits
Chris@16 105 {
Chris@16 106
Chris@16 107 template
Chris@16 108 <
Chris@16 109 typename Point,
Chris@16 110 bool ClockWise, bool Closed,
Chris@16 111 template<typename, typename> class PointList,
Chris@16 112 template<typename, typename> class RingList,
Chris@16 113 template<typename> class PointAlloc,
Chris@16 114 template<typename> class RingAlloc
Chris@16 115 >
Chris@16 116 struct tag
Chris@16 117 <
Chris@16 118 model::polygon
Chris@16 119 <
Chris@16 120 Point, ClockWise, Closed,
Chris@16 121 PointList, RingList, PointAlloc, RingAlloc
Chris@16 122 >
Chris@16 123 >
Chris@16 124 {
Chris@16 125 typedef polygon_tag type;
Chris@16 126 };
Chris@16 127
Chris@16 128 template
Chris@16 129 <
Chris@16 130 typename Point,
Chris@16 131 bool ClockWise, bool Closed,
Chris@16 132 template<typename, typename> class PointList,
Chris@16 133 template<typename, typename> class RingList,
Chris@16 134 template<typename> class PointAlloc,
Chris@16 135 template<typename> class RingAlloc
Chris@16 136 >
Chris@16 137 struct ring_const_type
Chris@16 138 <
Chris@16 139 model::polygon
Chris@16 140 <
Chris@16 141 Point, ClockWise, Closed,
Chris@16 142 PointList, RingList, PointAlloc, RingAlloc
Chris@16 143 >
Chris@16 144 >
Chris@16 145 {
Chris@16 146 typedef typename model::polygon
Chris@16 147 <
Chris@16 148 Point, ClockWise, Closed,
Chris@16 149 PointList, RingList,
Chris@16 150 PointAlloc, RingAlloc
Chris@16 151 >::ring_type const& type;
Chris@16 152 };
Chris@16 153
Chris@16 154
Chris@16 155 template
Chris@16 156 <
Chris@16 157 typename Point,
Chris@16 158 bool ClockWise, bool Closed,
Chris@16 159 template<typename, typename> class PointList,
Chris@16 160 template<typename, typename> class RingList,
Chris@16 161 template<typename> class PointAlloc,
Chris@16 162 template<typename> class RingAlloc
Chris@16 163 >
Chris@16 164 struct ring_mutable_type
Chris@16 165 <
Chris@16 166 model::polygon
Chris@16 167 <
Chris@16 168 Point, ClockWise, Closed,
Chris@16 169 PointList, RingList, PointAlloc, RingAlloc
Chris@16 170 >
Chris@16 171 >
Chris@16 172 {
Chris@16 173 typedef typename model::polygon
Chris@16 174 <
Chris@16 175 Point, ClockWise, Closed,
Chris@16 176 PointList, RingList,
Chris@16 177 PointAlloc, RingAlloc
Chris@16 178 >::ring_type& type;
Chris@16 179 };
Chris@16 180
Chris@16 181 template
Chris@16 182 <
Chris@16 183 typename Point,
Chris@16 184 bool ClockWise, bool Closed,
Chris@16 185 template<typename, typename> class PointList,
Chris@16 186 template<typename, typename> class RingList,
Chris@16 187 template<typename> class PointAlloc,
Chris@16 188 template<typename> class RingAlloc
Chris@16 189 >
Chris@16 190 struct interior_const_type
Chris@16 191 <
Chris@16 192 model::polygon
Chris@16 193 <
Chris@16 194 Point, ClockWise, Closed,
Chris@16 195 PointList, RingList,
Chris@16 196 PointAlloc, RingAlloc
Chris@16 197 >
Chris@16 198 >
Chris@16 199 {
Chris@16 200 typedef typename model::polygon
Chris@16 201 <
Chris@16 202 Point, ClockWise, Closed,
Chris@16 203 PointList, RingList,
Chris@16 204 PointAlloc, RingAlloc
Chris@16 205 >::inner_container_type const& type;
Chris@16 206 };
Chris@16 207
Chris@16 208
Chris@16 209 template
Chris@16 210 <
Chris@16 211 typename Point,
Chris@16 212 bool ClockWise, bool Closed,
Chris@16 213 template<typename, typename> class PointList,
Chris@16 214 template<typename, typename> class RingList,
Chris@16 215 template<typename> class PointAlloc,
Chris@16 216 template<typename> class RingAlloc
Chris@16 217 >
Chris@16 218 struct interior_mutable_type
Chris@16 219 <
Chris@16 220 model::polygon
Chris@16 221 <
Chris@16 222 Point, ClockWise, Closed,
Chris@16 223 PointList, RingList,
Chris@16 224 PointAlloc, RingAlloc
Chris@16 225 >
Chris@16 226 >
Chris@16 227 {
Chris@16 228 typedef typename model::polygon
Chris@16 229 <
Chris@16 230 Point, ClockWise, Closed,
Chris@16 231 PointList, RingList,
Chris@16 232 PointAlloc, RingAlloc
Chris@16 233 >::inner_container_type& type;
Chris@16 234 };
Chris@16 235
Chris@16 236
Chris@16 237 template
Chris@16 238 <
Chris@16 239 typename Point,
Chris@16 240 bool ClockWise, bool Closed,
Chris@16 241 template<typename, typename> class PointList,
Chris@16 242 template<typename, typename> class RingList,
Chris@16 243 template<typename> class PointAlloc,
Chris@16 244 template<typename> class RingAlloc
Chris@16 245 >
Chris@16 246 struct exterior_ring
Chris@16 247 <
Chris@16 248 model::polygon
Chris@16 249 <
Chris@16 250 Point, ClockWise, Closed,
Chris@16 251 PointList, RingList, PointAlloc, RingAlloc
Chris@16 252 >
Chris@16 253 >
Chris@16 254 {
Chris@16 255 typedef model::polygon
Chris@16 256 <
Chris@16 257 Point, ClockWise, Closed,
Chris@16 258 PointList, RingList,
Chris@16 259 PointAlloc, RingAlloc
Chris@16 260 > polygon_type;
Chris@16 261
Chris@16 262 static inline typename polygon_type::ring_type& get(polygon_type& p)
Chris@16 263 {
Chris@16 264 return p.outer();
Chris@16 265 }
Chris@16 266
Chris@16 267 static inline typename polygon_type::ring_type const& get(
Chris@16 268 polygon_type const& p)
Chris@16 269 {
Chris@16 270 return p.outer();
Chris@16 271 }
Chris@16 272 };
Chris@16 273
Chris@16 274 template
Chris@16 275 <
Chris@16 276 typename Point,
Chris@16 277 bool ClockWise, bool Closed,
Chris@16 278 template<typename, typename> class PointList,
Chris@16 279 template<typename, typename> class RingList,
Chris@16 280 template<typename> class PointAlloc,
Chris@16 281 template<typename> class RingAlloc
Chris@16 282 >
Chris@16 283 struct interior_rings
Chris@16 284 <
Chris@16 285 model::polygon
Chris@16 286 <
Chris@16 287 Point, ClockWise, Closed,
Chris@16 288 PointList, RingList,
Chris@16 289 PointAlloc, RingAlloc
Chris@16 290 >
Chris@16 291 >
Chris@16 292 {
Chris@16 293 typedef model::polygon
Chris@16 294 <
Chris@16 295 Point, ClockWise, Closed, PointList, RingList,
Chris@16 296 PointAlloc, RingAlloc
Chris@16 297 > polygon_type;
Chris@16 298
Chris@16 299 static inline typename polygon_type::inner_container_type& get(
Chris@16 300 polygon_type& p)
Chris@16 301 {
Chris@16 302 return p.inners();
Chris@16 303 }
Chris@16 304
Chris@16 305 static inline typename polygon_type::inner_container_type const& get(
Chris@16 306 polygon_type const& p)
Chris@16 307 {
Chris@16 308 return p.inners();
Chris@16 309 }
Chris@16 310 };
Chris@16 311
Chris@16 312 } // namespace traits
Chris@16 313 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
Chris@16 314
Chris@16 315
Chris@16 316
Chris@16 317 }} // namespace boost::geometry
Chris@16 318
Chris@16 319 #endif // BOOST_GEOMETRY_GEOMETRIES_POLYGON_HPP