Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:50:16

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
0004 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
0005 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
0006 // Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
0007 
0008 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0009 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0010 
0011 // Use, modification and distribution is subject to the Boost Software License,
0012 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0013 // http://www.boost.org/LICENSE_1_0.txt)
0014 
0015 #ifndef BOOST_GEOMETRY_GEOMETRIES_RING_HPP
0016 #define BOOST_GEOMETRY_GEOMETRIES_RING_HPP
0017 
0018 #include <memory>
0019 #include <vector>
0020 
0021 #include <boost/concept/assert.hpp>
0022 
0023 #include <boost/geometry/core/closure.hpp>
0024 #include <boost/geometry/core/point_order.hpp>
0025 #include <boost/geometry/core/tag.hpp>
0026 #include <boost/geometry/core/tags.hpp>
0027 
0028 #include <boost/geometry/geometries/concepts/point_concept.hpp>
0029 
0030 #include <boost/config.hpp>
0031 
0032 #include <initializer_list>
0033 
0034 namespace boost { namespace geometry
0035 {
0036 
0037 namespace model
0038 {
0039 /*!
0040 \brief A ring (aka linear ring) is a closed line which should not be selfintersecting
0041 \ingroup geometries
0042 \tparam Point point type
0043 \tparam ClockWise true for clockwise direction,
0044             false for CounterClockWise direction
0045 \tparam Closed true for closed polygons (last point == first point),
0046             false open points
0047 \tparam Container container type, for example std::vector, std::deque
0048 \tparam Allocator container-allocator-type
0049 
0050 \qbk{[include reference/geometries/ring.qbk]}
0051 \qbk{before.synopsis,
0052 [heading Model of]
0053 [link geometry.reference.concepts.concept_ring Ring Concept]
0054 }
0055 */
0056 template
0057 <
0058     typename Point,
0059     bool ClockWise = true, bool Closed = true,
0060     template<typename, typename> class Container = std::vector,
0061     template<typename> class Allocator = std::allocator
0062 >
0063 class ring : public Container<Point, Allocator<Point> >
0064 {
0065     BOOST_CONCEPT_ASSERT( (concepts::Point<Point>) );
0066 
0067     typedef Container<Point, Allocator<Point> > base_type;
0068 
0069 public :
0070     /// \constructor_default{ring}
0071     inline ring()
0072         : base_type()
0073     {}
0074 
0075     /// \constructor_begin_end{ring}
0076     template <typename Iterator>
0077     inline ring(Iterator begin, Iterator end)
0078         : base_type(begin, end)
0079     {}
0080 
0081     /// \constructor_initializer_list{ring}
0082     inline ring(std::initializer_list<Point> l)
0083         : base_type(l.begin(), l.end())
0084     {}
0085 
0086 // Commented out for now in order to support Boost.Assign
0087 // Without this assignment operator first the object should be created
0088 //   from initializer list, then it shoudl be moved.
0089 //// Without this workaround in MSVC the assignment operator is ambiguous
0090 //#ifndef BOOST_MSVC
0091 //    /// \assignment_initializer_list{ring}
0092 //    inline ring & operator=(std::initializer_list<Point> l)
0093 //    {
0094 //        base_type::assign(l.begin(), l.end());
0095 //        return *this;
0096 //    }
0097 //#endif
0098 
0099 };
0100 
0101 } // namespace model
0102 
0103 
0104 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
0105 namespace traits
0106 {
0107 
0108 template
0109 <
0110     typename Point,
0111     bool ClockWise, bool Closed,
0112     template<typename, typename> class Container,
0113     template<typename> class Allocator
0114 >
0115 struct tag<model::ring<Point, ClockWise, Closed, Container, Allocator> >
0116 {
0117     using type = ring_tag;
0118 };
0119 
0120 
0121 template
0122 <
0123     typename Point,
0124     bool Closed,
0125     template<typename, typename> class Container,
0126     template<typename> class Allocator
0127 >
0128 struct point_order<model::ring<Point, false, Closed, Container, Allocator> >
0129 {
0130     static const order_selector value = counterclockwise;
0131 };
0132 
0133 
0134 template
0135 <
0136     typename Point,
0137     bool Closed,
0138     template<typename, typename> class Container,
0139     template<typename> class Allocator
0140 >
0141 struct point_order<model::ring<Point, true, Closed, Container, Allocator> >
0142 {
0143     static const order_selector value = clockwise;
0144 };
0145 
0146 template
0147 <
0148     typename Point,
0149     bool PointOrder,
0150     template<typename, typename> class Container,
0151     template<typename> class Allocator
0152 >
0153 struct closure<model::ring<Point, PointOrder, true, Container, Allocator> >
0154 {
0155     static const closure_selector value = closed;
0156 };
0157 
0158 template
0159 <
0160     typename Point,
0161     bool PointOrder,
0162     template<typename, typename> class Container,
0163     template<typename> class Allocator
0164 >
0165 struct closure<model::ring<Point, PointOrder, false, Container, Allocator> >
0166 {
0167     static const closure_selector value = open;
0168 };
0169 
0170 
0171 } // namespace traits
0172 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
0173 
0174 
0175 }} // namespace boost::geometry
0176 
0177 #endif // BOOST_GEOMETRY_GEOMETRIES_RING_HPP