]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/test/algorithms/distance/distance_geo_pl_pl.cpp
Add patch for failing prerm scripts
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / distance / distance_geo_pl_pl.cpp
CommitLineData
11fdf7f2
TL
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2// Unit Test
3
4// Copyright (c) 2017, Oracle and/or its affiliates.
5
6// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
7
8// Licensed under the Boost Software License version 1.0.
9// http://www.boost.org/users/license.html
10
11#ifndef BOOST_TEST_MODULE
12#define BOOST_TEST_MODULE test_distance_geographic_pl_l
13#endif
14
15//#include <boost/geometry/core/srs.hpp>
16#include <boost/test/included/unit_test.hpp>
17
18#include "test_distance_geo_common.hpp"
19
20typedef bg::cs::geographic<bg::degree> cs_type;
21typedef bg::model::point<double, 2, cs_type> point_type;
22typedef bg::model::multi_point<point_type> multi_point_type;
23
24namespace services = bg::strategy::distance::services;
25typedef bg::default_distance_result<point_type>::type return_type;
26
27typedef bg::srs::spheroid<double> stype;
28
29// Strategies for point-point distance
30
31typedef bg::strategy::distance::andoyer<stype> andoyer;
32typedef bg::strategy::distance::thomas<stype> thomas;
33typedef bg::strategy::distance::vincenty<stype> vincenty;
34
35//===========================================================================
36
37template <typename Strategy>
38inline bg::default_distance_result<point_type>::type
39pp_distance(std::string const& wkt1,
40 std::string const& wkt2,
41 Strategy const& strategy)
42{
43 point_type p1, p2;
44 bg::read_wkt(wkt1, p1);
45 bg::read_wkt(wkt2, p2);
46 return bg::distance(p1, p2, strategy);
47}
48
49//===========================================================================
50
51template <typename Strategy>
52void test_distance_multipoint_point(Strategy const& strategy)
53{
54
55#ifdef BOOST_GEOMETRY_TEST_DEBUG
56 std::cout << std::endl;
57 std::cout << "multipoint/point distance tests" << std::endl;
58#endif
59 typedef test_distance_of_geometries<multi_point_type, point_type> tester;
60
61 tester::apply("mp-p-01",
62 "MULTIPOINT(1 1,1 2,2 3)",
63 "POINT(0 0)",
64 pp_distance("POINT(0 0)","POINT(1 1)",strategy),
65 strategy);
66
67 tester::apply("mp-p-01",
68 "MULTIPOINT(0 0,0 2,2 0,2 2)",
69 "POINT(1.1 1.1)",
70 pp_distance("POINT(1.1 1.1)","POINT(2 2)",strategy),
71 strategy);
72}
73
74//===========================================================================
75
76template <typename Point, typename Strategy>
77void test_empty_input_pointlike_linear(Strategy const& strategy)
78{
79#ifdef BOOST_GEOMETRY_TEST_DEBUG
80 std::cout << std::endl;
81 std::cout << "testing on empty inputs... " << std::flush;
82#endif
83 bg::model::multi_point<Point> multipoint_empty;
84 Point point_empty;
85
86 Point point = from_wkt<Point>("POINT(0 0)");
87
88 // 1st geometry is empty
89 test_empty_input(multipoint_empty, point, strategy);
90
91 // 2nd geometry is empty
92 test_empty_input(point, multipoint_empty, strategy);
93
94 // both geometries are empty
95 test_empty_input(multipoint_empty, point_empty, strategy);
96
97#ifdef BOOST_GEOMETRY_TEST_DEBUG
98 std::cout << "done!" << std::endl;
99#endif
100}
101
102//===========================================================================
103//===========================================================================
104//===========================================================================
105
106BOOST_AUTO_TEST_CASE( test_all_point_segment )
107{
108 test_distance_multipoint_point(vincenty());
109 test_distance_multipoint_point(thomas());
110 test_distance_multipoint_point(andoyer());
111
112 test_empty_input_pointlike_linear<point_type>(vincenty());
113 test_empty_input_pointlike_linear<point_type>(thomas());
114 test_empty_input_pointlike_linear<point_type>(andoyer());
115}