mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-02 21:02:13 +00:00
Merge pull request #257 from mkaravel/feature/set_ops_pointlike_linear
New feature: intersection and difference for pointlike/linear geometries
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2014.
|
||||
// Modifications copyright (c) 2014 Oracle and/or its affiliates.
|
||||
// This file was modified by Oracle on 2014, 2015.
|
||||
// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
#include <boost/geometry/algorithms/detail/overlay/linear_linear.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/pointlike_linear.hpp>
|
||||
|
||||
#if defined(BOOST_GEOMETRY_DEBUG_FOLLOW)
|
||||
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
|
||||
@@ -700,6 +701,79 @@ struct intersection_insert
|
||||
{};
|
||||
|
||||
|
||||
// dispatch for difference/intersection of pointlike-linear geometries
|
||||
template
|
||||
<
|
||||
typename Point, typename Linear, typename PointOut,
|
||||
overlay_type OverlayType,
|
||||
bool Reverse1, bool Reverse2, bool ReverseOut,
|
||||
typename Tag
|
||||
>
|
||||
struct intersection_insert
|
||||
<
|
||||
Point, Linear, PointOut, OverlayType,
|
||||
Reverse1, Reverse2, ReverseOut,
|
||||
point_tag, Tag, point_tag,
|
||||
false, false, false
|
||||
> : detail_dispatch::overlay::pointlike_linear_point
|
||||
<
|
||||
Point, Linear, PointOut, OverlayType,
|
||||
point_tag, typename tag_cast<Tag, segment_tag, linear_tag>::type
|
||||
>
|
||||
{};
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
typename MultiPoint, typename Linear, typename PointOut,
|
||||
overlay_type OverlayType,
|
||||
bool Reverse1, bool Reverse2, bool ReverseOut,
|
||||
typename Tag
|
||||
>
|
||||
struct intersection_insert
|
||||
<
|
||||
MultiPoint, Linear, PointOut, OverlayType,
|
||||
Reverse1, Reverse2, ReverseOut,
|
||||
multi_point_tag, Tag, point_tag,
|
||||
false, false, false
|
||||
> : detail_dispatch::overlay::pointlike_linear_point
|
||||
<
|
||||
MultiPoint, Linear, PointOut, OverlayType,
|
||||
multi_point_tag,
|
||||
typename tag_cast<Tag, segment_tag, linear_tag>::type
|
||||
>
|
||||
{};
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
typename Linestring, typename MultiPoint, typename PointOut,
|
||||
bool Reverse1, bool Reverse2, bool ReverseOut
|
||||
>
|
||||
struct intersection_insert
|
||||
<
|
||||
Linestring, MultiPoint, PointOut, overlay_intersection,
|
||||
Reverse1, Reverse2, ReverseOut,
|
||||
linestring_tag, multi_point_tag, point_tag,
|
||||
false, false, false
|
||||
>
|
||||
{
|
||||
template <typename RobustPolicy, typename OutputIterator, typename Strategy>
|
||||
static inline OutputIterator apply(Linestring const& linestring,
|
||||
MultiPoint const& multipoint,
|
||||
RobustPolicy const& robust_policy,
|
||||
OutputIterator out,
|
||||
Strategy const& strategy)
|
||||
{
|
||||
return detail_dispatch::overlay::pointlike_linear_point
|
||||
<
|
||||
MultiPoint, Linestring, PointOut, overlay_intersection,
|
||||
multi_point_tag, linear_tag
|
||||
>::apply(multipoint, linestring, robust_policy, out, strategy);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // namespace dispatch
|
||||
#endif // DOXYGEN_NO_DISPATCH
|
||||
|
||||
|
||||
@@ -0,0 +1,344 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2015, 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 <iterator>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/range.hpp>
|
||||
|
||||
#include <boost/geometry/core/tags.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/box.hpp>
|
||||
|
||||
#include <boost/geometry/iterators/segment_iterator.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/disjoint.hpp>
|
||||
#include <boost/geometry/algorithms/envelope.hpp>
|
||||
#include <boost/geometry/algorithms/expand.hpp>
|
||||
#include <boost/geometry/algorithms/not_implemented.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/not.hpp>
|
||||
#include <boost/geometry/algorithms/detail/partition.hpp>
|
||||
#include <boost/geometry/algorithms/detail/relate/less.hpp>
|
||||
#include <boost/geometry/algorithms/detail/disjoint/point_geometry.hpp>
|
||||
#include <boost/geometry/algorithms/detail/equals/point_point.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/overlay_type.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace overlay
|
||||
{
|
||||
|
||||
|
||||
// action struct for pointlike-linear difference/intersection
|
||||
// it works the same as its pointlike-pointlike counterpart, hence the
|
||||
// derivation
|
||||
template <typename PointOut, overlay_type OverlayType>
|
||||
struct action_selector_pl_l
|
||||
: action_selector_pl_pl<PointOut, OverlayType>
|
||||
{};
|
||||
|
||||
// difference/intersection of point-linear
|
||||
template
|
||||
<
|
||||
typename Point,
|
||||
typename Linear,
|
||||
typename PointOut,
|
||||
overlay_type OverlayType,
|
||||
typename Policy
|
||||
>
|
||||
struct point_linear_point
|
||||
{
|
||||
template <typename RobustPolicy, typename OutputIterator, typename Strategy>
|
||||
static inline OutputIterator apply(Point const& point,
|
||||
Linear const& linear,
|
||||
RobustPolicy const&,
|
||||
OutputIterator oit,
|
||||
Strategy const&)
|
||||
{
|
||||
action_selector_pl_l
|
||||
<
|
||||
PointOut, OverlayType
|
||||
>::apply(point, Policy::apply(point, linear), oit);
|
||||
return oit;
|
||||
}
|
||||
};
|
||||
|
||||
// difference/intersection of multipoint-segment
|
||||
template
|
||||
<
|
||||
typename MultiPoint,
|
||||
typename Segment,
|
||||
typename PointOut,
|
||||
overlay_type OverlayType,
|
||||
typename Policy
|
||||
>
|
||||
struct multipoint_segment_point
|
||||
{
|
||||
template <typename RobustPolicy, typename OutputIterator, typename Strategy>
|
||||
static inline OutputIterator apply(MultiPoint const& multipoint,
|
||||
Segment const& segment,
|
||||
RobustPolicy const&,
|
||||
OutputIterator oit,
|
||||
Strategy const&)
|
||||
{
|
||||
for (typename boost::range_iterator<MultiPoint const>::type
|
||||
it = boost::begin(multipoint);
|
||||
it != boost::end(multipoint);
|
||||
++it)
|
||||
{
|
||||
action_selector_pl_l
|
||||
<
|
||||
PointOut, OverlayType
|
||||
>::apply(*it, Policy::apply(*it, segment), oit);
|
||||
}
|
||||
|
||||
return oit;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// difference/intersection of multipoint-linear
|
||||
template
|
||||
<
|
||||
typename MultiPoint,
|
||||
typename Linear,
|
||||
typename PointOut,
|
||||
overlay_type OverlayType,
|
||||
typename Policy
|
||||
>
|
||||
class multipoint_linear_point
|
||||
{
|
||||
private:
|
||||
// structs for partition -- start
|
||||
struct expand_box
|
||||
{
|
||||
template <typename Box, typename Geometry>
|
||||
static inline void apply(Box& total, Geometry const& geometry)
|
||||
{
|
||||
geometry::expand(total, geometry::return_envelope<Box>(geometry));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct overlaps_box
|
||||
{
|
||||
template <typename Box, typename Geometry>
|
||||
static inline bool apply(Box const& box, Geometry const& geometry)
|
||||
{
|
||||
return ! geometry::disjoint(geometry, box);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename OutputIterator>
|
||||
class item_visitor_type
|
||||
{
|
||||
public:
|
||||
item_visitor_type(OutputIterator& oit) : m_oit(oit) {}
|
||||
|
||||
template <typename Item1, typename Item2>
|
||||
inline void apply(Item1 const& item1, Item2 const& item2)
|
||||
{
|
||||
action_selector_pl_l
|
||||
<
|
||||
PointOut, overlay_intersection
|
||||
>::apply(item1, Policy::apply(item1, item2), m_oit);
|
||||
}
|
||||
|
||||
private:
|
||||
OutputIterator& m_oit;
|
||||
};
|
||||
// structs for partition -- end
|
||||
|
||||
class segment_range
|
||||
{
|
||||
public:
|
||||
typedef geometry::segment_iterator<Linear const> const_iterator;
|
||||
typedef const_iterator iterator;
|
||||
|
||||
segment_range(Linear const& linear)
|
||||
: m_linear(linear)
|
||||
{}
|
||||
|
||||
const_iterator begin() const
|
||||
{
|
||||
return geometry::segments_begin(m_linear);
|
||||
}
|
||||
|
||||
const_iterator end() const
|
||||
{
|
||||
return geometry::segments_end(m_linear);
|
||||
}
|
||||
|
||||
private:
|
||||
Linear const& m_linear;
|
||||
};
|
||||
|
||||
template <typename OutputIterator>
|
||||
static inline OutputIterator get_common_points(MultiPoint const& multipoint,
|
||||
Linear const& linear,
|
||||
OutputIterator oit)
|
||||
{
|
||||
item_visitor_type<OutputIterator> item_visitor(oit);
|
||||
|
||||
segment_range rng(linear);
|
||||
|
||||
geometry::partition
|
||||
<
|
||||
geometry::model::box
|
||||
<
|
||||
typename boost::range_value<MultiPoint>::type
|
||||
>,
|
||||
expand_box,
|
||||
overlaps_box
|
||||
>::apply(multipoint, rng, item_visitor);
|
||||
|
||||
return oit;
|
||||
}
|
||||
|
||||
public:
|
||||
template <typename RobustPolicy, typename OutputIterator, typename Strategy>
|
||||
static inline OutputIterator apply(MultiPoint const& multipoint,
|
||||
Linear const& linear,
|
||||
RobustPolicy const& robust_policy,
|
||||
OutputIterator oit,
|
||||
Strategy const& strategy)
|
||||
{
|
||||
typedef std::vector
|
||||
<
|
||||
typename boost::range_value<MultiPoint>::type
|
||||
> point_vector_type;
|
||||
|
||||
point_vector_type common_points;
|
||||
|
||||
// compute the common points
|
||||
get_common_points(multipoint, linear,
|
||||
std::back_inserter(common_points));
|
||||
|
||||
return multipoint_multipoint_point
|
||||
<
|
||||
MultiPoint, point_vector_type, PointOut, OverlayType
|
||||
>::apply(multipoint, common_points, robust_policy, oit, strategy);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}} // namespace detail::overlay
|
||||
#endif // DOXYGEN_NO_DETAIL
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_DISPATCH
|
||||
namespace detail_dispatch { namespace overlay
|
||||
{
|
||||
|
||||
// dispatch struct for pointlike-linear difference/intersection computation
|
||||
template
|
||||
<
|
||||
typename PointLike,
|
||||
typename Linear,
|
||||
typename PointOut,
|
||||
overlay_type OverlayType,
|
||||
typename Tag1,
|
||||
typename Tag2
|
||||
>
|
||||
struct pointlike_linear_point
|
||||
: not_implemented<PointLike, Linear, PointOut>
|
||||
{};
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
typename Point,
|
||||
typename Linear,
|
||||
typename PointOut,
|
||||
overlay_type OverlayType
|
||||
>
|
||||
struct pointlike_linear_point
|
||||
<
|
||||
Point, Linear, PointOut, OverlayType, point_tag, linear_tag
|
||||
> : detail::overlay::point_linear_point
|
||||
<
|
||||
Point, Linear, PointOut, OverlayType,
|
||||
detail::not_<detail::disjoint::reverse_covered_by>
|
||||
>
|
||||
{};
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
typename Point,
|
||||
typename Segment,
|
||||
typename PointOut,
|
||||
overlay_type OverlayType
|
||||
>
|
||||
struct pointlike_linear_point
|
||||
<
|
||||
Point, Segment, PointOut, OverlayType, point_tag, segment_tag
|
||||
> : detail::overlay::point_linear_point
|
||||
<
|
||||
Point, Segment, PointOut, OverlayType,
|
||||
detail::not_<detail::disjoint::reverse_covered_by>
|
||||
>
|
||||
{};
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
typename MultiPoint,
|
||||
typename Linear,
|
||||
typename PointOut,
|
||||
overlay_type OverlayType
|
||||
>
|
||||
struct pointlike_linear_point
|
||||
<
|
||||
MultiPoint, Linear, PointOut, OverlayType, multi_point_tag, linear_tag
|
||||
> : detail::overlay::multipoint_linear_point
|
||||
<
|
||||
MultiPoint, Linear, PointOut, OverlayType,
|
||||
detail::not_<detail::disjoint::reverse_covered_by>
|
||||
>
|
||||
{};
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
typename MultiPoint,
|
||||
typename Segment,
|
||||
typename PointOut,
|
||||
overlay_type OverlayType
|
||||
>
|
||||
struct pointlike_linear_point
|
||||
<
|
||||
MultiPoint, Segment, PointOut, OverlayType, multi_point_tag, segment_tag
|
||||
> : detail::overlay::multipoint_segment_point
|
||||
<
|
||||
MultiPoint, Segment, PointOut, OverlayType,
|
||||
detail::not_<detail::disjoint::reverse_covered_by>
|
||||
>
|
||||
{};
|
||||
|
||||
|
||||
}} // namespace detail_dispatch::overlay
|
||||
#endif // DOXYGEN_NO_DISPATCH
|
||||
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
|
||||
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_POINTLIKE_LINEAR_HPP
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2014, Oracle and/or its affiliates.
|
||||
// Copyright (c) 2014-2015, Oracle and/or its affiliates.
|
||||
|
||||
// Licensed under the Boost Software License version 1.0.
|
||||
// http://www.boost.org/users/license.html
|
||||
@@ -264,7 +264,7 @@ struct multipoint_multipoint_point
|
||||
>::apply(multipoint2, multipoint1, robust_policy, oit, strategy);
|
||||
}
|
||||
|
||||
std::vector<typename point_type<MultiPoint2>::type>
|
||||
std::vector<typename boost::range_value<MultiPoint2>::type>
|
||||
points2(boost::begin(multipoint2), boost::end(multipoint2));
|
||||
|
||||
std::sort(points2.begin(), points2.end(), detail::relate::less());
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# 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) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
|
||||
# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
|
||||
#
|
||||
# This file was modified by Oracle on 2014.
|
||||
# Modifications copyright (c) 2014, Oracle and/or its affiliates.
|
||||
# This file was modified by Oracle on 2014, 2015.
|
||||
# Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
|
||||
#
|
||||
# Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
@@ -18,6 +18,7 @@ test-suite boost-geometry-algorithms-difference
|
||||
:
|
||||
[ run difference.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
|
||||
[ run difference_linear_linear.cpp ]
|
||||
[ run difference_pl_l.cpp ]
|
||||
[ run difference_pl_pl.cpp ]
|
||||
[ run multi_difference.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
|
||||
[ run multi_difference_spike.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
|
||||
|
||||
674
test/algorithms/set_operations/difference/difference_pl_l.cpp
Normal file
674
test/algorithms/set_operations/difference/difference_pl_l.cpp
Normal file
@@ -0,0 +1,674 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2015, 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_TEST_MODULE
|
||||
#define BOOST_TEST_MODULE test_difference_pointlike_linear
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
#include "../test_set_ops_pointlike.hpp"
|
||||
|
||||
#include <boost/geometry/geometries/point.hpp>
|
||||
#include <boost/geometry/geometries/linestring.hpp>
|
||||
#include <boost/geometry/geometries/segment.hpp>
|
||||
#include <boost/geometry/geometries/multi_point.hpp>
|
||||
#include <boost/geometry/geometries/multi_linestring.hpp>
|
||||
|
||||
typedef bg::model::point<double, 2, bg::cs::cartesian> point_type;
|
||||
typedef bg::model::segment<point_type> segment_type;
|
||||
typedef bg::model::linestring<point_type> linestring_type;
|
||||
typedef bg::model::multi_point<point_type> multi_point_type;
|
||||
typedef bg::model::multi_linestring<linestring_type> multi_linestring_type;
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//===========================================================================
|
||||
//===========================================================================
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_difference_point_segment )
|
||||
{
|
||||
#ifdef BOOST_GEOMETRY_TEST_DEBUG
|
||||
std::cout << "size of std::size_t: " << sizeof(std::size_t) << std::endl;
|
||||
std::cout << "size of range_iterator<multipoint>: "
|
||||
<< sizeof(boost::range_iterator<multi_point_type>::type)
|
||||
<< std::endl;
|
||||
std::cout << "size of range_iterator<multilinestring>: "
|
||||
<< sizeof(boost::range_iterator<multi_linestring_type>::type)
|
||||
<< std::endl;
|
||||
std::cout << "size of point_iterator<multipoint>: "
|
||||
<< sizeof(bg::point_iterator<multi_point_type>) << std::endl;
|
||||
std::cout << "size of point_iterator<linestring>: "
|
||||
<< sizeof(bg::point_iterator<linestring_type>) << std::endl;
|
||||
std::cout << "size of point_iterator<multilinestring>: "
|
||||
<< sizeof(bg::point_iterator<multi_linestring_type>) << std::endl;
|
||||
std::cout << "size of segment_iterator<linestring>: "
|
||||
<< sizeof(bg::segment_iterator<linestring_type>) << std::endl;
|
||||
std::cout << "size of segment_iterator<multilinestring>: "
|
||||
<< sizeof(bg::segment_iterator<multi_linestring_type>) << std::endl;
|
||||
|
||||
std::cout << std::endl << std::endl << std::endl;
|
||||
std::cout << "*** POINT / SEGMENT DIFFERENCE ***" << std::endl;
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
typedef point_type P;
|
||||
typedef segment_type S;
|
||||
typedef multi_point_type MP;
|
||||
|
||||
typedef test_set_op_of_pointlike_geometries
|
||||
<
|
||||
P, S, MP, bg::overlay_difference
|
||||
> tester;
|
||||
|
||||
tester::apply
|
||||
("psdf01",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<S>("SEGMENT(1 1,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("psdf02",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<S>("SEGMENT(0 0,1 1)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("psdf03",
|
||||
from_wkt<P>("POINT(1 1)"),
|
||||
from_wkt<S>("SEGMENT(0 0,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("psdf04",
|
||||
from_wkt<P>("POINT(3 3)"),
|
||||
from_wkt<S>("SEGMENT(0 0,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT(3 3)")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_difference_point_linestring )
|
||||
{
|
||||
#ifdef BOOST_GEOMETRY_TEST_DEBUG
|
||||
std::cout << std::endl << std::endl << std::endl;
|
||||
std::cout << "*** POINT / LINESTRING DIFFERENCE ***" << std::endl;
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
typedef point_type P;
|
||||
typedef linestring_type L;
|
||||
typedef multi_point_type MP;
|
||||
|
||||
typedef test_set_op_of_pointlike_geometries
|
||||
<
|
||||
P, L, MP, bg::overlay_difference
|
||||
> tester;
|
||||
|
||||
tester::apply
|
||||
("pldf01",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<L>("LINESTRING(1 1,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pldf02",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pldf03",
|
||||
from_wkt<P>("POINT(1 1)"),
|
||||
from_wkt<L>("LINESTRING(0 0,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pldf04",
|
||||
from_wkt<P>("POINT(3 3)"),
|
||||
from_wkt<L>("LINESTRING(0 0,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT(3 3)")
|
||||
);
|
||||
|
||||
// linestrings with more than two points
|
||||
tester::apply
|
||||
("pldf05",
|
||||
from_wkt<P>("POINT(1 1)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pldf06",
|
||||
from_wkt<P>("POINT(2 2)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pldf07",
|
||||
from_wkt<P>("POINT(10 10)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
|
||||
from_wkt<MP>("MULTIPOINT(10 10)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pldf08",
|
||||
from_wkt<P>("POINT(0 1)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 1)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pldf09",
|
||||
from_wkt<P>("POINT(4 4)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pldf10",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_difference_point_multilinestring )
|
||||
{
|
||||
#ifdef BOOST_GEOMETRY_TEST_DEBUG
|
||||
std::cout << std::endl << std::endl << std::endl;
|
||||
std::cout << "*** POINT / MULTILINESTRING DIFFERENCE ***" << std::endl;
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
typedef point_type P;
|
||||
typedef multi_linestring_type ML;
|
||||
typedef multi_point_type MP;
|
||||
|
||||
typedef test_set_op_of_pointlike_geometries
|
||||
<
|
||||
P, ML, MP, bg::overlay_difference
|
||||
> tester;
|
||||
|
||||
tester::apply
|
||||
("pmldf01",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 1,2 2))"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmldf02",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 1))"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmldf03",
|
||||
from_wkt<P>("POINT(1 1)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,2 2))"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmldf04",
|
||||
from_wkt<P>("POINT(3 3)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,2 2))"),
|
||||
from_wkt<MP>("MULTIPOINT(3 3)")
|
||||
);
|
||||
|
||||
// linestrings with more than two points
|
||||
tester::apply
|
||||
("pmldf05",
|
||||
from_wkt<P>("POINT(1 1)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 1,2 2))"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmldf06",
|
||||
from_wkt<P>("POINT(2 2)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmldf07",
|
||||
from_wkt<P>("POINT(10 10)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT(10 10)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmldf08",
|
||||
from_wkt<P>("POINT(0 1)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT(0 1)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmldf09",
|
||||
from_wkt<P>("POINT(4 4)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmldf10",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
// multilinestrings with more than one linestring
|
||||
tester::apply
|
||||
("pmldf11",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((-10,-10),(0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmldf12",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((-10 0,0 0,10 0),(0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmldf13",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmldf14",
|
||||
from_wkt<P>("POINT(-20 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT(-20 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmldf15",
|
||||
from_wkt<P>("POINT(0 1)"),
|
||||
from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT(0 1)")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_difference_multipoint_segment )
|
||||
{
|
||||
#ifdef BOOST_GEOMETRY_TEST_DEBUG
|
||||
std::cout << std::endl << std::endl << std::endl;
|
||||
std::cout << "*** MULTIPOINT / SEGMENT DIFFERENCE ***" << std::endl;
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
typedef multi_point_type MP;
|
||||
typedef segment_type S;
|
||||
|
||||
typedef test_set_op_of_pointlike_geometries
|
||||
<
|
||||
MP, S, MP, bg::overlay_difference
|
||||
> tester;
|
||||
|
||||
tester::apply
|
||||
("mpsdf01",
|
||||
from_wkt<MP>("MULTIPOINT(0 0)"),
|
||||
from_wkt<S>("SEGMENT(1 1,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsdf02",
|
||||
from_wkt<MP>("MULTIPOINT(0 0)"),
|
||||
from_wkt<S>("SEGMENT(0 0,1 1)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsdf03",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
|
||||
from_wkt<S>("SEGMENT(1 1,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsdf04",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
|
||||
from_wkt<S>("SEGMENT(0 0,1 1)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsdf05",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
|
||||
from_wkt<S>("SEGMENT(1 1,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsf06",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
|
||||
from_wkt<S>("SEGMENT(1 0,2 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsdf07",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<S>("SEGMENT(0 0,1 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(2 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsdf08",
|
||||
from_wkt<MP>("MULTIPOINT()"),
|
||||
from_wkt<S>("SEGMENT(0 0,1 1)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsdf09",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<S>("SEGMENT(-1 0,1 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(2 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsdf10",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<S>("SEGMENT(1 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsdf11",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<S>("SEGMENT(-1 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsdf12",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<S>("SEGMENT(3 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsdf12a",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0)"),
|
||||
from_wkt<S>("SEGMENT(3 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsdf12b",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0,2 0)"),
|
||||
from_wkt<S>("SEGMENT(3 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0,2 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsdf12c",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0,2 0,0 0)"),
|
||||
from_wkt<S>("SEGMENT(3 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,0 0,2 0,2 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsdf13",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<S>("SEGMENT(2 0,2 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsdf14",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<S>("SEGMENT(0 0,0 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(2 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsdf15",
|
||||
from_wkt<MP>("MULTIPOINT()"),
|
||||
from_wkt<S>("SEGMENT(0 0,1 0)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_difference_multipoint_linestring )
|
||||
{
|
||||
#ifdef BOOST_GEOMETRY_TEST_DEBUG
|
||||
std::cout << std::endl << std::endl << std::endl;
|
||||
std::cout << "*** MULTIPOINT / LINESTRING DIFFERENCE ***" << std::endl;
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
typedef multi_point_type MP;
|
||||
typedef linestring_type L;
|
||||
|
||||
typedef test_set_op_of_pointlike_geometries
|
||||
<
|
||||
MP, L, MP, bg::overlay_difference
|
||||
> tester;
|
||||
|
||||
tester::apply
|
||||
("mpldf01",
|
||||
from_wkt<MP>("MULTIPOINT(0 0)"),
|
||||
from_wkt<L>("LINESTRING(1 1,2 2,3 3,4 4,5 5)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpldf02",
|
||||
from_wkt<MP>("MULTIPOINT(0 0)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpldf03",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
|
||||
from_wkt<L>("LINESTRING(1 1,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpldf04",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpldf05",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
|
||||
from_wkt<L>("LINESTRING(1 1,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mplf06",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
|
||||
from_wkt<L>("LINESTRING(1 0,2 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpldf07",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(2 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpldf08",
|
||||
from_wkt<MP>("MULTIPOINT()"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpldf09",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<L>("LINESTRING(-1 0,1 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(2 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpldf10",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<L>("LINESTRING(1 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpldf11",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<L>("LINESTRING(-1 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpldf12",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<L>("LINESTRING(3 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpldf13",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<L>("LINESTRING(2 0,2 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpldf14",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<L>("LINESTRING(0 0,0 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(2 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpldf15",
|
||||
from_wkt<MP>("MULTIPOINT()"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 0,2 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpldf16",
|
||||
from_wkt<MP>("MULTIPOINT()"),
|
||||
from_wkt<L>("LINESTRING()"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_difference_multipoint_multilinestring )
|
||||
{
|
||||
#ifdef BOOST_GEOMETRY_TEST_DEBUG
|
||||
std::cout << std::endl << std::endl << std::endl;
|
||||
std::cout << "*** MULTIPOINT / MULTILINESTRING DIFFERENCE ***" << std::endl;
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
typedef multi_point_type MP;
|
||||
typedef multi_linestring_type ML;
|
||||
|
||||
typedef test_set_op_of_pointlike_geometries
|
||||
<
|
||||
MP, ML, MP, bg::overlay_difference
|
||||
> tester;
|
||||
|
||||
tester::apply
|
||||
("mpmldf01",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,1 1,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,2 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpmldf02",
|
||||
from_wkt<MP>("MULTIPOINT(2 2,3 3,0 0,0 0,2 2,1 1,1 1,1 0,1 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,1 1,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpmldf03",
|
||||
from_wkt<MP>("MULTIPOINT(5 5,3 3,0 0,0 0,5 5,1 1,1 1,1 0,1 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,1 1,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT(5 5,5 5,0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpmldf04",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,0 0,1 1,0 0))"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpmldf05",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0,5 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 1,0 0,1 2,1 0),\
|
||||
(0 1,2 0,0 10,2 0,2 10,5 10,5 0,5 10))"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpmldf05a",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,1 0,6 0,7 0,2 0,5 0,7 0,8 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 1,0 0,1 2,1 0),\
|
||||
(0 1,2 0,0 10,2 0,2 10,5 10,5 0,5 10))"),
|
||||
from_wkt<MP>("MULTIPOINT(7 0,7 0,8 0,6 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpmldf06",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
|
||||
from_wkt<ML>("MULTILINESTRING(())"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpmldf07",
|
||||
from_wkt<MP>("MULTIPOINT()"),
|
||||
from_wkt<ML>("MULTILINESTRING(())"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpmldf08",
|
||||
from_wkt<MP>("MULTIPOINT()"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 0),(9 0,10 0))"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
# 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) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
|
||||
# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
|
||||
#
|
||||
# This file was modified by Oracle on 2014.
|
||||
# Modifications copyright (c) 2014, Oracle and/or its affiliates.
|
||||
# This file was modified by Oracle on 2014, 2015.
|
||||
# Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
|
||||
#
|
||||
# Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
@@ -18,6 +18,7 @@ test-suite boost-geometry-algorithms-intersection
|
||||
:
|
||||
[ run intersection.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
|
||||
[ run intersection_linear_linear.cpp ]
|
||||
[ run intersection_pl_l.cpp ]
|
||||
[ run intersection_pl_pl.cpp ]
|
||||
[ run multi_intersection.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
|
||||
;
|
||||
|
||||
@@ -0,0 +1,702 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2015, 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_TEST_MODULE
|
||||
#define BOOST_TEST_MODULE test_intersection_pointlike_linear
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
#include "../test_set_ops_pointlike.hpp"
|
||||
|
||||
#include <boost/geometry/geometries/point.hpp>
|
||||
#include <boost/geometry/geometries/linestring.hpp>
|
||||
#include <boost/geometry/geometries/segment.hpp>
|
||||
#include <boost/geometry/geometries/multi_point.hpp>
|
||||
#include <boost/geometry/geometries/multi_linestring.hpp>
|
||||
|
||||
typedef bg::model::point<double, 2, bg::cs::cartesian> point_type;
|
||||
typedef bg::model::segment<point_type> segment_type;
|
||||
typedef bg::model::linestring<point_type> linestring_type;
|
||||
typedef bg::model::multi_point<point_type> multi_point_type;
|
||||
typedef bg::model::multi_linestring<linestring_type> multi_linestring_type;
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//===========================================================================
|
||||
//===========================================================================
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_intersection_point_segment )
|
||||
{
|
||||
#ifdef BOOST_GEOMETRY_TEST_DEBUG
|
||||
std::cout << std::endl << std::endl << std::endl;
|
||||
std::cout << "*** POINT / SEGMENT INTERSECTION ***" << std::endl;
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
typedef point_type P;
|
||||
typedef segment_type S;
|
||||
typedef multi_point_type MP;
|
||||
|
||||
typedef test_set_op_of_pointlike_geometries
|
||||
<
|
||||
P, S, MP, bg::overlay_intersection
|
||||
> tester;
|
||||
|
||||
tester::apply
|
||||
("psi01",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<S>("SEGMENT(1 1,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("psi02",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<S>("SEGMENT(0 0,1 1)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("psi03",
|
||||
from_wkt<P>("POINT(1 1)"),
|
||||
from_wkt<S>("SEGMENT(0 0,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT(1 1)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("psi04",
|
||||
from_wkt<P>("POINT(3 3)"),
|
||||
from_wkt<S>("SEGMENT(0 0,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_intersection_point_linestring )
|
||||
{
|
||||
#ifdef BOOST_GEOMETRY_TEST_DEBUG
|
||||
std::cout << std::endl << std::endl << std::endl;
|
||||
std::cout << "*** POINT / LINESTRING INTERSECTION ***" << std::endl;
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
typedef point_type P;
|
||||
typedef linestring_type L;
|
||||
typedef multi_point_type MP;
|
||||
|
||||
typedef test_set_op_of_pointlike_geometries
|
||||
<
|
||||
P, L, MP, bg::overlay_intersection
|
||||
> tester;
|
||||
|
||||
tester::apply
|
||||
("pli01",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<L>("LINESTRING(1 1,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pli02",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pli03",
|
||||
from_wkt<P>("POINT(1 1)"),
|
||||
from_wkt<L>("LINESTRING(0 0,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT(1 1)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pli04",
|
||||
from_wkt<P>("POINT(3 3)"),
|
||||
from_wkt<L>("LINESTRING(0 0,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
// linestrings with more than two points
|
||||
tester::apply
|
||||
("pli05",
|
||||
from_wkt<P>("POINT(1 1)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT(1 1)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pli06",
|
||||
from_wkt<P>("POINT(2 2)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
|
||||
from_wkt<MP>("MULTIPOINT(2 2)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pli07",
|
||||
from_wkt<P>("POINT(10 10)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pli08",
|
||||
from_wkt<P>("POINT(0 1)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pli09",
|
||||
from_wkt<P>("POINT(4 4)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
|
||||
from_wkt<MP>("MULTIPOINT(4 4)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pli10",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0)")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_intersection_point_multilinestring )
|
||||
{
|
||||
#ifdef BOOST_GEOMETRY_TEST_DEBUG
|
||||
std::cout << std::endl << std::endl << std::endl;
|
||||
std::cout << "*** POINT / MULTILINESTRING INTERSECTION ***" << std::endl;
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
typedef point_type P;
|
||||
typedef multi_linestring_type ML;
|
||||
typedef multi_point_type MP;
|
||||
|
||||
typedef test_set_op_of_pointlike_geometries
|
||||
<
|
||||
P, ML, MP, bg::overlay_intersection
|
||||
> tester;
|
||||
|
||||
tester::apply
|
||||
("pmli01",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 1,2 2))"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmli02",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 1))"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmli03",
|
||||
from_wkt<P>("POINT(1 1)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,2 2))"),
|
||||
from_wkt<MP>("MULTIPOINT(1 1)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmli04",
|
||||
from_wkt<P>("POINT(3 3)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,2 2))"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
// linestrings with more than two points
|
||||
tester::apply
|
||||
("pmli05",
|
||||
from_wkt<P>("POINT(1 1)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 1,2 2))"),
|
||||
from_wkt<MP>("MULTIPOINT(1 1)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmli06",
|
||||
from_wkt<P>("POINT(2 2)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT(2 2)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmli07",
|
||||
from_wkt<P>("POINT(10 10)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmli08",
|
||||
from_wkt<P>("POINT(0 1)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmli09",
|
||||
from_wkt<P>("POINT(4 4)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT(4 4)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmli10",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0)")
|
||||
);
|
||||
|
||||
// multilinestrings with more than one linestring
|
||||
tester::apply
|
||||
("pmli11",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((-10,-10),(0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmli12",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((-10 0,0 0,10 0),(0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmli13",
|
||||
from_wkt<P>("POINT(0 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmli14",
|
||||
from_wkt<P>("POINT(-20 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmli15",
|
||||
from_wkt<P>("POINT(0 1)"),
|
||||
from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 0,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmli16",
|
||||
from_wkt<P>("POINT(1 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(-1 0,2 0,20 0))"),
|
||||
from_wkt<MP>("MULTIPOINT(1 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("pmli17",
|
||||
from_wkt<P>("POINT(1 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 -1,0 2,0 4))"),
|
||||
from_wkt<MP>("MULTIPOINT(1 0)")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_intersection_multipoint_segment )
|
||||
{
|
||||
#ifdef BOOST_GEOMETRY_TEST_DEBUG
|
||||
std::cout << std::endl << std::endl << std::endl;
|
||||
std::cout << "*** MULTIPOINT / SEGMENT INTERSECTION ***" << std::endl;
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
typedef multi_point_type MP;
|
||||
typedef segment_type S;
|
||||
|
||||
typedef test_set_op_of_pointlike_geometries
|
||||
<
|
||||
MP, S, MP, bg::overlay_intersection
|
||||
> tester;
|
||||
|
||||
tester::apply
|
||||
("mpsi01",
|
||||
from_wkt<MP>("MULTIPOINT(0 0)"),
|
||||
from_wkt<S>("SEGMENT(1 1,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsi02",
|
||||
from_wkt<MP>("MULTIPOINT(0 0)"),
|
||||
from_wkt<S>("SEGMENT(0 0,1 1)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsi03",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
|
||||
from_wkt<S>("SEGMENT(1 1,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsi04",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
|
||||
from_wkt<S>("SEGMENT(0 0,1 1)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsi05",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
|
||||
from_wkt<S>("SEGMENT(1 1,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsf06",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
|
||||
from_wkt<S>("SEGMENT(1 0,2 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(1 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsi07",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<S>("SEGMENT(0 0,1 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsi07a",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<S>("SEGMENT(0 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsi08",
|
||||
from_wkt<MP>("MULTIPOINT()"),
|
||||
from_wkt<S>("SEGMENT(0 0,1 1)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsi09",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<S>("SEGMENT(-1 0,1 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsi10",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<S>("SEGMENT(1 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(2 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsi11",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<S>("SEGMENT(-1 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsi12",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<S>("SEGMENT(3 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsi12a",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0)"),
|
||||
from_wkt<S>("SEGMENT(3 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsi12b",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0,2 0)"),
|
||||
from_wkt<S>("SEGMENT(3 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsi12c",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0,2 0,0 0)"),
|
||||
from_wkt<S>("SEGMENT(3 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsi13",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<S>("SEGMENT(2 0,2 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(2 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsi14",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<S>("SEGMENT(0 0,0 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsi15",
|
||||
from_wkt<MP>("MULTIPOINT()"),
|
||||
from_wkt<S>("SEGMENT(0 0,1 0)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpsi16",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0,2 0,0 0)"),
|
||||
from_wkt<S>("SEGMENT(-1 0,10 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,0 0,2 0,2 0)")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_intersection_multipoint_linestring )
|
||||
{
|
||||
#ifdef BOOST_GEOMETRY_TEST_DEBUG
|
||||
std::cout << std::endl << std::endl << std::endl;
|
||||
std::cout << "*** MULTIPOINT / LINESTRING INTERSECTION ***" << std::endl;
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
typedef multi_point_type MP;
|
||||
typedef linestring_type L;
|
||||
|
||||
typedef test_set_op_of_pointlike_geometries
|
||||
<
|
||||
MP, L, MP, bg::overlay_intersection
|
||||
> tester;
|
||||
|
||||
tester::apply
|
||||
("mpli01",
|
||||
from_wkt<MP>("MULTIPOINT(0 0)"),
|
||||
from_wkt<L>("LINESTRING(1 1,2 2,3 3,4 4,5 5)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpli02",
|
||||
from_wkt<MP>("MULTIPOINT(0 0)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpli03",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
|
||||
from_wkt<L>("LINESTRING(1 1,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpli04",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpli05",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
|
||||
from_wkt<L>("LINESTRING(1 1,2 2)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpli06",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
|
||||
from_wkt<L>("LINESTRING(1 0,2 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(1 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpli07",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpli08",
|
||||
from_wkt<MP>("MULTIPOINT()"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 1)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpli09",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<L>("LINESTRING(-1 0,1 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpli10",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<L>("LINESTRING(1 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(2 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpli10a",
|
||||
from_wkt<MP>("MULTIPOINT(2 0,0 0,2 0,0 0,2 0)"),
|
||||
from_wkt<L>("LINESTRING(1 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(2 0,2 0,2 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpli11",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<L>("LINESTRING(-1 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(2 0,0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpli12",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<L>("LINESTRING(3 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpli13",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<L>("LINESTRING(2 0,2 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(2 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpli14",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
|
||||
from_wkt<L>("LINESTRING(0 0,0 0)"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpli15",
|
||||
from_wkt<MP>("MULTIPOINT()"),
|
||||
from_wkt<L>("LINESTRING(0 0,1 0,2 0,3 0)"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpli16",
|
||||
from_wkt<MP>("MULTIPOINT()"),
|
||||
from_wkt<L>("LINESTRING()"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_intersection_multipoint_multilinestring )
|
||||
{
|
||||
#ifdef BOOST_GEOMETRY_TEST_DEBUG
|
||||
std::cout << std::endl << std::endl << std::endl;
|
||||
std::cout << "*** MULTIPOINT / MULTILINESTRING INTERSECTION ***"
|
||||
<< std::endl;
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
typedef multi_point_type MP;
|
||||
typedef multi_linestring_type ML;
|
||||
|
||||
typedef test_set_op_of_pointlike_geometries
|
||||
<
|
||||
MP, ML, MP, bg::overlay_intersection
|
||||
> tester;
|
||||
|
||||
tester::apply
|
||||
("mpmli01",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,1 1,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT(1 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpmli02",
|
||||
from_wkt<MP>("MULTIPOINT(2 2,3 3,0 0,0 0,2 2,1 1,1 1,1 0,1 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,1 1,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT(2 2,2 2,3 3,1 1,1 1,1 0,1 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpmli03",
|
||||
from_wkt<MP>("MULTIPOINT(5 5,3 3,0 0,0 0,5 5,1 1,1 1,1 0,1 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,1 1,1 1,4 4))"),
|
||||
from_wkt<MP>("MULTIPOINT(1 0,1 0,3 3,1 1,1 1)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpmli04",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,0 0,1 1,0 0))"),
|
||||
from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,1 1)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpmli05",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0,5 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 1,0 0,1 2,1 0),\
|
||||
(0 1,2 0,0 10,2 0,2 10,5 10,5 0,5 10))"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0,5 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpmli06",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
|
||||
from_wkt<ML>("MULTILINESTRING(())"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpmli07",
|
||||
from_wkt<MP>("MULTIPOINT()"),
|
||||
from_wkt<ML>("MULTILINESTRING(())"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpmli08",
|
||||
from_wkt<MP>("MULTIPOINT()"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 0),(9 0,10 0))"),
|
||||
from_wkt<MP>("MULTIPOINT()")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpmli09",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,1 1,0 0,0 0,0 0,0 0,0 0,0 0,\
|
||||
0 0,0 0,0 0,0 0,0 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,0 1),(0 0,2 0),(0 0,0 3),\
|
||||
(0 0,4 0),(0 0,0 5),(0 0,6 0),(0 0,7 0),(0 0,8 0))"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0,0 0,0 0,0 0,0 0,0 0,\
|
||||
0 0,0 0,0 0,0 0,0 0)")
|
||||
);
|
||||
|
||||
tester::apply
|
||||
("mpmli09a",
|
||||
from_wkt<MP>("MULTIPOINT(0 0,1 1,0 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,0 1),(0 0,2 0),(0 0,0 3),\
|
||||
(0 0,4 0),(0 0,0 5),(0 0,6 0),(0 0,7 0),(0 0,8 0))"),
|
||||
from_wkt<MP>("MULTIPOINT(0 0,0 0)")
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user