// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2014 Bruno Lalande, Paris, France. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK. // Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2013-2014. // Modifications copyright (c) 2013-2014, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_LINEAR_SEGMENT_OR_BOX_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_LINEAR_SEGMENT_OR_BOX_HPP #include #include #include #include #include #include #include #include namespace boost { namespace geometry { #ifndef DOXYGEN_NO_DETAIL namespace detail { namespace disjoint { template < typename Range, closure_selector Closure, typename SegmentOrBox > struct disjoint_range_segment_or_box { template static inline bool apply(Range const& range, SegmentOrBox const& segment_or_box, Strategy const& strategy) { typedef typename closeable_view::type view_type; typedef typename ::boost::range_value::type point_type; typedef typename ::boost::range_iterator < view_type const >::type const_iterator; typedef typename ::boost::range_size::type size_type; typedef typename geometry::model::referring_segment < point_type const > range_segment; view_type view(range); const size_type count = ::boost::size(view); if ( count == 0 ) { return false; } else if ( count == 1 ) { return dispatch::disjoint < point_type, SegmentOrBox >::apply(geometry::range::front(view), segment_or_box, strategy.template get_point_in_geometry_strategy()); } else { const_iterator it0 = ::boost::begin(view); const_iterator it1 = ::boost::begin(view) + 1; const_iterator last = ::boost::end(view); for ( ; it1 != last ; ++it0, ++it1 ) { range_segment rng_segment(*it0, *it1); if ( !dispatch::disjoint < range_segment, SegmentOrBox >::apply(rng_segment, segment_or_box, strategy) ) { return false; } } return true; } } }; template < typename Linear, typename SegmentOrBox, typename Tag = typename tag::type > struct disjoint_linear_segment_or_box : not_implemented {}; template struct disjoint_linear_segment_or_box : disjoint_range_segment_or_box {}; template struct disjoint_linear_segment_or_box < MultiLinestring, SegmentOrBox, multi_linestring_tag > : multirange_constant_size_geometry {}; }} // namespace detail::disjoint #endif // DOXYGEN_NO_DETAIL #ifndef DOXYGEN_NO_DISPATCH namespace dispatch { template struct disjoint : detail::disjoint::disjoint_linear_segment_or_box {}; template struct disjoint : detail::disjoint::disjoint_linear_segment_or_box {}; } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH }} // namespace boost::geometry #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_LINEAR_SEGMENT_OR_BOX_HPP