1 // Boost.Geometry (aka GGL, Generic Geometry Library) 2 3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. 4 5 // This file was modified by Oracle on 2017. 6 // Modifications copyright (c) 2017 Oracle and/or its affiliates. 7 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle 8 9 // Use, modification and distribution is subject to the Boost Software License, 10 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 11 // http://www.boost.org/LICENSE_1_0.txt) 12 13 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_RING_PROPERTIES_HPP 14 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_RING_PROPERTIES_HPP 15 16 17 #include <boost/geometry/algorithms/area.hpp> 18 #include <boost/geometry/algorithms/within.hpp> 19 #include <boost/geometry/algorithms/detail/point_on_border.hpp> 20 21 22 namespace boost { namespace geometry 23 { 24 25 26 #ifndef DOXYGEN_NO_DETAIL 27 namespace detail { namespace overlay 28 { 29 30 template <typename Point, typename AreaType> 31 struct ring_properties 32 { 33 typedef Point point_type; 34 typedef AreaType area_type; 35 36 bool valid; 37 38 // Filled by "select_rings" 39 Point point; 40 area_type area; 41 42 // Filled by "update_ring_selection" 43 bool reversed; 44 45 // Filled/used by "assign_rings" 46 bool discarded; 47 ring_identifier parent; 48 area_type parent_area; 49 std::vector<ring_identifier> children; 50 ring_propertiesboost::geometry::detail::overlay::ring_properties51 inline ring_properties() 52 : valid(false) 53 , area(area_type()) 54 , reversed(false) 55 , discarded(false) 56 , parent_area(-1) 57 {} 58 59 template <typename RingOrBox, typename AreaStrategy> ring_propertiesboost::geometry::detail::overlay::ring_properties60 inline ring_properties(RingOrBox const& ring_or_box, AreaStrategy const& strategy) 61 : reversed(false) 62 , discarded(false) 63 , parent_area(-1) 64 { 65 this->area = geometry::area(ring_or_box, strategy); 66 valid = geometry::point_on_border(this->point, ring_or_box); 67 } 68 get_areaboost::geometry::detail::overlay::ring_properties69 inline area_type get_area() const 70 { 71 return reversed ? -area : area; 72 } 73 }; 74 75 }} // namespace detail::overlay 76 #endif // DOXYGEN_NO_DETAIL 77 78 79 }} // namespace boost::geometry 80 81 82 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_RING_PROPERTIES_HPP 83