mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-25 04:22:09 +00:00
[test][algorithms] Use new area strategy interface.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
|
||||
|
||||
// This file was modified by Oracle on 2015, 2016, 2017.
|
||||
// Modifications copyright (c) 2015-2017, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
|
||||
@@ -26,46 +28,46 @@ void test_geo_strategies()
|
||||
|
||||
typedef bg::model::point<CT, 2, bg::cs::geographic<bg::degree> > pt_geo;
|
||||
|
||||
bg::strategy::area::geographic<pt_geo> geographic_default;
|
||||
bg::strategy::area::geographic<> geographic_default;
|
||||
|
||||
bg::strategy::area::geographic<pt_geo, bg::strategy::andoyer, 1>
|
||||
bg::strategy::area::geographic<bg::strategy::andoyer, 1>
|
||||
geographic_andoyer1;
|
||||
bg::strategy::area::geographic<pt_geo, bg::strategy::andoyer, 2>
|
||||
bg::strategy::area::geographic<bg::strategy::andoyer, 2>
|
||||
geographic_andoyer2;
|
||||
bg::strategy::area::geographic<pt_geo, bg::strategy::andoyer, 3>
|
||||
bg::strategy::area::geographic<bg::strategy::andoyer, 3>
|
||||
geographic_andoyer3;
|
||||
bg::strategy::area::geographic<pt_geo, bg::strategy::andoyer, 4>
|
||||
bg::strategy::area::geographic<bg::strategy::andoyer, 4>
|
||||
geographic_andoyer4;
|
||||
bg::strategy::area::geographic<pt_geo, bg::strategy::andoyer, 5>
|
||||
bg::strategy::area::geographic<bg::strategy::andoyer, 5>
|
||||
geographic_andoyer5;
|
||||
|
||||
bg::strategy::area::geographic<pt_geo, bg::strategy::thomas, 1>
|
||||
bg::strategy::area::geographic<bg::strategy::thomas, 1>
|
||||
geographic_thomas1;
|
||||
bg::strategy::area::geographic<pt_geo, bg::strategy::thomas, 2>
|
||||
bg::strategy::area::geographic<bg::strategy::thomas, 2>
|
||||
geographic_thomas2;
|
||||
bg::strategy::area::geographic<pt_geo, bg::strategy::thomas, 3>
|
||||
bg::strategy::area::geographic<bg::strategy::thomas, 3>
|
||||
geographic_thomas3;
|
||||
bg::strategy::area::geographic<pt_geo, bg::strategy::thomas, 4>
|
||||
bg::strategy::area::geographic<bg::strategy::thomas, 4>
|
||||
geographic_thomas4;
|
||||
bg::strategy::area::geographic<pt_geo, bg::strategy::thomas, 5>
|
||||
bg::strategy::area::geographic<bg::strategy::thomas, 5>
|
||||
geographic_thomas5;
|
||||
|
||||
bg::strategy::area::geographic<pt_geo, bg::strategy::vincenty, 1>
|
||||
bg::strategy::area::geographic<bg::strategy::vincenty, 1>
|
||||
geographic_vincenty1;
|
||||
bg::strategy::area::geographic<pt_geo, bg::strategy::vincenty, 2>
|
||||
bg::strategy::area::geographic<bg::strategy::vincenty, 2>
|
||||
geographic_vincenty2;
|
||||
bg::strategy::area::geographic<pt_geo, bg::strategy::vincenty, 3>
|
||||
bg::strategy::area::geographic<bg::strategy::vincenty, 3>
|
||||
geographic_vincenty3;
|
||||
bg::strategy::area::geographic<pt_geo, bg::strategy::vincenty, 4>
|
||||
bg::strategy::area::geographic<bg::strategy::vincenty, 4>
|
||||
geographic_vincenty4;
|
||||
bg::strategy::area::geographic<pt_geo, bg::strategy::vincenty, 5>
|
||||
bg::strategy::area::geographic<bg::strategy::vincenty, 5>
|
||||
geographic_vincenty5;
|
||||
|
||||
bg::strategy::area::geographic<pt_geo, bg::strategy::andoyer>
|
||||
bg::strategy::area::geographic<bg::strategy::andoyer>
|
||||
geographic_andoyer_default;
|
||||
bg::strategy::area::geographic<pt_geo, bg::strategy::thomas>
|
||||
bg::strategy::area::geographic<bg::strategy::thomas>
|
||||
geographic_thomas_default;
|
||||
bg::strategy::area::geographic<pt_geo, bg::strategy::vincenty>
|
||||
bg::strategy::area::geographic<bg::strategy::vincenty>
|
||||
geographic_vincenty_default;
|
||||
|
||||
bg::model::polygon<pt_geo> geometry_geo;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
||||
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
|
||||
|
||||
// This file was modified by Oracle on 2015, 2016, 2017.
|
||||
// Modifications copyright (c) 2015-2017, Oracle and/or its affiliates.
|
||||
@@ -36,11 +37,8 @@ void test_spherical_geo()
|
||||
ct, 2, bg::cs::geographic<bg::degree>
|
||||
> pt_geo;
|
||||
|
||||
typedef typename bg::point_type<pt_geo>::type pt_geo_type;
|
||||
|
||||
bg::strategy::area::geographic
|
||||
<
|
||||
pt_geo_type,
|
||||
bg::strategy::vincenty,
|
||||
5
|
||||
> area_geographic;
|
||||
@@ -61,7 +59,7 @@ void test_spherical_geo()
|
||||
|
||||
bg::strategy::area::spherical
|
||||
<
|
||||
typename bg::point_type<pt>::type
|
||||
ct
|
||||
> strategy_unary(1.0);
|
||||
|
||||
ct const four = 4.0;
|
||||
@@ -74,7 +72,7 @@ void test_spherical_geo()
|
||||
// With strategy, radius 2 -> 4 pi r^2
|
||||
bg::strategy::area::spherical
|
||||
<
|
||||
typename bg::point_type<pt>::type
|
||||
ct
|
||||
> strategy(2.0);
|
||||
|
||||
area = bg::area(geometry, strategy);
|
||||
@@ -96,7 +94,7 @@ void test_spherical_geo()
|
||||
|
||||
bg::strategy::area::spherical
|
||||
<
|
||||
typename bg::point_type<pt>::type
|
||||
ct
|
||||
> spherical_earth(6373);
|
||||
bg::read_wkt(poly, geometry);
|
||||
area = bg::area(geometry, spherical_earth);
|
||||
@@ -376,7 +374,7 @@ void test_spherical_geo()
|
||||
}*/
|
||||
bg::strategy::area::spherical
|
||||
<
|
||||
typename bg::point_type<pt>::type
|
||||
ct
|
||||
> area_spherical(6372.795);
|
||||
area = bg::area(aurha, area_spherical);
|
||||
BOOST_CHECK_CLOSE(area, 1476.645675, 0.0001);
|
||||
@@ -395,13 +393,13 @@ void test_spherical_geo()
|
||||
std::string wkt = "POLYGON((0 0, 5 0, 5 5, 0 5, 0 0))";
|
||||
bg::read_wkt(wkt, geometry_sph);
|
||||
|
||||
area = bg::area(geometry_sph, bg::strategy::area::spherical<pt>(6371228.0));
|
||||
area = bg::area(geometry_sph, bg::strategy::area::spherical<>(6371228.0));
|
||||
BOOST_CHECK_CLOSE(area, 308932296103.83051, 0.0001);
|
||||
|
||||
bg::model::polygon<pt_geo, false> geometry_geo;
|
||||
bg::read_wkt(wkt, geometry_geo);
|
||||
|
||||
area = bg::area(geometry_geo, bg::strategy::area::geographic<pt_geo>(bg::srs::spheroid<double>(6371228.0, 6371228.0)));
|
||||
area = bg::area(geometry_geo, bg::strategy::area::geographic<>(bg::srs::spheroid<double>(6371228.0, 6371228.0)));
|
||||
BOOST_CHECK_CLOSE(area, 308932296103.82574, 0.001);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -40,16 +41,12 @@ void test_area(Geometry const& geometry,
|
||||
BOOST_CHECK_CLOSE(area, expected_area, 0.0001);
|
||||
|
||||
// Test with explicitly defined strategies
|
||||
bg::strategy::area::surveyor
|
||||
<
|
||||
typename bg::point_type<Geometry>::type
|
||||
> strategy1;
|
||||
bg::strategy::area::cartesian<> strategy1;
|
||||
|
||||
area = bg::area(geometry, strategy1);
|
||||
|
||||
bg::strategy::area::surveyor
|
||||
bg::strategy::area::cartesian
|
||||
<
|
||||
typename bg::point_type<Geometry>::type,
|
||||
typename bg::coordinate_type<Geometry>::type
|
||||
> strategy2;
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
|
||||
|
||||
// Copyright (c) 2014-2017, Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
@@ -46,7 +48,7 @@ void test_valid_s(std::string const& wkt,
|
||||
typedef typename bg::point_type<Poly>::type pt;
|
||||
|
||||
bg::strategy::intersection::geographic_segments<> is(sph);
|
||||
bg::strategy::area::geographic<pt> as(sph);
|
||||
bg::strategy::area::geographic<> as(sph);
|
||||
|
||||
Poly p;
|
||||
bg::read_wkt(wkt, p);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Boost.Geometry
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
|
||||
|
||||
// Copyright (c) 2017, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
@@ -50,7 +52,7 @@ void test_geographic_one(std::string const& wkt1, std::string const& wkt2,
|
||||
bg::srs::spheroid<double> sph(6378137.0000000000, 6356752.3142451793);
|
||||
|
||||
bg::strategy::intersection::geographic_segments<> is(sph);
|
||||
bg::strategy::area::geographic<point> as(sph);
|
||||
bg::strategy::area::geographic<> as(sph);
|
||||
|
||||
polygon p1, p2;
|
||||
|
||||
@@ -98,8 +100,8 @@ void test_geographic_one(std::string const& wkt1, std::string const& wkt2,
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_CHECK_EQUAL(result_count, 0);
|
||||
BOOST_CHECK_EQUAL(result_area, 0);
|
||||
BOOST_CHECK_EQUAL(result_count, 0u);
|
||||
BOOST_CHECK_EQUAL(result_area, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user