mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-12 05:51:47 +00:00
Marked some tests as not being for Intel (for 600 s limit)
Added (commited) select_rings Removed dissolver from solution Added optional offset for interior_triangles.cpp [SVN r70582]
This commit is contained in:
parent
01bf7a9be1
commit
3d058b87d7
@ -38,7 +38,7 @@ void test_all()
|
|||||||
typedef bg::model::polygon<P> polygon;
|
typedef bg::model::polygon<P> polygon;
|
||||||
typedef bg::model::ring<P> ring;
|
typedef bg::model::ring<P> ring;
|
||||||
|
|
||||||
bool const is_float =
|
bool const is_float =
|
||||||
boost::is_same<typename bg::coordinate_type<P>::type, float>::value;
|
boost::is_same<typename bg::coordinate_type<P>::type, float>::value;
|
||||||
|
|
||||||
test_one<polygon, polygon, polygon>("simplex_normal",
|
test_one<polygon, polygon, polygon>("simplex_normal",
|
||||||
@ -211,17 +211,17 @@ void test_all()
|
|||||||
5, 22, 1.1901714, 5, 27, 1.6701714);
|
5, 22, 1.1901714, 5, 27, 1.6701714);
|
||||||
|
|
||||||
test_one<polygon, ring, polygon>(
|
test_one<polygon, ring, polygon>(
|
||||||
"ring_star_ring", example_ring, example_star,
|
"ring_star_ring", example_ring, example_star,
|
||||||
5, 22, 1.6701714, 5, 27, 1.1901714);
|
5, 22, 1.6701714, 5, 27, 1.1901714);
|
||||||
|
|
||||||
static std::string const clip = "POLYGON((2.5 0.5,5.5 2.5))";
|
static std::string const clip = "POLYGON((2.5 0.5,5.5 2.5))";
|
||||||
|
|
||||||
test_one<polygon, box, ring>("star_box",
|
test_one<polygon, box, ring>("star_box",
|
||||||
clip, example_star,
|
clip, example_star,
|
||||||
4, 11, 2.833333, 4, 11, 0.833333);
|
4, 11, 2.833333, 4, 11, 0.833333);
|
||||||
|
|
||||||
test_one<polygon, ring, box>("box_star",
|
test_one<polygon, ring, box>("box_star",
|
||||||
example_star, clip,
|
example_star, clip,
|
||||||
4, 11, 0.833333, 4, 11, 2.833333);
|
4, 11, 0.833333, 4, 11, 2.833333);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,16 +247,16 @@ void test_all()
|
|||||||
|
|
||||||
static std::string const clip = "POLYGON((2 2,4 4))";
|
static std::string const clip = "POLYGON((2 2,4 4))";
|
||||||
|
|
||||||
test_one<polygon, box, mp>("simplex_multi_box_mp",
|
test_one<polygon, box, mp>("simplex_multi_box_mp",
|
||||||
clip, case_multi_simplex[0],
|
clip, case_multi_simplex[0],
|
||||||
3, 11, 4.53333, 3, 11, 8.53333);
|
3, 11, 4.53333, 3, 11, 8.53333);
|
||||||
test_one<polygon, mp, box>("simplex_multi_mp_box",
|
test_one<polygon, mp, box>("simplex_multi_mp_box",
|
||||||
case_multi_simplex[0], clip,
|
case_multi_simplex[0], clip,
|
||||||
3, 11, 8.53333, 3, 11, 4.53333);
|
3, 11, 8.53333, 3, 11, 4.53333);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
Experimental (cut), does not work:
|
Experimental (cut), does not work:
|
||||||
test_one<polygon, polygon, polygon>(
|
test_one<polygon, polygon, polygon>(
|
||||||
"polygon_pseudo_line",
|
"polygon_pseudo_line",
|
||||||
"POLYGON((0 0,0 4,4 4,4 0,0 0))",
|
"POLYGON((0 0,0 4,4 4,4 0,0 0))",
|
||||||
@ -362,12 +362,15 @@ int test_main(int, char* [])
|
|||||||
//test_difference_parcel_precision<float>();
|
//test_difference_parcel_precision<float>();
|
||||||
//test_difference_parcel_precision<double>();
|
//test_difference_parcel_precision<double>();
|
||||||
|
|
||||||
test_all<bg::model::d2::point_xy<float> >();
|
|
||||||
test_all<bg::model::d2::point_xy<double> >();
|
test_all<bg::model::d2::point_xy<double> >();
|
||||||
|
|
||||||
|
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
|
test_all<bg::model::d2::point_xy<float> >();
|
||||||
|
|
||||||
#ifdef HAVE_TTMATH
|
#ifdef HAVE_TTMATH
|
||||||
test_all<bg::model::d2::point_xy<ttmath_big> >();
|
test_all<bg::model::d2::point_xy<ttmath_big> >();
|
||||||
//test_difference_parcel_precision<ttmath_big>();
|
//test_difference_parcel_precision<ttmath_big>();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -40,7 +40,7 @@ void test_areal()
|
|||||||
simplex_normal[0], polygon_empty,
|
simplex_normal[0], polygon_empty,
|
||||||
0, 0, 0.0);
|
0, 0, 0.0);
|
||||||
test_one<Polygon, Polygon, Polygon>("simplex_with_empty_2",
|
test_one<Polygon, Polygon, Polygon>("simplex_with_empty_2",
|
||||||
polygon_empty, simplex_normal[0],
|
polygon_empty, simplex_normal[0],
|
||||||
0, 0, 0.0);
|
0, 0, 0.0);
|
||||||
|
|
||||||
test_one<Polygon, Polygon, Polygon>("simplex_normal",
|
test_one<Polygon, Polygon, Polygon>("simplex_normal",
|
||||||
@ -204,7 +204,7 @@ void test_areal_clip()
|
|||||||
2, 13, 1.0744456);
|
2, 13, 1.0744456);
|
||||||
|
|
||||||
test_one<Polygon, Box, Polygon>("clip_poly7", "Box(0 0, 3 3)",
|
test_one<Polygon, Box, Polygon>("clip_poly7", "Box(0 0, 3 3)",
|
||||||
"POLYGON((2 2, 1 4, 2 4, 3 3, 2 2))",
|
"POLYGON((2 2, 1 4, 2 4, 3 3, 2 2))",
|
||||||
1, 4, 0.75);
|
1, 4, 0.75);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,7 +253,7 @@ void test_all()
|
|||||||
|
|
||||||
#if defined(TEST_FAIL_DIFFERENT_ORIENTATIONS)
|
#if defined(TEST_FAIL_DIFFERENT_ORIENTATIONS)
|
||||||
// Should NOT compile
|
// Should NOT compile
|
||||||
// NOTE: this can probably be relaxed later on.
|
// NOTE: this can probably be relaxed later on.
|
||||||
test_one<polygon, polygon_ccw, polygon>("simplex_normal",
|
test_one<polygon, polygon_ccw, polygon>("simplex_normal",
|
||||||
simplex_normal[0], simplex_normal[1],
|
simplex_normal[0], simplex_normal[1],
|
||||||
1, 7, 5.47363293);
|
1, 7, 5.47363293);
|
||||||
@ -287,7 +287,7 @@ void test_all()
|
|||||||
// Outputting two lines (because of 3-4-5 constructions (0.3,0.4,0.5)
|
// Outputting two lines (because of 3-4-5 constructions (0.3,0.4,0.5)
|
||||||
// which occur 4 times, the length is expected to be 2.0)
|
// which occur 4 times, the length is expected to be 2.0)
|
||||||
test_one<linestring, linestring, box>("llb_2", "LINESTRING(1.7 1.6,2.3 2.4,2.9 1.6,3.5 2.4,4.1 1.6)", clip, 2, 6, 4 * 0.5);
|
test_one<linestring, linestring, box>("llb_2", "LINESTRING(1.7 1.6,2.3 2.4,2.9 1.6,3.5 2.4,4.1 1.6)", clip, 2, 6, 4 * 0.5);
|
||||||
|
|
||||||
// linear
|
// linear
|
||||||
test_one<P, linestring, linestring>("llp1", "LINESTRING(0 0,1 1)", "LINESTRING(0 1,1 0)", 1, 1, 0);
|
test_one<P, linestring, linestring>("llp1", "LINESTRING(0 0,1 1)", "LINESTRING(0 1,1 0)", 1, 1, 0);
|
||||||
test_one<P, segment, segment>("ssp1", "LINESTRING(0 0,1 1)", "LINESTRING(0 1,1 0)", 1, 1, 0);
|
test_one<P, segment, segment>("ssp1", "LINESTRING(0 0,1 1)", "LINESTRING(0 1,1 0)", 1, 1, 0);
|
||||||
@ -348,14 +348,18 @@ void test_pointer_version()
|
|||||||
|
|
||||||
int test_main(int, char* [])
|
int test_main(int, char* [])
|
||||||
{
|
{
|
||||||
test_all<bg::model::d2::point_xy<float> >();
|
|
||||||
test_all<bg::model::d2::point_xy<double> >();
|
test_all<bg::model::d2::point_xy<double> >();
|
||||||
|
|
||||||
|
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
|
test_all<bg::model::d2::point_xy<float> >();
|
||||||
|
|
||||||
#if defined(HAVE_TTMATH)
|
#if defined(HAVE_TTMATH)
|
||||||
test_all<bg::model::d2::point_xy<ttmath_big> >();
|
test_all<bg::model::d2::point_xy<ttmath_big> >();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//test_pointer_version();
|
//test_pointer_version();
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,11 +10,10 @@ test-suite boost-geometry-algorithms-overlay
|
|||||||
:
|
:
|
||||||
[ run assemble.cpp ]
|
[ run assemble.cpp ]
|
||||||
# [ run ccw_traverse.cpp ]
|
# [ run ccw_traverse.cpp ]
|
||||||
# [ run dissolver.cpp ]
|
|
||||||
[ run get_turn_info.cpp ]
|
[ run get_turn_info.cpp ]
|
||||||
[ run get_turns.cpp ]
|
[ run get_turns.cpp ]
|
||||||
# [ run relative_order.cpp ]
|
# [ run relative_order.cpp ]
|
||||||
|
[ run select_rings.cpp ]
|
||||||
# [ run self_intersection_points.cpp ]
|
# [ run self_intersection_points.cpp ]
|
||||||
# [ run split_rings.cpp ]
|
|
||||||
[ run traverse.cpp ]
|
[ run traverse.cpp ]
|
||||||
;
|
;
|
||||||
|
@ -12,10 +12,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "relative_order", "relative_
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assemble", "assemble.vcproj", "{306E829F-ACEC-42D5-B1D4-2531B2F56EA3}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assemble", "assemble.vcproj", "{306E829F-ACEC-42D5-B1D4-2531B2F56EA3}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dissolver", "dissolver.vcproj", "{6CCB145C-C682-4B9F-8672-6D04DB5C76DD}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ccw_traverse", "ccw_traverse.vcproj", "{BA789719-B2FC-405A-9258-E9E4ABCE1791}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ccw_traverse", "ccw_traverse.vcproj", "{BA789719-B2FC-405A-9258-E9E4ABCE1791}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "select_rings", "select_rings.vcproj", "{029117F7-1D6A-4A05-9FB7-93E09751C909}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Win32 = Debug|Win32
|
Debug|Win32 = Debug|Win32
|
||||||
@ -46,14 +46,14 @@ Global
|
|||||||
{306E829F-ACEC-42D5-B1D4-2531B2F56EA3}.Debug|Win32.Build.0 = Debug|Win32
|
{306E829F-ACEC-42D5-B1D4-2531B2F56EA3}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{306E829F-ACEC-42D5-B1D4-2531B2F56EA3}.Release|Win32.ActiveCfg = Release|Win32
|
{306E829F-ACEC-42D5-B1D4-2531B2F56EA3}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{306E829F-ACEC-42D5-B1D4-2531B2F56EA3}.Release|Win32.Build.0 = Release|Win32
|
{306E829F-ACEC-42D5-B1D4-2531B2F56EA3}.Release|Win32.Build.0 = Release|Win32
|
||||||
{6CCB145C-C682-4B9F-8672-6D04DB5C76DD}.Debug|Win32.ActiveCfg = Debug|Win32
|
|
||||||
{6CCB145C-C682-4B9F-8672-6D04DB5C76DD}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{6CCB145C-C682-4B9F-8672-6D04DB5C76DD}.Release|Win32.ActiveCfg = Release|Win32
|
|
||||||
{6CCB145C-C682-4B9F-8672-6D04DB5C76DD}.Release|Win32.Build.0 = Release|Win32
|
|
||||||
{BA789719-B2FC-405A-9258-E9E4ABCE1791}.Debug|Win32.ActiveCfg = Debug|Win32
|
{BA789719-B2FC-405A-9258-E9E4ABCE1791}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{BA789719-B2FC-405A-9258-E9E4ABCE1791}.Debug|Win32.Build.0 = Debug|Win32
|
{BA789719-B2FC-405A-9258-E9E4ABCE1791}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{BA789719-B2FC-405A-9258-E9E4ABCE1791}.Release|Win32.ActiveCfg = Release|Win32
|
{BA789719-B2FC-405A-9258-E9E4ABCE1791}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{BA789719-B2FC-405A-9258-E9E4ABCE1791}.Release|Win32.Build.0 = Release|Win32
|
{BA789719-B2FC-405A-9258-E9E4ABCE1791}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{029117F7-1D6A-4A05-9FB7-93E09751C909}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{029117F7-1D6A-4A05-9FB7-93E09751C909}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{029117F7-1D6A-4A05-9FB7-93E09751C909}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{029117F7-1D6A-4A05-9FB7-93E09751C909}.Release|Win32.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -33,13 +33,13 @@
|
|||||||
|
|
||||||
|
|
||||||
template <typename Polygon>
|
template <typename Polygon>
|
||||||
inline void make_polygon(Polygon& polygon, int count_x, int count_y, int index)
|
inline void make_polygon(Polygon& polygon, int count_x, int count_y, int index, int offset)
|
||||||
{
|
{
|
||||||
typedef typename bg::point_type<Polygon>::type point_type;
|
typedef typename bg::point_type<Polygon>::type point_type;
|
||||||
bg::exterior_ring(polygon).push_back(point_type(0, 0));
|
bg::exterior_ring(polygon).push_back(point_type(0, 0));
|
||||||
bg::exterior_ring(polygon).push_back(point_type(0, count_y * 10));
|
bg::exterior_ring(polygon).push_back(point_type(0, count_y * 10));
|
||||||
bg::exterior_ring(polygon).push_back(point_type(count_x * 10, count_y * 10));
|
bg::exterior_ring(polygon).push_back(point_type(count_x * 10 + 10, count_y * 10));
|
||||||
bg::exterior_ring(polygon).push_back(point_type(count_x * 10, 0));
|
bg::exterior_ring(polygon).push_back(point_type(count_x * 10 + 10, 0));
|
||||||
bg::exterior_ring(polygon).push_back(point_type(0, 0));
|
bg::exterior_ring(polygon).push_back(point_type(0, 0));
|
||||||
|
|
||||||
for(int j = 0; j < count_x; ++j)
|
for(int j = 0; j < count_x; ++j)
|
||||||
@ -47,10 +47,10 @@ inline void make_polygon(Polygon& polygon, int count_x, int count_y, int index)
|
|||||||
for(int k = 0; k < count_y; ++k)
|
for(int k = 0; k < count_y; ++k)
|
||||||
{
|
{
|
||||||
polygon.inners().push_back(Polygon::inner_container_type::value_type());
|
polygon.inners().push_back(Polygon::inner_container_type::value_type());
|
||||||
polygon.inners().back().push_back(point_type(j * 10 + 1, k * 10 + 1));
|
polygon.inners().back().push_back(point_type(offset + j * 10 + 1, k * 10 + 1));
|
||||||
polygon.inners().back().push_back(point_type(j * 10 + 7, k * 10 + 5 + index));
|
polygon.inners().back().push_back(point_type(offset + j * 10 + 7, k * 10 + 5 + index));
|
||||||
polygon.inners().back().push_back(point_type(j * 10 + 5 + index, k * 10 + 7));
|
polygon.inners().back().push_back(point_type(offset + j * 10 + 5 + index, k * 10 + 7));
|
||||||
polygon.inners().back().push_back(point_type(j * 10 + 1, k * 10 + 1));
|
polygon.inners().back().push_back(point_type(offset + j * 10 + 1, k * 10 + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bg::correct(polygon);
|
bg::correct(polygon);
|
||||||
@ -59,12 +59,12 @@ inline void make_polygon(Polygon& polygon, int count_x, int count_y, int index)
|
|||||||
|
|
||||||
|
|
||||||
template <typename Polygon>
|
template <typename Polygon>
|
||||||
void test_star_comb(int count_x, int count_y, p_q_settings const& settings)
|
void test_star_comb(int count_x, int count_y, int offset, p_q_settings const& settings)
|
||||||
{
|
{
|
||||||
Polygon p, q;
|
Polygon p, q;
|
||||||
|
|
||||||
make_polygon(p, count_x, count_y, 0);
|
make_polygon(p, count_x, count_y, 0, 0);
|
||||||
make_polygon(q, count_x, count_y, 1);
|
make_polygon(q, count_x, count_y, 1, offset);
|
||||||
|
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << "interior_triangles";
|
out << "interior_triangles";
|
||||||
@ -77,7 +77,7 @@ void test_star_comb(int count_x, int count_y, p_q_settings const& settings)
|
|||||||
|
|
||||||
|
|
||||||
template <typename T, bool Clockwise, bool Closed>
|
template <typename T, bool Clockwise, bool Closed>
|
||||||
void test_all(int count, int count_x, int count_y, p_q_settings const& settings)
|
void test_all(int count, int count_x, int count_y, int offset, p_q_settings const& settings)
|
||||||
{
|
{
|
||||||
boost::timer t;
|
boost::timer t;
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ void test_all(int count, int count_x, int count_y, p_q_settings const& settings)
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
for(int i = 0; i < count; i++)
|
for(int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
test_star_comb<polygon>(count_x, count_y, settings);
|
test_star_comb<polygon>(count_x, count_y, offset, settings);
|
||||||
}
|
}
|
||||||
std::cout
|
std::cout
|
||||||
<< " type: " << string_from_type<T>::name()
|
<< " type: " << string_from_type<T>::name()
|
||||||
@ -104,6 +104,7 @@ int main(int argc, char** argv)
|
|||||||
namespace po = boost::program_options;
|
namespace po = boost::program_options;
|
||||||
po::options_description description("=== interior_triangles ===\nAllowed options");
|
po::options_description description("=== interior_triangles ===\nAllowed options");
|
||||||
|
|
||||||
|
int offset = 0;
|
||||||
int count = 1;
|
int count = 1;
|
||||||
int count_x = 10;
|
int count_x = 10;
|
||||||
int count_y = 10;
|
int count_y = 10;
|
||||||
@ -116,6 +117,7 @@ int main(int argc, char** argv)
|
|||||||
("count", po::value<int>(&count)->default_value(1), "Number of tests")
|
("count", po::value<int>(&count)->default_value(1), "Number of tests")
|
||||||
("count_x", po::value<int>(&count_x)->default_value(10), "Triangle count in x-direction")
|
("count_x", po::value<int>(&count_x)->default_value(10), "Triangle count in x-direction")
|
||||||
("count_y", po::value<int>(&count_y)->default_value(10), "Triangle count in y-direction")
|
("count_y", po::value<int>(&count_y)->default_value(10), "Triangle count in y-direction")
|
||||||
|
("offset", po::value<int>(&offset)->default_value(0), "Offset of second triangle in x-direction")
|
||||||
("diff", po::value<bool>(&settings.also_difference)->default_value(false), "Include testing on difference")
|
("diff", po::value<bool>(&settings.also_difference)->default_value(false), "Include testing on difference")
|
||||||
("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
|
("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
|
||||||
("open", po::value<bool>(&open)->default_value(false), "Open polygons")
|
("open", po::value<bool>(&open)->default_value(false), "Open polygons")
|
||||||
@ -135,19 +137,19 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
if (ccw && open)
|
if (ccw && open)
|
||||||
{
|
{
|
||||||
test_all<double, false, false>(count, count_x, count_y, settings);
|
test_all<double, false, false>(count, count_x, count_y, offset, settings);
|
||||||
}
|
}
|
||||||
else if (ccw)
|
else if (ccw)
|
||||||
{
|
{
|
||||||
test_all<double, false, true>(count, count_x, count_y, settings);
|
test_all<double, false, true>(count, count_x, count_y, offset, settings);
|
||||||
}
|
}
|
||||||
else if (open)
|
else if (open)
|
||||||
{
|
{
|
||||||
test_all<double, true, false>(count, count_x, count_y, settings);
|
test_all<double, true, false>(count, count_x, count_y, offset, settings);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
test_all<double, true, true>(count, count_x, count_y, settings);
|
test_all<double, true, true>(count, count_x, count_y, offset, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_TTMATH)
|
#if defined(HAVE_TTMATH)
|
||||||
|
82
test/algorithms/overlay/select_rings.cpp
Normal file
82
test/algorithms/overlay/select_rings.cpp
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||||
|
//
|
||||||
|
// Copyright Barend Gehrels, Geodan B.V. 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)
|
||||||
|
|
||||||
|
#include <geometry_test_common.hpp>
|
||||||
|
|
||||||
|
#include <algorithms/test_overlay.hpp>
|
||||||
|
|
||||||
|
#include <boost/range/algorithm/copy.hpp>
|
||||||
|
|
||||||
|
#include <boost/geometry/geometry.hpp>
|
||||||
|
#include <boost/geometry/algorithms/detail/overlay/select_rings.hpp>
|
||||||
|
#include <boost/geometry/algorithms/detail/overlay/assign_parents.hpp>
|
||||||
|
|
||||||
|
#include <boost/geometry/domains/gis/io/wkt/read_wkt.hpp>
|
||||||
|
|
||||||
|
#include <boost/assign/list_of.hpp>
|
||||||
|
#include <boost/foreach.hpp>
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template <typename Geometry1, typename Geometry2, bg::overlay_type OverlayType, typename Vector>
|
||||||
|
void test_geometry(std::string const& wkt1, std::string const& wkt2, Vector const& expected)
|
||||||
|
{
|
||||||
|
typedef bg::detail::overlay::ring_properties<typename bg::point_type<Geometry1>::type> properties;
|
||||||
|
|
||||||
|
Geometry1 geometry1;
|
||||||
|
Geometry2 geometry2;
|
||||||
|
|
||||||
|
bg::read_wkt(wkt1, geometry1);
|
||||||
|
bg::read_wkt(wkt2, geometry2);
|
||||||
|
|
||||||
|
typedef std::map<bg::ring_identifier, properties> map_type;
|
||||||
|
map_type selected;
|
||||||
|
std::map<bg::ring_identifier, int> empty;
|
||||||
|
|
||||||
|
bg::detail::overlay::select_rings<OverlayType>(geometry1, geometry2, empty, selected);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL(selected.size(), expected.size());
|
||||||
|
|
||||||
|
if (selected.size() <= expected.size())
|
||||||
|
{
|
||||||
|
BOOST_AUTO(eit, expected.begin());
|
||||||
|
for(typename map_type::const_iterator it = selected.begin(); it != selected.end(); ++it, ++eit)
|
||||||
|
{
|
||||||
|
bg::ring_identifier const ring_id = it->first;
|
||||||
|
BOOST_CHECK_EQUAL(ring_id.source_index, eit->template get<0>());
|
||||||
|
BOOST_CHECK_EQUAL(ring_id.multi_index, eit->template get<1>());
|
||||||
|
BOOST_CHECK_EQUAL(ring_id.ring_index, eit->template get<2>());
|
||||||
|
BOOST_CHECK_EQUAL(it->second.within_code, eit->template get<3>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template <typename P>
|
||||||
|
void test_all()
|
||||||
|
{
|
||||||
|
// Point in correct clockwise ring -> should return true
|
||||||
|
test_geometry<bg::model::polygon<P>, bg::model::polygon<P>, bg::overlay_union>(
|
||||||
|
winded[0], winded[1],
|
||||||
|
boost::assign::tuple_list_of(0,-1,-1,-1)(0,-1,0,-1)(0,-1,1,-1)(0,-1,3,-1)(1,-1,1,-1)(1,-1,2,-1));
|
||||||
|
test_geometry<bg::model::polygon<P>, bg::model::polygon<P>, bg::overlay_intersection>(
|
||||||
|
winded[0], winded[1],
|
||||||
|
boost::assign::tuple_list_of(0,-1,2,1)(1,-1,-1,1)(1,-1,0,1)(1,-1,3,1));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int test_main( int , char* [] )
|
||||||
|
{
|
||||||
|
test_all<bg::model::d2::point_xy<double> >();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
174
test/algorithms/overlay/select_rings.vcproj
Normal file
174
test/algorithms/overlay/select_rings.vcproj
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="8.00"
|
||||||
|
Name="select_rings"
|
||||||
|
ProjectGUID="{029117F7-1D6A-4A05-9FB7-93E09751C909}"
|
||||||
|
RootNamespace="select_rings"
|
||||||
|
Keyword="Win32Proj"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)\select_rings"
|
||||||
|
ConfigurationType="1"
|
||||||
|
InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
|
||||||
|
CharacterSet="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories=".;../../../../..;../..;../../../../../boost/geometry/extensions/contrib/ttmath"
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;TEST_WITH_SVG"
|
||||||
|
ExceptionHandling="2"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
DebugInformationFormat="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)\select_rings"
|
||||||
|
ConfigurationType="1"
|
||||||
|
InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
|
||||||
|
CharacterSet="1"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=".;../../../../..;../..;../../../../../boost/geometry/extensions/contrib/ttmath"
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||||
|
ExceptionHandling="2"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
SubSystem="1"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<File
|
||||||
|
RelativePath=".\select_rings.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
@ -77,7 +77,7 @@ template
|
|||||||
>
|
>
|
||||||
struct test_traverse
|
struct test_traverse
|
||||||
{
|
{
|
||||||
|
|
||||||
static void apply(std::string const& id,
|
static void apply(std::string const& id,
|
||||||
int expected_count, double expected_area,
|
int expected_count, double expected_area,
|
||||||
G1 const& g1, G2 const& g2,
|
G1 const& g1, G2 const& g2,
|
||||||
@ -897,7 +897,7 @@ void test_open()
|
|||||||
|
|
||||||
typedef bg::model::polygon
|
typedef bg::model::polygon
|
||||||
<
|
<
|
||||||
bg::model::point<T, 2, bg::cs::cartesian>,
|
bg::model::point<T, 2, bg::cs::cartesian>,
|
||||||
true, false
|
true, false
|
||||||
> polygon;
|
> polygon;
|
||||||
|
|
||||||
@ -915,7 +915,7 @@ void test_ccw()
|
|||||||
|
|
||||||
typedef bg::model::polygon
|
typedef bg::model::polygon
|
||||||
<
|
<
|
||||||
bg::model::point<T, 2, bg::cs::cartesian>,
|
bg::model::point<T, 2, bg::cs::cartesian>,
|
||||||
false, true
|
false, true
|
||||||
> polygon;
|
> polygon;
|
||||||
|
|
||||||
@ -929,6 +929,9 @@ void test_ccw()
|
|||||||
|
|
||||||
int test_main(int, char* [])
|
int test_main(int, char* [])
|
||||||
{
|
{
|
||||||
|
#if defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
|
test_all<double>();
|
||||||
|
#else
|
||||||
test_all<float>();
|
test_all<float>();
|
||||||
test_all<double>();
|
test_all<double>();
|
||||||
test_open<double>();
|
test_open<double>();
|
||||||
@ -940,6 +943,7 @@ int test_main(int, char* [])
|
|||||||
|
|
||||||
#ifdef HAVE_TTMATH
|
#ifdef HAVE_TTMATH
|
||||||
test_all<ttmath_big>();
|
test_all<ttmath_big>();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -47,7 +47,7 @@ void test_areal()
|
|||||||
simplex_normal[0], polygon_empty,
|
simplex_normal[0], polygon_empty,
|
||||||
1, 0, 4, 8.0);
|
1, 0, 4, 8.0);
|
||||||
test_one<Polygon, Polygon, Polygon>("simplex_with_empty_2",
|
test_one<Polygon, Polygon, Polygon>("simplex_with_empty_2",
|
||||||
polygon_empty, simplex_normal[0],
|
polygon_empty, simplex_normal[0],
|
||||||
1, 0, 4, 8.0);
|
1, 0, 4, 8.0);
|
||||||
|
|
||||||
test_one<Polygon, Polygon, Polygon>("star_ring", example_star, example_ring,
|
test_one<Polygon, Polygon, Polygon>("star_ring", example_star, example_ring,
|
||||||
@ -239,8 +239,8 @@ void test_areal()
|
|||||||
isovist1[0], isovist1[1],
|
isovist1[0], isovist1[1],
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
tn == std::string("f") ? 71
|
tn == std::string("f") ? 71
|
||||||
: tn == std::string("d") ? 72
|
: tn == std::string("d") ? 72
|
||||||
: 73,
|
: 73,
|
||||||
313.36036462);
|
313.36036462);
|
||||||
}
|
}
|
||||||
@ -305,12 +305,15 @@ void test_all()
|
|||||||
|
|
||||||
int test_main(int, char* [])
|
int test_main(int, char* [])
|
||||||
{
|
{
|
||||||
test_all<bg::model::d2::point_xy<float> >();
|
|
||||||
test_all<bg::model::d2::point_xy<double> >();
|
test_all<bg::model::d2::point_xy<double> >();
|
||||||
|
|
||||||
|
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
|
test_all<bg::model::d2::point_xy<float> >();
|
||||||
//test_all<bg::model::d2::point_xy<long double> >();
|
//test_all<bg::model::d2::point_xy<long double> >();
|
||||||
|
|
||||||
#if defined(HAVE_TTMATH)
|
#if defined(HAVE_TTMATH)
|
||||||
test_all<bg::model::d2::point_xy<ttmath_big> >();
|
test_all<bg::model::d2::point_xy<ttmath_big> >();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -19,6 +19,15 @@
|
|||||||
//#pragma warning( disable : 4305 )
|
//#pragma warning( disable : 4305 )
|
||||||
#endif // defined(_MSC_VER)
|
#endif // defined(_MSC_VER)
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(BOOST_INTEL_CXX_VERSION)
|
||||||
|
#define BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,6 +145,8 @@ void test_all()
|
|||||||
typedef bg::model::multi_polygon<polygon> multi_polygon;
|
typedef bg::model::multi_polygon<polygon> multi_polygon;
|
||||||
test_areal<ring, polygon, multi_polygon>();
|
test_areal<ring, polygon, multi_polygon>();
|
||||||
|
|
||||||
|
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
|
|
||||||
typedef bg::model::ring<P, false> ring_ccw;
|
typedef bg::model::ring<P, false> ring_ccw;
|
||||||
typedef bg::model::polygon<P, false> polygon_ccw;
|
typedef bg::model::polygon<P, false> polygon_ccw;
|
||||||
typedef bg::model::multi_polygon<polygon_ccw> multi_polygon_ccw;
|
typedef bg::model::multi_polygon<polygon_ccw> multi_polygon_ccw;
|
||||||
@ -167,7 +169,7 @@ void test_all()
|
|||||||
typedef bg::model::multi_linestring<linestring> multi_linestring;
|
typedef bg::model::multi_linestring<linestring> multi_linestring;
|
||||||
|
|
||||||
test_linear<linestring, multi_linestring, box>();
|
test_linear<linestring, multi_linestring, box>();
|
||||||
|
#endif
|
||||||
|
|
||||||
// linear
|
// linear
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user