1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2017, 2018, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
#ifndef BOOST_TEST_MODULE
#define BOOST_TEST_MODULE test_distance_geographic_pointlike_pointlike
#endif
#include <boost/test/included/unit_test.hpp>
#include "test_distance_geo_common.hpp"
#include "test_empty_geometry.hpp"
//===========================================================================
template <typename Point, typename Strategy>
void test_distance_point_point(Strategy const& strategy)
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << std::endl;
std::cout << "point/point distance tests" << std::endl;
#endif
typedef test_distance_of_geometries<Point, Point> tester;
tester::apply("p-p-01",
"POINT(1 1)",
"POINT(0 0)",
strategy.apply(Point(1,1), Point(0,0)),
strategy, true, false, false);
}
//===========================================================================
template <typename Point, typename Strategy>
void test_distance_multipoint_point(Strategy const& strategy)
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << std::endl;
std::cout << "multipoint/point distance tests" << std::endl;
#endif
typedef bg::model::multi_point<Point> multi_point_type;
typedef test_distance_of_geometries<multi_point_type, Point> tester;
tester::apply("mp-p-01",
"MULTIPOINT(1 1,1 2,2 3)",
"POINT(0 0)",
pp_distance<Point>("POINT(0 0)","POINT(1 1)",strategy),
strategy, true, false, false);
tester::apply("mp-p-01",
"MULTIPOINT(0 0,0 2,2 0,2 2)",
"POINT(1.1 1.1)",
pp_distance<Point>("POINT(1.1 1.1)","POINT(2 2)",strategy),
strategy, true, false, false);
}
//===========================================================================
template <typename Point, typename Strategy>
void test_distance_multipoint_multipoint(Strategy const& strategy)
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << std::endl;
std::cout << "multipoint/multipoint distance tests" << std::endl;
#endif
typedef bg::model::multi_point<Point> multi_point_type;
typedef test_distance_of_geometries<multi_point_type, multi_point_type> tester;
tester::apply("mp-mp-01",
"MULTIPOINT(1 1,1 2,2 3)",
"MULTIPOINT(0 0, 0 -1)",
pp_distance<Point>("POINT(0 0)","POINT(1 1)",strategy),
strategy, true, false, false);
}
//===========================================================================
//===========================================================================
//===========================================================================
template <typename Point, typename Strategy>
void test_all_pl_pl(Strategy pp_strategy)
{
test_distance_point_point<Point>(pp_strategy);
test_distance_multipoint_point<Point>(pp_strategy);
test_distance_multipoint_multipoint<Point>(pp_strategy);
test_more_empty_input_pointlike_pointlike<Point>(pp_strategy);
}
BOOST_AUTO_TEST_CASE( test_all_pointlike_pointlike )
{
typedef bg::model::point
<
double, 2,
bg::cs::spherical_equatorial<bg::degree>
> sph_point;
test_all_pl_pl<sph_point>(spherical_pp());
typedef bg::model::point
<
double, 2,
bg::cs::geographic<bg::degree>
> geo_point;
test_all_pl_pl<geo_point>(vincenty_pp());
test_all_pl_pl<geo_point>(thomas_pp());
test_all_pl_pl<geo_point>(andoyer_pp());
test_all_pl_pl<geo_point>(andoyer_pp(stype(5000000,6000000)));
}
|