[disjoint] [test] Code cleaning

This commit is contained in:
Vissarion Fysikopoulos 2017-02-16 16:43:52 +02:00
parent 2ef3f99fc3
commit 6a2b202eb6
5 changed files with 36 additions and 35 deletions

View File

@ -61,13 +61,7 @@ struct disjoint
{
typedef typename strategy::disjoint::services::default_strategy
<
Geometry1, Geometry2,
typename geometry::tag<Geometry1>::type,
typename geometry::tag<Geometry2>::type,
geometry::topological_dimension<Geometry1>::value,
geometry::topological_dimension<Geometry2>::value,
typename cs_tag<Geometry1>::type,
typename cs_tag<Geometry2>::type
Geometry1, Geometry2
>::type strategy_type;
return dispatch::disjoint

View File

@ -137,14 +137,9 @@ private:
// coordinates are assumed to be in radians
BOOST_GEOMETRY_ASSERT(lon1 <= lon2);
//CalculationType lon1_rad = math::as_radian<Units>(lon1);
CalculationType lat1_rad = math::as_radian<Units>(lat1);
//CalculationType lon2_rad = math::as_radian<Units>(lon2);
CalculationType lat2_rad = math::as_radian<Units>(lat2);
//CalculationType a1, a2;
//strategy.apply(lon1_rad, lat1_rad, lon2_rad, lat2_rad, a1, a2);
if (lat1 > lat2)
{
std::swap(lat1, lat2);
@ -250,8 +245,6 @@ private:
lon1 += constants::period();
swap(lon1, lat1, lon2, lat2);
}
//compute_box_corners<Units>(lon1, lat1, lon2, lat2, strategy);
}
template <

View File

@ -8,9 +8,9 @@
// This file was modified by Oracle on 2013-2017.
// Modifications copyright (c) 2013-2017, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at

View File

@ -80,21 +80,30 @@ void disjoint_tests_2(bool expected_result)
test_disjoint<bg::model::box<P>, bg::model::segment<P> >("BOX(1 1,3 3)",
"SEGMENT(1 0.999, 10 0.999)",
expected_result);
test_disjoint<bg::model::box<P>, bg::model::segment<P> >("BOX(1 1,3 3)",
"SEGMENT(10 0.999, 1 0.999)",
expected_result);
}
template <typename P>
void disjoint_tests_3(bool expected_result)
{
test_disjoint<bg::model::box<P>, bg::model::segment<P> >("BOX(3. 4.42, 100. 5.)",
test_disjoint<bg::model::box<P>, bg::model::segment<P> >("BOX(3 4.42, 100 5)",
"SEGMENT(2 2.9, 100 2.9)",
expected_result);
test_disjoint<bg::model::box<P>, bg::model::segment<P> >("BOX(3 4.42, 100 5)",
"SEGMENT(100 2.9, 2 2.9)",
expected_result);
}
template <typename P>
void disjoint_tests_4(bool expected_result)
{
test_disjoint<bg::model::box<P>, bg::model::segment<P> >("BOX(1. 1.,3. 3.)",
"SEGMENT(0. 0.99999999, 2. 0.99999999)",
test_disjoint<bg::model::box<P>, bg::model::segment<P> >("BOX(1 1,3 3)",
"SEGMENT(0 0.99999999, 2 0.99999999)",
expected_result);
test_disjoint<bg::model::box<P>, bg::model::segment<P> >("BOX(1 1,3 3)",
"SEGMENT(2 0.99999999, 0 0.99999999)",
expected_result);
}
@ -102,25 +111,25 @@ template <typename P, typename CT>
void disjoint_tests_with_strategy(bool expected_result)
{
bg::strategy::disjoint::segment_box_geographic
<
CT,
bg::srs::spheroid<CT>,
bg::formula::andoyer_inverse
> geographic_andoyer;
<
CT,
bg::srs::spheroid<CT>,
bg::formula::andoyer_inverse
> geographic_andoyer;
bg::strategy::disjoint::segment_box_geographic
<
CT,
bg::srs::spheroid<CT>,
bg::formula::thomas_inverse
> geographic_thomas;
<
CT,
bg::srs::spheroid<CT>,
bg::formula::thomas_inverse
> geographic_thomas;
bg::strategy::disjoint::segment_box_geographic
<
CT,
bg::srs::spheroid<CT>,
bg::formula::vincenty_inverse
> geographic_vincenty;
<
CT,
bg::srs::spheroid<CT>,
bg::formula::vincenty_inverse
> geographic_vincenty;
test_disjoint_strategy<bg::model::box<P>, bg::model::segment<P> >
("BOX(1 1,3 3)", "SEGMENT(1 0.999, 10 0.999)",
@ -138,9 +147,9 @@ void test_all()
{
typedef bg::model::d2::point_xy<CT> point;
typedef bg::model::point<CT, 2,
bg::cs::spherical_equatorial<bg::degree> > sph_point;
bg::cs::spherical_equatorial<bg::degree> > sph_point;
typedef bg::model::point<CT, 2,
bg::cs::geographic<bg::degree> > geo_point;
bg::cs::geographic<bg::degree> > geo_point;
disjoint_tests_1<point>();
disjoint_tests_1<sph_point>();

View File

@ -25,6 +25,8 @@ void test_disjoint(std::string const& wkt1,
bg::read_wkt(wkt2, geometry2);
BOOST_CHECK_EQUAL(bg::disjoint(geometry1, geometry2), expected_result);
//reverse
BOOST_CHECK_EQUAL(bg::disjoint(geometry2, geometry1), expected_result);
}
template <typename Geometry1, typename Geometry2, typename Strategy>
@ -41,4 +43,7 @@ void test_disjoint_strategy(std::string const& wkt1,
BOOST_CHECK_EQUAL(bg::disjoint(geometry1, geometry2, strategy),
expected_result);
//reverse
BOOST_CHECK_EQUAL(bg::disjoint(geometry2, geometry1, strategy),
expected_result);
}