// Boost.Geometry (aka GGL, Generic Geometry Library)
-// Copyright (c) 2014-2015, Oracle and/or its affiliates.
+// Copyright (c) 2014-2017, 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
// 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_TEST_UNION_LINEAR_LINEAR_HPP
#define BOOST_GEOMETRY_TEST_UNION_LINEAR_LINEAR_HPP
//==================================================================
//==================================================================
+template <typename Geometry1, typename Geometry2, typename MultiLineString>
+inline void check_result(Geometry1 const& geometry1,
+ Geometry2 const& geometry2,
+ MultiLineString const& mls_output,
+ MultiLineString const& mls_union,
+ std::string const& case_id,
+ double tolerance)
+{
+ BOOST_CHECK_MESSAGE( equals::apply(mls_union, mls_output, tolerance),
+ "case id: " << case_id
+ << ", union L/L: " << bg::wkt(geometry1)
+ << " " << bg::wkt(geometry2)
+ << " -> Expected: " << bg::wkt(mls_union)
+ << " computed: " << bg::wkt(mls_output) );
+}
+
template
<
typename Geometry1, typename Geometry2,
linestring_vector ls_vector_output;
linestring_deque ls_deque_output;
+ // Check strategy passed explicitly
+ typedef typename bg::strategy::relate::services::default_strategy
+ <
+ Geometry1, Geometry2
+ >::type strategy_type;
+ bg::union_(geometry1, geometry2, mls_output, strategy_type());
+
+ check_result(geometry1, geometry2, mls_output, mls_union1, case_id, tolerance);
+
+ // Check normal behaviour
+ bg::clear(mls_output);
bg::union_(geometry1, geometry2, mls_output);
- BOOST_CHECK_MESSAGE( equals::apply(mls_union1, mls_output, tolerance),
- "case id: " << case_id
- << ", union L/L: " << bg::wkt(geometry1)
- << " " << bg::wkt(geometry2)
- << " -> Expected: " << bg::wkt(mls_union1)
- << " computed: " << bg::wkt(mls_output) );
+ check_result(geometry1, geometry2, mls_output, mls_union1, case_id, tolerance);
set_operation_output("union", case_id,
geometry1, geometry2, mls_output);
#endif
}
- // check the symmetric difference where the order of the two
+ // check the union where the order of the two
// geometries is reversed
bg::clear(mls_output);
bg::union_(geometry2, geometry1, mls_output);
- BOOST_CHECK_MESSAGE( equals::apply(mls_union2, mls_output, tolerance),
- "case id: " << case_id
- << ", union L/L: " << bg::wkt(geometry2)
- << " " << bg::wkt(geometry1)
- << " -> Expected: " << bg::wkt(mls_union2)
- << " computed: " << bg::wkt(mls_output) );
+ check_result(geometry1, geometry2, mls_output, mls_union2, case_id, tolerance);
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << "Geometry #1: " << bg::wkt(geometry2) << std::endl;