mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-11 13:34:10 +00:00
added empty test for get_turns(L,A) and some small changes like naming, comments. to_svg() (test debug helper tool) is now using turn_info defined in relate::turns, also traversal info output commented out.
This commit is contained in:
parent
629d6b1246
commit
e8b5e64f2b
@ -766,6 +766,11 @@ struct get_turn_info_type<Geometry1, Geometry2, AssignPolicy, Tag1, Tag2, linear
|
||||
: overlay::get_turn_info_linear_linear<AssignPolicy>
|
||||
{};
|
||||
|
||||
//template <typename Geometry1, typename Geometry2, typename AssignPolicy, typename Tag1, typename Tag2>
|
||||
//struct get_turn_info_type<Geometry1, Geometry2, AssignPolicy, Tag1, Tag2, linear_tag, areal_tag>
|
||||
// : overlay::get_turn_info_linear_linear<AssignPolicy>
|
||||
//{};
|
||||
|
||||
template <typename Geometry1, typename Geometry2,
|
||||
typename Tag1 = typename tag<Geometry1>::type, typename Tag2 = typename tag<Geometry2>::type,
|
||||
typename TagBase1 = typename tag_base<Tag1>::type, typename TagBase2 = typename tag_base<Tag2>::type>
|
||||
@ -780,6 +785,12 @@ struct turn_operation_type<Geometry1, Geometry2, Tag1, Tag2, linear_tag, linear_
|
||||
typedef overlay::turn_operation_linear type;
|
||||
};
|
||||
|
||||
//template <typename Geometry1, typename Geometry2, typename Tag1, typename Tag2>
|
||||
//struct turn_operation_type<Geometry1, Geometry2, Tag1, Tag2, linear_tag, areal_tag>
|
||||
//{
|
||||
// typedef overlay::turn_operation_linear type;
|
||||
//};
|
||||
|
||||
}} // namespace detail::get_turns
|
||||
#endif // DOXYGEN_NO_DETAIL
|
||||
|
||||
|
@ -60,7 +60,7 @@ struct enriched_info // linear_enriched_info ?
|
||||
};
|
||||
|
||||
template <typename P>
|
||||
struct enriched_turn_operation : public overlay::turn_operation_linear
|
||||
struct enriched_turn_operation_linear : public overlay::turn_operation_linear
|
||||
{
|
||||
enriched_info<P> enriched;
|
||||
};
|
||||
@ -80,7 +80,7 @@ struct get_turns
|
||||
typedef overlay::turn_info
|
||||
<
|
||||
point1_type,
|
||||
enriched_turn_operation<point1_type>
|
||||
enriched_turn_operation_linear<point1_type>
|
||||
> turn_info;
|
||||
|
||||
template <typename Turns>
|
||||
|
195
test/algorithms/overlay/get_turns_linear_areal.cpp
Normal file
195
test/algorithms/overlay/get_turns_linear_areal.cpp
Normal file
@ -0,0 +1,195 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test
|
||||
|
||||
// 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.
|
||||
|
||||
// This file was modified by Oracle on 2014.
|
||||
// Modifications copyright (c) 2014 Oracle and/or its affiliates.
|
||||
|
||||
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
||||
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
#include "test_get_turns.hpp"
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
|
||||
//TEST
|
||||
#include <to_svg.hpp>
|
||||
//#include <boost/geometry.hpp>
|
||||
//#include <boost/geometry/multi/geometries/multi_linestring.hpp>
|
||||
|
||||
template <typename T>
|
||||
void test_all()
|
||||
{
|
||||
typedef bg::model::point<T, 2, bg::cs::cartesian> pt;
|
||||
typedef bg::model::linestring<pt> ls;
|
||||
typedef bg::model::polygon<pt> poly;
|
||||
|
||||
to_svg<ls, poly>("LINESTRING(15 5,24 5,13 -4,13 10,10 10,8 10,4 6,2 8,1 10)",
|
||||
"POLYGON((0 0,5 5,0 10,20 10,20 0,0 0)(10 3,15 3,15 7,10 7,10 3))",
|
||||
"ls_poly.svg");
|
||||
to_svg<poly, ls>("POLYGON((0 0,5 5,0 10,20 10,20 0,0 0)(10 3,15 3,15 7,10 7,10 3))",
|
||||
"LINESTRING(15 5,24 5,13 -4,13 10,10 10,8 10,4 6,2 8,1 10)",
|
||||
"poly_ls.svg");
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
test_all<float>();
|
||||
test_all<double>();
|
||||
|
||||
#if ! defined(_MSC_VER)
|
||||
test_all<long double>();
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_TTMATH)
|
||||
test_all<ttmath_big>();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(1 0,3 0)", "lsls0000.svg");
|
||||
to_svg<ls, ls>("LINESTRING(1 0,3 0)", "LINESTRING(2 0,0 0)", "lsls0001.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(3 0,1 0)", "lsls0002.svg");
|
||||
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0)", "LINESTRING(1 0,2 0)", "lsls0003.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0)", "LINESTRING(2 0,1 0)", "lsls0004.svg");
|
||||
to_svg<ls, ls>("LINESTRING(1 0,2 0)", "LINESTRING(1 0,0 0)", "lsls0005.svg");
|
||||
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(0 0,2 0)", "lsls0006.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(2 0,0 0)", "lsls0007.svg");
|
||||
|
||||
to_svg<ls, ls>("LINESTRING(0 0,3 0)", "LINESTRING(1 0,2 0)", "lsls0008.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,3 0)", "LINESTRING(2 0,1 0)", "lsls0009.svg");
|
||||
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0)", "LINESTRING(1 0,1 1)", "lsls00010.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0)", "LINESTRING(1 1,1 0)", "lsls00011.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0)", "LINESTRING(0 0,0 1)", "lsls00012.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0)", "LINESTRING(0 1,0 0)", "lsls00013.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(1 0,1 1)", "lsls00014.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(1 1,1 0)", "lsls00015.svg");
|
||||
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(1 0,3 1)", "lsls00016.svg");
|
||||
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(2 0,1 0)", "lsls00017.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(0 0,1 0)", "lsls00018.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(1 0,0 0)", "lsls00019.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(1 0,2 0)", "lsls00020.svg");
|
||||
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(0 0,2 0)", "lsls000.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,2 0,3 0)", "LINESTRING(0 0,2 0)", "lsls001.svg");
|
||||
to_svg<ls, ls>("LINESTRING(1 0,1 1)", "LINESTRING(0 0,1 0,2 0)", "lsls0020.svg");
|
||||
to_svg<ls, ls>("LINESTRING(1 0,0 0)", "LINESTRING(0 0,1 0,2 0)", "lsls0021.svg");
|
||||
to_svg<ls, ls>("LINESTRING(1 0,2 0)", "LINESTRING(0 0,1 0,2 0)", "lsls0022.svg");
|
||||
to_svg<ls, ls>("LINESTRING(1 1,1 0)", "LINESTRING(0 0,1 0,2 0)", "lsls0023.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0)", "LINESTRING(0 0,1 0,2 0)", "lsls0024.svg");
|
||||
to_svg<ls, ls>("LINESTRING(2 0,1 0)", "LINESTRING(0 0,1 0,2 0)", "lsls0025.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 0,1 1)", "lsls00200.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 0,0 0)", "lsls00211.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 0,2 0)", "lsls00222.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 1,1 0)", "lsls00233.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(0 0,1 0)", "lsls00244.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(2 0,1 0)", "lsls00255.svg");
|
||||
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,4 0,6 0,8 0)", "LINESTRING(1 0,3 0,5 0,6 0,9 0)", "lsls01.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,4 0,4 4)", "LINESTRING(1 0,3 0,4 0,4 2,4 5)", "lsls02.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,4 0,4 4)", "LINESTRING(1 0,4 0,4 4)", "lsls031.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,4 0,4 4)", "LINESTRING(4 0,2 0,0 0)", "lsls032.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,4 0,4 4)", "LINESTRING(4 0,2 2,0 2)", "lsls0321.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,4 0,4 4)", "LINESTRING(4 0,2 0)", "lsls033.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,4 0,4 4)", "LINESTRING(4 0,4 4)", "lsls034.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,4 0,4 4)", "LINESTRING(4 0,3 1)", "lsls035.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,4 0,4 4)", "LINESTRING(4 0,4 -1)", "lsls036.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,4 0,4 4)", "LINESTRING(1 0,4 0,4 3)", "lsls04.svg");
|
||||
to_svg<ls, ls>("LINESTRING(1 0,2 0,4 0,6 0,8 0)", "LINESTRING(0 0,3 0,5 0,6 0,9 0)", "lsls05.svg");
|
||||
|
||||
to_svg<ls, ls>("LINESTRING(0 0,10 0,10 10)", "LINESTRING(1 0,10 9)", "lsls061.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,10 0,10 10)", "LINESTRING(1 0,10 -9)", "lsls062.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,10 0,10 10)", "LINESTRING(1 0,-10 9)", "lsls063.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,10 0,10 10)", "LINESTRING(1 0,-10 -9)", "lsls064.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0,10 9,10 10)", "LINESTRING(1 0,10 9)", "lsls065.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,10 0,10 10)", "LINESTRING(1 0,9 9)", "lsls071.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,10 0,10 10)", "LINESTRING(1 0,9 -9)", "lsls072.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,10 0,10 10)", "LINESTRING(1 0,-9 9)", "lsls073.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,10 0,10 10)", "LINESTRING(1 0,-9 -9)", "lsls074.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0,10 0,10 10)", "LINESTRING(1 0,9 9)", "lsls081.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0,10 0,10 10)", "LINESTRING(0 0,9 9)", "lsls082.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0)", "LINESTRING(1 0,9 9)", "lsls083.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0)", "LINESTRING(9 9,1 0)", "lsls084.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0)", "LINESTRING(1 0,2 0)", "lsls085.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,1 0)", "LINESTRING(2 0,1 0)", "lsls086.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,10 0,10 10)", "LINESTRING(1 1,10 5)", "lsls091.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,10 0,10 5,10 10)", "LINESTRING(1 1,10 5)", "lsls092.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,10 0,10 10)", "LINESTRING(19 1,10 5)", "lsls093.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,10 0,10 5,10 10)", "LINESTRING(19 1,10 5)", "lsls094.svg");
|
||||
|
||||
to_svg<ls, ls>("LINESTRING(5 3,1 1,3 3,2 2,0 0)", "LINESTRING(0 0,3 3,6 3)", "1F100F10T.svg");
|
||||
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(1 1,1 0,3 0,3 1)", "lsls_01.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(1 -1,1 0,3 0,3 -1)", "lsls_02.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(3 1,3 0,1 0,1 1)", "lsls_03.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(3 -1,3 0,1 0,1 -1)", "lsls_04.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(2 1,2 0,4 0,4 1)", "lsls_05.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(2 -1,2 0,4 0,4 -1)", "lsls_06.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(4 1,4 0,2 0,2 1)", "lsls_07.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(4 -1,4 0,2 0,2 -1)", "lsls_08.svg");
|
||||
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(1 1,1 0,2 0,3 0,3 1)", "lsls_11.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(1 -1,1 0,2 0,3 0,3 -1)", "lsls_12.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(3 1,3 0,2 0,1 0,1 1)", "lsls_13.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(3 -1,3 0,2 0,1 0,1 -1)", "lsls_14.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(2 1,2 0,3 0,4 0,4 1)", "lsls_15.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(2 -1,2 0,3 0,4 0,4 -1)", "lsls_16.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(4 1,4 0,3 0,2 0,2 1)", "lsls_17.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(4 -1,4 0,3 0,2 0,2 -1)", "lsls_18.svg");
|
||||
|
||||
to_svg<ls, ls>("LINESTRING(0 5,5 5,10 5,10 10,5 10,5 5,5 0)", "LINESTRING(0 5,5 5,5 10,10 10,10 5,5 5,5 0)", "lsls11.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 5,5 5,10 5,10 10,5 10,5 5,5 0)", "LINESTRING(5 0,5 5,10 5,10 10,5 10,5 5,0 5)", "lsls12.svg");
|
||||
to_svg<ls, ls>("LINESTRING(5 0,5 5,5 10,10 10,10 5,5 5,0 5)", "LINESTRING(0 5,5 5,5 10,10 10,10 5,5 5,5 0)", "lsls13.svg");
|
||||
to_svg<ls, ls>("LINESTRING(5 0,5 5,5 10,10 10,10 5,5 5,0 5)", "LINESTRING(5 0,5 5,10 5,10 10,5 10,5 5,0 5)", "lsls14.svg");
|
||||
|
||||
to_svg<ls, ls>("LINESTRING(0 5,10 5,10 10,5 10,5 0)", "LINESTRING(0 5,5 5,5 10,10 10,10 5,5 5,5 0)", "lsls15.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 5,10 5,10 10,5 10,5 0)", "LINESTRING(5 0,5 10,10 10,10 5,0 5)", "lsls16.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 5,10 5)", "LINESTRING(5 0,5 10,10 10,10 5,0 5)", "lsls161.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 5,8 5,10 5)", "LINESTRING(5 0,5 10,10 10,10 5,0 5)", "lsls162.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 5,8 5)", "LINESTRING(5 0,5 10,10 10,10 5,0 5)", "lsls1631.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 5,1 5,7 5,8 5)", "LINESTRING(5 0,5 10,10 10,10 5,0 5)", "lsls1632.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 5,1 5,7 5,8 5)", "LINESTRING(5 10,10 10,10 5,0 5)", "lsls1633.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 5,8 4)", "LINESTRING(5 0,5 10,10 10,10 5,0 5)", "lsls1641.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 5,8 6)", "LINESTRING(5 0,5 10,10 10,10 5,0 5)", "lsls1642.svg");
|
||||
to_svg<ls, ls>("LINESTRING(1 5,8 4)", "LINESTRING(5 0,5 10,10 10,10 5,0 5)", "lsls1643.svg");
|
||||
to_svg<ls, ls>("LINESTRING(1 5,8 5)", "LINESTRING(5 0,5 10,10 10,10 5,0 5)", "lsls1644.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 5,5 5,8 4)", "LINESTRING(5 0,5 10,10 10,10 5,0 5)", "lsls165.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 5,5 5,8 5)", "LINESTRING(5 0,5 10,10 10,10 5,0 5)", "lsls166.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 5,5 5,8 5)", "LINESTRING(0 10,10 0,5 0,5 10,10 10,10 5,0 5)", "lsls167.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 5,5 5,8 5)", "LINESTRING(0 10,5 5,10 0,5 0,5 5,5 10,10 10,10 5,0 5)", "lsls168.svg");
|
||||
|
||||
to_svg<ls, ls>("LINESTRING(0 0,0 10,10 10,10 0,0 0)", "LINESTRING(0 2,0 0,10 0,10 10,0 10,0 8,0 2)", "lsls1690.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,10 0,10 10,0 10,0 0)", "LINESTRING(0 8,0 0,10 0,10 10,0 10,0 8)", "lsls1691.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,10 0,10 10,0 10,0 0)", "LINESTRING(0 2,0 0,10 0,10 10,0 10,0 8)", "lsls1692.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 0,0 10,10 10,10 0,0 0)", "LINESTRING(0 2,0 0,10 0,10 10,0 10,0 8)", "lsls1693.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 2,0 0,10 0,10 10,0 10,0 8)", "LINESTRING(0 0,10 0,10 10,0 10,0 0)", "lsls1694.svg");
|
||||
to_svg<ls, ls>("LINESTRING(0 2,0 0,10 0,10 10,0 10,0 8)", "LINESTRING(0 0,0 10,10 10,10 0,0 0)", "lsls1695.svg");
|
||||
|
||||
to_svg<ls>("LINESTRING(0 8,0 0,10 0,10 10,0 10,0 2)", "ls1.svg");
|
||||
to_svg<ls>("LINESTRING(8 8,0 0,10 0,10 10,0 10,8 2)", "ls2.svg");
|
||||
|
||||
typedef bg::model::multi_linestring<ls> mls;
|
||||
to_svg<ls, mls>("LINESTRING(0 5,10 5,10 10,5 10,5 0)", "MULTILINESTRING((5 0,5 7),(5 8,5 10,10 10,10 5,0 5))", "lsls17.svg");
|
||||
to_svg<ls, mls>("LINESTRING(0 5,10 5,10 10,5 10,5 0)", "MULTILINESTRING((5 0,5 4,5 6,5 7),(5 8,5 10,10 10,10 5,0 5))", "lsls18.svg");
|
||||
to_svg<ls, mls>("LINESTRING(0 5,10 5,10 10,5 10,5 0)", "MULTILINESTRING((5 0,5 8),(5 7,5 10,10 10,10 5,0 5))", "lsls19.svg");
|
||||
to_svg<mls, ls>("MULTILINESTRING((5 0,5 7),(5 8,5 10,10 10,10 5,0 5))", "LINESTRING(0 5,10 5,10 10,5 10,5 0)", "lsls20.svg");
|
||||
to_svg<mls, ls>("MULTILINESTRING((5 0,5 8),(5 7,5 10,10 10,10 5,0 5))", "LINESTRING(0 5,10 5,10 10,5 10,5 0)", "lsls21.svg");
|
||||
|
||||
to_svg<ls, ls>("LINESTRING(0 5,5 5,10 5,10 10,5 10,5 5,5 0)", "LINESTRING(0 5,5 5,0 10,10 10,10 5,5 5,5 0)", "lsls100.svg");
|
||||
|
||||
to_svg<ls, ls>("LINESTRING(5 0,5 5,5 0)", "LINESTRING(0 5,5 5,0 10,2 10,5 5,5 10,10 10,10 5,5 5,10 2,10 0,8 0,5 5,5 0)", "lsls101.svg");
|
||||
*/
|
@ -17,146 +17,9 @@
|
||||
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
#include <geometry_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/correct.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
|
||||
|
||||
#include "test_get_turns.hpp"
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
|
||||
#include <boost/geometry/io/wkt/read.hpp>
|
||||
#include <boost/geometry/io/wkt/write.hpp>
|
||||
|
||||
struct equal_turn
|
||||
{
|
||||
equal_turn(std::string const& s) : turn_ptr(&s) {}
|
||||
|
||||
template <typename T>
|
||||
bool operator()(T const& t) const
|
||||
{
|
||||
BOOST_ASSERT(turn_ptr && turn_ptr->size() == 3);
|
||||
return bg::method_char(t.method) == (*turn_ptr)[0]
|
||||
&& bg::operation_char(t.operations[0].operation) == (*turn_ptr)[1]
|
||||
&& bg::operation_char(t.operations[1].operation) == (*turn_ptr)[2];
|
||||
}
|
||||
|
||||
const std::string * turn_ptr;
|
||||
};
|
||||
|
||||
template <typename Geometry1, typename Geometry2>
|
||||
void check_geometry(
|
||||
Geometry1 const& g1,
|
||||
Geometry2 const& g2,
|
||||
std::string const& wkt1,
|
||||
std::string const& wkt2,
|
||||
std::vector<std::string> const& expected)
|
||||
{
|
||||
typedef bg::detail::overlay::turn_info
|
||||
<
|
||||
typename bg::point_type<Geometry2>::type,
|
||||
typename bg::detail::get_turns::turn_operation_type<Geometry1, Geometry2>::type
|
||||
> turn_info;
|
||||
typedef bg::detail::overlay::assign_null_policy assign_policy_t;
|
||||
typedef bg::detail::get_turns::no_interrupt_policy interrupt_policy_t;
|
||||
|
||||
std::vector<turn_info> turns;
|
||||
interrupt_policy_t interrupt_policy;
|
||||
|
||||
// Don't switch the geometries
|
||||
typedef bg::detail::get_turns::get_turn_info_type<Geometry1, Geometry2, assign_policy_t> turn_policy_t;
|
||||
bg::dispatch::get_turns
|
||||
<
|
||||
typename bg::tag<Geometry1>::type, typename bg::tag<Geometry2>::type,
|
||||
Geometry1, Geometry2, false, false,
|
||||
turn_policy_t
|
||||
>::apply(0, g1, 1, g2, bg::detail::no_rescale_policy(), turns, interrupt_policy);
|
||||
|
||||
bool ok = expected.size() == turns.size();
|
||||
|
||||
BOOST_CHECK_MESSAGE(ok,
|
||||
"get_turns: " << wkt1 << " and " << wkt2
|
||||
<< " -> Expected turns #: " << expected.size() << " detected turns #: " << turns.size());
|
||||
|
||||
BOOST_FOREACH(std::string const& s, expected)
|
||||
{
|
||||
typename std::vector<turn_info>::iterator
|
||||
it = std::find_if(turns.begin(), turns.end(), equal_turn(s));
|
||||
|
||||
if ( it != turns.end() )
|
||||
turns.erase(it);
|
||||
else
|
||||
{
|
||||
BOOST_CHECK_MESSAGE(false,
|
||||
"get_turns: " << wkt1 << " and " << wkt2
|
||||
<< " -> Expected turn: " << s << " not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Geometry1, typename Geometry2>
|
||||
void test_geometry(std::string const& wkt1, std::string const& wkt2,
|
||||
std::vector<std::string> const& expected)
|
||||
{
|
||||
Geometry1 geometry1;
|
||||
Geometry2 geometry2;
|
||||
bg::read_wkt(wkt1, geometry1);
|
||||
bg::read_wkt(wkt2, geometry2);
|
||||
check_geometry(geometry1, geometry2, wkt1, wkt2, expected);
|
||||
}
|
||||
|
||||
template <typename G1, typename G2>
|
||||
void test_geometry(std::string const& wkt1, std::string const& wkt2,
|
||||
std::string const& ex0)
|
||||
{
|
||||
std::vector<std::string> expected;
|
||||
expected.push_back(ex0);
|
||||
test_geometry<G1, G2>(wkt1, wkt2, expected);
|
||||
}
|
||||
|
||||
template <typename G1, typename G2>
|
||||
void test_geometry(std::string const& wkt1, std::string const& wkt2,
|
||||
std::string const& ex0, std::string const& ex1)
|
||||
{
|
||||
std::vector<std::string> expected;
|
||||
expected.push_back(ex0);
|
||||
expected.push_back(ex1);
|
||||
test_geometry<G1, G2>(wkt1, wkt2, expected);
|
||||
}
|
||||
|
||||
template <typename G1, typename G2>
|
||||
void test_geometry(std::string const& wkt1, std::string const& wkt2,
|
||||
std::string const& ex0, std::string const& ex1, std::string const& ex2)
|
||||
{
|
||||
std::vector<std::string> expected;
|
||||
expected.push_back(ex0);
|
||||
expected.push_back(ex1);
|
||||
expected.push_back(ex2);
|
||||
test_geometry<G1, G2>(wkt1, wkt2, expected);
|
||||
}
|
||||
|
||||
struct expected_pusher
|
||||
{
|
||||
expected_pusher & operator()(std::string const& ex)
|
||||
{
|
||||
vec.push_back(ex);
|
||||
return *this;
|
||||
}
|
||||
std::vector<std::string> vec;
|
||||
};
|
||||
|
||||
expected_pusher expected(std::string const& ex)
|
||||
{
|
||||
expected_pusher res;
|
||||
return res(ex);
|
||||
}
|
||||
|
||||
//TEST
|
||||
//#include <to_svg.hpp>
|
||||
//#include <boost/geometry.hpp>
|
||||
|
159
test/algorithms/overlay/test_get_turns.hpp
Normal file
159
test/algorithms/overlay/test_get_turns.hpp
Normal file
@ -0,0 +1,159 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// 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.
|
||||
|
||||
// This file was modified by Oracle on 2014.
|
||||
// Modifications copyright (c) 2014 Oracle and/or its affiliates.
|
||||
|
||||
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
||||
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_ALGORITHMS_OVERLAY_TEST_GET_TURNS_HPP
|
||||
#define BOOST_GEOMETRY_TEST_ALGORITHMS_OVERLAY_TEST_GET_TURNS_HPP
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
#include <geometry_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
|
||||
|
||||
#include <boost/geometry/io/wkt/read.hpp>
|
||||
#include <boost/geometry/io/wkt/write.hpp>
|
||||
|
||||
struct equal_turn
|
||||
{
|
||||
equal_turn(std::string const& s) : turn_ptr(&s) {}
|
||||
|
||||
template <typename T>
|
||||
bool operator()(T const& t) const
|
||||
{
|
||||
BOOST_ASSERT(turn_ptr && turn_ptr->size() == 3);
|
||||
return bg::method_char(t.method) == (*turn_ptr)[0]
|
||||
&& bg::operation_char(t.operations[0].operation) == (*turn_ptr)[1]
|
||||
&& bg::operation_char(t.operations[1].operation) == (*turn_ptr)[2];
|
||||
}
|
||||
|
||||
const std::string * turn_ptr;
|
||||
};
|
||||
|
||||
template <typename Geometry1, typename Geometry2>
|
||||
void check_geometry(
|
||||
Geometry1 const& g1,
|
||||
Geometry2 const& g2,
|
||||
std::string const& wkt1,
|
||||
std::string const& wkt2,
|
||||
std::vector<std::string> const& expected)
|
||||
{
|
||||
typedef bg::detail::overlay::turn_info
|
||||
<
|
||||
typename bg::point_type<Geometry2>::type,
|
||||
typename bg::detail::get_turns::turn_operation_type<Geometry1, Geometry2>::type
|
||||
> turn_info;
|
||||
typedef bg::detail::overlay::assign_null_policy assign_policy_t;
|
||||
typedef bg::detail::get_turns::no_interrupt_policy interrupt_policy_t;
|
||||
|
||||
std::vector<turn_info> turns;
|
||||
interrupt_policy_t interrupt_policy;
|
||||
|
||||
// Don't switch the geometries
|
||||
typedef bg::detail::get_turns::get_turn_info_type<Geometry1, Geometry2, assign_policy_t> turn_policy_t;
|
||||
bg::dispatch::get_turns
|
||||
<
|
||||
typename bg::tag<Geometry1>::type, typename bg::tag<Geometry2>::type,
|
||||
Geometry1, Geometry2, false, false,
|
||||
turn_policy_t
|
||||
>::apply(0, g1, 1, g2, bg::detail::no_rescale_policy(), turns, interrupt_policy);
|
||||
|
||||
bool ok = expected.size() == turns.size();
|
||||
|
||||
BOOST_CHECK_MESSAGE(ok,
|
||||
"get_turns: " << wkt1 << " and " << wkt2
|
||||
<< " -> Expected turns #: " << expected.size() << " detected turns #: " << turns.size());
|
||||
|
||||
BOOST_FOREACH(std::string const& s, expected)
|
||||
{
|
||||
typename std::vector<turn_info>::iterator
|
||||
it = std::find_if(turns.begin(), turns.end(), equal_turn(s));
|
||||
|
||||
if ( it != turns.end() )
|
||||
turns.erase(it);
|
||||
else
|
||||
{
|
||||
BOOST_CHECK_MESSAGE(false,
|
||||
"get_turns: " << wkt1 << " and " << wkt2
|
||||
<< " -> Expected turn: " << s << " not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Geometry1, typename Geometry2>
|
||||
void test_geometry(std::string const& wkt1, std::string const& wkt2,
|
||||
std::vector<std::string> const& expected)
|
||||
{
|
||||
Geometry1 geometry1;
|
||||
Geometry2 geometry2;
|
||||
bg::read_wkt(wkt1, geometry1);
|
||||
bg::read_wkt(wkt2, geometry2);
|
||||
check_geometry(geometry1, geometry2, wkt1, wkt2, expected);
|
||||
}
|
||||
|
||||
template <typename G1, typename G2>
|
||||
void test_geometry(std::string const& wkt1, std::string const& wkt2,
|
||||
std::string const& ex0)
|
||||
{
|
||||
std::vector<std::string> expected;
|
||||
expected.push_back(ex0);
|
||||
test_geometry<G1, G2>(wkt1, wkt2, expected);
|
||||
}
|
||||
|
||||
template <typename G1, typename G2>
|
||||
void test_geometry(std::string const& wkt1, std::string const& wkt2,
|
||||
std::string const& ex0, std::string const& ex1)
|
||||
{
|
||||
std::vector<std::string> expected;
|
||||
expected.push_back(ex0);
|
||||
expected.push_back(ex1);
|
||||
test_geometry<G1, G2>(wkt1, wkt2, expected);
|
||||
}
|
||||
|
||||
template <typename G1, typename G2>
|
||||
void test_geometry(std::string const& wkt1, std::string const& wkt2,
|
||||
std::string const& ex0, std::string const& ex1, std::string const& ex2)
|
||||
{
|
||||
std::vector<std::string> expected;
|
||||
expected.push_back(ex0);
|
||||
expected.push_back(ex1);
|
||||
expected.push_back(ex2);
|
||||
test_geometry<G1, G2>(wkt1, wkt2, expected);
|
||||
}
|
||||
|
||||
struct expected_pusher
|
||||
{
|
||||
expected_pusher & operator()(std::string const& ex)
|
||||
{
|
||||
vec.push_back(ex);
|
||||
return *this;
|
||||
}
|
||||
std::vector<std::string> vec;
|
||||
};
|
||||
|
||||
expected_pusher expected(std::string const& ex)
|
||||
{
|
||||
expected_pusher res;
|
||||
return res(ex);
|
||||
}
|
||||
|
||||
#endif // BOOST_GEOMETRY_TEST_ALGORITHMS_OVERLAY_TEST_GET_TURNS_HPP
|
@ -88,19 +88,19 @@ inline void turns_to_svg(Turns const& turns, Mapper & mapper, bool enrich = fals
|
||||
<< ' ' << turn.operations[0].other_id.ring_index
|
||||
<< ' ' << turn.operations[0].other_id.segment_index;
|
||||
|
||||
if ( enrich )
|
||||
/*if ( enrich )
|
||||
{
|
||||
out << ", ";
|
||||
if (turn.operations[0].enriched.next_ip_index != -1)
|
||||
{
|
||||
out << "ip: " << turn.operations[0].enriched.next_ip_index;
|
||||
}
|
||||
else
|
||||
{
|
||||
out << "vx: " << turn.operations[0].enriched.travels_to_vertex_index
|
||||
<< " -> ip: " << turn.operations[0].enriched.travels_to_ip_index;
|
||||
}
|
||||
out << ", ";
|
||||
if (turn.operations[0].enriched.next_ip_index != -1)
|
||||
{
|
||||
out << "ip: " << turn.operations[0].enriched.next_ip_index;
|
||||
}
|
||||
else
|
||||
{
|
||||
out << "vx: " << turn.operations[0].enriched.travels_to_vertex_index
|
||||
<< " -> ip: " << turn.operations[0].enriched.travels_to_ip_index;
|
||||
}
|
||||
}*/
|
||||
|
||||
out << '\n';
|
||||
|
||||
@ -111,10 +111,10 @@ inline void turns_to_svg(Turns const& turns, Mapper & mapper, bool enrich = fals
|
||||
<< ' ' << turn.operations[1].seg_id.segment_index << ", ";
|
||||
out << "other: " << turn.operations[1].other_id.source_index
|
||||
<< ' ' << turn.operations[1].other_id.multi_index
|
||||
<< ' ' << turn.operations[1].other_id.segment_index
|
||||
<< ' ' << turn.operations[1].other_id.ring_index;
|
||||
<< ' ' << turn.operations[1].other_id.ring_index
|
||||
<< ' ' << turn.operations[1].other_id.segment_index;
|
||||
|
||||
if ( enrich )
|
||||
/*if ( enrich )
|
||||
{
|
||||
out << ", ";
|
||||
if (turn.operations[1].enriched.next_ip_index != -1)
|
||||
@ -126,7 +126,7 @@ inline void turns_to_svg(Turns const& turns, Mapper & mapper, bool enrich = fals
|
||||
out << "vx: " << turn.operations[1].enriched.travels_to_vertex_index
|
||||
<< " -> ip: " << turn.operations[1].enriched.travels_to_ip_index;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
//out << std::endl;
|
||||
|
||||
@ -253,7 +253,8 @@ inline void to_svg(G1 const& g1, G2 const& g2, std::string const& filename, bool
|
||||
|
||||
// GET TURNS
|
||||
|
||||
typedef bg::detail::overlay::traversal_turn_info<P1> turn_info;
|
||||
typedef typename bg::detail::relate::turns::get_turns<G1, G2>::turn_info turn_info;
|
||||
//typedef bg::detail::overlay::traversal_turn_info<P1> turn_info;
|
||||
//typedef bg::detail::overlay::calculate_distance_policy AssignPolicy;
|
||||
typedef to_svg_assign_policy AssignPolicy;
|
||||
|
||||
@ -291,7 +292,7 @@ inline void to_svg(G1 const& g1, G2 const& g2, std::string const& filename, bool
|
||||
std::sort(boost::begin(turns), boost::end(turns), less());
|
||||
}
|
||||
|
||||
if ( enrich )
|
||||
/*if ( enrich )
|
||||
{
|
||||
typedef typename bg::strategy::side::services::default_strategy
|
||||
<
|
||||
@ -304,7 +305,7 @@ inline void to_svg(G1 const& g1, G2 const& g2, std::string const& filename, bool
|
||||
g1, g1,
|
||||
bg::detail::no_rescale_policy(),
|
||||
side_strategy_type());
|
||||
}
|
||||
}*/
|
||||
|
||||
turns_to_svg<G1>(turns, mapper, enrich);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user