From caadd6ce000ace4e28ae79d108bbc55cb2078a1a Mon Sep 17 00:00:00 2001 From: Menelaos Karavelas Date: Thu, 10 Apr 2014 08:45:38 +0300 Subject: [PATCH] [set ops] replace included unit test by unit test --- .../detail/overlay/pointlike_linear.hpp | 216 ------------------ test/algorithms/difference_linear_linear.cpp | 2 +- test/algorithms/difference_pl_pl.cpp | 2 +- .../algorithms/intersection_linear_linear.cpp | 2 +- test/algorithms/intersection_pl_pl.cpp | 2 +- .../sym_difference_linear_linear.cpp | 2 +- test/algorithms/union_linear_linear.cpp | 2 +- test/algorithms/union_pl_pl.cpp | 2 +- 8 files changed, 7 insertions(+), 223 deletions(-) delete mode 100644 include/boost/geometry/algorithms/detail/overlay/pointlike_linear.hpp diff --git a/include/boost/geometry/algorithms/detail/overlay/pointlike_linear.hpp b/include/boost/geometry/algorithms/detail/overlay/pointlike_linear.hpp deleted file mode 100644 index 5461a6e6f..000000000 --- a/include/boost/geometry/algorithms/detail/overlay/pointlike_linear.hpp +++ /dev/null @@ -1,216 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2014, Oracle and/or its affiliates. - -// Licensed under the Boost Software License version 1.0. -// http://www.boost.org/users/license.html - -// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle - - -#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_POINTLIKE_LINEAR_HPP -#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_POINTLIKE_LINEAR_HPP - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace overlay -{ - - -template -< - typename Point, - typename Linear, - typename PointOut, - overlay_type OverlayType -> -struct point_linear_point -{ - template - < - typename OutputIterator, typename Strategy - > - static inline OutputIterator apply(Point const& point, - Linear const& linear, - OutputIterator oit, - Strategy const&) - { - bool contained = geometry::within(point, linear); - action_selector_pl_pl - < - PointOut, OverlayType - >::apply(point, contained, oit); - return oit; - } -}; - - - - -//=========================================================================== -//=========================================================================== -//=========================================================================== - - - - -template -< - typename MultiPoint1, - typename Linear2, - typename PointOut, - overlay_type OverlayType -> -class multipoint_linear_point -{ -private: - typedef typename point_type::type Point1; - typedef model::linestring Linestring1; - typedef model::multi_linestring MultiLinestring1; - - - template - static inline - void multipoint_to_multilinestring(MultiPoint const& multipoint, - MultiLinestring& multilinestring) - { - typedef typename boost::range_value - < - MultiLinestring - >::type Linestring; - - BOOST_AUTO_TPL(it, boost::begin(multipoint)); - for (; it != boost::end(multipoint); ++it) - { - Linestring linestring; - geometry::append(linestring, *it); - geometry::append(linestring, *it); - traits::push_back::apply(multilinestring, - linestring); - } - } - - - struct AssignPolicy - { - static bool const include_no_turn = false; - static bool const include_degenerate = true; - static bool const include_opposite = false; - - template - < - typename Info, - typename Point1, - typename Point2, - typename IntersectionInfo, - typename DirInfo - > - static inline void apply(Info& info, Point1 const& p1, Point2 const& p2, - IntersectionInfo const& ii, DirInfo const& di) - { - calculate_distance_policy::apply(info, p1, p2, ii, di); - } - }; - - - template - < - typename Turns, - typename LinearGeometry1, - typename LinearGeometry2 - > - static inline void compute_turns(Turns& turns, - LinearGeometry1 const& linear1, - LinearGeometry2 const& linear2) - { - turns.clear(); - geometry::detail::relate::turns::get_turns - < - LinearGeometry1, - LinearGeometry2, - detail::get_turns::get_turn_info_type - < - LinearGeometry1, - LinearGeometry2, - AssignPolicy - > - >::apply(turns, linear1, linear2); - } - - template - struct TurnLess - { - geometry::less turn_point_less; - - template - bool operator()(Turn const& turn1, Turn const& turn2) const - { - return turn_point_less(turn1.point, turn2.point); - } - }; - - -public: - template - < - typename OutputIterator, typename Strategy - > - static inline OutputIterator apply(MultiPoint1 const& multipoint1, - Linear2 const& linear2, - OutputIterator oit, - Strategy const& strategy) - { - typedef traversal_turn_info turn_info; - - typedef std::vector Turns; - - MultiLinestring1 multilinestring1; - multipoint_to_multilinestring(multipoint1, multilinestring1); - - Turns turns; - compute_turns(turns, multilinestring1, linear2); - -#ifdef GEOMETRY_TEST_DEBUG - detail::turns::print_turns(multilinestring1, linear2, turns); -#endif - - MultiPoint1 turn_points; - for (typename Turns::const_iterator it = turns.begin(); - it != turns.end(); ++it) - { - geometry::append(turn_points, it->point); - } - - return multipoint_multipoint_point - < - MultiPoint1, MultiPoint1, PointOut, OverlayType - >::apply(multipoint1, turn_points, oit, strategy); - } -}; - - - - -}} // namespace detail::overlay -#endif // DOXYGEN_NO_DETAIL - - -}} // namespace boost::geometry - - - -#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_POINTLIKE_LINEAR_HPP diff --git a/test/algorithms/difference_linear_linear.cpp b/test/algorithms/difference_linear_linear.cpp index fc002cbea..055e27e6f 100644 --- a/test/algorithms/difference_linear_linear.cpp +++ b/test/algorithms/difference_linear_linear.cpp @@ -18,7 +18,7 @@ #define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER #endif -#include +#include #include "test_difference_linear_linear.hpp" diff --git a/test/algorithms/difference_pl_pl.cpp b/test/algorithms/difference_pl_pl.cpp index ed3cce984..e18a9ab13 100644 --- a/test/algorithms/difference_pl_pl.cpp +++ b/test/algorithms/difference_pl_pl.cpp @@ -18,7 +18,7 @@ #define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER #endif -#include +#include #include "test_set_ops_pl_pl.hpp" diff --git a/test/algorithms/intersection_linear_linear.cpp b/test/algorithms/intersection_linear_linear.cpp index 845cd5822..8923ccf9f 100644 --- a/test/algorithms/intersection_linear_linear.cpp +++ b/test/algorithms/intersection_linear_linear.cpp @@ -18,7 +18,7 @@ #define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER #endif -#include +#include #include "test_intersection_linear_linear.hpp" diff --git a/test/algorithms/intersection_pl_pl.cpp b/test/algorithms/intersection_pl_pl.cpp index a405f558a..22d906d19 100644 --- a/test/algorithms/intersection_pl_pl.cpp +++ b/test/algorithms/intersection_pl_pl.cpp @@ -18,7 +18,7 @@ #define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER #endif -#include +#include #include "test_set_ops_pl_pl.hpp" diff --git a/test/algorithms/sym_difference_linear_linear.cpp b/test/algorithms/sym_difference_linear_linear.cpp index 0a56103ce..4866d50e3 100644 --- a/test/algorithms/sym_difference_linear_linear.cpp +++ b/test/algorithms/sym_difference_linear_linear.cpp @@ -18,7 +18,7 @@ #define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER #endif -#include +#include #include "test_sym_difference_linear_linear.hpp" diff --git a/test/algorithms/union_linear_linear.cpp b/test/algorithms/union_linear_linear.cpp index 538a976b5..580fe5da9 100644 --- a/test/algorithms/union_linear_linear.cpp +++ b/test/algorithms/union_linear_linear.cpp @@ -18,7 +18,7 @@ #define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER #endif -#include +#include #include "test_union_linear_linear.hpp" diff --git a/test/algorithms/union_pl_pl.cpp b/test/algorithms/union_pl_pl.cpp index f458d9fba..2d74964d8 100644 --- a/test/algorithms/union_pl_pl.cpp +++ b/test/algorithms/union_pl_pl.cpp @@ -18,7 +18,7 @@ #define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER #endif -#include +#include #include "test_set_ops_pl_pl.hpp"