1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // Use, modification and distribution is subject to the Boost Software License,
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_RING_PROPERTIES_HPP
10 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_RING_PROPERTIES_HPP
13 #include <boost/geometry/algorithms/area.hpp>
14 #include <boost/geometry/algorithms/within.hpp>
15 #include <boost/geometry/algorithms/detail/point_on_border.hpp>
18 namespace boost { namespace geometry
22 #ifndef DOXYGEN_NO_DETAIL
23 namespace detail { namespace overlay
26 template <typename Point>
27 struct ring_properties
29 typedef Point point_type;
30 typedef typename default_area_result<Point>::type area_type;
34 // Filled by "select_rings"
38 // Filled by "update_ring_selection"
41 // Filled/used by "assign_rings"
43 ring_identifier parent;
44 area_type parent_area;
45 std::vector<ring_identifier> children;
47 inline ring_properties()
55 template <typename RingOrBox>
56 inline ring_properties(RingOrBox const& ring_or_box)
61 this->area = geometry::area(ring_or_box);
62 // We should take a point somewhere in the middle of the ring,
63 // to avoid taking a point on a (self)tangency,
64 // in cases where multiple points come together
65 valid = geometry::point_on_border(this->point, ring_or_box, true);
68 inline area_type get_area() const
70 return reversed ? -area : area;
74 }} // namespace detail::overlay
75 #endif // DOXYGEN_NO_DETAIL
78 }} // namespace boost::geometry
81 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_RING_PROPERTIES_HPP