annotate DEPENDENCIES/generic/include/boost/geometry/algorithms/union.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
Chris@16 5 // Use, modification and distribution is subject to the Boost Software License,
Chris@16 6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 7 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 8
Chris@16 9 #ifndef BOOST_GEOMETRY_ALGORITHMS_UNION_HPP
Chris@16 10 #define BOOST_GEOMETRY_ALGORITHMS_UNION_HPP
Chris@16 11
Chris@16 12
Chris@16 13 #include <boost/range/metafunctions.hpp>
Chris@16 14
Chris@16 15 #include <boost/geometry/core/is_areal.hpp>
Chris@16 16 #include <boost/geometry/core/point_order.hpp>
Chris@16 17 #include <boost/geometry/core/reverse_dispatch.hpp>
Chris@16 18 #include <boost/geometry/geometries/concepts/check.hpp>
Chris@16 19 #include <boost/geometry/algorithms/not_implemented.hpp>
Chris@16 20 #include <boost/geometry/algorithms/detail/overlay/overlay.hpp>
Chris@16 21
Chris@16 22
Chris@16 23 namespace boost { namespace geometry
Chris@16 24 {
Chris@16 25
Chris@16 26 #ifndef DOXYGEN_NO_DISPATCH
Chris@16 27 namespace dispatch
Chris@16 28 {
Chris@16 29
Chris@16 30 template
Chris@16 31 <
Chris@16 32 typename Geometry1, typename Geometry2, typename GeometryOut,
Chris@16 33 typename TagIn1 = typename tag<Geometry1>::type,
Chris@16 34 typename TagIn2 = typename tag<Geometry2>::type,
Chris@16 35 typename TagOut = typename tag<GeometryOut>::type,
Chris@16 36 bool Areal1 = geometry::is_areal<Geometry1>::value,
Chris@16 37 bool Areal2 = geometry::is_areal<Geometry2>::value,
Chris@16 38 bool ArealOut = geometry::is_areal<GeometryOut>::value,
Chris@16 39 bool Reverse1 = detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
Chris@16 40 bool Reverse2 = detail::overlay::do_reverse<geometry::point_order<Geometry2>::value>::value,
Chris@16 41 bool ReverseOut = detail::overlay::do_reverse<geometry::point_order<GeometryOut>::value>::value,
Chris@16 42 bool Reverse = geometry::reverse_dispatch<Geometry1, Geometry2>::type::value
Chris@16 43 >
Chris@16 44 struct union_insert: not_implemented<TagIn1, TagIn2, TagOut>
Chris@16 45 {};
Chris@16 46
Chris@16 47
Chris@16 48 // If reversal is needed, perform it first
Chris@16 49
Chris@16 50 template
Chris@16 51 <
Chris@16 52 typename Geometry1, typename Geometry2, typename GeometryOut,
Chris@16 53 typename TagIn1, typename TagIn2, typename TagOut,
Chris@16 54 bool Reverse1, bool Reverse2, bool ReverseOut
Chris@16 55 >
Chris@16 56 struct union_insert
Chris@16 57 <
Chris@16 58 Geometry1, Geometry2, GeometryOut,
Chris@16 59 TagIn1, TagIn2, TagOut,
Chris@16 60 true, true, true,
Chris@16 61 Reverse1, Reverse2, ReverseOut,
Chris@16 62 true
Chris@16 63 >: union_insert<Geometry2, Geometry1, GeometryOut>
Chris@16 64 {
Chris@16 65 template <typename OutputIterator, typename Strategy>
Chris@16 66 static inline OutputIterator apply(Geometry1 const& g1,
Chris@16 67 Geometry2 const& g2, OutputIterator out,
Chris@16 68 Strategy const& strategy)
Chris@16 69 {
Chris@16 70 return union_insert
Chris@16 71 <
Chris@16 72 Geometry2, Geometry1, GeometryOut
Chris@16 73 >::apply(g2, g1, out, strategy);
Chris@16 74 }
Chris@16 75 };
Chris@16 76
Chris@16 77
Chris@16 78 template
Chris@16 79 <
Chris@16 80 typename Geometry1, typename Geometry2, typename GeometryOut,
Chris@16 81 typename TagIn1, typename TagIn2, typename TagOut,
Chris@16 82 bool Reverse1, bool Reverse2, bool ReverseOut
Chris@16 83 >
Chris@16 84 struct union_insert
Chris@16 85 <
Chris@16 86 Geometry1, Geometry2, GeometryOut,
Chris@16 87 TagIn1, TagIn2, TagOut,
Chris@16 88 true, true, true,
Chris@16 89 Reverse1, Reverse2, ReverseOut,
Chris@16 90 false
Chris@16 91 > : detail::overlay::overlay
Chris@16 92 <Geometry1, Geometry2, Reverse1, Reverse2, ReverseOut, GeometryOut, overlay_union>
Chris@16 93 {};
Chris@16 94
Chris@16 95
Chris@16 96 } // namespace dispatch
Chris@16 97 #endif // DOXYGEN_NO_DISPATCH
Chris@16 98
Chris@16 99 #ifndef DOXYGEN_NO_DETAIL
Chris@16 100 namespace detail { namespace union_
Chris@16 101 {
Chris@16 102
Chris@16 103 template
Chris@16 104 <
Chris@16 105 typename GeometryOut,
Chris@16 106 typename Geometry1, typename Geometry2,
Chris@16 107 typename OutputIterator,
Chris@16 108 typename Strategy
Chris@16 109 >
Chris@16 110 inline OutputIterator insert(Geometry1 const& geometry1,
Chris@16 111 Geometry2 const& geometry2,
Chris@16 112 OutputIterator out,
Chris@16 113 Strategy const& strategy)
Chris@16 114 {
Chris@16 115 return dispatch::union_insert
Chris@16 116 <
Chris@16 117 Geometry1, Geometry2, GeometryOut
Chris@16 118 >::apply(geometry1, geometry2, out, strategy);
Chris@16 119 }
Chris@16 120
Chris@16 121 /*!
Chris@16 122 \brief_calc2{union} \brief_strategy
Chris@16 123 \ingroup union
Chris@16 124 \details \details_calc2{union_insert, spatial set theoretic union}
Chris@16 125 \brief_strategy. details_insert{union}
Chris@16 126 \tparam GeometryOut output geometry type, must be specified
Chris@16 127 \tparam Geometry1 \tparam_geometry
Chris@16 128 \tparam Geometry2 \tparam_geometry
Chris@16 129 \tparam OutputIterator output iterator
Chris@16 130 \tparam Strategy \tparam_strategy_overlay
Chris@16 131 \param geometry1 \param_geometry
Chris@16 132 \param geometry2 \param_geometry
Chris@16 133 \param out \param_out{union}
Chris@16 134 \param strategy \param_strategy{union}
Chris@16 135 \return \return_out
Chris@16 136
Chris@16 137 \qbk{distinguish,with strategy}
Chris@16 138 */
Chris@16 139 template
Chris@16 140 <
Chris@16 141 typename GeometryOut,
Chris@16 142 typename Geometry1,
Chris@16 143 typename Geometry2,
Chris@16 144 typename OutputIterator,
Chris@16 145 typename Strategy
Chris@16 146 >
Chris@16 147 inline OutputIterator union_insert(Geometry1 const& geometry1,
Chris@16 148 Geometry2 const& geometry2,
Chris@16 149 OutputIterator out,
Chris@16 150 Strategy const& strategy)
Chris@16 151 {
Chris@16 152 concept::check<Geometry1 const>();
Chris@16 153 concept::check<Geometry2 const>();
Chris@16 154 concept::check<GeometryOut>();
Chris@16 155
Chris@16 156 return detail::union_::insert<GeometryOut>(geometry1, geometry2, out, strategy);
Chris@16 157 }
Chris@16 158
Chris@16 159 /*!
Chris@16 160 \brief_calc2{union}
Chris@16 161 \ingroup union
Chris@16 162 \details \details_calc2{union_insert, spatial set theoretic union}.
Chris@16 163 \details_insert{union}
Chris@16 164 \tparam GeometryOut output geometry type, must be specified
Chris@16 165 \tparam Geometry1 \tparam_geometry
Chris@16 166 \tparam Geometry2 \tparam_geometry
Chris@16 167 \tparam OutputIterator output iterator
Chris@16 168 \param geometry1 \param_geometry
Chris@16 169 \param geometry2 \param_geometry
Chris@16 170 \param out \param_out{union}
Chris@16 171 \return \return_out
Chris@16 172 */
Chris@16 173 template
Chris@16 174 <
Chris@16 175 typename GeometryOut,
Chris@16 176 typename Geometry1,
Chris@16 177 typename Geometry2,
Chris@16 178 typename OutputIterator
Chris@16 179 >
Chris@16 180 inline OutputIterator union_insert(Geometry1 const& geometry1,
Chris@16 181 Geometry2 const& geometry2,
Chris@16 182 OutputIterator out)
Chris@16 183 {
Chris@16 184 concept::check<Geometry1 const>();
Chris@16 185 concept::check<Geometry2 const>();
Chris@16 186 concept::check<GeometryOut>();
Chris@16 187
Chris@16 188 typedef strategy_intersection
Chris@16 189 <
Chris@16 190 typename cs_tag<GeometryOut>::type,
Chris@16 191 Geometry1,
Chris@16 192 Geometry2,
Chris@16 193 typename geometry::point_type<GeometryOut>::type
Chris@16 194 > strategy;
Chris@16 195
Chris@16 196 return union_insert<GeometryOut>(geometry1, geometry2, out, strategy());
Chris@16 197 }
Chris@16 198
Chris@16 199
Chris@16 200 }} // namespace detail::union_
Chris@16 201 #endif // DOXYGEN_NO_DETAIL
Chris@16 202
Chris@16 203
Chris@16 204
Chris@16 205
Chris@16 206 /*!
Chris@16 207 \brief Combines two geometries which each other
Chris@16 208 \ingroup union
Chris@16 209 \details \details_calc2{union, spatial set theoretic union}.
Chris@16 210 \tparam Geometry1 \tparam_geometry
Chris@16 211 \tparam Geometry2 \tparam_geometry
Chris@16 212 \tparam Collection output collection, either a multi-geometry,
Chris@16 213 or a std::vector<Geometry> / std::deque<Geometry> etc
Chris@16 214 \param geometry1 \param_geometry
Chris@16 215 \param geometry2 \param_geometry
Chris@16 216 \param output_collection the output collection
Chris@16 217 \note Called union_ because union is a reserved word.
Chris@16 218
Chris@16 219 \qbk{[include reference/algorithms/union.qbk]}
Chris@16 220 */
Chris@16 221 template
Chris@16 222 <
Chris@16 223 typename Geometry1,
Chris@16 224 typename Geometry2,
Chris@16 225 typename Collection
Chris@16 226 >
Chris@16 227 inline void union_(Geometry1 const& geometry1,
Chris@16 228 Geometry2 const& geometry2,
Chris@16 229 Collection& output_collection)
Chris@16 230 {
Chris@16 231 concept::check<Geometry1 const>();
Chris@16 232 concept::check<Geometry2 const>();
Chris@16 233
Chris@16 234 typedef typename boost::range_value<Collection>::type geometry_out;
Chris@16 235 concept::check<geometry_out>();
Chris@16 236
Chris@16 237 detail::union_::union_insert<geometry_out>(geometry1, geometry2,
Chris@16 238 std::back_inserter(output_collection));
Chris@16 239 }
Chris@16 240
Chris@16 241
Chris@16 242 }} // namespace boost::geometry
Chris@16 243
Chris@16 244
Chris@16 245 #endif // BOOST_GEOMETRY_ALGORITHMS_UNION_HPP