view release on metacpan or search on metacpan
src/boost/geometry/algorithms/detail/calculate_sum.hpp
src/boost/geometry/algorithms/detail/convert_indexed_to_indexed.hpp
src/boost/geometry/algorithms/detail/convert_point_to_point.hpp
src/boost/geometry/algorithms/detail/disjoint.hpp
src/boost/geometry/algorithms/detail/equals/collect_vectors.hpp
src/boost/geometry/algorithms/detail/for_each_range.hpp
src/boost/geometry/algorithms/detail/get_left_turns.hpp
src/boost/geometry/algorithms/detail/has_self_intersections.hpp
src/boost/geometry/algorithms/detail/not.hpp
src/boost/geometry/algorithms/detail/occupation_info.hpp
src/boost/geometry/algorithms/detail/overlay/add_rings.hpp
src/boost/geometry/algorithms/detail/overlay/append_no_duplicates.hpp
src/boost/geometry/algorithms/detail/overlay/assign_parents.hpp
src/boost/geometry/algorithms/detail/overlay/backtrack_check_si.hpp
src/boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp
src/boost/geometry/algorithms/detail/overlay/check_enrich.hpp
src/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp
src/boost/geometry/algorithms/detail/overlay/convert_ring.hpp
src/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp
src/boost/geometry/algorithms/detail/overlay/copy_segments.hpp
src/boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp
src/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp
src/boost/geometry/algorithms/detail/overlay/enrichment_info.hpp
src/boost/geometry/algorithms/detail/overlay/follow.hpp
src/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp
src/boost/geometry/algorithms/detail/overlay/get_relative_order.hpp
src/boost/geometry/algorithms/detail/overlay/get_ring.hpp
src/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp
src/boost/geometry/algorithms/detail/overlay/get_turns.hpp
src/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp
src/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp
src/boost/geometry/algorithms/detail/overlay/overlay.hpp
src/boost/geometry/algorithms/detail/overlay/overlay_type.hpp
src/boost/geometry/algorithms/detail/overlay/ring_properties.hpp
src/boost/geometry/algorithms/detail/overlay/segment_identifier.hpp
src/boost/geometry/algorithms/detail/overlay/select_rings.hpp
src/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp
src/boost/geometry/algorithms/detail/overlay/stream_info.hpp
src/boost/geometry/algorithms/detail/overlay/traversal_info.hpp
src/boost/geometry/algorithms/detail/overlay/traverse.hpp
src/boost/geometry/algorithms/detail/overlay/turn_info.hpp
src/boost/geometry/algorithms/detail/overlay/visit_info.hpp
src/boost/geometry/algorithms/detail/partition.hpp
src/boost/geometry/algorithms/detail/point_on_border.hpp
src/boost/geometry/algorithms/detail/ring_identifier.hpp
src/boost/geometry/algorithms/detail/sections/range_by_section.hpp
src/boost/geometry/algorithms/detail/sections/sectionalize.hpp
src/boost/geometry/algorithms/detail/throw_on_empty_input.hpp
src/boost/geometry/algorithms/difference.hpp
src/boost/geometry/algorithms/disjoint.hpp
src/boost/geometry/algorithms/distance.hpp
src/boost/geometry/algorithms/envelope.hpp
src/boost/geometry/multi/algorithms/area.hpp
src/boost/geometry/multi/algorithms/centroid.hpp
src/boost/geometry/multi/algorithms/clear.hpp
src/boost/geometry/multi/algorithms/convert.hpp
src/boost/geometry/multi/algorithms/correct.hpp
src/boost/geometry/multi/algorithms/covered_by.hpp
src/boost/geometry/multi/algorithms/detail/for_each_range.hpp
src/boost/geometry/multi/algorithms/detail/modify.hpp
src/boost/geometry/multi/algorithms/detail/modify_with_predicate.hpp
src/boost/geometry/multi/algorithms/detail/multi_sum.hpp
src/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp
src/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp
src/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp
src/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp
src/boost/geometry/multi/algorithms/detail/overlay/select_rings.hpp
src/boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp
src/boost/geometry/multi/algorithms/detail/point_on_border.hpp
src/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp
src/boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp
src/boost/geometry/multi/algorithms/disjoint.hpp
src/boost/geometry/multi/algorithms/distance.hpp
src/boost/geometry/multi/algorithms/envelope.hpp
src/boost/geometry/multi/algorithms/equals.hpp
src/boost/geometry/multi/algorithms/for_each.hpp
src/boost/geometry/multi/algorithms/intersection.hpp
src/boost/geometry/multi/algorithms/length.hpp
src/boost/geometry/algorithms/detail/get_left_turns.hpp view on Meta::CPAN
}
template <typename Operation>
inline bool include_operation(Operation const& op,
segment_identifier const& outgoing_seg_id,
segment_identifier const& incoming_seg_id)
{
return op.seg_id == outgoing_seg_id
&& op.other_id == incoming_seg_id
&& (op.operation == detail::overlay::operation_union
||op.operation == detail::overlay::operation_continue)
;
}
template <typename Turn>
inline bool process_include(segment_identifier const& outgoing_seg_id, segment_identifier const& incoming_seg_id,
int turn_index, Turn& turn,
std::set<int>& keep_indices, int priority)
{
bool result = false;
for (int i = 0; i < 2; i++)
src/boost/geometry/algorithms/detail/get_left_turns.hpp view on Meta::CPAN
result = true;
}
}
}
return result;
}
template <std::size_t Index, typename Turn>
inline bool corresponds(Turn const& turn, segment_identifier const& seg_id)
{
return turn.operations[Index].operation == detail::overlay::operation_union
&& turn.operations[Index].seg_id == seg_id;
}
template <typename Turns, typename TurnSegmentIndices>
inline bool prefer_by_other(Turns const& turns,
TurnSegmentIndices const& turn_segment_indices,
std::set<int>& indices)
{
std::map<segment_identifier, int> map;
src/boost/geometry/algorithms/detail/get_left_turns.hpp view on Meta::CPAN
std::pair<segment_identifier, segment_identifier> pair = ordered_pair(front, back);
typename boost::range_iterator<TurnSegmentIndices const>::type it = turn_segment_indices.find(pair);
if (it != turn_segment_indices.end())
{
// debug_turns_by_indices("Found", it->second);
// Check which is the union/continue
segment_identifier good;
for (std::set<int>::const_iterator sit = it->second.begin(); sit != it->second.end(); ++sit)
{
if (turns[*sit].operations[0].operation == detail::overlay::operation_union)
{
good = turns[*sit].operations[0].seg_id;
}
else if (turns[*sit].operations[1].operation == detail::overlay::operation_union)
{
good = turns[*sit].operations[1].seg_id;
}
}
#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_PREFER
std::cout << "Good: " << si(good) << std::endl;
#endif
// Find in indexes-to-keep this segment with the union. Discard the other one
src/boost/geometry/algorithms/detail/has_self_intersections.hpp view on Meta::CPAN
// 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_HAS_SELF_INTERSECTIONS_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_HAS_SELF_INTERSECTIONS_HPP
#include <deque>
#include <boost/range.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
#include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp>
#include <boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp>
#ifdef BOOST_GEOMETRY_DEBUG_HAS_SELF_INTERSECTIONS
# include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
# include <boost/geometry/io/dsv/write.hpp>
#endif
namespace boost { namespace geometry
{
#if ! defined(BOOST_GEOMETRY_OVERLAY_NO_THROW)
/*!
\brief Overlay Invalid Input Exception
\ingroup overlay
\details The overlay_invalid_input_exception is thrown at invalid input
*/
class overlay_invalid_input_exception : public geometry::exception
{
public:
inline overlay_invalid_input_exception() {}
virtual char const* what() const throw()
{
return "Boost.Geometry Overlay invalid input exception";
}
};
#endif
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
template <typename Geometry>
inline bool has_self_intersections(Geometry const& geometry)
{
typedef typename point_type<Geometry>::type point_type;
typedef detail::overlay::turn_info<point_type> turn_info;
std::deque<turn_info> turns;
detail::disjoint::disjoint_interrupt_policy policy;
geometry::self_turns<detail::overlay::assign_null_policy>(geometry, turns, policy);
#ifdef BOOST_GEOMETRY_DEBUG_HAS_SELF_INTERSECTIONS
bool first = true;
#endif
for(typename std::deque<turn_info>::const_iterator it = boost::begin(turns);
it != boost::end(turns); ++it)
{
turn_info const& info = *it;
bool const both_union_turn =
info.operations[0].operation == detail::overlay::operation_union
&& info.operations[1].operation == detail::overlay::operation_union;
bool const both_intersection_turn =
info.operations[0].operation == detail::overlay::operation_intersection
&& info.operations[1].operation == detail::overlay::operation_intersection;
bool const valid = (both_union_turn || both_intersection_turn)
&& (info.method == detail::overlay::method_touch
|| info.method == detail::overlay::method_touch_interior);
if (! valid)
{
#ifdef BOOST_GEOMETRY_DEBUG_HAS_SELF_INTERSECTIONS
if (first)
{
std::cout << "turn points: " << std::endl;
first = false;
}
std::cout << method_char(info.method);
for (int i = 0; i < 2; i++)
{
std::cout << " " << operation_char(info.operations[i].operation);
}
std::cout << " " << geometry::dsv(info.point) << std::endl;
#endif
#if ! defined(BOOST_GEOMETRY_OVERLAY_NO_THROW)
throw overlay_invalid_input_exception();
#endif
}
}
return false;
}
}} // namespace detail::overlay
#endif // DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_HAS_SELF_INTERSECTIONS_HPP
src/boost/geometry/algorithms/detail/overlay/add_rings.hpp view on Meta::CPAN
// 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_OVERLAY_ADD_RINGS_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_ADD_RINGS_HPP
#include <boost/geometry/core/closure.hpp>
#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/detail/overlay/convert_ring.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_ring.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
template
<
typename GeometryOut,
typename Geometry1,
typename Geometry2,
typename RingCollection
>
inline void convert_and_add(GeometryOut& result,
src/boost/geometry/algorithms/detail/overlay/add_rings.hpp view on Meta::CPAN
inline OutputIterator add_rings(SelectionMap const& map,
Geometry const& geometry,
RingCollection const& collection,
OutputIterator out)
{
Geometry empty;
return add_rings<GeometryOut>(map, geometry, empty, collection, out);
}
}} // namespace detail::overlay
#endif // DOXYGEN_NO_DETAIL
}} // namespace geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_ADD_RINGS_HPP
src/boost/geometry/algorithms/detail/overlay/append_no_duplicates.hpp view on Meta::CPAN
#include <boost/geometry/algorithms/append.hpp>
#include <boost/geometry/algorithms/detail/disjoint.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
template <typename Range, typename Point>
inline void append_no_duplicates(Range& range, Point const& point, bool force = false)
{
if (boost::size(range) == 0
|| force
|| ! geometry::detail::equals::equals_point_point(*(boost::end(range)-1), point))
{
#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
std::cout << " add: ("
<< geometry::get<0>(point) << ", " << geometry::get<1>(point) << ")"
<< std::endl;
#endif
geometry::append(range, point);
}
}
}} // namespace detail::overlay
#endif // DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_APPEND_NO_DUPLICATES_HPP
src/boost/geometry/algorithms/detail/overlay/assign_parents.hpp view on Meta::CPAN
// 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_OVERLAY_ASSIGN_PARENTS_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_ASSIGN_PARENTS_HPP
#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/envelope.hpp>
#include <boost/geometry/algorithms/expand.hpp>
#include <boost/geometry/algorithms/detail/partition.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_ring.hpp>
#include <boost/geometry/algorithms/within.hpp>
#include <boost/geometry/geometries/box.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
template
<
typename Item,
typename Geometry1, typename Geometry2,
typename RingCollection
>
src/boost/geometry/algorithms/detail/overlay/assign_parents.hpp view on Meta::CPAN
bool check_for_orientation)
{
// Call it with an empty geometry
// (ring_map should be empty for source_id==1)
Geometry empty;
assign_parents(geometry, empty, collection, ring_map, check_for_orientation);
}
}} // namespace detail::overlay
#endif // DOXYGEN_NO_DETAIL
}} // namespace geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_ASSIGN_PARENTS_HPP
src/boost/geometry/algorithms/detail/overlay/backtrack_check_si.hpp view on Meta::CPAN
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_BACKTRACK_CHECK_SI_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_BACKTRACK_CHECK_SI_HPP
#include <cstddef>
#include <string>
#include <boost/range.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
#include <boost/geometry/algorithms/detail/has_self_intersections.hpp>
#if defined(BOOST_GEOMETRY_DEBUG_INTERSECTION) || defined(BOOST_GEOMETRY_OVERLAY_REPORT_WKT)
# include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
# include <boost/geometry/io/wkt/wkt.hpp>
#endif
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
template <typename Turns>
inline void clear_visit_info(Turns& turns)
{
typedef typename boost::range_value<Turns>::type tp_type;
for (typename boost::range_iterator<Turns>::type
it = boost::begin(turns);
it != boost::end(turns);
src/boost/geometry/algorithms/detail/overlay/backtrack_check_si.hpp view on Meta::CPAN
std::cout << "BACKTRACK (" << reason << " )"
<< " " << c << " of " << turns.size() << " rejected"
<< std::endl;
std::cout
<< geometry::wkt(geometry1) << std::endl
<< geometry::wkt(geometry2) << std::endl;
}
};
#endif // BOOST_GEOMETRY_OVERLAY_REPORT_WKT
}} // namespace detail::overlay
#endif // DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_BACKTRACK_CHECK_SI_HPP
src/boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp view on Meta::CPAN
#include <boost/geometry/algorithms/comparable_distance.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
/*!
\brief Policy calculating distance
\details get_turn_info has an optional policy to get some
extra information.
This policy calculates the distance (using default distance strategy)
*/
struct calculate_distance_policy
src/boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp view on Meta::CPAN
{
info.operations[0].enriched.distance
= geometry::comparable_distance(info.point, p1);
info.operations[1].enriched.distance
= geometry::comparable_distance(info.point, p2);
}
};
}} // namespace detail::overlay
#endif //DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_CALCULATE_DISTANCE_POLICY_HPP
src/boost/geometry/algorithms/detail/overlay/check_enrich.hpp view on Meta::CPAN
#include <boost/geometry/algorithms/detail/ring_identifier.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
template<typename Turn>
struct meta_turn
{
int index;
Turn const* turn;
bool handled[2];
src/boost/geometry/algorithms/detail/overlay/check_enrich.hpp view on Meta::CPAN
#endif
}
}
}
}
return error;
}
}} // namespace detail::overlay
#endif //DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_CHECK_ENRICH_HPP
src/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp view on Meta::CPAN
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_CLIP_LINESTRING_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_CLIP_LINESTRING_HPP
#include <boost/range.hpp>
#include <boost/geometry/algorithms/clear.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/detail/overlay/append_no_duplicates.hpp>
#include <boost/geometry/util/select_coordinate_type.hpp>
#include <boost/geometry/geometries/segment.hpp>
namespace boost { namespace geometry
{
namespace strategy { namespace intersection
{
/*!
\brief Strategy: line clipping algorithm after Liang Barsky
\ingroup overlay
\details The Liang-Barsky line clipping algorithm clips a line with a clipping box.
It is slightly adapted in the sense that it returns which points are clipped
\tparam B input box type of clipping box
\tparam P input/output point-type of segments to be clipped
\note The algorithm is currently only implemented for 2D Cartesian points
\note Though it is implemented in namespace strategy, and theoretically another
strategy could be used, it is not (yet) updated to the general strategy concepts,
and not (yet) splitted into a file in folder strategies
\author Barend Gehrels, and the following recourses
- A tutorial: http://www.skytopia.com/project/articles/compsci/clipping.html
src/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp view on Meta::CPAN
{
// a. If necessary, finish the line and add a start a new one
if (c1)
{
strategy.apply(line_out, out);
}
// b. Add p1 only if it is the first point, then add p2
if (boost::empty(line_out))
{
detail::overlay::append_no_duplicates(line_out, p1, true);
}
detail::overlay::append_no_duplicates(line_out, p2);
// c. If c2 is clipped, finish the line
if (c2)
{
strategy.apply(line_out, out);
}
}
}
src/boost/geometry/algorithms/detail/overlay/convert_ring.hpp view on Meta::CPAN
#include <boost/geometry/algorithms/detail/ring_identifier.hpp>
#include <boost/geometry/algorithms/convert.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
template<typename Tag>
struct convert_ring
{
BOOST_MPL_ASSERT_MSG
(
false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TAG
, (types<Tag>)
src/boost/geometry/algorithms/detail/overlay/convert_ring.hpp view on Meta::CPAN
if (reverse)
{
boost::reverse(interior_rings(destination).back());
}
}
}
}
};
}} // namespace detail::overlay
#endif // DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_CONVERT_RING_HPP
src/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp view on Meta::CPAN
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
/*!
\brief Helper function, copies a point from a segment
\ingroup overlay
*/
template<bool Reverse, typename Geometry, typename SegmentIdentifier, typename PointOut>
inline bool copy_segment_point(Geometry const& geometry,
SegmentIdentifier const& seg_id, bool second,
PointOut& point_out)
{
concept::check<Geometry const>();
return dispatch::copy_segment_point
<
src/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp view on Meta::CPAN
Reverse,
SegmentIdentifier,
PointOut
>::apply(geometry, seg_id, second, point_out);
}
/*!
\brief Helper function, to avoid the same construct several times,
copies a point, based on a source-index and two geometries
\ingroup overlay
*/
template
<
bool Reverse1, bool Reverse2,
typename Geometry1, typename Geometry2,
typename SegmentIdentifier,
typename PointOut
>
inline bool copy_segment_point(Geometry1 const& geometry1, Geometry2 const& geometry2,
SegmentIdentifier const& seg_id, bool second,
src/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp view on Meta::CPAN
>::apply(geometry2, seg_id, second, point_out);
}
// Exception?
return false;
}
/*!
\brief Helper function, to avoid the same construct several times,
copies a point, based on a source-index and two geometries
\ingroup overlay
*/
template
<
bool Reverse1, bool Reverse2,
typename Geometry1, typename Geometry2,
typename SegmentIdentifier,
typename PointOut
>
inline bool copy_segment_points(Geometry1 const& geometry1, Geometry2 const& geometry2,
SegmentIdentifier const& seg_id,
src/boost/geometry/algorithms/detail/overlay/copy_segments.hpp view on Meta::CPAN
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/iterators/ever_circling_iterator.hpp>
#include <boost/geometry/views/closeable_view.hpp>
#include <boost/geometry/views/reversible_view.hpp>
#include <boost/geometry/algorithms/detail/overlay/append_no_duplicates.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace copy_segments
{
src/boost/geometry/algorithms/detail/overlay/copy_segments.hpp view on Meta::CPAN
// [2..4] -> 4 - 2 + 1 = 3 -> {2,3,4} -> OK
// [4..2],size=6 -> 6 - 4 + 2 + 1 = 5 -> {4,5,0,1,2} -> OK
// [1..1], travel the whole ring round
typedef typename boost::range_difference<Ring>::type size_type;
size_type const count = from_index <= to_index
? to_index - from_index + 1
: int(boost::size(view)) - from_index + to_index + 1;
for (size_type i = 0; i < count; ++i, ++it)
{
detail::overlay::append_no_duplicates(current_output, *it);
}
}
};
template
<
typename LineString,
bool Reverse,
typename SegmentIdentifier,
typename RangeOut
src/boost/geometry/algorithms/detail/overlay/copy_segments.hpp view on Meta::CPAN
return;
}
typedef typename boost::range_difference<LineString>::type size_type;
size_type const count = to_index - from_index + 1;
typename boost::range_iterator<LineString const>::type it = boost::begin(ls) + from_index;
for (size_type i = 0; i < count; ++i, ++it)
{
detail::overlay::append_no_duplicates(current_output, *it);
}
}
};
template
<
typename Polygon,
bool Reverse,
typename SegmentIdentifier,
typename RangeOut
src/boost/geometry/algorithms/detail/overlay/copy_segments.hpp view on Meta::CPAN
// Create array of points, the fifth one closes it
boost::array<typename point_type<Box>::type, 5> bp;
assign_box_corners_oriented<Reverse>(box, bp);
bp[4] = bp[0];
// (possibly cyclic) copy to output
// (see comments in ring-version)
for (int i = 0; i < count; i++, index++)
{
detail::overlay::append_no_duplicates(current_output, bp[index % 5]);
}
}
};
}} // namespace detail::copy_segments
#endif // DOXYGEN_NO_DETAIL
src/boost/geometry/algorithms/detail/overlay/copy_segments.hpp view on Meta::CPAN
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
/*!
\brief Copy segments from a geometry, starting with the specified segment (seg_id)
until the specified index (to_index)
\ingroup overlay
*/
template
<
bool Reverse,
typename Geometry,
typename SegmentIdentifier,
typename RangeOut
>
inline void copy_segments(Geometry const& geometry,
SegmentIdentifier const& seg_id, int to_index,
src/boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp view on Meta::CPAN
// Copyright (c) 2007-2012 Barend Gehrels, 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_OVERLAY_DEBUG_TURN_INFO_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_DEBUG_TURN_INFO_HPP
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/visit_info.hpp>
namespace boost { namespace geometry
{
inline char method_char(detail::overlay::method_type const& method)
{
using namespace detail::overlay;
switch(method)
{
case method_none : return '-';
case method_disjoint : return 'd';
case method_crosses : return 'i';
case method_touch : return 't';
case method_touch_interior : return 'm';
case method_collinear : return 'c';
case method_equal : return 'e';
case method_error : return '!';
default : return '?';
}
}
inline char operation_char(detail::overlay::operation_type const& operation)
{
using namespace detail::overlay;
switch(operation)
{
case operation_none : return '-';
case operation_union : return 'u';
case operation_intersection : return 'i';
case operation_blocked : return 'x';
case operation_continue : return 'c';
case operation_opposite : return 'o';
default : return '?';
}
}
inline char visited_char(detail::overlay::visit_info const& v)
{
if (v.rejected()) return 'R';
if (v.started()) return 's';
if (v.visited()) return 'v';
if (v.none()) return '-';
if (v.finished()) return 'f';
return '?';
}
src/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp view on Meta::CPAN
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_ENRICH_HPP
#include <cstddef>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#ifdef BOOST_GEOMETRY_DEBUG_ENRICH
# include <iostream>
# include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
# include <boost/geometry/io/wkt/wkt.hpp>
# define BOOST_GEOMETRY_DEBUG_IDENTIFIER
#endif
#include <boost/assert.hpp>
#include <boost/range.hpp>
#include <boost/geometry/algorithms/detail/ring_identifier.hpp>
#include <boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_relative_order.hpp>
#include <boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp>
#ifdef BOOST_GEOMETRY_DEBUG_ENRICH
# include <boost/geometry/algorithms/detail/overlay/check_enrich.hpp>
#endif
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
// Wraps "turn_operation" from turn_info.hpp,
// giving it extra information
template <typename TurnOperation>
struct indexed_turn_operation
{
typedef TurnOperation type;
int index;
src/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp view on Meta::CPAN
mapped_vector[ring_id].push_back
(
IndexedType(index, op_index, *op_it)
);
}
}
}
}
}} // namespace detail::overlay
#endif //DOXYGEN_NO_DETAIL
/*!
\brief All intersection points are enriched with successor information
\ingroup overlay
\tparam TurnPoints type of intersection container
(e.g. vector of "intersection/turn point"'s)
\tparam Geometry1 \tparam_geometry
\tparam Geometry2 \tparam_geometry
\tparam Strategy side strategy type
\param turn_points container containing intersectionpoints
\param for_operation operation_type (union or intersection)
\param geometry1 \param_geometry
\param geometry2 \param_geometry
\param strategy strategy
*/
template
<
bool Reverse1, bool Reverse2,
typename TurnPoints,
typename Geometry1, typename Geometry2,
typename Strategy
>
inline void enrich_intersection_points(TurnPoints& turn_points,
detail::overlay::operation_type for_operation,
Geometry1 const& geometry1, Geometry2 const& geometry2,
Strategy const& strategy)
{
typedef typename boost::range_value<TurnPoints>::type turn_point_type;
typedef typename turn_point_type::turn_operation_type turn_operation_type;
typedef detail::overlay::indexed_turn_operation
<
turn_operation_type
> indexed_turn_operation;
typedef std::map
<
ring_identifier,
std::vector<indexed_turn_operation>
> mapped_vector_type;
// DISCARD ALL UU
// #76 is the reason that this is necessary...
// With uu, at all points there is the risk that rings are being traversed twice or more.
// Without uu, all rings having only uu will be untouched and gathered by assemble
for (typename boost::range_iterator<TurnPoints>::type
it = boost::begin(turn_points);
it != boost::end(turn_points);
++it)
{
if (it->both(detail::overlay::operation_union))
{
it->discarded = true;
}
}
// Create a map of vectors of indexed operation-types to be able
// to sort intersection points PER RING
mapped_vector_type mapped_vector;
detail::overlay::create_map<indexed_turn_operation>(turn_points, mapped_vector);
// No const-iterator; contents of mapped copy is temporary,
// and changed by enrich
for (typename mapped_vector_type::iterator mit
= mapped_vector.begin();
mit != mapped_vector.end();
++mit)
{
#ifdef BOOST_GEOMETRY_DEBUG_ENRICH
std::cout << "ENRICH-sort Ring "
<< mit->first << std::endl;
#endif
detail::overlay::enrich_sort<indexed_turn_operation, Reverse1, Reverse2>(mit->second, turn_points, for_operation,
geometry1, geometry2, strategy);
}
for (typename mapped_vector_type::iterator mit
= mapped_vector.begin();
mit != mapped_vector.end();
++mit)
{
#ifdef BOOST_GEOMETRY_DEBUG_ENRICH
std::cout << "ENRICH-discard Ring "
<< mit->first << std::endl;
#endif
detail::overlay::enrich_discard<indexed_turn_operation>(mit->second, turn_points);
}
for (typename mapped_vector_type::iterator mit
= mapped_vector.begin();
mit != mapped_vector.end();
++mit)
{
#ifdef BOOST_GEOMETRY_DEBUG_ENRICH
std::cout << "ENRICH-assign Ring "
<< mit->first << std::endl;
#endif
detail::overlay::enrich_assign<indexed_turn_operation>(mit->second, turn_points, for_operation,
geometry1, geometry2, strategy);
}
#ifdef BOOST_GEOMETRY_DEBUG_ENRICH
//detail::overlay::check_graph(turn_points, for_operation);
#endif
}
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_ENRICH_HPP
src/boost/geometry/algorithms/detail/overlay/enrichment_info.hpp view on Meta::CPAN
#include <boost/geometry/strategies/distance.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
/*!
\brief Keeps info to enrich intersection info (per source)
\details Class to keep information necessary for traversal phase (a phase
of the overlay process). The information is gathered during the
enrichment phase
*/
template<typename P>
struct enrichment_info
{
typedef typename strategy::distance::services::return_type
<
typename strategy::distance::services::comparable_type
<
typename strategy::distance::services::default_strategy
src/boost/geometry/algorithms/detail/overlay/enrichment_info.hpp view on Meta::CPAN
// same but now IP index, so "next IP index" but not on THIS segment
int travels_to_ip_index;
// index of next IP on this segment, -1 if there is no one
int next_ip_index;
distance_type distance; // distance-measurement from segment.first to IP
};
}} // namespace detail::overlay
#endif //DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_ENRICHMENT_INFO_HPP
src/boost/geometry/algorithms/detail/overlay/follow.hpp view on Meta::CPAN
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_FOLLOW_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_FOLLOW_HPP
#include <cstddef>
#include <boost/range.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/geometry/algorithms/detail/point_on_border.hpp>
#include <boost/geometry/algorithms/detail/overlay/append_no_duplicates.hpp>
#include <boost/geometry/algorithms/detail/overlay/copy_segments.hpp>
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
#include <boost/geometry/algorithms/covered_by.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
namespace following
{
template <typename Turn, typename Operation>
static inline bool is_entering(Turn const& /* TODO remove this parameter */, Operation const& op)
{
// (Blocked means: blocked for polygon/polygon intersection, because
// they are reversed. But for polygon/line it is similar to continue)
src/boost/geometry/algorithms/detail/overlay/follow.hpp view on Meta::CPAN
{
if (first && (turn.method == method_collinear || turn.method == method_equal))
{
return last_covered_by(turn, op, linestring, polygon);
}
return false;
}
// Template specialization structure to call the right actions for the right type
template<overlay_type OverlayType>
struct action_selector
{
// If you get here the overlay type is not intersection or difference
// BOOST_MPL_ASSERT(false);
};
// Specialization for intersection, containing the implementation
template<>
struct action_selector<overlay_intersection>
{
template
<
typename OutputIterator,
typename LineStringOut,
typename LineString,
typename Point,
typename Operation
>
static inline void enter(LineStringOut& current_piece,
LineString const& ,
segment_identifier& segment_id,
int , Point const& point,
Operation const& operation, OutputIterator& )
{
// On enter, append the intersection point and remember starting point
detail::overlay::append_no_duplicates(current_piece, point);
segment_id = operation.seg_id;
}
template
<
typename OutputIterator,
typename LineStringOut,
typename LineString,
typename Point,
typename Operation
>
static inline void leave(LineStringOut& current_piece,
LineString const& linestring,
segment_identifier& segment_id,
int index, Point const& point,
Operation const& , OutputIterator& out)
{
// On leave, copy all segments from starting point, append the intersection point
// and add the output piece
geometry::copy_segments<false>(linestring, segment_id, index, current_piece);
detail::overlay::append_no_duplicates(current_piece, point);
if (current_piece.size() > 1)
{
*out++ = current_piece;
}
current_piece.clear();
}
static inline bool is_entered(bool entered)
{
return entered;
src/boost/geometry/algorithms/detail/overlay/follow.hpp view on Meta::CPAN
template <typename Point, typename Geometry>
static inline bool included(Point const& point, Geometry const& geometry)
{
return geometry::covered_by(point, geometry);
}
};
// Specialization for difference, which reverses these actions
template<>
struct action_selector<overlay_difference>
{
typedef action_selector<overlay_intersection> normal_action;
template
<
typename OutputIterator,
typename LineStringOut,
typename LineString,
typename Point,
typename Operation
>
static inline void enter(LineStringOut& current_piece,
src/boost/geometry/algorithms/detail/overlay/follow.hpp view on Meta::CPAN
return ! normal_action::included(point, geometry);
}
};
}
/*!
\brief Follows a linestring from intersection point to intersection point, outputting which
is inside, or outside, a ring or polygon
\ingroup overlay
*/
template
<
typename LineStringOut,
typename LineString,
typename Polygon,
overlay_type OverlayType
>
class follow
{
template<typename Turn>
struct sort_on_segment
{
// In case of turn point at the same location, we want to have continue/blocked LAST
// because that should be followed (intersection) or skipped (difference).
inline int operation_order(Turn const& turn) const
src/boost/geometry/algorithms/detail/overlay/follow.hpp view on Meta::CPAN
public :
template <typename Point, typename Geometry>
static inline bool included(Point const& point, Geometry const& geometry)
{
return following::action_selector<OverlayType>::included(point, geometry);
}
template<typename Turns, typename OutputIterator>
static inline OutputIterator apply(LineString const& linestring, Polygon const& polygon,
detail::overlay::operation_type , // TODO: this parameter might be redundant
Turns& turns, OutputIterator out)
{
typedef typename boost::range_iterator<Turns>::type turn_iterator;
typedef typename boost::range_value<Turns>::type turn_type;
typedef typename boost::range_iterator
<
typename turn_type::container_type
>::type turn_operation_iterator_type;
typedef following::action_selector<OverlayType> action;
src/boost/geometry/algorithms/detail/overlay/follow.hpp view on Meta::CPAN
if (current_piece.size() > 1)
{
*out++ = current_piece;
}
return out;
}
};
}} // namespace detail::overlay
#endif // DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_FOLLOW_HPP
src/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp view on Meta::CPAN
// 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_OVERLAY_GET_INTERSECTION_POINTS_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_GET_INTERSECTION_POINTS_HPP
#include <cstddef>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
#include <boost/geometry/geometries/segment.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace get_intersection_points
src/boost/geometry/algorithms/detail/overlay/get_relative_order.hpp view on Meta::CPAN
#include <boost/geometry/algorithms/distance.hpp>
#include <boost/geometry/strategies/intersection.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
/*!
\brief Get relative order
\details Can indicate which of two segments R and S,
both crossing a common segment P, comes first.
If the two segments cross P very close (e.g. in a spike),
the distance between the intersection points can be zero,
but we still need to know which comes first.
src/boost/geometry/algorithms/detail/overlay/get_relative_order.hpp view on Meta::CPAN
std::cout
<< " o: " << order
<< std::endl << std::endl;
#endif
return order;
}
};
}} // namespace detail::overlay
#endif //DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_GET_RELATIVE_ORDER_HPP
src/boost/geometry/algorithms/detail/overlay/get_ring.hpp view on Meta::CPAN
#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/algorithms/detail/ring_identifier.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
template<typename Tag>
struct get_ring
{};
// A container of rings (multi-ring but that does not exist)
// gets the "void" tag and is dispatched here.
template<>
src/boost/geometry/algorithms/detail/overlay/get_ring.hpp view on Meta::CPAN
id.ring_index >= -1
&& id.ring_index < int(boost::size(interior_rings(polygon)))
);
return id.ring_index < 0
? exterior_ring(polygon)
: interior_rings(polygon)[id.ring_index];
}
};
}} // namespace detail::overlay
#endif // DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_GET_RING_HPP
src/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp view on Meta::CPAN
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_GET_TURN_INFO_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_GET_TURN_INFO_HPP
#include <boost/assert.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/strategies/intersection.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
#include <boost/geometry/geometries/segment.hpp>
namespace boost { namespace geometry
{
#if ! defined(BOOST_GEOMETRY_OVERLAY_NO_THROW)
class turn_info_exception : public geometry::exception
{
src/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp view on Meta::CPAN
{}
virtual char const* what() const throw()
{
return message.c_str();
}
};
#endif
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
struct base_turn_handler
{
// Returns true if both sides are opposite
static inline bool opposite(int side1, int side2)
{
// We cannot state side1 == -side2, because 0 == -0
// So either side1*side2==-1 or side1==-side2 && side1 != 0
src/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp view on Meta::CPAN
>
static inline void apply(Info& , Point1 const& , Point2 const&, IntersectionInfo const&, DirInfo const&)
{}
};
/*!
\brief Turn information: intersection point, method, and turn information
\details Information necessary for traversal phase (a phase
of the overlay process). The information is gathered during the
get_turns (segment intersection) phase.
\tparam Point1 point type of first segment
\tparam Point2 point type of second segment
\tparam TurnInfo type of class getting intersection and turn info
\tparam AssignPolicy policy to assign extra info,
e.g. to calculate distance from segment's first points
to intersection points.
It also defines if a certain class of points
(degenerate, non-turns) should be included.
*/
src/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp view on Meta::CPAN
#endif
}
break;
}
return out;
}
};
}} // namespace detail::overlay
#endif //DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_GET_TURN_INFO_HPP
src/boost/geometry/algorithms/detail/overlay/get_turns.hpp view on Meta::CPAN
#include <boost/geometry/geometries/segment.hpp>
#include <boost/geometry/iterators/ever_circling_iterator.hpp>
#include <boost/geometry/strategies/cartesian/cart_intersect.hpp>
#include <boost/geometry/strategies/intersection.hpp>
#include <boost/geometry/strategies/intersection_result.hpp>
#include <boost/geometry/algorithms/detail/disjoint.hpp>
#include <boost/geometry/algorithms/detail/partition.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turn_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/segment_identifier.hpp>
#include <boost/geometry/algorithms/detail/sections/range_by_section.hpp>
#include <boost/geometry/algorithms/expand.hpp>
#include <boost/geometry/algorithms/detail/sections/sectionalize.hpp>
#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
# include <sstream>
# include <boost/geometry/io/dsv/write.hpp>
src/boost/geometry/algorithms/detail/overlay/get_turns.hpp view on Meta::CPAN
};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
/*!
\brief \brief_calc2{turn points}
\ingroup overlay
\tparam Geometry1 \tparam_geometry
\tparam Geometry2 \tparam_geometry
\tparam Turns type of turn-container (e.g. vector of "intersection/turn point"'s)
\param geometry1 \param_geometry
\param geometry2 \param_geometry
\param turns container which will contain turn points
\param interrupt_policy policy determining if process is stopped
when intersection is found
*/
template
src/boost/geometry/algorithms/detail/overlay/get_turns.hpp view on Meta::CPAN
concept::check_concepts_and_equal_dimensions<Geometry1 const, Geometry2 const>();
typedef typename strategy_intersection
<
typename cs_tag<Geometry1>::type,
Geometry1,
Geometry2,
typename boost::range_value<Turns>::type
>::segment_intersection_strategy_type segment_intersection_strategy_type;
typedef detail::overlay::get_turn_info
<
typename point_type<Geometry1>::type,
typename point_type<Geometry2>::type,
typename boost::range_value<Turns>::type,
AssignPolicy
> TurnPolicy;
boost::mpl::if_c
<
reverse_dispatch<Geometry1, Geometry2>::type::value,
src/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp view on Meta::CPAN
// 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_OVERLAY_HANDLE_TANGENCIES_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_HANDLE_TANGENCIES_HPP
#include <algorithm>
#include <boost/geometry/algorithms/detail/ring_identifier.hpp>
#include <boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp>
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
#include <boost/geometry/geometries/segment.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
template
<
typename TurnPoints,
typename Indexed,
typename Geometry1, typename Geometry2,
bool Reverse1, bool Reverse2,
typename Strategy
src/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp view on Meta::CPAN
}
std::cout << std::endl;
//<< "\tOn segments: " << prev_op.seg_id << " / " << prev_op.other_id
//<< " and " << op.seg_id << " / " << op.other_id
//<< geometry::distance(turn_points[prev->index].point, turn_points[it->index].point)
#endif
}
}} // namespace detail::overlay
#endif //DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_HANDLE_TANGENCIES_HPP
src/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp view on Meta::CPAN
#include <boost/mpl/assert.hpp>
#include <boost/range/metafunctions.hpp>
#include <boost/geometry/core/is_areal.hpp>
#include <boost/geometry/core/point_order.hpp>
#include <boost/geometry/core/reverse_dispatch.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/detail/point_on_border.hpp>
#include <boost/geometry/algorithms/detail/overlay/clip_linestring.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp>
#include <boost/geometry/algorithms/detail/overlay/overlay.hpp>
#include <boost/geometry/algorithms/detail/overlay/overlay_type.hpp>
#include <boost/geometry/algorithms/detail/overlay/follow.hpp>
#include <boost/geometry/views/segment_view.hpp>
#if defined(BOOST_GEOMETRY_DEBUG_FOLLOW)
#include <boost/foreach.hpp>
#endif
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
src/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp view on Meta::CPAN
<
typename Linestring1, typename Linestring2,
typename OutputIterator, typename Strategy
>
static inline OutputIterator apply(Linestring1 const& linestring1,
Linestring2 const& linestring2, OutputIterator out,
Strategy const& )
{
typedef typename point_type<PointOut>::type point_type;
typedef detail::overlay::turn_info<point_type> turn_info;
std::deque<turn_info> turns;
geometry::get_intersection_points(linestring1, linestring2, turns);
for (typename boost::range_iterator<std::deque<turn_info> const>::type
it = boost::begin(turns); it != boost::end(turns); ++it)
{
PointOut p;
geometry::convert(it->point, p);
*out++ = p;
src/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp view on Meta::CPAN
}
};
/*!
\brief Version of linestring with an areal feature (polygon or multipolygon)
*/
template
<
bool ReverseAreal,
typename LineStringOut,
overlay_type OverlayType
>
struct intersection_of_linestring_with_areal
{
#if defined(BOOST_GEOMETRY_DEBUG_FOLLOW)
template <typename Turn, typename Operation>
static inline void debug_follow(Turn const& turn, Operation op,
int index)
{
std::cout << index
<< " at " << op.seg_id
src/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp view on Meta::CPAN
>
static inline OutputIterator apply(LineString const& linestring, Areal const& areal,
OutputIterator out,
Strategy const& )
{
if (boost::size(linestring) == 0)
{
return out;
}
typedef detail::overlay::follow
<
LineStringOut,
LineString,
Areal,
OverlayType
> follower;
typedef typename point_type<LineStringOut>::type point_type;
typedef detail::overlay::traversal_turn_info<point_type> turn_info;
std::deque<turn_info> turns;
detail::get_turns::no_interrupt_policy policy;
geometry::get_turns
<
false,
(OverlayType == overlay_intersection ? ReverseAreal : !ReverseAreal),
detail::overlay::calculate_distance_policy
>(linestring, areal, turns, policy);
if (turns.empty())
{
// No intersection points, it is either completely
// inside (interior + borders)
// or completely outside
// Use border point (on a segment) to check this
// (because turn points might skip some cases)
src/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp view on Meta::CPAN
int index = 0;
BOOST_FOREACH(turn_info const& turn, turns)
{
debug_follow(turn, turn.operations[0], index++);
}
#endif
return follower::apply
(
linestring, areal,
geometry::detail::overlay::operation_intersection,
turns, out
);
}
};
}} // namespace detail::intersection
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template
<
// real types
typename Geometry1, typename Geometry2,
typename GeometryOut,
overlay_type OverlayType,
// orientation
bool Reverse1 = detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
bool Reverse2 = detail::overlay::do_reverse<geometry::point_order<Geometry2>::value>::value,
bool ReverseOut = detail::overlay::do_reverse<geometry::point_order<GeometryOut>::value>::value,
// tag dispatching:
typename TagIn1 = typename geometry::tag<Geometry1>::type,
typename TagIn2 = typename geometry::tag<Geometry2>::type,
typename TagOut = typename geometry::tag<GeometryOut>::type,
// metafunction finetuning helpers:
bool Areal1 = geometry::is_areal<Geometry1>::value,
bool Areal2 = geometry::is_areal<Geometry2>::value,
bool ArealOut = geometry::is_areal<GeometryOut>::value
>
struct intersection_insert
src/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp view on Meta::CPAN
false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPES_OR_ORIENTATIONS
, (types<Geometry1, Geometry2, GeometryOut>)
);
};
template
<
typename Geometry1, typename Geometry2,
typename GeometryOut,
overlay_type OverlayType,
bool Reverse1, bool Reverse2, bool ReverseOut,
typename TagIn1, typename TagIn2, typename TagOut
>
struct intersection_insert
<
Geometry1, Geometry2,
GeometryOut,
OverlayType,
Reverse1, Reverse2, ReverseOut,
TagIn1, TagIn2, TagOut,
true, true, true
> : detail::overlay::overlay
<Geometry1, Geometry2, Reverse1, Reverse2, ReverseOut, GeometryOut, OverlayType>
{};
// Any areal type with box:
template
<
typename Geometry, typename Box,
typename GeometryOut,
overlay_type OverlayType,
bool Reverse1, bool Reverse2, bool ReverseOut,
typename TagIn, typename TagOut
>
struct intersection_insert
<
Geometry, Box,
GeometryOut,
OverlayType,
Reverse1, Reverse2, ReverseOut,
TagIn, box_tag, TagOut,
true, true, true
> : detail::overlay::overlay
<Geometry, Box, Reverse1, Reverse2, ReverseOut, GeometryOut, OverlayType>
{};
template
<
typename Segment1, typename Segment2,
typename GeometryOut,
overlay_type OverlayType,
bool Reverse1, bool Reverse2, bool ReverseOut
>
struct intersection_insert
<
Segment1, Segment2,
GeometryOut,
OverlayType,
Reverse1, Reverse2, ReverseOut,
segment_tag, segment_tag, point_tag,
false, false, false
> : detail::intersection::intersection_segment_segment_point<GeometryOut>
{};
template
<
typename Linestring1, typename Linestring2,
typename GeometryOut,
overlay_type OverlayType,
bool Reverse1, bool Reverse2, bool ReverseOut
>
struct intersection_insert
<
Linestring1, Linestring2,
GeometryOut,
OverlayType,
Reverse1, Reverse2, ReverseOut,
linestring_tag, linestring_tag, point_tag,
false, false, false
> : detail::intersection::intersection_linestring_linestring_point<GeometryOut>
{};
template
<
typename Linestring, typename Box,
typename GeometryOut,
overlay_type OverlayType,
bool Reverse1, bool Reverse2, bool ReverseOut
>
struct intersection_insert
<
Linestring, Box,
GeometryOut,
OverlayType,
Reverse1, Reverse2, ReverseOut,
linestring_tag, box_tag, linestring_tag,
false, true, false
src/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp view on Meta::CPAN
return detail::intersection::clip_range_with_box
<GeometryOut>(box, linestring, out, lb_strategy);
}
};
template
<
typename Linestring, typename Polygon,
typename GeometryOut,
overlay_type OverlayType,
bool ReverseLinestring, bool ReversePolygon, bool ReverseOut
>
struct intersection_insert
<
Linestring, Polygon,
GeometryOut,
OverlayType,
ReverseLinestring, ReversePolygon, ReverseOut,
linestring_tag, polygon_tag, linestring_tag,
false, true, false
src/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp view on Meta::CPAN
GeometryOut,
OverlayType
>
{};
template
<
typename Linestring, typename Ring,
typename GeometryOut,
overlay_type OverlayType,
bool ReverseLinestring, bool ReverseRing, bool ReverseOut
>
struct intersection_insert
<
Linestring, Ring,
GeometryOut,
OverlayType,
ReverseLinestring, ReverseRing, ReverseOut,
linestring_tag, ring_tag, linestring_tag,
false, true, false
src/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp view on Meta::CPAN
ReverseRing,
GeometryOut,
OverlayType
>
{};
template
<
typename Segment, typename Box,
typename GeometryOut,
overlay_type OverlayType,
bool Reverse1, bool Reverse2, bool ReverseOut
>
struct intersection_insert
<
Segment, Box,
GeometryOut,
OverlayType,
Reverse1, Reverse2, ReverseOut,
segment_tag, box_tag, linestring_tag,
false, true, false
src/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp view on Meta::CPAN
strategy::intersection::liang_barsky<Box, point_type> lb_strategy;
return detail::intersection::clip_range_with_box
<GeometryOut>(box, range, out, lb_strategy);
}
};
template
<
typename Geometry1, typename Geometry2,
typename PointOut,
overlay_type OverlayType,
bool Reverse1, bool Reverse2, bool ReverseOut,
typename Tag1, typename Tag2,
bool Areal1, bool Areal2
>
struct intersection_insert
<
Geometry1, Geometry2,
PointOut,
OverlayType,
Reverse1, Reverse2, ReverseOut,
Tag1, Tag2, point_tag,
Areal1, Areal2, false
>
{
template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, OutputIterator out, Strategy const& )
{
typedef detail::overlay::turn_info<PointOut> turn_info;
std::vector<turn_info> turns;
detail::get_turns::no_interrupt_policy policy;
geometry::get_turns
<
false, false, detail::overlay::assign_null_policy
>(geometry1, geometry2, turns, policy);
for (typename std::vector<turn_info>::const_iterator it
= turns.begin(); it != turns.end(); ++it)
{
*out++ = it->point;
}
return out;
}
};
template
<
typename Geometry1, typename Geometry2, typename GeometryOut,
overlay_type OverlayType,
bool Reverse1, bool Reverse2, bool ReverseOut
>
struct intersection_insert_reversed
{
template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(Geometry1 const& g1,
Geometry2 const& g2, OutputIterator out,
Strategy const& strategy)
{
return intersection_insert
src/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp view on Meta::CPAN
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace intersection
{
template
<
typename GeometryOut,
bool ReverseSecond,
overlay_type OverlayType,
typename Geometry1, typename Geometry2,
typename OutputIterator,
typename Strategy
>
inline OutputIterator insert(Geometry1 const& geometry1,
Geometry2 const& geometry2,
OutputIterator out,
Strategy const& strategy)
{
return boost::mpl::if_c
<
geometry::reverse_dispatch<Geometry1, Geometry2>::type::value,
geometry::dispatch::intersection_insert_reversed
<
Geometry1, Geometry2,
GeometryOut,
OverlayType,
overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
overlay::do_reverse<geometry::point_order<Geometry2>::value, ReverseSecond>::value,
overlay::do_reverse<geometry::point_order<GeometryOut>::value>::value
>,
geometry::dispatch::intersection_insert
<
Geometry1, Geometry2,
GeometryOut,
OverlayType,
geometry::detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
geometry::detail::overlay::do_reverse<geometry::point_order<Geometry2>::value, ReverseSecond>::value
>
>::type::apply(geometry1, geometry2, out, strategy);
}
/*!
\brief \brief_calc2{intersection} \brief_strategy
\ingroup intersection
\details \details_calc2{intersection_insert, spatial set theoretic intersection}
\brief_strategy. \details_insert{intersection}
\tparam GeometryOut \tparam_geometry{\p_l_or_c}
\tparam Geometry1 \tparam_geometry
\tparam Geometry2 \tparam_geometry
\tparam OutputIterator \tparam_out{\p_l_or_c}
\tparam Strategy \tparam_strategy_overlay
\param geometry1 \param_geometry
\param geometry2 \param_geometry
\param out \param_out{intersection}
\param strategy \param_strategy{intersection}
\return \return_out
\qbk{distinguish,with strategy}
\qbk{[include reference/algorithms/intersection.qbk]}
*/
template
src/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp view on Meta::CPAN
inline OutputIterator intersection_insert(Geometry1 const& geometry1,
Geometry2 const& geometry2,
OutputIterator out,
Strategy const& strategy)
{
concept::check<Geometry1 const>();
concept::check<Geometry2 const>();
return detail::intersection::insert
<
GeometryOut, false, overlay_intersection
>(geometry1, geometry2, out, strategy);
}
/*!
\brief \brief_calc2{intersection}
\ingroup intersection
\details \details_calc2{intersection_insert, spatial set theoretic intersection}.
\details_insert{intersection}
\tparam GeometryOut \tparam_geometry{\p_l_or_c}
src/boost/geometry/algorithms/detail/overlay/overlay.hpp view on Meta::CPAN
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_OVERLAY_HPP
#include <deque>
#include <map>
#include <boost/range.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp>
#include <boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp>
#include <boost/geometry/algorithms/detail/overlay/enrichment_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
#include <boost/geometry/algorithms/detail/overlay/overlay_type.hpp>
#include <boost/geometry/algorithms/detail/overlay/traverse.hpp>
#include <boost/geometry/algorithms/detail/overlay/traversal_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
#include <boost/geometry/algorithms/num_points.hpp>
#include <boost/geometry/algorithms/reverse.hpp>
#include <boost/geometry/algorithms/detail/overlay/add_rings.hpp>
#include <boost/geometry/algorithms/detail/overlay/assign_parents.hpp>
#include <boost/geometry/algorithms/detail/overlay/ring_properties.hpp>
#include <boost/geometry/algorithms/detail/overlay/select_rings.hpp>
#ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE
# include <boost/geometry/io/dsv/write.hpp>
#endif
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
// Skip for assemble process
template <typename TurnInfo>
inline bool skip(TurnInfo const& turn_info)
{
return (turn_info.discarded || turn_info.both(operation_union))
&& ! turn_info.any_blocked()
&& ! turn_info.both(operation_intersection)
;
src/boost/geometry/algorithms/detail/overlay/overlay.hpp view on Meta::CPAN
);
map[ring_id]++;
}
}
}
}
template
<
typename GeometryOut, overlay_type Direction, bool ReverseOut,
typename Geometry1, typename Geometry2,
typename OutputIterator
>
inline OutputIterator return_if_one_input_is_empty(Geometry1 const& geometry1,
Geometry2 const& geometry2,
OutputIterator out)
{
typedef std::deque
<
typename geometry::ring_type<GeometryOut>::type
> ring_container_type;
typedef ring_properties<typename geometry::point_type<Geometry1>::type> properties;
// Union: return either of them
// Intersection: return nothing
// Difference: return first of them
if (Direction == overlay_intersection
|| (Direction == overlay_difference
&& geometry::num_points(geometry1) == 0))
{
return out;
}
std::map<ring_identifier, int> empty;
std::map<ring_identifier, properties> all_of_one_of_them;
select_rings<Direction>(geometry1, geometry2, empty, all_of_one_of_them, false);
ring_container_type rings;
assign_parents(geometry1, geometry2, rings, all_of_one_of_them);
return add_rings<GeometryOut>(all_of_one_of_them, geometry1, geometry2, rings, out);
}
template
<
typename Geometry1, typename Geometry2,
bool Reverse1, bool Reverse2, bool ReverseOut,
typename GeometryOut,
overlay_type Direction
>
struct overlay
{
template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(
Geometry1 const& geometry1, Geometry2 const& geometry2,
OutputIterator out,
Strategy const& )
{
if (geometry::num_points(geometry1) == 0
&& geometry::num_points(geometry2) == 0)
{
src/boost/geometry/algorithms/detail/overlay/overlay.hpp view on Meta::CPAN
if (geometry::num_points(geometry1) == 0
|| geometry::num_points(geometry2) == 0)
{
return return_if_one_input_is_empty
<
GeometryOut, Direction, ReverseOut
>(geometry1, geometry2, out);
}
typedef typename geometry::point_type<GeometryOut>::type point_type;
typedef detail::overlay::traversal_turn_info<point_type> turn_info;
typedef std::deque<turn_info> container_type;
typedef std::deque
<
typename geometry::ring_type<GeometryOut>::type
> ring_container_type;
container_type turn_points;
#ifdef BOOST_GEOMETRY_TIME_OVERLAY
boost::timer timer;
#endif
#ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE
std::cout << "get turns" << std::endl;
#endif
detail::get_turns::no_interrupt_policy policy;
geometry::get_turns
<
Reverse1, Reverse2,
detail::overlay::calculate_distance_policy
>(geometry1, geometry2, turn_points, policy);
#ifdef BOOST_GEOMETRY_TIME_OVERLAY
std::cout << "get_turns: " << timer.elapsed() << std::endl;
#endif
#ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE
std::cout << "enrich" << std::endl;
#endif
typename Strategy::side_strategy_type side_strategy;
geometry::enrich_intersection_points<Reverse1, Reverse2>(turn_points,
Direction == overlay_union
? geometry::detail::overlay::operation_union
: geometry::detail::overlay::operation_intersection,
geometry1, geometry2,
side_strategy);
#ifdef BOOST_GEOMETRY_TIME_OVERLAY
std::cout << "enrich_intersection_points: " << timer.elapsed() << std::endl;
#endif
#ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE
std::cout << "traverse" << std::endl;
#endif
// Traverse through intersection/turn points and create rings of them.
// Note that these rings are always in clockwise order, even in CCW polygons,
// and are marked as "to be reversed" below
ring_container_type rings;
traverse<Reverse1, Reverse2, Geometry1, Geometry2>::apply
(
geometry1, geometry2,
Direction == overlay_union
? geometry::detail::overlay::operation_union
: geometry::detail::overlay::operation_intersection,
turn_points, rings
);
#ifdef BOOST_GEOMETRY_TIME_OVERLAY
std::cout << "traverse: " << timer.elapsed() << std::endl;
#endif
std::map<ring_identifier, int> map;
map_turns(map, turn_points);
src/boost/geometry/algorithms/detail/overlay/overlay.hpp view on Meta::CPAN
struct do_reverse<clockwise, true> : boost::true_type {};
template <>
struct do_reverse<counterclockwise, false> : boost::true_type {};
template <>
struct do_reverse<counterclockwise, true> : boost::false_type {};
}} // namespace detail::overlay
#endif // DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_OVERLAY_HPP
src/boost/geometry/algorithms/detail/overlay/overlay_type.hpp view on Meta::CPAN
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_OVERLAY_TYPE_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_OVERLAY_TYPE_HPP
namespace boost { namespace geometry
{
enum overlay_type
{
overlay_union,
overlay_intersection,
overlay_difference,
overlay_dissolve
};
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_OVERLAY_TYPE_HPP
src/boost/geometry/algorithms/detail/overlay/ring_properties.hpp view on Meta::CPAN
#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/within.hpp>
#include <boost/geometry/algorithms/detail/point_on_border.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
template <typename Point>
struct ring_properties
{
typedef Point point_type;
typedef typename default_area_result<Point>::type area_type;
// Filled by "select_rings"
Point point;
src/boost/geometry/algorithms/detail/overlay/ring_properties.hpp view on Meta::CPAN
this->area = geometry::area(ring_or_box);
geometry::point_on_border(this->point, ring_or_box, midpoint);
}
inline area_type get_area() const
{
return reversed ? -area : area;
}
};
}} // namespace detail::overlay
#endif // DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_RING_PROPERTIES_HPP
src/boost/geometry/algorithms/detail/overlay/select_rings.hpp view on Meta::CPAN
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SELECT_RINGS_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SELECT_RINGS_HPP
#include <map>
#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/within.hpp>
#include <boost/geometry/algorithms/detail/point_on_border.hpp>
#include <boost/geometry/algorithms/detail/ring_identifier.hpp>
#include <boost/geometry/algorithms/detail/overlay/ring_properties.hpp>
#include <boost/geometry/algorithms/detail/overlay/overlay_type.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
namespace dispatch
{
template <typename Tag, typename Geometry>
struct select_rings
{};
src/boost/geometry/algorithms/detail/overlay/select_rings.hpp view on Meta::CPAN
for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it)
{
id.ring_index++;
per_ring::apply(*it, id, map, midpoint);
}
}
};
}
template<overlay_type OverlayType>
struct decide
{};
template<>
struct decide<overlay_union>
{
template <typename Code>
static bool include(ring_identifier const& , Code const& code)
{
return code.within_code * -1 == 1;
}
template <typename Code>
static bool reversed(ring_identifier const& , Code const& )
{
return false;
}
};
template<>
struct decide<overlay_difference>
{
template <typename Code>
static bool include(ring_identifier const& id, Code const& code)
{
bool is_first = id.source_index == 0;
return code.within_code * -1 * (is_first ? 1 : -1) == 1;
}
template <typename Code>
static bool reversed(ring_identifier const& id, Code const& code)
{
return include(id, code) && id.source_index == 1;
}
};
template<>
struct decide<overlay_intersection>
{
template <typename Code>
static bool include(ring_identifier const& , Code const& code)
{
return code.within_code * 1 == 1;
}
template <typename Code>
static bool reversed(ring_identifier const& , Code const& )
{
return false;
}
};
template
<
overlay_type OverlayType,
typename Geometry1, typename Geometry2,
typename IntersectionMap, typename SelectionMap
>
inline void update_selection_map(Geometry1 const& geometry1,
Geometry2 const& geometry2,
IntersectionMap const& intersection_map,
SelectionMap const& map_with_all, SelectionMap& selection_map)
{
selection_map.clear();
src/boost/geometry/algorithms/detail/overlay/select_rings.hpp view on Meta::CPAN
{
properties.reversed = decide<OverlayType>::reversed(id, properties);
selection_map[id] = properties;
}
}
}
}
/*!
\brief The function select_rings select rings based on the overlay-type (union,intersection)
*/
template
<
overlay_type OverlayType,
typename Geometry1, typename Geometry2,
typename IntersectionMap, typename SelectionMap
>
inline void select_rings(Geometry1 const& geometry1, Geometry2 const& geometry2,
IntersectionMap const& intersection_map,
SelectionMap& selection_map, bool midpoint)
{
typedef typename geometry::tag<Geometry1>::type tag1;
typedef typename geometry::tag<Geometry2>::type tag2;
src/boost/geometry/algorithms/detail/overlay/select_rings.hpp view on Meta::CPAN
ring_identifier(0, -1, -1), map_with_all, midpoint);
dispatch::select_rings<tag2, Geometry2>::apply(geometry2, geometry1,
ring_identifier(1, -1, -1), map_with_all, midpoint);
update_selection_map<OverlayType>(geometry1, geometry2, intersection_map,
map_with_all, selection_map);
}
template
<
overlay_type OverlayType,
typename Geometry,
typename IntersectionMap, typename SelectionMap
>
inline void select_rings(Geometry const& geometry,
IntersectionMap const& intersection_map,
SelectionMap& selection_map, bool midpoint)
{
typedef typename geometry::tag<Geometry>::type tag;
SelectionMap map_with_all;
dispatch::select_rings<tag, Geometry>::apply(geometry,
ring_identifier(0, -1, -1), map_with_all, midpoint);
update_selection_map<OverlayType>(geometry, geometry, intersection_map,
map_with_all, selection_map);
}
}} // namespace detail::overlay
#endif // DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SELECT_RINGS_HPP
src/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp view on Meta::CPAN
#include <boost/range.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/algorithms/detail/disjoint.hpp>
#include <boost/geometry/algorithms/detail/partition.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
#include <boost/geometry/geometries/box.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace self_get_turn_points
{
src/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp view on Meta::CPAN
>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
/*!
\brief Calculate self intersections of a geometry
\ingroup overlay
\tparam Geometry geometry type
\tparam Turns type of intersection container
(e.g. vector of "intersection/turn point"'s)
\param geometry geometry
\param turns container which will contain intersection points
\param interrupt_policy policy determining if process is stopped
when intersection is found
*/
template
<
src/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp view on Meta::CPAN
concept::check<Geometry const>();
typedef typename strategy_intersection
<
typename cs_tag<Geometry>::type,
Geometry,
Geometry,
typename boost::range_value<Turns>::type
>::segment_intersection_strategy_type strategy_type;
typedef detail::overlay::get_turn_info
<
typename point_type<Geometry>::type,
typename point_type<Geometry>::type,
typename boost::range_value<Turns>::type,
detail::overlay::assign_null_policy
> TurnPolicy;
dispatch::self_get_turn_points
<
typename tag<Geometry>::type,
Geometry,
Turns,
TurnPolicy,
InterruptPolicy
>::apply(geometry, turns, interrupt_policy);
src/boost/geometry/algorithms/detail/overlay/stream_info.hpp view on Meta::CPAN
#include <string>
#include <boost/array.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
static inline std::string dir(int d)
{
return d == 0 ? "-" : (d == 1 ? "L" : d == -1 ? "R" : "#");
}
static inline std::string how_str(int h)
{
return h == 0 ? "-" : (h == 1 ? "A" : "D");
src/boost/geometry/algorithms/detail/overlay/stream_info.hpp view on Meta::CPAN
<< info.visit_state;
if (info.flagged)
{
os << " FLAGGED";
}
return os;
}
}} // namespace detail::overlay
#endif //DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_STREAM_INFO_HPP