123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- // Boost.Geometry (aka GGL, Generic Geometry Library)
- // Copyright (c) 2014-2015, Oracle and/or its affiliates.
- // 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
- #include <iostream>
- #ifndef BOOST_TEST_MODULE
- #define BOOST_TEST_MODULE test_difference_pointlike_pointlike
- #endif
- #ifdef BOOST_GEOMETRY_TEST_DEBUG
- #define BOOST_GEOMETRY_DEBUG_TURNS
- #define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
- #endif
- #include <boost/test/included/unit_test.hpp>
- #include "../test_set_ops_pointlike.hpp"
- #include <boost/geometry/geometries/multi_point.hpp>
- typedef bg::model::point<double,2,bg::cs::cartesian> point_type;
- typedef bg::model::multi_point<point_type> multi_point_type;
- //===========================================================================
- //===========================================================================
- //===========================================================================
- BOOST_AUTO_TEST_CASE( test_difference_point_point )
- {
- #ifdef BOOST_GEOMETRY_TEST_DEBUG
- std::cout << std::endl << std::endl << std::endl;
- std::cout << "*** POINT / POINT DIFFERENCE ***" << std::endl;
- std::cout << std::endl;
- #endif
- typedef point_type P;
- typedef multi_point_type MP;
- typedef test_set_op_of_pointlike_geometries
- <
- P, P, MP, bg::overlay_difference
- > tester;
- tester::apply
- ("ppdf01",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<P>("POINT(1 1)"),
- from_wkt<MP>("MULTIPOINT(0 0)"),
- from_wkt<MP>("MULTIPOINT(1 1)")
- );
- tester::apply
- ("ppdf02",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT()")
- );
- }
- BOOST_AUTO_TEST_CASE( test_difference_multipoint_point )
- {
- #ifdef BOOST_GEOMETRY_TEST_DEBUG
- std::cout << std::endl << std::endl << std::endl;
- std::cout << "*** MULTIPOINT / POINT DIFFERENCE ***" << std::endl;
- std::cout << std::endl;
- #endif
- typedef point_type P;
- typedef multi_point_type MP;
- typedef test_set_op_of_pointlike_geometries
- <
- MP, P, MP, bg::overlay_difference
- > tester;
- tester::apply
- ("mppdf01",
- from_wkt<MP>("MULTIPOINT(0 0)"),
- from_wkt<P>("POINT(1 1)"),
- from_wkt<MP>("MULTIPOINT(0 0)"),
- from_wkt<MP>("MULTIPOINT(1 1)")
- );
- tester::apply
- ("mppdf02",
- from_wkt<MP>("MULTIPOINT(0 0)"),
- from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT()")
- );
- tester::apply
- ("mppdf03",
- from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
- from_wkt<P>("POINT(1 1)"),
- from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
- from_wkt<MP>("MULTIPOINT(1 1)")
- );
- tester::apply
- ("mppdf04",
- from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
- from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT()")
- );
- tester::apply
- ("mppdf05",
- from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
- from_wkt<P>("POINT(1 1)"),
- from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
- from_wkt<MP>("MULTIPOINT(1 1)")
- );
- tester::apply
- ("mppdf06",
- from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
- from_wkt<P>("POINT(1 0)"),
- from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
- from_wkt<MP>("MULTIPOINT()")
- );
- tester::apply
- ("mppdf07",
- from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
- from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT(1 0)"),
- from_wkt<MP>("MULTIPOINT()")
- );
- tester::apply
- ("mppdf08",
- from_wkt<MP>("MULTIPOINT()"),
- from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT()"),
- from_wkt<MP>("MULTIPOINT(0 0)")
- );
- }
- BOOST_AUTO_TEST_CASE( test_difference_point_multipoint )
- {
- #ifdef BOOST_GEOMETRY_TEST_DEBUG
- std::cout << std::endl << std::endl << std::endl;
- std::cout << "*** POINT / MULTIPOINT DIFFERENCE ***" << std::endl;
- std::cout << std::endl;
- #endif
- typedef point_type P;
- typedef multi_point_type MP;
- typedef test_set_op_of_pointlike_geometries
- <
- P, MP, MP, bg::overlay_difference
- > tester;
- tester::apply
- ("pmpdf01",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT(1 0,1 1,1 1)"),
- from_wkt<MP>("MULTIPOINT(0 0)"),
- from_wkt<MP>("MULTIPOINT(1 0,1 1,1 1)")
- );
- tester::apply
- ("pmpdf02",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
- from_wkt<MP>("MULTIPOINT()"),
- from_wkt<MP>("MULTIPOINT(1 0,1 1)")
- );
- tester::apply
- ("pmpdf03",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT()"),
- from_wkt<MP>("MULTIPOINT(0 0)"),
- from_wkt<MP>("MULTIPOINT()")
- );
- }
- BOOST_AUTO_TEST_CASE( test_difference_multipoint_multipoint )
- {
- #ifdef BOOST_GEOMETRY_TEST_DEBUG
- std::cout << std::endl << std::endl << std::endl;
- std::cout << "*** MULTIPOINT / MULTIPOINT DIFFERENCE ***" << std::endl;
- std::cout << std::endl;
- #endif
- typedef multi_point_type MP;
- typedef test_set_op_of_pointlike_geometries
- <
- MP, MP, MP, bg::overlay_difference
- > tester;
- tester::apply
- ("mpmpdf01",
- from_wkt<MP>("MULTIPOINT(2 2,3 3,0 0,0 0,2 2,1 1,1 1,1 0,1 0)"),
- from_wkt<MP>("MULTIPOINT(1 0,1 1,1 1,4 4)"),
- from_wkt<MP>("MULTIPOINT(2 2,3 3,0 0,0 0,2 2)"),
- from_wkt<MP>("MULTIPOINT(4 4)")
- );
- tester::apply
- ("mpmpdf02",
- from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
- from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
- from_wkt<MP>("MULTIPOINT()")
- );
- tester::apply
- ("mpmpdf03",
- from_wkt<MP>("MULTIPOINT()"),
- from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
- from_wkt<MP>("MULTIPOINT()"),
- from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)")
- );
- tester::apply
- ("mpmpdf04",
- from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
- from_wkt<MP>("MULTIPOINT()"),
- from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
- from_wkt<MP>("MULTIPOINT()")
- );
- tester::apply
- ("mpmpdf05",
- from_wkt<MP>("MULTIPOINT()"),
- from_wkt<MP>("MULTIPOINT()"),
- from_wkt<MP>("MULTIPOINT()")
- );
- }
|