Chris@16: // Boost.Geometry (aka GGL, Generic Geometry Library) Chris@16: Chris@16: // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. Chris@16: // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. Chris@16: // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. Chris@101: // Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland. Chris@16: Chris@16: // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library Chris@16: // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. Chris@16: Chris@16: // Use, modification and distribution is subject to the Boost Software License, Chris@16: // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #ifndef BOOST_GEOMETRY_GEOMETRIES_RING_HPP Chris@16: #define BOOST_GEOMETRY_GEOMETRIES_RING_HPP Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@101: #ifdef BOOST_GEOMETRY_EXPERIMENTAL_ENABLE_INITIALIZER_LIST Chris@101: #include Chris@101: #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST Chris@101: #include Chris@101: #endif Chris@101: #endif Chris@16: Chris@16: namespace boost { namespace geometry Chris@16: { Chris@16: Chris@16: namespace model Chris@16: { Chris@16: /*! Chris@16: \brief A ring (aka linear ring) is a closed line which should not be selfintersecting Chris@16: \ingroup geometries Chris@16: \tparam Point point type Chris@16: \tparam ClockWise true for clockwise direction, Chris@16: false for CounterClockWise direction Chris@16: \tparam Closed true for closed polygons (last point == first point), Chris@16: false open points Chris@16: \tparam Container container type, for example std::vector, std::deque Chris@16: \tparam Allocator container-allocator-type Chris@16: Chris@16: \qbk{before.synopsis, Chris@16: [heading Model of] Chris@16: [link geometry.reference.concepts.concept_ring Ring Concept] Chris@16: } Chris@16: */ Chris@16: template Chris@16: < Chris@16: typename Point, Chris@16: bool ClockWise = true, bool Closed = true, Chris@16: template class Container = std::vector, Chris@16: template class Allocator = std::allocator Chris@16: > Chris@16: class ring : public Container > Chris@16: { Chris@16: BOOST_CONCEPT_ASSERT( (concept::Point) ); Chris@16: Chris@16: typedef Container > base_type; Chris@16: Chris@16: public : Chris@16: /// \constructor_default{ring} Chris@16: inline ring() Chris@16: : base_type() Chris@16: {} Chris@16: Chris@16: /// \constructor_begin_end{ring} Chris@16: template Chris@16: inline ring(Iterator begin, Iterator end) Chris@16: : base_type(begin, end) Chris@16: {} Chris@101: Chris@101: #ifdef BOOST_GEOMETRY_EXPERIMENTAL_ENABLE_INITIALIZER_LIST Chris@101: #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST Chris@101: Chris@101: /// \constructor_initializer_list{ring} Chris@101: inline ring(std::initializer_list l) Chris@101: : base_type(l.begin(), l.end()) Chris@101: {} Chris@101: Chris@101: // Commented out for now in order to support Boost.Assign Chris@101: // Without this assignment operator first the object should be created Chris@101: // from initializer list, then it shoudl be moved. Chris@101: //// Without this workaround in MSVC the assignment operator is ambiguous Chris@101: //#ifndef BOOST_MSVC Chris@101: // /// \assignment_initializer_list{ring} Chris@101: // inline ring & operator=(std::initializer_list l) Chris@101: // { Chris@101: // base_type::assign(l.begin(), l.end()); Chris@101: // return *this; Chris@101: // } Chris@101: //#endif Chris@101: Chris@101: #endif Chris@101: #endif Chris@16: }; Chris@16: Chris@16: } // namespace model Chris@16: Chris@16: Chris@16: #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS Chris@16: namespace traits Chris@16: { Chris@16: Chris@16: template Chris@16: < Chris@16: typename Point, Chris@16: bool ClockWise, bool Closed, Chris@16: template class Container, Chris@16: template class Allocator Chris@16: > Chris@16: struct tag > Chris@16: { Chris@16: typedef ring_tag type; Chris@16: }; Chris@16: Chris@16: Chris@16: template Chris@16: < Chris@16: typename Point, Chris@16: bool Closed, Chris@16: template class Container, Chris@16: template class Allocator Chris@16: > Chris@16: struct point_order > Chris@16: { Chris@16: static const order_selector value = counterclockwise; Chris@16: }; Chris@16: Chris@16: Chris@16: template Chris@16: < Chris@16: typename Point, Chris@16: bool Closed, Chris@16: template class Container, Chris@16: template class Allocator Chris@16: > Chris@16: struct point_order > Chris@16: { Chris@16: static const order_selector value = clockwise; Chris@16: }; Chris@16: Chris@16: template Chris@16: < Chris@16: typename Point, Chris@16: bool PointOrder, Chris@16: template class Container, Chris@16: template class Allocator Chris@16: > Chris@16: struct closure > Chris@16: { Chris@16: static const closure_selector value = closed; Chris@16: }; Chris@16: Chris@16: template Chris@16: < Chris@16: typename Point, Chris@16: bool PointOrder, Chris@16: template class Container, Chris@16: template class Allocator Chris@16: > Chris@16: struct closure > Chris@16: { Chris@16: static const closure_selector value = open; Chris@16: }; Chris@16: Chris@16: Chris@16: } // namespace traits Chris@16: #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS Chris@16: Chris@16: Chris@16: }} // namespace boost::geometry Chris@16: Chris@16: #endif // BOOST_GEOMETRY_GEOMETRIES_RING_HPP