summaryrefslogtreecommitdiff
path: root/libs/geometry/test
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2016-10-06 10:30:07 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2016-10-06 10:32:57 +0900
commit71d216b90256936a9638f325af9bc69d720e75de (patch)
tree9c5f682d341c7c88ad0c8e3d4b262e00b6fb691a /libs/geometry/test
parent733b5d5ae2c5d625211e2985ac25728ac3f54883 (diff)
downloadboost-71d216b90256936a9638f325af9bc69d720e75de.tar.gz
boost-71d216b90256936a9638f325af9bc69d720e75de.tar.bz2
boost-71d216b90256936a9638f325af9bc69d720e75de.zip
Imported Upstream version 1.59.0
Change-Id: I2dde00f4eca71df3eea9d251dcaecde18a6c90a5 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'libs/geometry/test')
-rw-r--r--libs/geometry/test/Jamfile.v23
-rw-r--r--libs/geometry/test/algorithms/Jamfile.v293
-rw-r--r--libs/geometry/test/algorithms/append.cpp21
-rw-r--r--libs/geometry/test/algorithms/area.cpp80
-rw-r--r--libs/geometry/test/algorithms/area_multi.cpp (renamed from libs/geometry/test/algorithms/multi_area.cpp)7
-rw-r--r--libs/geometry/test/algorithms/buffer/Jamfile.v218
-rw-r--r--libs/geometry/test/algorithms/buffer/buffer_countries.cpp (renamed from libs/geometry/test/algorithms/buffer/country_buffer.cpp)168
-rw-r--r--libs/geometry/test/algorithms/buffer/buffer_linestring.cpp (renamed from libs/geometry/test/algorithms/buffer/linestring_buffer.cpp)69
-rw-r--r--libs/geometry/test/algorithms/buffer/buffer_linestring_aimes.cpp (renamed from libs/geometry/test/algorithms/buffer/aimes_linestring_buffer.cpp)0
-rw-r--r--libs/geometry/test/algorithms/buffer/buffer_multi_linestring.cpp (renamed from libs/geometry/test/algorithms/buffer/multi_linestring_buffer.cpp)62
-rw-r--r--libs/geometry/test/algorithms/buffer/buffer_multi_point.cpp (renamed from libs/geometry/test/algorithms/buffer/multi_point_buffer.cpp)115
-rw-r--r--libs/geometry/test/algorithms/buffer/buffer_multi_polygon.cpp (renamed from libs/geometry/test/algorithms/buffer/multi_polygon_buffer.cpp)66
-rw-r--r--libs/geometry/test/algorithms/buffer/buffer_point.cpp (renamed from libs/geometry/test/algorithms/buffer/point_buffer.cpp)0
-rw-r--r--libs/geometry/test/algorithms/buffer/buffer_polygon.cpp (renamed from libs/geometry/test/algorithms/buffer/polygon_buffer.cpp)79
-rw-r--r--libs/geometry/test/algorithms/buffer/buffer_with_strategies.cpp138
-rw-r--r--libs/geometry/test/algorithms/buffer/test_buffer.hpp502
-rw-r--r--libs/geometry/test/algorithms/buffer/test_buffer_svg.hpp473
-rw-r--r--libs/geometry/test/algorithms/buffer/test_buffer_svg_per_turn.hpp164
-rw-r--r--libs/geometry/test/algorithms/centroid.cpp58
-rw-r--r--libs/geometry/test/algorithms/centroid_multi.cpp (renamed from libs/geometry/test/algorithms/multi_centroid.cpp)16
-rw-r--r--libs/geometry/test/algorithms/clear_multi.cpp (renamed from libs/geometry/test/algorithms/multi_clear.cpp)8
-rw-r--r--libs/geometry/test/algorithms/convert_multi.cpp (renamed from libs/geometry/test/algorithms/multi_convert.cpp)12
-rw-r--r--libs/geometry/test/algorithms/convex_hull_multi.cpp (renamed from libs/geometry/test/algorithms/multi_convex_hull.cpp)30
-rw-r--r--libs/geometry/test/algorithms/correct_multi.cpp (renamed from libs/geometry/test/algorithms/multi_correct.cpp)7
-rw-r--r--libs/geometry/test/algorithms/detail/Jamfile.v215
-rw-r--r--libs/geometry/test/algorithms/detail/partition.cpp5
-rw-r--r--libs/geometry/test/algorithms/detail/sections/Jamfile.v215
-rw-r--r--libs/geometry/test/algorithms/distance/Jamfile.v223
-rw-r--r--libs/geometry/test/algorithms/distance/distance.cpp12
-rw-r--r--libs/geometry/test/algorithms/distance/distance_brute_force.hpp43
-rw-r--r--libs/geometry/test/algorithms/distance/distance_se_pl_l.cpp83
-rw-r--r--libs/geometry/test/algorithms/distance/distance_se_pl_pl.cpp4
-rw-r--r--libs/geometry/test/algorithms/distance/distance_se_point_box.cpp464
-rw-r--r--libs/geometry/test/algorithms/distance/test_distance_se_common.hpp11
-rw-r--r--libs/geometry/test/algorithms/envelope.cpp160
-rw-r--r--libs/geometry/test/algorithms/envelope_multi.cpp (renamed from libs/geometry/test/algorithms/multi_envelope.cpp)14
-rw-r--r--libs/geometry/test/algorithms/envelope_on_spheroid.cpp1506
-rw-r--r--libs/geometry/test/algorithms/expand_on_spheroid.cpp948
-rw-r--r--libs/geometry/test/algorithms/for_each_multi.cpp (renamed from libs/geometry/test/algorithms/multi_for_each.cpp)10
-rw-r--r--libs/geometry/test/algorithms/is_convex.cpp61
-rw-r--r--libs/geometry/test/algorithms/is_empty.cpp335
-rw-r--r--libs/geometry/test/algorithms/is_simple.cpp22
-rw-r--r--libs/geometry/test/algorithms/is_valid.cpp257
-rw-r--r--libs/geometry/test/algorithms/length_multi.cpp (renamed from libs/geometry/test/algorithms/multi_length.cpp)9
-rw-r--r--libs/geometry/test/algorithms/maximum_gap.cpp139
-rw-r--r--libs/geometry/test/algorithms/num_geometries_multi.cpp (renamed from libs/geometry/test/algorithms/multi_num_geometries.cpp)7
-rw-r--r--libs/geometry/test/algorithms/num_interior_rings_multi.cpp (renamed from libs/geometry/test/algorithms/multi_num_interior_rings.cpp)7
-rw-r--r--libs/geometry/test/algorithms/num_points.cpp11
-rw-r--r--libs/geometry/test/algorithms/num_points_multi.cpp (renamed from libs/geometry/test/algorithms/multi_num_points.cpp)10
-rw-r--r--libs/geometry/test/algorithms/overlay/Jamfile.v241
-rw-r--r--libs/geometry/test/algorithms/overlay/assemble.cpp6
-rw-r--r--libs/geometry/test/algorithms/overlay/dissolver.cpp7
-rw-r--r--libs/geometry/test/algorithms/overlay/get_turn_info.cpp9
-rw-r--r--libs/geometry/test/algorithms/overlay/get_turns.cpp2
-rw-r--r--libs/geometry/test/algorithms/overlay/multi_overlay_common.hpp12
-rw-r--r--libs/geometry/test/algorithms/overlay/traverse.cpp9
-rw-r--r--libs/geometry/test/algorithms/overlay/traverse_ccw.cpp (renamed from libs/geometry/test/algorithms/overlay/ccw_traverse.cpp)0
-rw-r--r--libs/geometry/test/algorithms/overlay/traverse_multi.cpp (renamed from libs/geometry/test/algorithms/overlay/multi_traverse.cpp)32
-rw-r--r--libs/geometry/test/algorithms/perimeter_multi.cpp (renamed from libs/geometry/test/algorithms/multi_perimeter.cpp)6
-rw-r--r--libs/geometry/test/algorithms/point_on_surface.cpp18
-rw-r--r--libs/geometry/test/algorithms/relational_operations/Jamfile.v229
-rw-r--r--libs/geometry/test/algorithms/relational_operations/covered_by_multi.cpp (renamed from libs/geometry/test/algorithms/relational_operations/multi_covered_by.cpp)9
-rw-r--r--libs/geometry/test/algorithms/relational_operations/disjoint/Jamfile.v222
-rw-r--r--libs/geometry/test/algorithms/relational_operations/disjoint/disjoint.cpp81
-rw-r--r--libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage.cpp1723
-rw-r--r--libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_a_a.cpp387
-rw-r--r--libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_l_a.cpp538
-rw-r--r--libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_l_l.cpp379
-rw-r--r--libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_p_a.cpp291
-rw-r--r--libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_p_l.cpp391
-rw-r--r--libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_p_p.cpp169
-rw-r--r--libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_multi.cpp (renamed from libs/geometry/test/algorithms/relational_operations/disjoint/multi_disjoint.cpp)13
-rw-r--r--libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_point_box_geometry.cpp127
-rw-r--r--libs/geometry/test/algorithms/relational_operations/disjoint/test_disjoint.hpp9
-rw-r--r--libs/geometry/test/algorithms/relational_operations/equals_multi.cpp (renamed from libs/geometry/test/algorithms/relational_operations/multi_equals.cpp)9
-rw-r--r--libs/geometry/test/algorithms/relational_operations/equals_on_spheroid.cpp255
-rw-r--r--libs/geometry/test/algorithms/relational_operations/intersects/Jamfile.v224
-rw-r--r--libs/geometry/test/algorithms/relational_operations/intersects/intersects.cpp (renamed from libs/geometry/test/algorithms/relational_operations/intersects.cpp)162
-rw-r--r--libs/geometry/test/algorithms/relational_operations/intersects/intersects_box_geometry.cpp100
-rw-r--r--libs/geometry/test/algorithms/relational_operations/intersects/intersects_multi.cpp (renamed from libs/geometry/test/algorithms/relational_operations/multi_intersects.cpp)3
-rw-r--r--libs/geometry/test/algorithms/relational_operations/intersects/intersects_self.cpp133
-rw-r--r--libs/geometry/test/algorithms/relational_operations/intersects/test_intersects.hpp (renamed from libs/geometry/test/algorithms/relational_operations/test_intersects.hpp)23
-rw-r--r--libs/geometry/test/algorithms/relational_operations/overlaps/Jamfile.v223
-rw-r--r--libs/geometry/test/algorithms/relational_operations/overlaps/overlaps.cpp56
-rw-r--r--libs/geometry/test/algorithms/relational_operations/overlaps/overlaps_areal.cpp (renamed from libs/geometry/test/algorithms/relational_operations/overlaps.cpp)61
-rw-r--r--libs/geometry/test/algorithms/relational_operations/overlaps/overlaps_box.cpp64
-rw-r--r--libs/geometry/test/algorithms/relational_operations/overlaps/test_overlaps.hpp (renamed from libs/geometry/test/algorithms/relational_operations/test_overlaps.hpp)0
-rw-r--r--libs/geometry/test/algorithms/relational_operations/relate/Jamfile.v218
-rw-r--r--libs/geometry/test/algorithms/relational_operations/relate/relate_areal_areal.cpp14
-rw-r--r--libs/geometry/test/algorithms/relational_operations/relate/relate_linear_linear.cpp35
-rw-r--r--libs/geometry/test/algorithms/relational_operations/relate/relate_pointlike_geometry.cpp (renamed from libs/geometry/test/algorithms/relational_operations/relate/relate_pointlike_xxx.cpp)8
-rw-r--r--libs/geometry/test/algorithms/relational_operations/relate/test_relate.hpp80
-rw-r--r--libs/geometry/test/algorithms/relational_operations/test_covered_by.hpp9
-rw-r--r--libs/geometry/test/algorithms/relational_operations/touches/Jamfile.v223
-rw-r--r--libs/geometry/test/algorithms/relational_operations/touches/test_touches.hpp (renamed from libs/geometry/test/algorithms/relational_operations/test_touches.hpp)0
-rw-r--r--libs/geometry/test/algorithms/relational_operations/touches/touches.cpp (renamed from libs/geometry/test/algorithms/relational_operations/touches.cpp)47
-rw-r--r--libs/geometry/test/algorithms/relational_operations/touches/touches_box.cpp65
-rw-r--r--libs/geometry/test/algorithms/relational_operations/touches/touches_multi.cpp (renamed from libs/geometry/test/algorithms/relational_operations/multi_touches.cpp)23
-rw-r--r--libs/geometry/test/algorithms/relational_operations/touches/touches_self.cpp43
-rw-r--r--libs/geometry/test/algorithms/relational_operations/within/Jamfile.v222
-rw-r--r--libs/geometry/test/algorithms/relational_operations/within/test_within.hpp13
-rw-r--r--libs/geometry/test/algorithms/relational_operations/within/within.cpp15
-rw-r--r--libs/geometry/test/algorithms/relational_operations/within/within_areal_areal.cpp7
-rw-r--r--libs/geometry/test/algorithms/relational_operations/within/within_linear_areal.cpp13
-rw-r--r--libs/geometry/test/algorithms/relational_operations/within/within_linear_linear.cpp11
-rw-r--r--libs/geometry/test/algorithms/relational_operations/within/within_multi.cpp (renamed from libs/geometry/test/algorithms/relational_operations/within/multi_within.cpp)9
-rw-r--r--libs/geometry/test/algorithms/relational_operations/within/within_pointlike_geometry.cpp (renamed from libs/geometry/test/algorithms/relational_operations/within/within_pointlike_xxx.cpp)15
-rw-r--r--libs/geometry/test/algorithms/remove_spikes.cpp17
-rw-r--r--libs/geometry/test/algorithms/reverse_multi.cpp (renamed from libs/geometry/test/algorithms/multi_reverse.cpp)8
-rw-r--r--libs/geometry/test/algorithms/set_operations/check_turn_less.hpp106
-rw-r--r--libs/geometry/test/algorithms/set_operations/difference/Jamfile.v224
-rw-r--r--libs/geometry/test/algorithms/set_operations/difference/difference.cpp95
-rw-r--r--libs/geometry/test/algorithms/set_operations/difference/difference_linear_linear.cpp36
-rw-r--r--libs/geometry/test/algorithms/set_operations/difference/difference_multi.cpp (renamed from libs/geometry/test/algorithms/set_operations/difference/multi_difference.cpp)25
-rw-r--r--libs/geometry/test/algorithms/set_operations/difference/difference_multi_spike.cpp (renamed from libs/geometry/test/algorithms/set_operations/difference/multi_difference_spike.cpp)26
-rw-r--r--libs/geometry/test/algorithms/set_operations/difference/difference_pl_l.cpp674
-rw-r--r--libs/geometry/test/algorithms/set_operations/difference/difference_pl_pl.cpp126
-rw-r--r--libs/geometry/test/algorithms/set_operations/difference/test_difference.hpp41
-rw-r--r--libs/geometry/test/algorithms/set_operations/difference/test_difference_linear_linear.hpp3
-rw-r--r--libs/geometry/test/algorithms/set_operations/intersection/Jamfile.v222
-rw-r--r--libs/geometry/test/algorithms/set_operations/intersection/intersection.cpp77
-rw-r--r--libs/geometry/test/algorithms/set_operations/intersection/intersection_areal_areal_linear.cpp391
-rw-r--r--libs/geometry/test/algorithms/set_operations/intersection/intersection_linear_linear.cpp2
-rw-r--r--libs/geometry/test/algorithms/set_operations/intersection/intersection_multi.cpp (renamed from libs/geometry/test/algorithms/set_operations/intersection/multi_intersection.cpp)16
-rw-r--r--libs/geometry/test/algorithms/set_operations/intersection/intersection_pl_l.cpp702
-rw-r--r--libs/geometry/test/algorithms/set_operations/intersection/intersection_pl_pl.cpp112
-rw-r--r--libs/geometry/test/algorithms/set_operations/intersection/test_intersection.hpp17
-rw-r--r--libs/geometry/test/algorithms/set_operations/intersection/test_intersection_linear_linear.hpp28
-rw-r--r--libs/geometry/test/algorithms/set_operations/sym_difference/Jamfile.v213
-rw-r--r--libs/geometry/test/algorithms/set_operations/sym_difference/sym_difference_areal_areal.cpp137
-rw-r--r--libs/geometry/test/algorithms/set_operations/sym_difference/sym_difference_linear_linear.cpp5
-rw-r--r--libs/geometry/test/algorithms/set_operations/test_get_turns_ll_invariance.hpp20
-rw-r--r--libs/geometry/test/algorithms/set_operations/test_set_ops_linear_linear.hpp37
-rw-r--r--libs/geometry/test/algorithms/set_operations/test_set_ops_pointlike.hpp (renamed from libs/geometry/test/algorithms/set_operations/test_set_ops_pl_pl.hpp)149
-rw-r--r--libs/geometry/test/algorithms/set_operations/union/Jamfile.v220
-rw-r--r--libs/geometry/test/algorithms/set_operations/union/test_union.hpp11
-rw-r--r--libs/geometry/test/algorithms/set_operations/union/union.cpp30
-rw-r--r--libs/geometry/test/algorithms/set_operations/union/union_linear_linear.cpp4
-rw-r--r--libs/geometry/test/algorithms/set_operations/union/union_multi.cpp (renamed from libs/geometry/test/algorithms/set_operations/union/multi_union.cpp)21
-rw-r--r--libs/geometry/test/algorithms/set_operations/union/union_pl_pl.cpp113
-rw-r--r--libs/geometry/test/algorithms/simplify_multi.cpp (renamed from libs/geometry/test/algorithms/multi_simplify.cpp)13
-rw-r--r--libs/geometry/test/algorithms/test_centroid.hpp43
-rw-r--r--libs/geometry/test/algorithms/test_convex_hull.hpp9
-rw-r--r--libs/geometry/test/algorithms/test_envelope_expand_on_spheroid.hpp192
-rw-r--r--libs/geometry/test/algorithms/test_length.hpp2
-rw-r--r--libs/geometry/test/algorithms/transform.cpp22
-rw-r--r--libs/geometry/test/algorithms/transform_multi.cpp (renamed from libs/geometry/test/algorithms/multi_transform.cpp)13
-rw-r--r--libs/geometry/test/algorithms/unique_multi.cpp (renamed from libs/geometry/test/algorithms/multi_unique.cpp)10
-rw-r--r--libs/geometry/test/arithmetic/Jamfile.v211
-rw-r--r--libs/geometry/test/concepts/Jamfile.v225
-rw-r--r--libs/geometry/test/concepts/function_asserting_a_point.hpp (renamed from libs/geometry/test/point_concept/function_asserting_a_point.hpp)0
-rw-r--r--libs/geometry/test/concepts/function_requiring_a_point.hpp (renamed from libs/geometry/test/point_concept/function_requiring_a_point.hpp)0
-rw-r--r--libs/geometry/test/concepts/linestring_concept.cpp10
-rw-r--r--libs/geometry/test/concepts/point_array.cpp (renamed from libs/geometry/test/point_concept/array_point.cpp)0
-rw-r--r--libs/geometry/test/concepts/point_concept_checker.cpp (renamed from libs/geometry/test/point_concept/concept_checker.cpp)0
-rw-r--r--libs/geometry/test/concepts/point_geographic_custom_with_wrong_units.cpp (renamed from libs/geometry/test/point_concept/geographic_custom_point_with_wrong_units.cpp)0
-rw-r--r--libs/geometry/test/concepts/point_geographic_with_wrong_units.cpp (renamed from libs/geometry/test/point_concept/geographic_point_with_wrong_units.cpp)0
-rw-r--r--libs/geometry/test/concepts/point_spherical_custom_with_wrong_units.cpp (renamed from libs/geometry/test/point_concept/spherical_equatorial_custom_point_with_wrong_units.cpp)0
-rw-r--r--libs/geometry/test/concepts/point_spherical_with_wrong_units.cpp (renamed from libs/geometry/test/point_concept/spherical_equatorial_point_with_wrong_units.cpp)0
-rw-r--r--libs/geometry/test/concepts/point_well_formed.cpp (renamed from libs/geometry/test/point_concept/well_formed_point.cpp)0
-rw-r--r--libs/geometry/test/concepts/point_well_formed_non_cartesian.cpp (renamed from libs/geometry/test/point_concept/well_formed_non_cartesian_point.cpp)0
-rw-r--r--libs/geometry/test/concepts/point_well_formed_traits.cpp (renamed from libs/geometry/test/point_concept/well_formed_point_traits.cpp)0
-rw-r--r--libs/geometry/test/concepts/point_with_incorrect_dimension.cpp (renamed from libs/geometry/test/point_concept/point_with_incorrect_dimension.cpp)1
-rw-r--r--libs/geometry/test/concepts/point_without_coordinate_type.cpp (renamed from libs/geometry/test/point_concept/point_without_coordinate_type.cpp)1
-rw-r--r--libs/geometry/test/concepts/point_without_dimension.cpp (renamed from libs/geometry/test/point_concept/point_without_dimension.cpp)1
-rw-r--r--libs/geometry/test/concepts/point_without_getter.cpp (renamed from libs/geometry/test/point_concept/point_without_getter.cpp)1
-rw-r--r--libs/geometry/test/concepts/point_without_setter.cpp (renamed from libs/geometry/test/point_concept/point_without_setter.cpp)1
-rw-r--r--libs/geometry/test/core/Jamfile.v232
-rw-r--r--libs/geometry/test/core/assert.cpp63
-rw-r--r--libs/geometry/test/from_wkt.hpp9
-rw-r--r--libs/geometry/test/geometries/Jamfile.v230
-rw-r--r--libs/geometry/test/geometries/adapted.cpp7
-rw-r--r--libs/geometry/test/geometries/geometries.cpp3
-rw-r--r--libs/geometry/test/geometry_test_common.hpp10
-rw-r--r--libs/geometry/test/io/dsv/Jamfile.v29
-rw-r--r--libs/geometry/test/io/dsv/dsv_multi.cpp (renamed from libs/geometry/test/io/dsv/multi_dsv.cpp)11
-rw-r--r--libs/geometry/test/io/wkt/Jamfile.v211
-rw-r--r--libs/geometry/test/io/wkt/wkt_multi.cpp (renamed from libs/geometry/test/io/wkt/multi_wkt.cpp)23
-rw-r--r--libs/geometry/test/iterators/Jamfile.v223
-rw-r--r--libs/geometry/test/iterators/point_iterator.cpp379
-rw-r--r--libs/geometry/test/iterators/segment_iterator.cpp122
-rw-r--r--libs/geometry/test/point_concept/Jamfile.v227
-rw-r--r--libs/geometry/test/policies/Jamfile.v211
-rw-r--r--libs/geometry/test/robustness/convex_hull/random_multi_points.cpp3
-rw-r--r--libs/geometry/test/robustness/overlay/areal_areal/test_overlay_p_q.hpp3
-rw-r--r--libs/geometry/test/robustness/overlay/areal_areal/ticket_9081.cpp4
-rw-r--r--libs/geometry/test/robustness/overlay/buffer/many_ring_buffer.cpp4
-rw-r--r--libs/geometry/test/robustness/overlay/buffer/multi_point_growth.cpp2
-rw-r--r--libs/geometry/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp10
-rw-r--r--libs/geometry/test/robustness/overlay/linear_areal/recursive_polygons_linear_areal.cpp3
-rw-r--r--libs/geometry/test/strategies/Jamfile.v239
-rw-r--r--libs/geometry/test/strategies/andoyer.cpp60
-rw-r--r--libs/geometry/test/strategies/segment_intersection.cpp1
-rw-r--r--libs/geometry/test/strategies/segment_intersection_collinear.cpp1
-rw-r--r--libs/geometry/test/strategies/side_of_intersection.cpp89
-rw-r--r--libs/geometry/test/strategies/spherical_side.cpp30
-rw-r--r--libs/geometry/test/strategies/thomas.cpp145
-rw-r--r--libs/geometry/test/strategies/vincenty.cpp111
-rw-r--r--libs/geometry/test/test_geometries/copy_on_dereference_geometries.hpp177
-rw-r--r--libs/geometry/test/util/Jamfile.v219
-rw-r--r--libs/geometry/test/util/math_abs.cpp102
-rw-r--r--libs/geometry/test/util/math_equals.cpp79
-rw-r--r--libs/geometry/test/util/number_types.hpp52
203 files changed, 13296 insertions, 3924 deletions
diff --git a/libs/geometry/test/Jamfile.v2 b/libs/geometry/test/Jamfile.v2
index 7ba3fa4b61..f8c1eac840 100644
--- a/libs/geometry/test/Jamfile.v2
+++ b/libs/geometry/test/Jamfile.v2
@@ -19,10 +19,11 @@ project boost-geometry-test
<toolset>msvc:<cxxflags>/bigobj
<toolset>clang:<cxxflags>-Wno-unneeded-internal-declaration # supress warning by Boost.None
<host-os>windows,<toolset>intel:<cxxflags>/bigobj
+ <define>BOOST_NO_AUTO_PTR # disable the deprecated std::auto_ptr support in SmartPtr and Core
;
build-project core ;
-build-project point_concept ;
+build-project concepts ;
build-project geometries ;
build-project arithmetic ;
build-project algorithms ;
diff --git a/libs/geometry/test/algorithms/Jamfile.v2 b/libs/geometry/test/algorithms/Jamfile.v2
index 5fd0e3c043..894dd57d41 100644
--- a/libs/geometry/test/algorithms/Jamfile.v2
+++ b/libs/geometry/test/algorithms/Jamfile.v2
@@ -16,50 +16,55 @@
test-suite boost-geometry-algorithms
:
- [ run append.cpp ]
- [ run area.cpp ]
- [ run assign.cpp ]
- [ run buffer.cpp ]
- [ run centroid.cpp ]
- [ run comparable_distance.cpp ]
- [ run convex_hull.cpp ]
- [ run correct.cpp ]
- [ run convert.cpp ]
- [ run envelope.cpp ]
- [ run expand.cpp ]
- [ run for_each.cpp ]
- [ run is_simple.cpp ]
- [ run is_valid.cpp ]
- [ run is_valid_failure.cpp ]
- [ run length.cpp ]
- [ run make.cpp ]
- [ run multi_area.cpp ]
- [ run multi_centroid.cpp ]
- [ run multi_convert.cpp ]
- [ run multi_convex_hull.cpp ]
- [ run multi_correct.cpp ]
- [ run multi_envelope.cpp ]
- [ run multi_for_each.cpp ]
- [ run multi_length.cpp ]
- [ run multi_num_geometries.cpp ]
- [ run multi_num_interior_rings.cpp ]
- [ run multi_num_points.cpp ]
- [ run multi_perimeter.cpp ]
- [ run multi_reverse.cpp ]
- [ run multi_simplify.cpp ]
- [ run multi_transform.cpp ]
- [ run multi_unique.cpp ]
- [ run num_geometries.cpp ]
- [ run num_interior_rings.cpp ]
- [ run num_points.cpp ]
- [ run num_segments.cpp ]
- [ run perimeter.cpp ]
- [ run point_on_surface.cpp ]
- [ run remove_spikes.cpp ]
- [ run reverse.cpp ]
- [ run simplify.cpp ]
- [ run transform.cpp ]
- [ run unique.cpp ]
+ [ run append.cpp : : : : algorithms_append ]
+ [ run area.cpp : : : : algorithms_area ]
+ [ run area_multi.cpp : : : : algorithms_area_multi ]
+ [ run assign.cpp : : : : algorithms_assign ]
+ [ run buffer.cpp : : : : algorithms_buffer ]
+ [ run centroid.cpp : : : : algorithms_centroid ]
+ [ run centroid_multi.cpp : : : : algorithms_centroid_multi ]
+ [ run comparable_distance.cpp : : : : algorithms_comparable_distance ]
+ [ run convert.cpp : : : : algorithms_convert ]
+ [ run convert_multi.cpp : : : : algorithms_convert_multi ]
+ [ run convex_hull.cpp : : : : algorithms_convex_hull ]
+ [ run convex_hull_multi.cpp : : : : algorithms_convex_hull_multi ]
+ [ run correct.cpp : : : : algorithms_correct ]
+ [ run correct_multi.cpp : : : : algorithms_correct_multi ]
+ [ run envelope.cpp : : : : algorithms_envelope ]
+ [ run envelope_multi.cpp : : : : algorithms_envelope_multi ]
+ [ run envelope_on_spheroid.cpp : : : : algorithms_envelope_on_spheroid ]
+ [ run expand.cpp : : : : algorithms_expand ]
+ [ run expand_on_spheroid.cpp : : : : algorithms_expand_on_spheroid ]
+ [ run for_each.cpp : : : : algorithms_for_each ]
+ [ run for_each_multi.cpp : : : : algorithms_for_each_multi ]
+ [ run is_convex.cpp : : : : algorithms_is_convex ]
+ [ run is_empty.cpp : : : : algorithms_is_empty ]
+ [ run is_simple.cpp : : : : algorithms_is_simple ]
+ [ run is_valid.cpp : : : : algorithms_is_valid ]
+ [ run is_valid_failure.cpp : : : : algorithms_is_valid_failure ]
+ [ run length.cpp : : : : algorithms_length ]
+ [ run length_multi.cpp : : : : algorithms_length_multi ]
+ [ run make.cpp : : : : algorithms_make ]
+ [ run maximum_gap.cpp : : : : algorithms_maximum_gap ]
+ [ run num_geometries.cpp : : : : algorithms_num_geometries ]
+ [ run num_geometries_multi.cpp : : : : algorithms_num_geometries_multi ]
+ [ run num_interior_rings.cpp : : : : algorithms_num_interior_rings ]
+ [ run num_interior_rings_multi.cpp : : : : algorithms_num_interior_rings_multi ]
+ [ run num_points.cpp : : : : algorithms_num_points ]
+ [ run num_points_multi.cpp : : : : algorithms_num_points_multi ]
+ [ run num_segments.cpp : : : : algorithms_segments ]
+ [ run perimeter.cpp : : : : algorithms_perimeter ]
+ [ run perimeter_multi.cpp : : : : algorithms_perimeter_multi ]
+ [ run point_on_surface.cpp : : : : algorithms_point_on_surface ]
+ [ run remove_spikes.cpp : : : : algorithms_remove_spikes ]
+ [ run reverse.cpp : : : : algorithms_reverse ]
+ [ run reverse_multi.cpp : : : : algorithms_reverse_multi ]
+ [ run simplify.cpp : : : : algorithms_simplify ]
+ [ run simplify_multi.cpp : : : : algorithms_simplify_multi ]
+ [ run transform.cpp : : : : algorithms_transform ]
+ [ run transform_multi.cpp : : : : algorithms_transform_multi ]
+ [ run unique.cpp : : : : algorithms_unique ]
+ [ run unique_multi.cpp : : : : algorithms_unique_multi ]
;
build-project buffer ;
diff --git a/libs/geometry/test/algorithms/append.cpp b/libs/geometry/test/algorithms/append.cpp
index 2a3d01a86a..0eda9669c6 100644
--- a/libs/geometry/test/algorithms/append.cpp
+++ b/libs/geometry/test/algorithms/append.cpp
@@ -1,12 +1,12 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
-// Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
-// Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
-// This file was modified by Oracle on 2014.
-// Modifications copyright (c) 2014, Oracle and/or its affiliates.
+// This file was modified by Oracle on 2014, 2015.
+// Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
@@ -24,25 +24,20 @@
#include <geometry_test_common.hpp>
#include <boost/geometry/core/access.hpp>
+#include <boost/geometry/core/point_type.hpp>
+#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/algorithms/make.hpp>
#include <boost/geometry/algorithms/clear.hpp>
#include <boost/geometry/algorithms/append.hpp>
#include <boost/geometry/algorithms/num_points.hpp>
#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/geometries/register/linestring.hpp>
#include <boost/variant/variant.hpp>
#include <test_common/test_point.hpp>
#include <test_geometries/wrapped_boost_array.hpp>
-// includes for multi-geometries
-#include <boost/geometry/multi/core/point_type.hpp>
-#include <boost/geometry/multi/core/tags.hpp>
-#include <boost/geometry/multi/geometries/concepts/check.hpp>
-#include <boost/geometry/multi/geometries/multi_geometries.hpp>
-#include <boost/geometry/multi/algorithms/append.hpp>
-#include <boost/geometry/multi/algorithms/clear.hpp>
-#include <boost/geometry/multi/algorithms/num_points.hpp>
BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque)
diff --git a/libs/geometry/test/algorithms/area.cpp b/libs/geometry/test/algorithms/area.cpp
index 7213464b07..6125dfac8d 100644
--- a/libs/geometry/test/algorithms/area.cpp
+++ b/libs/geometry/test/algorithms/area.cpp
@@ -5,6 +5,11 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+// This file was modified by Oracle on 2015.
+// Modifications copyright (c) 2015, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@@ -145,6 +150,81 @@ void test_spherical(bool polar = false)
area = bg::area(geometry, spherical_earth);
BOOST_CHECK_CLOSE(area, 133233.844876, 0.001); // SQL Server gives: 133353.335
+ // around 0 meridian
+ {
+ bg::read_wkt("POLYGON((-10 0,-10 10,0 10,0 0,-10 0))", geometry);
+ ct area1 = bg::area(geometry);
+ bg::read_wkt("POLYGON((0 0,0 10,10 10,10 0,0 0))", geometry);
+ ct area2 = bg::area(geometry);
+ bg::read_wkt("POLYGON((-5 0,-5 10,5 10,5 0,-5 0))", geometry);
+ ct area3 = bg::area(geometry);
+ BOOST_CHECK_CLOSE(area1, area2, 0.001);
+ BOOST_CHECK_CLOSE(area2, area3, 0.001);
+ BOOST_CHECK_CLOSE(area1, 0.0303822, 0.001);
+ }
+ {
+ bg::read_wkt("POLYGON((-10 -5,-10 5,0 5,0 -5,-10 -5))", geometry);
+ ct area1 = bg::area(geometry);
+ bg::read_wkt("POLYGON((0 -5,0 5,10 5,10 -5,0 -5))", geometry);
+ ct area2 = bg::area(geometry);
+ bg::read_wkt("POLYGON((-5 -5,-5 5,5 5,5 -5,-5 -5))", geometry);
+ ct area3 = bg::area(geometry);
+ BOOST_CHECK_CLOSE(area1, area2, 0.001);
+ BOOST_CHECK_CLOSE(area2, area3, 0.001);
+ BOOST_CHECK_CLOSE(area1, 0.0305, 0.001);
+ }
+ // around 180 meridian
+ {
+ bg::read_wkt("POLYGON((-180 0,-180 10,-170 10,-170 0,-180 0))", geometry);
+ ct area1 = bg::area(geometry);
+ bg::read_wkt("POLYGON((175 0,175 10,-175 10,-175 0,175 0))", geometry);
+ ct area2 = bg::area(geometry);
+ bg::read_wkt("POLYGON((170 0,170 10,180 10,180 0,170 0))", geometry);
+ ct area3 = bg::area(geometry);
+ bg::read_wkt("POLYGON((170 0,170 10,-180 10,-180 0,170 0))", geometry);
+ ct area4 = bg::area(geometry);
+ bg::read_wkt("POLYGON((180 0,180 10,-170 10,-170 0,180 0))", geometry);
+ ct area5 = bg::area(geometry);
+ BOOST_CHECK_CLOSE(area1, area2, 0.001);
+ BOOST_CHECK_CLOSE(area2, area3, 0.001);
+ BOOST_CHECK_CLOSE(area3, area4, 0.001);
+ BOOST_CHECK_CLOSE(area4, area5, 0.001);
+ BOOST_CHECK_CLOSE(area1, 0.0303822, 0.001);
+ }
+ {
+ bg::read_wkt("POLYGON((-180 -5,-180 5,-170 5,-170 -5,-180 -5))", geometry);
+ ct area1 = bg::area(geometry);
+ bg::read_wkt("POLYGON((175 -5,175 5,-175 5,-175 -5,175 -5))", geometry);
+ ct area2 = bg::area(geometry);
+ bg::read_wkt("POLYGON((170 -5,170 5,180 5,180 -5,170 -5))", geometry);
+ ct area3 = bg::area(geometry);
+ bg::read_wkt("POLYGON((170 -5,170 5,-180 5,-180 -5,170 -5))", geometry);
+ ct area4 = bg::area(geometry);
+ bg::read_wkt("POLYGON((180 -5,180 5,-170 5,-170 -5,180 -5))", geometry);
+ ct area5 = bg::area(geometry);
+ BOOST_CHECK_CLOSE(area1, area2, 0.001);
+ BOOST_CHECK_CLOSE(area2, area3, 0.001);
+ BOOST_CHECK_CLOSE(area3, area4, 0.001);
+ BOOST_CHECK_CLOSE(area4, area5, 0.001);
+ BOOST_CHECK_CLOSE(area1, 0.0305, 0.001);
+ }
+ // around poles
+#ifdef BOOST_GEOMETRY_ENABLE_FAILING_TESTS
+ {
+ bg::read_wkt("POLYGON((0 80,-90 80,-180 80,90 80,0 80))", geometry);
+ ct area1 = bg::area(geometry);
+ bg::read_wkt("POLYGON((0 80,-90 80,180 80,90 80,0 80))", geometry);
+ ct area2 = bg::area(geometry);
+ bg::read_wkt("POLYGON((0 -80,90 -80,-180 -80,-90 -80,0 -80))", geometry);
+ ct area3 = bg::area(geometry);
+ bg::read_wkt("POLYGON((0 -80,90 -80,180 -80,-90 -80,0 -80))", geometry);
+ ct area4 = bg::area(geometry);
+ BOOST_CHECK_CLOSE(area1, area2, 0.001);
+ BOOST_CHECK_CLOSE(area2, area3, 0.001);
+ BOOST_CHECK_CLOSE(area3, area4, 0.001);
+ }
+#endif
+
{
bg::model::ring<Point> aurha; // a'dam-utr-rott.-den haag-a'dam
bg::read_wkt("POLYGON((4.892 52.373,5.119 52.093,4.479 51.930,4.23 52.08,4.892 52.373))", aurha);
diff --git a/libs/geometry/test/algorithms/multi_area.cpp b/libs/geometry/test/algorithms/area_multi.cpp
index 3dbc658e10..fdb9ea6d70 100644
--- a/libs/geometry/test/algorithms/multi_area.cpp
+++ b/libs/geometry/test/algorithms/area_multi.cpp
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, 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)
@@ -8,14 +8,11 @@
#include <algorithms/test_area.hpp>
-#include <boost/geometry/multi/multi.hpp>
-
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
diff --git a/libs/geometry/test/algorithms/buffer/Jamfile.v2 b/libs/geometry/test/algorithms/buffer/Jamfile.v2
index c7a37a6467..567bf41b00 100644
--- a/libs/geometry/test/algorithms/buffer/Jamfile.v2
+++ b/libs/geometry/test/algorithms/buffer/Jamfile.v2
@@ -14,13 +14,15 @@ project boost-geometry-algorithms-buffer
test-suite boost-geometry-algorithms-buffer
:
- [ run point_buffer.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
- [ run linestring_buffer.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
- [ run polygon_buffer.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
- [ run multi_point_buffer.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
- [ run multi_linestring_buffer.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
- [ run multi_polygon_buffer.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
- [ run aimes_linestring_buffer.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
-# [ run country_buffer.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ] # Uncomment if you want to test this manually; requires access to data/ folder
+ [ run buffer_with_strategies.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE : algorithms_buffer_with_strategies ]
+ [ run buffer_point.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE : algorithms_buffer_point ]
+ [ run buffer_linestring.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE : algorithms_buffer_linestring ]
+ [ run buffer_polygon.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE : algorithms_buffer_polygon ]
+ [ run buffer_multi_point.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE : algorithms_buffer_multi_point ]
+ [ run buffer_multi_linestring.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE : algorithms_buffer_multi_linestring ]
+ [ run buffer_multi_polygon.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE : algorithms_buffer_multi_polygon ]
+ [ run buffer_linestring_aimes.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE : algorithms_buffer_linestring_aimes ]
+# Uncomment next line if you want to test this manually; requires access to data/ folder
+# [ run buffer_countries.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE : algorithms_buffer_countries ]
;
diff --git a/libs/geometry/test/algorithms/buffer/country_buffer.cpp b/libs/geometry/test/algorithms/buffer/buffer_countries.cpp
index b4e56f6754..364c17108a 100644
--- a/libs/geometry/test/algorithms/buffer/country_buffer.cpp
+++ b/libs/geometry/test/algorithms/buffer/buffer_countries.cpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2014 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2014-2015 Barend Gehrels, 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
@@ -9,8 +9,6 @@
#include <test_buffer.hpp>
-#include <boost/geometry/multi/geometries/multi_geometries.hpp>
-
template <typename MultiPolygon>
std::string read_from_file(std::string const& filename)
@@ -131,8 +129,17 @@ void test_one(std::string const& caseid, std::string const& wkt, double expected
bg::strategy::buffer::join_round join_round(100);
bg::strategy::buffer::end_flat end_flat;
+ // Test with a high tolerance, even a difference of 1000 is only ~1.0e-6%
+
+#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
+ // in case robustness policies are changed, areas should be adapted
+ double const countries_tolerance = boost::starts_with(caseid, "no") ? 200000.0 : 100000.0;
+#else
+ double const countries_tolerance = 10000.0;
+#endif
+
test_one<MP, P>(caseid, wkt, join_round, end_flat,
- expected_area, distance * 1000.0, distance * 1000.0, NULL, 10.0);
+ expected_area, distance * 1000.0, distance * 1000.0, false, countries_tolerance);
}
@@ -142,86 +149,87 @@ void test_all()
typedef bg::model::polygon<P, Clockwise> pt;
typedef bg::model::multi_polygon<pt> mpt;
- std::string gr = read_from_file<mpt>("data/gr.wkt");
- std::string it = read_from_file<mpt>("data/it.wkt");
- std::string nl = read_from_file<mpt>("data/nl.wkt");
- std::string no = read_from_file<mpt>("data/no.wkt");
- std::string uk = read_from_file<mpt>("data/uk.wkt");
-
- test_one<mpt, pt>("gr10", gr, 336279815057, 10);
- test_one<mpt, pt>("gr20", gr, 442317493728, 20);
- test_one<mpt, pt>("gr50", gr, 680442278144, 50);
- test_one<mpt, pt>("gr100", gr, 910474619262, 100);
-
- test_one<mpt, pt>("gr10", gr, 139313148239, -10);
- test_one<mpt, pt>("gr20", gr, 96991352461, -20);
- test_one<mpt, pt>("gr50", gr, 31391928703, -50);
- test_one<mpt, pt>("gr100", gr, 2035400463, -100);
-
- test_one<mpt, pt>("it1", it, 569863002352, 1);
- test_one<mpt, pt>("it2", it, 579239205460, 2);
- test_one<mpt, pt>("it5", it, 607625467971, 5);
- test_one<mpt, pt>("it10", it, 655018590164, 10);
- test_one<mpt, pt>("it20", it, 749353300126, 20);
- test_one<mpt, pt>("it50", it, 1018323108593, 50);
- test_one<mpt, pt>("it100", it, 1436451405440, 100);
-
- test_one<mpt, pt>("it1", it, 551474409670, -1);
- test_one<mpt, pt>("it2", it, 542617726944, -2);
- test_one<mpt, pt>("it5", it, 517402446347, -5);
- test_one<mpt, pt>("it10", it, 477945526913, -10);
- test_one<mpt, pt>("it20", it, 404693994961, -20);
- test_one<mpt, pt>("it50", it, 238748456044, -50);
- test_one<mpt, pt>("it100", it, 69768639974, -100);
+ std::string base_folder = "data/";
+ std::string gr = read_from_file<mpt>(base_folder + "gr.wkt");
+ std::string it = read_from_file<mpt>(base_folder + "it.wkt");
+ std::string nl = read_from_file<mpt>(base_folder + "nl.wkt");
+ std::string no = read_from_file<mpt>(base_folder + "no.wkt");
+ std::string uk = read_from_file<mpt>(base_folder + "uk.wkt");
+
+ test_one<mpt, pt>("gr10", gr, 336279815682, 10);
+ test_one<mpt, pt>("gr20", gr, 442317491749, 20);
+ test_one<mpt, pt>("gr50", gr, 680442278645, 50);
+ test_one<mpt, pt>("gr100", gr, 910474621215, 100);
+
+ test_one<mpt, pt>("gr10", gr, 139313156846, -10);
+ test_one<mpt, pt>("gr20", gr, 96991350242, -20);
+ test_one<mpt, pt>("gr50", gr, 31391928002, -50);
+ test_one<mpt, pt>("gr100", gr, 2035400805, -100);
+
+ test_one<mpt, pt>("it1", it, 569862998347, 1);
+ test_one<mpt, pt>("it2", it, 579239208963, 2);
+ test_one<mpt, pt>("it5", it, 607625463736, 5);
+ test_one<mpt, pt>("it10", it, 655018578530, 10);
+ test_one<mpt, pt>("it20", it, 749353305743, 20);
+ test_one<mpt, pt>("it50", it, 1018323115670, 50);
+ test_one<mpt, pt>("it100", it, 1436451405439, 100);
+
+ test_one<mpt, pt>("it1", it, 551474421881, -1);
+ test_one<mpt, pt>("it2", it, 542617730624, -2);
+ test_one<mpt, pt>("it5", it, 517402445790, -5);
+ test_one<mpt, pt>("it10", it, 477945510429, -10);
+ test_one<mpt, pt>("it20", it, 404693983797, -20);
+ test_one<mpt, pt>("it50", it, 238748449624, -50);
+ test_one<mpt, pt>("it100", it, 69768648896, -100);
test_one<mpt, pt>("it200", it, 0, -200);
- test_one<mpt, pt>("nl1", nl, 97391171492, 1);
- test_one<mpt, pt>("nl2", nl, 100816708947, 2);
- test_one<mpt, pt>("nl5", nl, 110239800198, 5);
- test_one<mpt, pt>("nl10", nl, 123408276767, 10);
- test_one<mpt, pt>("nl20", nl, 145046916470, 20);
- test_one<mpt, pt>("nl50", nl, 201207309280, 50);
- test_one<mpt, pt>("nl100", nl, 303300936130, 100);
-
- test_one<mpt, pt>("nl1", nl, 90095047258, -1);
- test_one<mpt, pt>("nl2", nl, 86601864925, -2);
- test_one<mpt, pt>("nl5", nl, 77307843491, -5);
- test_one<mpt, pt>("nl10", nl, 64668873412, -10);
- test_one<mpt, pt>("nl20", nl, 46683532991, -20);
- test_one<mpt, pt>("nl50", nl, 10244522894, -50);
+ test_one<mpt, pt>("nl1", nl, 97391170774, 1);
+ test_one<mpt, pt>("nl2", nl, 100816707832, 2);
+ test_one<mpt, pt>("nl5", nl, 110239801028, 5);
+ test_one<mpt, pt>("nl10", nl, 123408274536, 10);
+ test_one<mpt, pt>("nl20", nl, 145046915403, 20);
+ test_one<mpt, pt>("nl50", nl, 201207309002, 50);
+ test_one<mpt, pt>("nl100", nl, 303300936340, 100);
+
+ test_one<mpt, pt>("nl1", nl, 90095050333, -1);
+ test_one<mpt, pt>("nl2", nl, 86601861798, -2);
+ test_one<mpt, pt>("nl5", nl, 77307843754, -5);
+ test_one<mpt, pt>("nl10", nl, 64668870425, -10);
+ test_one<mpt, pt>("nl20", nl, 46683531062, -20);
+ test_one<mpt, pt>("nl50", nl, 10244523910, -50);
test_one<mpt, pt>("nl100", nl, 0, -100);
- test_one<mpt, pt>("no1", no, 1819566643132, 1);
- test_one<mpt, pt>("no2", no, 1865041330273, 2);
- test_one<mpt, pt>("no5", no, 1973615513085, 5);
- test_one<mpt, pt>("no10", no, 2102034197635, 10);
- test_one<mpt, pt>("no20", no, 2292171193871, 20);
- test_one<mpt, pt>("no50", no, 2725475412131, 50);
- test_one<mpt, pt>("no100", no, 3374987097497, 100);
-
- test_one<mpt, pt>("no1", no, 1725145365167, -1);
- test_one<mpt, pt>("no2", no, 1678942477834, -2);
- test_one<mpt, pt>("no5", no, 1547329288139, -5);
- test_one<mpt, pt>("no10", no, 1361198992659, -10);
- test_one<mpt, pt>("no20", no, 1089847769281, -20);
- test_one<mpt, pt>("no50", no, 649622185906, -50);
- test_one<mpt, pt>("no100", no, 306739135037, -100);
-
- test_one<mpt, pt>("uk1", uk, 733080792661, 1);
- test_one<mpt, pt>("uk2", uk, 749555934157, 2);
- test_one<mpt, pt>("uk5", uk, 793752670139, 5);
- test_one<mpt, pt>("uk10", uk, 857682293758, 10);
- test_one<mpt, pt>("uk20", uk, 970488073372, 20);
- test_one<mpt, pt>("uk50", uk, 1247830326998, 50);
- test_one<mpt, pt>("uk100", uk, 1659861947865, 100);
-
- test_one<mpt, pt>("uk1", uk, 699378105887, -1);
- test_one<mpt, pt>("uk2", uk, 683086430553, -2);
- test_one<mpt, pt>("uk5", uk, 637325270073, -5);
- test_one<mpt, pt>("uk10", uk, 572556645697, -10);
- test_one<mpt, pt>("uk20", uk, 479258135850, -20);
- test_one<mpt, pt>("uk50", uk, 274828075226, -50);
- test_one<mpt, pt>("uk100", uk, 78205462121, -100);
+ test_one<mpt, pt>("no1", no, 1819566570720, 1);
+ test_one<mpt, pt>("no2", no, 1865041238129, 2);
+ test_one<mpt, pt>("no5", no, 1973615533600, 5);
+ test_one<mpt, pt>("no10", no, 2102034240506, 10);
+ test_one<mpt, pt>("no20", no, 2292171257647, 20);
+ test_one<mpt, pt>("no50", no, 2725475403816, 50);
+ test_one<mpt, pt>("no100", no, 3374987120112, 100);
+
+ test_one<mpt, pt>("no1", no, 1725145487969, -1);
+ test_one<mpt, pt>("no2", no, 1678942603503, -2);
+ test_one<mpt, pt>("no5", no, 1547329249723, -5);
+ test_one<mpt, pt>("no10", no, 1361198873951, -10);
+ test_one<mpt, pt>("no20", no, 1089847815351, -20);
+ test_one<mpt, pt>("no50", no, 649622162382, -50);
+ test_one<mpt, pt>("no100", no, 306739133606, -100);
+
+ test_one<mpt, pt>("uk1", uk, 733080790315, 1);
+ test_one<mpt, pt>("uk2", uk, 749555939251, 2);
+ test_one<mpt, pt>("uk5", uk, 793752660191, 5);
+ test_one<mpt, pt>("uk10", uk, 857682286960, 10);
+ test_one<mpt, pt>("uk20", uk, 970488082763, 20);
+ test_one<mpt, pt>("uk50", uk, 1247830325401, 50);
+ test_one<mpt, pt>("uk100", uk, 1659861958875, 100);
+
+ test_one<mpt, pt>("uk1", uk, 699378146599, -1);
+ test_one<mpt, pt>("uk2", uk, 683086442146, -2);
+ test_one<mpt, pt>("uk5", uk, 637325279340, -5);
+ test_one<mpt, pt>("uk10", uk, 572556625332, -10);
+ test_one<mpt, pt>("uk20", uk, 479258129205, -20);
+ test_one<mpt, pt>("uk50", uk, 274828071591, -50);
+ test_one<mpt, pt>("uk100", uk, 78205461294, -100);
}
int test_main(int, char* [])
diff --git a/libs/geometry/test/algorithms/buffer/linestring_buffer.cpp b/libs/geometry/test/algorithms/buffer/buffer_linestring.cpp
index 337ea2824d..3f36735933 100644
--- a/libs/geometry/test/algorithms/buffer/linestring_buffer.cpp
+++ b/libs/geometry/test/algorithms/buffer/buffer_linestring.cpp
@@ -63,6 +63,35 @@ static std::string const mysql_report_2015_03_02a = "LINESTRING(0 0,0 5,5 5,5 0,
static std::string const mysql_report_2015_03_02b = "LINESTRING(0 1,0 5,5 5,5 0,1 0)"; // not closed, 1 difference
static std::string const mysql_report_2015_03_02c = "LINESTRING(0 2,0 5,5 5,5 0,2 0)"; // not closed, 2 difference
+static std::string const mysql_report_2015_04_01 = "LINESTRING(103 5,107 2,111 4,116 -1,115 0,112 4)";
+
+static std::string const mysql_report_2015_04_10a = "LINESTRING(1.922421e+307 1.520384e+308, 15 42, 89 -93,-89 -22)";
+static std::string const mysql_report_2015_04_10b = "LINESTRING(15 42, 89 -93,-89 -22, 1.922421e+307 1.520384e+308)";
+static std::string const mysql_report_2015_04_10c = "LINESTRING(15 42, 1.922421e+307 1.520384e+308, 89 -93,-89 -22)";
+static std::string const mysql_report_2015_04_10d = "LINESTRING(1.922421e+307 1.520384e+308, 1.923421e+307 1.521384e+308, 15 42, 89 -93,-89 -22)";
+static std::string const mysql_report_2015_04_10e = "LINESTRING(15 42, 89 -93,-89 -22, 1.922421e+307 1.520384e+308, 1.923421e+307 1.521384e+308)";
+static std::string const mysql_report_2015_04_10f = "LINESTRING(15 42, 1.922421e+307 1.520384e+308, 1.923421e+307 1.521384e+308, 89 -93,-89 -22)";
+static std::string const mysql_report_2015_04_10g = "LINESTRING(15 42, 89 -93,-89 -22)";
+
+static std::string const mysql_report_2015_06_11 = "LINESTRING("
+ "-155.9300341531310000 4.1672727531600900, -14.0079144546799000 "
+ "-12.2485554508160000, 176.9503531590800000 -3.0930641354495000, "
+ "32.6863251871831000 -17.9691125862157000, -17.7739746299451000 "
+ "41.3177973084700000, -36.0310834162082000 59.9486214620753000, "
+ "153.1574937017440000 46.3007892930418000, 172.7795126069240000 "
+ "19.5367061763707000, -85.6306040220105000 35.0128339347489000, "
+ "-61.1404987988716000 0.3278080608359490, -127.5034592987520000 "
+ "18.6202802642343000, 114.5567005754250000 -83.7227732658958000, "
+ "-66.1134822881378000 -75.2141906159065000, -93.7363999307791000 "
+ "49.3124773443269000, -8.7182702071584100 56.2071174970861000, "
+ "7.7959787229988800 60.8845281744769000, 13.0420633931840000 "
+ "58.8150539662759000, -89.9754374613871000 26.4546501154335000, "
+ "-44.5746548960799000 -88.8122262334508000, -178.4807616092640000 "
+ "10.7770331393820000, 161.8238702890570000 -42.3894892597522000, "
+ "136.2382890452810000 28.6261570633511000, 49.6788041059295000 "
+ "61.7724885566963000, 52.7876201424690000 -61.9246644395984000, "
+ "-162.7456296900030000 11.7183989853218000, 115.6208648232840000 "
+ "51.0941612539320000, -48.7772321835054000 50.4339743128205000)";
template <bool Clockwise, typename P>
void test_all()
@@ -201,6 +230,11 @@ void test_all()
double const d15 = 1.5;
test_one<linestring, polygon>("mysql_report_2015_03_02c_asym1", mysql_report_2015_03_02c, join_round(7), end_round(7), 39.714, d10, d15);
test_one<linestring, polygon>("mysql_report_2015_03_02c_asym2", mysql_report_2015_03_02c, join_round(7), end_round(7), 46.116, d15, d10);
+
+#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
+ double const d100 = 10;
+ test_one<linestring, polygon>("mysql_report_2015_04_01", mysql_report_2015_04_01, join_round(32), end_round(32), 632.234, d100);
+#endif
}
@@ -225,14 +259,40 @@ void test_all()
test_one<linestring, polygon>("aimes181", aimes181, join_round_by_divide, end_round, 2.57415564419716247e-08, 0.000036, 0.000036, true, tolerance);
}
- test_one<linestring, polygon>("crossing", crossing, join_round32, end_flat, 1702.119, 20.0);
- test_one<linestring, polygon>("crossing", crossing, join_round32, end_round32, 2140.450, 20.0);
+ // On one compiler 1702.56530051454502 2140.78725663358819
+ // so we increase tolerance
+ test_one<linestring, polygon>("crossing", crossing, join_round32, end_flat, 1702.1, 20.0, 20.0, true, 0.5);
+ test_one<linestring, polygon>("crossing", crossing, join_round32, end_round32, 2140.4, 20.0, 20.0, true, 0.5);
test_one<linestring, polygon>("mikado1", mikado1, join_round32, end_round32, 5441135039.0979, 41751.0);
+
+ test_one<linestring, polygon>("mysql_report_2015_06_11",
+ mysql_report_2015_06_11, join_round32, end_round32,
+ 27862.733459829971,
+ 5.9518403867035365);
}
+template <bool Clockwise, typename P>
+void test_invalid()
+{
+ typedef bg::model::linestring<P> linestring;
+ typedef bg::model::polygon<P, Clockwise> polygon;
+
+ bg::strategy::buffer::end_round end_round32(32);
+ bg::strategy::buffer::join_round join_round32(32);
+
+ // Linestring contains extreme differences causing numeric errors. Empty geometry is returned
+ test_one<linestring, polygon>("mysql_report_2015_04_10a", mysql_report_2015_04_10a, join_round32, end_round32, 0.0, 100.0);
+ test_one<linestring, polygon>("mysql_report_2015_04_10b", mysql_report_2015_04_10b, join_round32, end_round32, 0.0, 100.0);
+ test_one<linestring, polygon>("mysql_report_2015_04_10c", mysql_report_2015_04_10c, join_round32, end_round32, 0.0, 100.0);
+ test_one<linestring, polygon>("mysql_report_2015_04_10d", mysql_report_2015_04_10d, join_round32, end_round32, 0.0, 100.0);
+ test_one<linestring, polygon>("mysql_report_2015_04_10e", mysql_report_2015_04_10e, join_round32, end_round32, 0.0, 100.0);
+ test_one<linestring, polygon>("mysql_report_2015_04_10f", mysql_report_2015_04_10f, join_round32, end_round32, 0.0, 100.0);
+
+ // The equivalent, valid, case
+ test_one<linestring, polygon>("mysql_report_2015_04_10g", mysql_report_2015_04_10g, join_round32, end_round32, 86527.871, 100.0);
+}
-//#define HAVE_TTMATH
#ifdef HAVE_TTMATH
#include <ttmath_stub.hpp>
#endif
@@ -243,5 +303,8 @@ int test_main(int, char* [])
test_all<true, bg::model::point<double, 2, bg::cs::cartesian> >();
test_all<false, bg::model::point<double, 2, bg::cs::cartesian> >();
//test_all<bg::model::point<tt, 2, bg::cs::cartesian> >();
+
+ test_invalid<true, bg::model::point<double, 2, bg::cs::cartesian> >();
+// test_invalid<true, bg::model::point<long double, 2, bg::cs::cartesian> >();
return 0;
}
diff --git a/libs/geometry/test/algorithms/buffer/aimes_linestring_buffer.cpp b/libs/geometry/test/algorithms/buffer/buffer_linestring_aimes.cpp
index 2a1f08b870..2a1f08b870 100644
--- a/libs/geometry/test/algorithms/buffer/aimes_linestring_buffer.cpp
+++ b/libs/geometry/test/algorithms/buffer/buffer_linestring_aimes.cpp
diff --git a/libs/geometry/test/algorithms/buffer/multi_linestring_buffer.cpp b/libs/geometry/test/algorithms/buffer/buffer_multi_linestring.cpp
index 24aca1a676..11b1915479 100644
--- a/libs/geometry/test/algorithms/buffer/multi_linestring_buffer.cpp
+++ b/libs/geometry/test/algorithms/buffer/buffer_multi_linestring.cpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2012-2015 Barend Gehrels, 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
@@ -9,8 +9,6 @@
#include <test_buffer.hpp>
-#include <boost/geometry/multi/geometries/multi_geometries.hpp>
-
static std::string const simplex = "MULTILINESTRING((0 0,4 5),(5 4,10 0))";
static std::string const two_bends = "MULTILINESTRING((0 0,4 5,7 4,10 6),(1 5,5 9,8 6))";
static std::string const turn_inside = "MULTILINESTRING((0 0,4 5,7 4,10 6),(1 5,5 9,8 6),(0 4,-2 6))";
@@ -31,6 +29,8 @@ static std::string const mikado2 = "MULTILINESTRING((-6.117647058823528993798390
static std::string const mikado3 = "MULTILINESTRING((1 18,4.0559006211180124168436122999992 7.8136645962732922399140989000443),(6.7243816254416959310447055031545 -1.0812720848056533995418249105569,7 -2,7 -8,14 3.6666666666666669627261399000417),(15.297872340425531234586742357351 5.8297872340425538340014099958353,16 7,15.214285714285713524418497399893 5.8445378151260509724806979647838),(13.685863874345550073030608473346 3.5968586387434555717845796607435,-1 -18,-3.7900797165633304253162805252941 -11.117803365810452476125647081062),(-11.540540540540540348501963308081 8,-16 19,8 14),(1 -10,6.5999999999999996447286321199499 -1.200000000000000177635683940025),(11.5 6.5,15 12),(19 10,11.564231738035264385189293534495 6.4886649874055422060337150469422),(-13.438785504407443127661281323526 -5.3183153770812925387190261972137,-17 -7,-12.970074812967581578959652688354 -7.7556109725685784539450651209336),(-2.3532338308457703135445626685396 -9.7462686567164187323442092747428,-1 -10,12.285714285714286475581502600107 3.2857142857142864755815026001073),(14.90000000000000035527136788005 5.9000000000000003552713678800501,15 6,14.893004115226338157640384451952 5.9012345679012341292946075554937),(11.987804878048780921062643756159 3.2195121951219514144781896902714,-11 -18),(-12.210826210826210669324609625619 -11.703703703703702387883822666481,-15 -15,-11.463576158940396609864365018439 -15.589403973509934786534358863719),(-8.9189189189189193029960733838379 -16.013513513513512265262761502527,-3 -17,-7.0297239915074314353660156484693 -14.210191082802548834251865628175),(-12.450511945392491952588898129761 -10.457337883959045399251408525743,-16 -8,-12.923076923076923350208744523115 -8),(-0.52380952380952372493538859998807 -8,18 -8),(2 -19,-2.2961165048543685784920853620861 -9.6917475728155331182733789319173),(6.0463576158940393057150686217938 -1.7284768211920527036795647291001,7 -3,6.4482758620689653028534848999698 -1.3448275862068967967388744000345),(-1.3333333333333339254522798000835 8,4 16,2.9090909090909091716525836091023 8),(0.64705882352941168633719826175366 -6.8823529411764710062016092706472,-3 -16))";
static std::string const mikado4 = "MULTILINESTRING((-15 2,-15 -17,-6 11,-1.9358288770053475591481628725887 10.572192513368984023713892383967),(2.1545064377682408007785852532834 10.14163090128755406738036981551,6.87603305785123986026974307606 9.6446280991735537924114396446384),(8.4810810810810810522752944962122 9.475675675675674369813350494951,13 9),(-15 0,-8 9,-2.9850746268656713766631582984701 4.4865671641791049495395782287233),(-1.8235294117647056211239942058455 3.4411764705882355031008046353236,-1.1428571428571423496123315999284 2.8285714285714291804652020800859),(1.2307692307692308375521861307789 0.69230769230769229061195346730528,1.2857142857142858094476878250134 0.64285714285714290472384391250671,2 0,1.9459459459459460539676456392044 0.51351351351351348650808859019889),(1.908127208480565384363103476062 0.87279151943462895957281943992712,1.9078014184397162900097555393586 0.87588652482269502286271745106205),(1.4685990338164249813246442499803 5.0483091787439615671928550000302,0.63551401869158885560295857430901 12.962616822429906093816498469096,0 19,2.9565217391304345895264304999728 8.6521739130434784925682834000327),(0 19,3.4942528735632185643567027000245 6.770114942528735468840750399977),(4.75 2.375,5.2427184466019420838733822165523 0.65048543689320226235395239200443),(5.5384615384615383248956277384423 -0.38461538461538458122390693461057,5.7358490566037731994697423942853 -1.0754716981132084185901476303115),(5.9777777777777778567269706400111 -1.9222222222222207221875578397885,6.867052023121386739035187929403 -5.0346820809248553629799971531611,10 -16,-14 -19,-12 -12),(0 10,1.9476439790575916788384347455576 5.4554973821989527493769855936989),(-4 1,-4.2790697674418600726653494348284 0.16279069767441856075862460784265))";
+static std::string const mysql_2015_04_10a = "MULTILINESTRING((-58 19, 61 88),(1.922421e+307 1.520384e+308, 15 42, 89 -93,-89 -22),(-63 -5, -262141 -536870908, -3 87, 77 -69))";
+static std::string const mysql_2015_04_10b = "MULTILINESTRING((-58 19, 61 88), (-63 -5, -262141 -536870908, -3 87, 77 -69))";
template <bool Clockwise, typename P>
void test_all()
@@ -84,21 +84,47 @@ void test_all()
// Cases formly causing a segmentation fault because a generated side was skipped
// (The expected area for large distances is about R*R*PI where R is distance)
// Note that for large distances the flat ends (not tested here) still give weird effects
- test_one<multi_linestring_type, polygon>("mikado1_large", mikado1, join_round32, end_round32, 5455052109.518, 41751.0);
- test_one<multi_linestring_type, polygon>("mikado1_small", mikado1, join_round32, end_round32, 1057.37, 10.0);
- test_one<multi_linestring_type, polygon>("mikado1_small", mikado1, join_round32, end_flat, 874.590, 10.0);
-
- test_one<multi_linestring_type, polygon>("mikado2_large", mikado2, join_round32, end_round32, 19878812278.387, 79610.0);
- test_one<multi_linestring_type, polygon>("mikado2_small", mikado2, join_round32, end_round32, 1082.470, 10.0);
- test_one<multi_linestring_type, polygon>("mikado2_small", mikado2, join_round32, end_flat, 711.678, 10.0);
-
- test_one<multi_linestring_type, polygon>("mikado3_large", mikado3, join_round32, end_round32, 29151950703.779, 96375.0);
- test_one<multi_linestring_type, polygon>("mikado3_small", mikado3, join_round32, end_round32, 2533.285, 10.0);
- test_one<multi_linestring_type, polygon>("mikado3_small", mikado3, join_round32, end_flat, 2136.236, 10.0);
-
- test_one<multi_linestring_type, polygon>("mikado4_large", mikado4, join_round32, end_round32, 11212832197.267, 59772.0);
- test_one<multi_linestring_type, polygon>("mikado4_small", mikado4, join_round32, end_round32, 2103.686, 10.0);
- test_one<multi_linestring_type, polygon>("mikado4_small", mikado4, join_round32, end_flat, 1930.785, 10.0);
+ {
+ // The results can differ between compilers and platforms
+#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
+ double mikado_tolerance = 40.0;
+#else
+ double mikado_tolerance = 30.0;
+#endif
+
+ test_one<multi_linestring_type, polygon>("mikado1_large", mikado1, join_round32, end_round32, 5455052125, 41751.0, same_distance, true, mikado_tolerance);
+ test_one<multi_linestring_type, polygon>("mikado1_small", mikado1, join_round32, end_round32, 1057.37, 10.0);
+ test_one<multi_linestring_type, polygon>("mikado1_small", mikado1, join_round32, end_flat, 874.590, 10.0);
+
+ test_one<multi_linestring_type, polygon>("mikado2_large", mikado2, join_round32, end_round32, 19878812253, 79610.0, same_distance, true, mikado_tolerance);
+ test_one<multi_linestring_type, polygon>("mikado2_small", mikado2, join_round32, end_round32, 1082.470, 10.0);
+ test_one<multi_linestring_type, polygon>("mikado2_small", mikado2, join_round32, end_flat, 711.678, 10.0);
+
+ // BSD 29151950588
+ // msvc 29151950611
+ // clang/linux 29151950612
+ // mingw 29151950711
+ test_one<multi_linestring_type, polygon>("mikado3_large", mikado3, join_round32, end_round32, 29151950650, 96375.0, same_distance, true, 3 * mikado_tolerance);
+ test_one<multi_linestring_type, polygon>("mikado3_small", mikado3, join_round32, end_round32, 2533.285, 10.0);
+ test_one<multi_linestring_type, polygon>("mikado3_small", mikado3, join_round32, end_flat, 2136.236, 10.0);
+
+ test_one<multi_linestring_type, polygon>("mikado4_large", mikado4, join_round32, end_round32, 11212832169, 59772.0, same_distance, true, mikado_tolerance);
+ test_one<multi_linestring_type, polygon>("mikado4_small", mikado4, join_round32, end_round32, 2103.686, 10.0);
+ test_one<multi_linestring_type, polygon>("mikado4_small", mikado4, join_round32, end_flat, 1930.785, 10.0);
+ }
+
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
+ // Coordinates in one linestring vary so much that
+ // length = geometry::math::sqrt(dx * dx + dy * dy); returns a value of inf for length
+ // That geometry is skipped for the buffer
+ // SQL Server reports area 2117753600 (for b)
+ // PostGIS reports 2087335072 (for b)
+ // BG (2) reports 794569660 (for a/b) which apparently misses parts
+ // old value was 927681870 (for a/b) which also misses parts
+ // (2: since selecting other IP at end points or when segment b is smaller than a)
+ test_one<multi_linestring_type, polygon>("mysql_2015_04_10a", mysql_2015_04_10a, join_round32, end_round32, 1063005187.214, 0.98);
+ test_one<multi_linestring_type, polygon>("mysql_2015_04_10b", mysql_2015_04_10b, join_round32, end_round32, 1063005187.214, 0.98);
+#endif
}
diff --git a/libs/geometry/test/algorithms/buffer/multi_point_buffer.cpp b/libs/geometry/test/algorithms/buffer/buffer_multi_point.cpp
index 5c4cbd6a75..fc83d758f0 100644
--- a/libs/geometry/test/algorithms/buffer/multi_point_buffer.cpp
+++ b/libs/geometry/test/algorithms/buffer/buffer_multi_point.cpp
@@ -9,8 +9,6 @@
#include <test_buffer.hpp>
-#include <boost/geometry/multi/geometries/multi_geometries.hpp>
-
static std::string const simplex = "MULTIPOINT((5 5),(7 7))";
static std::string const three = "MULTIPOINT((5 8),(9 8),(7 11))";
@@ -32,7 +30,7 @@ void test_all()
typedef bg::model::polygon<P, Clockwise> polygon;
typedef bg::model::multi_point<P> multi_point_type;
- bg::strategy::buffer::join_miter join_miter;
+ bg::strategy::buffer::join_round join;
bg::strategy::buffer::end_flat end_flat;
typedef bg::strategy::buffer::distance_symmetric
<
@@ -42,41 +40,42 @@ void test_all()
double const pi = boost::geometry::math::pi<double>();
- test_one<multi_point_type, polygon>("simplex1", simplex, join_miter, end_flat, 2.0 * pi, 1.0, 1.0);
- test_one<multi_point_type, polygon>("simplex2", simplex, join_miter, end_flat, 22.8372, 2.0, 2.0);
- test_one<multi_point_type, polygon>("simplex3", simplex, join_miter, end_flat, 44.5692, 3.0, 3.0);
-
- test_one<multi_point_type, polygon>("three1", three, join_miter, end_flat, 3.0 * pi, 1.0, 1.0);
- test_one<multi_point_type, polygon>("three2", three, join_miter, end_flat, 36.7592, 2.0, 2.0);
- test_one<multi_point_type, polygon>("three19", three, join_miter, end_flat, 33.6914, 1.9, 1.9);
- test_one<multi_point_type, polygon>("three21", three, join_miter, end_flat, 39.6394, 2.1, 2.1);
- test_one<multi_point_type, polygon>("three3", three, join_miter, end_flat, 65.533, 3.0, 3.0);
+ test_one<multi_point_type, polygon>("simplex1", simplex, join, end_flat, 2.0 * pi, 1.0, 1.0);
+ test_one<multi_point_type, polygon>("simplex2", simplex, join, end_flat, 22.8372, 2.0, 2.0);
+ test_one<multi_point_type, polygon>("simplex3", simplex, join, end_flat, 44.5692, 3.0, 3.0);
- test_one<multi_point_type, polygon>("multipoint_a", multipoint_a, join_miter, end_flat, 2049.98, 14.0, 14.0);
- test_one<multi_point_type, polygon>("multipoint_b", multipoint_b, join_miter, end_flat, 7109.88, 15.0, 15.0);
- test_one<multi_point_type, polygon>("multipoint_b1", multipoint_b, join_miter, end_flat, 6911.89, 14.7, 14.7);
- test_one<multi_point_type, polygon>("multipoint_b2", multipoint_b, join_miter, end_flat, 7174.79, 15.1, 15.1);
+ test_one<multi_point_type, polygon>("three1", three, join, end_flat, 3.0 * pi, 1.0, 1.0);
+#if !defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
+ // For no-rescaling, fails in CCW mode
+ test_one<multi_point_type, polygon>("three2", three, join, end_flat, 36.7592, 2.0, 2.0);
+#endif
+ test_one<multi_point_type, polygon>("three19", three, join, end_flat, 33.6914, 1.9, 1.9);
+ test_one<multi_point_type, polygon>("three21", three, join, end_flat, 39.6394, 2.1, 2.1);
+ test_one<multi_point_type, polygon>("three3", three, join, end_flat, 65.533, 3.0, 3.0);
+ test_one<multi_point_type, polygon>("multipoint_a", multipoint_a, join, end_flat, 2049.98, 14.0, 14.0);
+ test_one<multi_point_type, polygon>("multipoint_b", multipoint_b, join, end_flat, 7109.88, 15.0, 15.0);
+ test_one<multi_point_type, polygon>("multipoint_b1", multipoint_b, join, end_flat, 6911.89, 14.7, 14.7);
+ test_one<multi_point_type, polygon>("multipoint_b2", multipoint_b, join, end_flat, 7174.79, 15.1, 15.1);
// Grid tests
{
bg::strategy::buffer::point_square point_strategy;
-
test_with_custom_strategies<multi_point_type, polygon>("grid_a50",
- grid_a, join_miter, end_flat,
+ grid_a, join, end_flat,
distance_strategy(0.5), side_strategy, point_strategy, 7.0);
-#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS)
+#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
test_with_custom_strategies<multi_point_type, polygon>("grid_a54",
- grid_a, join_miter, end_flat,
- distance_strategy(0.54), side_strategy, point_strategy, 99);
+ grid_a, join, end_flat,
+ distance_strategy(0.54), side_strategy, point_strategy, 7.819);
#endif
}
test_with_custom_strategies<multi_point_type, polygon>("mysql_report_2015_02_25_1_800",
- mysql_report_2015_02_25_1, join_miter, end_flat,
+ mysql_report_2015_02_25_1, join, end_flat,
distance_strategy(6051788), side_strategy,
bg::strategy::buffer::point_circle(800), 115057490003226.125, 1.0);
}
@@ -94,7 +93,7 @@ void test_many_points_per_circle()
typedef bg::model::polygon<P, false> polygon;
typedef bg::model::multi_point<P> multi_point_type;
- bg::strategy::buffer::join_miter join_miter;
+ bg::strategy::buffer::join_round join;
bg::strategy::buffer::end_flat end_flat;
typedef bg::strategy::buffer::distance_symmetric
<
@@ -105,42 +104,86 @@ void test_many_points_per_circle()
using bg::strategy::buffer::point_circle;
double const tolerance = 1.0;
+#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
+ double const tolerance_multiplier = 1000.0;
+#else
+ double const tolerance_multiplier = 1.0;
+#endif
+
+ // Area should be somewhat larger (~>) than pi*distance^2
+ // 6051788: area ~> 115058122875258
// Strategies with many points, which are (very) slow in debug mode
test_with_custom_strategies<multi_point_type, polygon>(
"mysql_report_2015_02_25_1_8000",
- mysql_report_2015_02_25_1, join_miter, end_flat,
+ mysql_report_2015_02_25_1, join, end_flat,
distance_strategy(6051788), side_strategy, point_circle(8000),
115058661065242.812, tolerance);
+ // Expectations:
+ // 115058672785641.031
+ // 115058672785680.281
+ // 115058672785679.922
test_with_custom_strategies<multi_point_type, polygon>(
"mysql_report_2015_02_25_1",
- mysql_report_2015_02_25_1, join_miter, end_flat,
+ mysql_report_2015_02_25_1, join, end_flat,
distance_strategy(6051788), side_strategy, point_circle(83585),
- 115058672785611.219, tolerance);
+ 115058672785660, 25.0 * tolerance_multiplier);
- // Takes about 20 seconds in release mode
+ // Takes about 7 seconds in release mode
+ // Expectations:
+ // 115058672880035.391
+ // 115058672879944.547
+ // 115058672879920.484
test_with_custom_strategies<multi_point_type, polygon>(
"mysql_report_2015_02_25_1_250k",
- mysql_report_2015_02_25_1, join_miter, end_flat,
+ mysql_report_2015_02_25_1, join, end_flat,
distance_strategy(6051788), side_strategy, point_circle(250000),
- 115058672880671.531, tolerance);
+ 115058672879977, 75.0 * tolerance_multiplier);
-#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS)
- // Takes too long, TODO improve turn_in_piece_visitor
+#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_SLOW_TESTS)
+ // Takes about 110 seconds in release mode
test_with_custom_strategies<multi_point_type, polygon>(
- "mysql_report_2015_02_25_1",
- mysql_report_2015_02_25_1, join_miter, end_flat,
+ "mysql_report_2015_02_25_1_800k",
+ mysql_report_2015_02_25_1, join, end_flat,
distance_strategy(6051788), side_strategy, point_circle(800000),
- 115058672799999.999, tolerance); // area to be determined
+ 115058672871849.219, tolerance);
#endif
+ // 5666962: area ~> 100890546298964
+ // Expectations:
+ // 100891031341796.875
+ // 100891031341794.766
+ // 100891031341794.078
test_with_custom_strategies<multi_point_type, polygon>(
"mysql_report_2015_02_25_2",
- mysql_report_2015_02_25_2, join_miter, end_flat,
+ mysql_report_2015_02_25_2, join, end_flat,
distance_strategy(5666962), side_strategy, point_circle(46641),
- 100891031341757.344, tolerance);
+ 100891031341795, 3.0 * tolerance_multiplier);
+
+ // Multipoint b with large distances/many points
+ // Area ~> pi * 10x
+
+ // Expectations:
+ // 3141871558222.398
+ // 3141871558231.5166
+ // 3141871558231.48926
+ test_with_custom_strategies<multi_point_type, polygon>(
+ "multipoint_b_50k",
+ multipoint_b, join, end_flat,
+ distance_strategy(1000000), side_strategy, point_circle(50000),
+ 3141871558227, 10.0 * tolerance_multiplier);
+
+#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_SLOW_TESTS)
+ // Tests optimization min/max radius
+ // Takes about 55 seconds in release mode
+ test_with_custom_strategies<multi_point_type, polygon>(
+ "multipoint_b_500k",
+ multipoint_b, join, end_flat,
+ distance_strategy(10000000), side_strategy, point_circle(500000),
+ 314162054419515.562, tolerance);
+#endif
}
int test_main(int, char* [])
diff --git a/libs/geometry/test/algorithms/buffer/multi_polygon_buffer.cpp b/libs/geometry/test/algorithms/buffer/buffer_multi_polygon.cpp
index 4b526a8e6e..32c579b838 100644
--- a/libs/geometry/test/algorithms/buffer/multi_polygon_buffer.cpp
+++ b/libs/geometry/test/algorithms/buffer/buffer_multi_polygon.cpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2012-2015 Barend Gehrels, 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
@@ -9,8 +9,6 @@
#include <test_buffer.hpp>
-#include <boost/geometry/multi/geometries/multi_geometries.hpp>
-
static std::string const simplex
= "MULTIPOLYGON(((0 1,2 5,5 3,0 1)),((1 1,5 2,5 0,1 1)))";
@@ -276,6 +274,13 @@ static std::string const neighbouring
static std::string const neighbouring_with_holes
= "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)),((10 10,10 20,20 20,20 10,10 10),(14 14,14 16,16 16,16 14,14 14)))";
+
+// MultiPolygons causing assertion failure
+static std::string const mysql_report_2015_07_05_1
+ = "MULTIPOLYGON(((44 25,2.68435e+08 1.75922e+13,-6.87195e+10 -6.87195e+10,44 25),(-9704 8028,1.01776e+308 4.42027e+307,1.34218e+08 7.20576e+16,-9704 8028),(27945 15972,13 24,18 34,27945 15972),(3.3444e+307 1.47467e+308,1.22536e+38 1.42547e+38,10 -88,-28578 24802,3.3444e+307 1.47467e+308)))";
+static std::string const mysql_report_2015_07_05_2
+ = "MULTIPOLYGON(((19777 -21893,3.22595e+307 6.86823e+307,-40 -13,19777 -21893)),((-1322 4851,8.49998e+307 3.94481e+307,75 -69,8.64636e+307 3.94909e+307,-1.15292e+18 7.20576e+16,-1322 4851)))";
+
template <bool Clockwise, typename P>
void test_all()
{
@@ -357,16 +362,18 @@ void test_all()
test_one<multi_polygon_type, polygon_type>("rt_c", rt_c, join_round, end_flat, 14.7093, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_c", rt_c, join_miter, end_flat, 16, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_d", rt_d, join_round, end_flat, 18.8726, 0.3);
- test_one<multi_polygon_type, polygon_type>("rt_d", rt_d, join_miter, end_flat, 19.8823, 0.3);
test_one<multi_polygon_type, polygon_type>("rt_e", rt_e, join_round, end_flat, 14.1866, 0.3);
- test_one<multi_polygon_type, polygon_type>("rt_e", rt_e, join_miter, end_flat, 15.1198, 0.3);
-
- test_one<multi_polygon_type, polygon_type>("rt_f", rt_f, join_miter, end_flat, 4.60853, 0.3);
test_one<multi_polygon_type, polygon_type>("rt_g1", rt_g1, join_round, end_flat, 24.719, 1.0);
+ test_one<multi_polygon_type, polygon_type>("rt_g3", rt_g3, join_miter, end_flat, 16.5711, 1.0);
+
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
+ test_one<multi_polygon_type, polygon_type>("rt_d", rt_d, join_miter, end_flat, 19.8823, 0.3);
+ test_one<multi_polygon_type, polygon_type>("rt_e", rt_e, join_miter, end_flat, 15.1198, 0.3);
+ test_one<multi_polygon_type, polygon_type>("rt_f", rt_f, join_miter, end_flat, 4.60853, 0.3);
test_one<multi_polygon_type, polygon_type>("rt_g1", rt_g1, join_miter, end_flat, 30.3137, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_g2", rt_g2, join_miter, end_flat, 18.5711, 1.0);
- test_one<multi_polygon_type, polygon_type>("rt_g3", rt_g3, join_miter, end_flat, 16.5711, 1.0);
+#endif
test_one<multi_polygon_type, polygon_type>("rt_h", rt_h, join_round, end_flat, 47.6012, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_h", rt_h, join_miter, end_flat, 61.7058, 1.0);
@@ -376,7 +383,11 @@ void test_all()
test_one<multi_polygon_type, polygon_type>("rt_j", rt_j, join_miter, end_flat, 35.1421, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_k", rt_k, join_round, end_flat, 42.0092, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_k", rt_k, join_miter, end_flat, 48.0563, 1.0);
+
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<multi_polygon_type, polygon_type>("rt_l", rt_l, join_miter, end_flat, 19.3995, 1.0);
+#endif
+
test_one<multi_polygon_type, polygon_type>("rt_m1", rt_m1, join_round, end_flat, 14.1074, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_m1", rt_m1, join_miter, end_flat, 19.4853, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_m2", rt_m2, join_miter, end_flat, 21.4853, 1.0);
@@ -384,17 +395,23 @@ void test_all()
test_one<multi_polygon_type, polygon_type>("rt_n", rt_n, join_miter, end_flat, 18.4853, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_o1", rt_o1, join_round, end_flat, 17.536, 1.0);
- test_one<multi_polygon_type, polygon_type>("rt_o1", rt_o1, join_miter, end_flat, 20.9142, 1.0);
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
+ test_one<multi_polygon_type, polygon_type>("rt_o1", rt_o1, join_miter, end_flat, 20.9142, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_o2", rt_o2, join_miter, end_flat, 25.7426, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_o3", rt_o3, join_miter, end_flat, 28.8247, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_o4", rt_o4, join_miter, end_flat, 34.6532, 1.0);
+#endif
test_one<multi_polygon_type, polygon_type>("rt_p1", rt_p1, join_miter, end_flat, 24.8211, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_p2", rt_p2, join_miter, end_flat, 21.4853, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_p3", rt_p3, join_miter, end_flat, 22.3995, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_p4", rt_p4, join_miter, end_flat, 33.0563, 1.0);
+
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<multi_polygon_type, polygon_type>("rt_p5", rt_p5, join_miter, end_flat, 17, 1.0);
+#endif
+
test_one<multi_polygon_type, polygon_type>("rt_p6", rt_p6, join_miter, end_flat, 18.4853, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_p7", rt_p7, join_miter, end_flat, 26.2279, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_p8", rt_p8, join_miter, end_flat, 29.0563, 1.0);
@@ -407,22 +424,37 @@ void test_all()
test_one<multi_polygon_type, polygon_type>("rt_p14", rt_p14, join_miter, end_flat, 20.8284, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_p15", rt_p15, join_miter, end_flat, 23.6569, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_p16", rt_p16, join_miter, end_flat, 23.4853, 1.0);
+
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<multi_polygon_type, polygon_type>("rt_p17", rt_p17, join_miter, end_flat, 25.3137, 1.0);
+#endif
+
test_one<multi_polygon_type, polygon_type>("rt_p18", rt_p18, join_miter, end_flat, 23.3137, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_p19", rt_p19, join_miter, end_flat, 25.5637, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_p20", rt_p20, join_miter, end_flat, 25.4853, 1.0);
+
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<multi_polygon_type, polygon_type>("rt_p21", rt_p21, join_miter, end_flat, 17.1716, 1.0);
+#endif
+
test_one<multi_polygon_type, polygon_type>("rt_p22", rt_p22, join_miter, end_flat, 26.5711, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_q1", rt_q1, join_miter, end_flat, 27, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_q2", rt_q2, join_miter, end_flat, 26.4853, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_q2", rt_q2, join_miter, end_flat, 0.9697, -0.25);
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<multi_polygon_type, polygon_type>("rt_r", rt_r, join_miter, end_flat, 21.0761, 1.0);
+#endif
+
test_one<multi_polygon_type, polygon_type>("rt_s1", rt_s1, join_miter, end_flat, 20.4853, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_s2", rt_s2, join_miter, end_flat, 24.6495, 1.0);
- test_one<multi_polygon_type, polygon_type>("rt_t", rt_t, join_miter, end_flat, 15.6569, 1.0);
- test_one<multi_polygon_type, polygon_type>("rt_t", rt_t, join_miter, end_flat, 0.1679, -0.25);
+
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
+ test_one<multi_polygon_type, polygon_type>("rt_t1", rt_t, join_miter, end_flat, 15.6569, 1.0);
+#endif
+
+ test_one<multi_polygon_type, polygon_type>("rt_t2", rt_t, join_miter, end_flat, 0.1679, -0.25);
test_one<multi_polygon_type, polygon_type>("rt_u1", rt_u1, join_round, end_flat, 33.2032, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_u2", rt_u2, join_round, end_flat, 138.8001, 1.0);
@@ -451,8 +483,8 @@ void test_all()
test_one<multi_polygon_type, polygon_type>("rt_u11_50", rt_u11, join_miter, end_flat, 0.04289, -0.50);
test_one<multi_polygon_type, polygon_type>("rt_u11_25", rt_u11, join_miter, end_flat, 10.1449, -0.25);
-#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS)
- test_one<multi_polygon_type, polygon_type>("rt_u12", rt_u12, join_miter, end_flat, 999, 1.0);
+#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
+ test_one<multi_polygon_type, polygon_type>("rt_u12", rt_u12, join_miter, end_flat, 142.1348, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_u13", rt_u13, join_miter, end_flat, 115.4853, 1.0);
#endif
@@ -468,6 +500,14 @@ void test_all()
test_one<multi_polygon_type, polygon_type>("neighbouring_with_holes_large",
neighbouring_with_holes,
join_round32, end_round32, 0, -10);
+
+ test_one<multi_polygon_type, polygon_type>("mysql_report_2015_07_05_1",
+ mysql_report_2015_07_05_1,
+ join_round32, end_round32, 6.04454566324708726e+23, 5526,
+ same_distance, false, 1e+020);
+ test_one<multi_polygon_type, polygon_type>("mysql_report_2015_07_05_2",
+ mysql_report_2015_07_05_2,
+ join_round32, end_round32, 0, 948189399);
}
int test_main(int, char* [])
diff --git a/libs/geometry/test/algorithms/buffer/point_buffer.cpp b/libs/geometry/test/algorithms/buffer/buffer_point.cpp
index a5f1b979b7..a5f1b979b7 100644
--- a/libs/geometry/test/algorithms/buffer/point_buffer.cpp
+++ b/libs/geometry/test/algorithms/buffer/buffer_point.cpp
diff --git a/libs/geometry/test/algorithms/buffer/polygon_buffer.cpp b/libs/geometry/test/algorithms/buffer/buffer_polygon.cpp
index b45e0f59f2..8db5c2cbd7 100644
--- a/libs/geometry/test/algorithms/buffer/polygon_buffer.cpp
+++ b/libs/geometry/test/algorithms/buffer/buffer_polygon.cpp
@@ -147,6 +147,19 @@ static std::string const mysql_report_2015_02_17_2
static std::string const mysql_report_2015_02_17_3
= "POLYGON((10 10,10 20,20 20,20 10,10 10))";
+// Polygons causing assertion failure
+static std::string const mysql_report_2015_07_05_0
+ = "POLYGON((0 0,0 30000,30000 20000,25000 0,0 0),(-11 3,4.99294e+306 1.78433e+307,15 -14,-11 3))";
+static std::string const mysql_report_2015_07_05_1
+ = "POLYGON((9192 27876,128 4.5036e+15,-1 5,3 9,9192 27876),(-11 3,4.99294e+306 1.78433e+307,15 -14,-11 3))";
+static std::string const mysql_report_2015_07_05_2
+ = "POLYGON((-15 -15,1.31128e+308 2.47964e+307,-20 -9,-15 -15),(11 -4,1.04858e+06 5.36871e+08,7.03687e+13 -1.15292e+18,-12 17,10284 -21812,11 -4),(-28066 -10001,2.19902e+12 3.35544e+07,8.80784e+306 1.04773e+308,1.42177e+308 1.6141e+308,-28066 -10001))";
+static std::string const mysql_report_2015_07_05_3
+ = "POLYGON((-2.68435e+08 -12,27090 -14130,5.76461e+17 5.49756e+11,-2.68435e+08 -12),(2.68435e+08 65539,1.42845e+308 1.63164e+308,-1 -8,-4 10,2.68435e+08 65539),(13 17,8.79609e+12 -2.2518e+15,1.02101e+308 3.13248e+306,17868 780,5 -4,13 17),(-1 14,1.35905e+308 2.09331e+307,1.37439e+11 -2047,-1 14))";
+static std::string const mysql_report_2015_07_05_4
+ = "POLYGON((2.19902e+12 524287,1.13649e+308 1.36464e+308,-10 -19,2.19902e+12 524287),(1.44115e+17 -1.09951e+12,-14 0,-4347 16243,1.44115e+17 -1.09951e+12))";
+static std::string const mysql_report_2015_07_05_5
+ = "POLYGON((9 3,-8193 8.38861e+06,-2 -4,9 3),(-10 -2,32268 -2557,1.72036e+308 5.67867e+307,4.91634e+307 1.41031e+308,-2.68435e+08 -19,-10 -2),(-5 4,9.50167e+307 1.05883e+308,-422 -25737,-5 4))";
class buffer_custom_side_strategy
{
@@ -157,7 +170,7 @@ public :
typename OutputRange,
typename DistanceStrategy
>
- static inline void apply(
+ static inline bg::strategy::buffer::result_code apply(
Point const& input_p1, Point const& input_p2,
bg::strategy::buffer::buffer_side_selector side,
DistanceStrategy const& distance,
@@ -173,7 +186,7 @@ public :
if (bg::math::equals(length, 0))
{
- return;
+ return bg::strategy::buffer::result_no_output;
}
// Generate the perpendicular p, to the left (ccw), and use an adapted distance
@@ -187,6 +200,8 @@ public :
bg::set<1>(output_range.front(), bg::get<1>(input_p1) + py);
bg::set<0>(output_range.back(), bg::get<0>(input_p2) + px);
bg::set<1>(output_range.back(), bg::get<1>(input_p2) + py);
+
+ return bg::strategy::buffer::result_normal;
}
};
@@ -225,8 +240,8 @@ void test_all()
test_one<polygon_type, polygon_type>("concave_b10", concave_b, join_miter, end_flat, 836.9106, 10.0);
test_one<polygon_type, polygon_type>("concave_b25", concave_b, join_miter, end_flat, 4386.6479, 25.0);
test_one<polygon_type, polygon_type>("concave_b50", concave_b, join_miter, end_flat, 16487.2000, 50.0);
- test_one<polygon_type, polygon_type>("concave_b75", concave_b, join_miter, end_flat, 36318.1642, 75.0);
- test_one<polygon_type, polygon_type>("concave_b100", concave_b, join_miter, end_flat, 63879.5140, 100.0);
+ test_one<polygon_type, polygon_type>("concave_b75", concave_b, join_miter, end_flat, 36318.1506, 75.0);
+ test_one<polygon_type, polygon_type>("concave_b100", concave_b, join_miter, end_flat, 63879.5186, 100.0);
test_one<polygon_type, polygon_type>("concave_b10", concave_b, join_round, end_flat, 532.2875, 10.0);
test_one<polygon_type, polygon_type>("concave_b25", concave_b, join_round, end_flat, 2482.8329, 25.0);
@@ -243,13 +258,13 @@ void test_all()
test_one<polygon_type, polygon_type>("spike_simplex15", spike_simplex, join_round, end_round, 50.3633, 1.5);
test_one<polygon_type, polygon_type>("spike_simplex15", spike_simplex, join_miter, end_flat, 51.5509, 1.5);
-#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS)
test_one<polygon_type, polygon_type>("spike_simplex30", spike_simplex, join_round, end_round, 100.9199, 3.0);
- test_one<polygon_type, polygon_type>("spike_simplex30", spike_simplex, join_miter, end_flat, 120.9859, 3.0);
+#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS)
+ test_one<polygon_type, polygon_type>("spike_simplex30", spike_simplex, join_miter, end_flat, 106.6979, 3.0);
#endif
test_one<polygon_type, polygon_type>("spike_simplex150", spike_simplex, join_round, end_round, 998.9821, 15.0);
#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS)
- test_one<polygon_type, polygon_type>("spike_simplex150", spike_simplex, join_miter, end_flat, 1532.6543, 15.0);
+ test_one<polygon_type, polygon_type>("spike_simplex150", spike_simplex, join_miter, end_flat, 1428.1560, 15.0);
#endif
test_one<polygon_type, polygon_type>("join_types", join_types, join_round, end_flat, 88.2060, 1.5);
@@ -333,7 +348,9 @@ void test_all()
test_one<polygon_type, polygon_type>("snake4", snake, join_miter, end_flat, 64.44, 0.4);
test_one<polygon_type, polygon_type>("snake5", snake, join_miter, end_flat, 72, 0.5);
test_one<polygon_type, polygon_type>("snake6", snake, join_miter, end_flat, 75.44, 0.6);
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<polygon_type, polygon_type>("snake16", snake, join_miter, end_flat, 114.24, 1.6);
+#endif
test_one<polygon_type, polygon_type>("funnelgate2", funnelgate, join_miter, end_flat, 120.982, 2);
test_one<polygon_type, polygon_type>("funnelgate3", funnelgate, join_miter, end_flat, 13*13, 3);
@@ -428,10 +445,14 @@ void test_all()
test_one<polygon_type, polygon_type>(out.str(), bowl, join_miter, end_flat, expected_miter[i - 1], double(i) / 2.0);
}
}
- test_one<polygon_type, polygon_type>("county1", county1, join_round, end_flat, 0.00114092, 0.01);
- test_one<polygon_type, polygon_type>("county1", county1, join_miter, end_flat, 0.00132859, 0.01);
- test_one<polygon_type, polygon_type>("county1", county1, join_round, end_flat, 0.00114092, -0.01);
- test_one<polygon_type, polygon_type>("county1", county1, join_miter, end_flat, 0.00132859, -0.01);
+
+ {
+ double const small_tolerance = 0.0000001;
+ test_one<polygon_type, polygon_type>("county1", county1, join_round, end_flat, 0.00114092, 0.01, 0.01, true, small_tolerance);
+ test_one<polygon_type, polygon_type>("county1", county1, join_miter, end_flat, 0.00132859, 0.01, 0.01, true, small_tolerance);
+ test_one<polygon_type, polygon_type>("county1", county1, join_round, end_flat, 3.94411299566854723e-05, -0.003, -0.003, true, small_tolerance);
+ test_one<polygon_type, polygon_type>("county1", county1, join_miter, end_flat, 3.94301960113807581e-05, -0.003, -0.003, true, small_tolerance);
+ }
test_one<polygon_type, polygon_type>("parcel1_10", parcel1, join_round, end_flat, 7571.405, 10.0);
test_one<polygon_type, polygon_type>("parcel1_10", parcel1, join_miter, end_flat, 8207.453, 10.0);
@@ -467,11 +488,21 @@ void test_all()
test_one<polygon_type, polygon_type>("parcel1_20", parcel1, join_round, end_flat, 209.3579, -20.0);
test_one<polygon_type, polygon_type>("parcel1_20", parcel1, join_miter, end_flat, 188.4224, -20.0);
- test_one<polygon_type, polygon_type>("nl_part1_2", nl_part1, join_round, end_flat, 1848737355.633, -0.2 * 1000.0);
- test_one<polygon_type, polygon_type>("nl_part1_5", nl_part1, join_round, end_flat, 1775953844.678, -0.5 * 1000.0);
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
+ test_one<polygon_type, polygon_type>("nl_part1_2", nl_part1, join_round, end_flat, 1848737356.991, -0.2 * 1000.0);
+ test_one<polygon_type, polygon_type>("nl_part1_5", nl_part1, join_round, end_flat, 1775953811.679, -0.5 * 1000.0);
+#else
+ test_one<polygon_type, polygon_type>("nl_part1_2", nl_part1, join_round, end_flat, 1848737292.653, -0.2 * 1000.0);
+ test_one<polygon_type, polygon_type>("nl_part1_5", nl_part1, join_round, end_flat, 1775953824.799, -0.5 * 1000.0);
+#endif
- test_one<polygon_type, polygon_type>("italy_part1_30", italy_part1, join_round, end_flat, 5015638830.339, 30.0 * 1000.0);
- test_one<polygon_type, polygon_type>("italy_part1_50", italy_part1, join_round, end_flat, 11363180030.278, 50.0 * 1000.0);
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
+ test_one<polygon_type, polygon_type>("italy_part1_30", italy_part1, join_round, end_flat, 5015638814.956, 30.0 * 1000.0);
+ test_one<polygon_type, polygon_type>("italy_part1_50", italy_part1, join_round, end_flat, 11363180044.822, 50.0 * 1000.0);
+#else
+ test_one<polygon_type, polygon_type>("italy_part1_30", italy_part1, join_round, end_flat, 5015638827.704, 30.0 * 1000.0);
+ test_one<polygon_type, polygon_type>("italy_part1_50", italy_part1, join_round, end_flat, 11363180033.564, 50.0 * 1000.0);
+#endif
test_one<polygon_type, polygon_type>("italy_part1_60", italy_part1, join_round, end_flat, 15479097108.720, 60.0 * 1000.0);
// Tickets
@@ -531,6 +562,24 @@ void test_all()
test_one<polygon_type, polygon_type>("mysql_report_2015_02_17_3_d1",
mysql_report_2015_02_17_3,
join_round32, end_round32, 64, -1);
+
+ {
+ double high_tolerance = 1.0e+20;
+ test_one<polygon_type, polygon_type>("mysql_report_2015_07_05_0", mysql_report_2015_07_05_0,
+ join_round32, end_round32, 700643542.242915988, 6);
+ test_one<polygon_type, polygon_type>("mysql_report_2015_07_05_1", mysql_report_2015_07_05_1,
+ join_round32, end_round32, 2.07548405999982264e+19, 6);
+ test_one<polygon_type, polygon_type>("mysql_report_2015_07_05_2", mysql_report_2015_07_05_2,
+ join_round32, end_round32, 9.48681585720922691e+23, 549755813889);
+ test_one<polygon_type, polygon_type>("mysql_report_2015_07_05_3", mysql_report_2015_07_05_3,
+ join_round32, end_round32, 6.10005339242509925e+22, 49316,
+ same_distance, false, high_tolerance);
+ test_one<polygon_type, polygon_type>("mysql_report_2015_07_05_4", mysql_report_2015_07_05_4,
+ join_round32, end_round32, 4.25405937213774089e+23, 1479986,
+ same_distance, false, high_tolerance);
+ test_one<polygon_type, polygon_type>("mysql_report_2015_07_05_5", mysql_report_2015_07_05_5,
+ join_round32, end_round32, 644489321051.62439, 38141);
+ }
}
diff --git a/libs/geometry/test/algorithms/buffer/buffer_with_strategies.cpp b/libs/geometry/test/algorithms/buffer/buffer_with_strategies.cpp
new file mode 100644
index 0000000000..4914631332
--- /dev/null
+++ b/libs/geometry/test/algorithms/buffer/buffer_with_strategies.cpp
@@ -0,0 +1,138 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2015 Barend Gehrels, 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 <boost/geometry/algorithms/buffer.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+// For test
+#include <boost/geometry/algorithms/area.hpp>
+#include <boost/geometry/algorithms/correct.hpp>
+#include <boost/geometry/algorithms/num_points.hpp>
+
+
+// This unit test tests boost::geometry::buffer (overload with strategies)
+// More detailed tests are, per geometry type, available in buffer_<TYPE>.cpp
+// (testing boost::geometry::buffer_inserter)
+
+// SVG's are not created (they are in detailed tests)
+
+static std::string const polygon_simplex = "POLYGON ((0 0,1 5,6 1,0 0))";
+static std::string const polygon_empty = "POLYGON()";
+static std::string const multi_polygon_empty = "MULTIPOLYGON()";
+static std::string const multi_polygon_simplex
+ = "MULTIPOLYGON(((0 1,2 5,5 3,0 1)),((1 1,5 2,5 0,1 1)))";
+
+
+template
+<
+ typename Geometry,
+ typename GeometryOut,
+ typename JoinStrategy,
+ typename EndStrategy,
+ typename SideStrategy,
+ typename PointStrategy,
+ typename DistanceStrategy
+>
+void test_with_strategies(std::string const& caseid,
+ std::string const& wkt,
+ JoinStrategy const& join_strategy,
+ EndStrategy const& end_strategy,
+ SideStrategy const& side_strategy,
+ PointStrategy const& point_strategy,
+ DistanceStrategy const& distance_strategy,
+ double expected_area,
+ std::size_t expected_numpoints,
+ double tolerance = 0.01)
+{
+ namespace bg = boost::geometry;
+ Geometry g;
+ bg::read_wkt(wkt, g);
+ bg::correct(g);
+
+ GeometryOut result;
+
+ bg::buffer(g, result,
+ distance_strategy, side_strategy,
+ join_strategy, end_strategy, point_strategy);
+
+ BOOST_CHECK_MESSAGE
+ (
+ bg::num_points(result) == expected_numpoints,
+ "Buffer " << caseid
+ << " numpoints expected: " << expected_numpoints
+ << " detected: " << bg::num_points(result)
+ );
+
+ double const area = bg::area(result);
+ double const difference = area - expected_area;
+
+ BOOST_CHECK_MESSAGE
+ (
+ bg::math::abs(difference) < tolerance,
+ "Buffer " << caseid
+ << std::setprecision(12)
+ << " area expected: " << expected_area
+ << " detected: " << area
+ );
+}
+
+
+template <bool Clockwise, typename Point>
+void test_all()
+{
+ typedef bg::model::polygon<Point, Clockwise> polygon;
+ typedef bg::model::multi_polygon<polygon> multi_polygon;
+
+ bg::strategy::buffer::join_round join(160);
+ bg::strategy::buffer::end_round end(160);
+ bg::strategy::buffer::point_circle circle(160);
+ bg::strategy::buffer::side_straight side;
+
+ typedef bg::strategy::buffer::distance_symmetric
+ <
+ typename bg::coordinate_type<Point>::type
+ > distance;
+
+ test_with_strategies<multi_polygon, multi_polygon>(
+ "multi_polygon_empty", multi_polygon_empty,
+ join, end, side, circle, distance(1.0),
+ 0.0, 0);
+
+
+ // PostGIS: 34.2550669294223 216 (40 / qcircle)
+ // SQL Server: 34.2550419903829 220 (default options)
+ test_with_strategies<multi_polygon, multi_polygon>(
+ "multi_polygon_simplex", multi_polygon_simplex,
+ join, end, side, circle, distance(1.0),
+ 34.2551, 219);
+
+ test_with_strategies<polygon, multi_polygon>(
+ "polygon_empty", polygon_empty,
+ join, end, side, circle, distance(1.0),
+ 0.0, 0);
+
+ //
+ // PostGIS: 35.2256914798762 164 (40 / qcircle)
+ // SQL Server: 35.2252355201605 153 (default options)
+ test_with_strategies<polygon, multi_polygon>(
+ "polygon_simplex", polygon_simplex,
+ join, end, side, circle, distance(1.0),
+ 35.2257, 166);
+}
+
+int test_main(int, char* [])
+{
+ test_all<true, bg::model::point<double, 2, bg::cs::cartesian> >();
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/buffer/test_buffer.hpp b/libs/geometry/test/algorithms/buffer/test_buffer.hpp
index 6b0d91105a..5f4afa1787 100644
--- a/libs/geometry/test/algorithms/buffer/test_buffer.hpp
+++ b/libs/geometry/test/algorithms/buffer/test_buffer.hpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
-// Unit Test
+// Unit Test Helper
-// Copyright (c) 2010-2014 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2010-2015 Barend Gehrels, 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)
@@ -10,35 +10,25 @@
#ifndef BOOST_GEOMETRY_TEST_BUFFER_HPP
#define BOOST_GEOMETRY_TEST_BUFFER_HPP
-#include <iostream>
-#include <fstream>
-#include <iomanip>
-
#if defined(TEST_WITH_SVG)
-#define BOOST_GEOMETRY_BUFFER_USE_HELPER_POINTS
-
-// Uncomment next lines if you want to have a zoomed view
-// #define BOOST_GEOMETRY_BUFFER_TEST_SVG_USE_ALTERNATE_BOX
-
-// If possible define box before including this unit with the right view
-#ifdef BOOST_GEOMETRY_BUFFER_TEST_SVG_USE_ALTERNATE_BOX
-# ifndef BOOST_GEOMETRY_BUFFER_TEST_SVG_ALTERNATE_BOX
-# define BOOST_GEOMETRY_BUFFER_TEST_SVG_ALTERNATE_BOX "BOX(0 0,100 100)"
-# endif
+ // Define before including any buffer headerfile
+ #define BOOST_GEOMETRY_BUFFER_USE_HELPER_POINTS
#endif
-#endif // TEST_WITH_SVG
+#include <iostream>
+#include <fstream>
+#include <iomanip>
#include <boost/foreach.hpp>
#include <geometry_test_common.hpp>
-
#include <boost/geometry/algorithms/envelope.hpp>
#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/buffer.hpp>
#include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/algorithms/disjoint.hpp>
#include <boost/geometry/algorithms/intersects.hpp>
+#include <boost/geometry/algorithms/is_empty.hpp>
#include <boost/geometry/algorithms/is_valid.hpp>
#include <boost/geometry/algorithms/union.hpp>
@@ -55,298 +45,11 @@
#include <boost/geometry/util/condition.hpp>
+const double same_distance = -999;
#if defined(TEST_WITH_SVG)
-
-#include <boost/geometry/io/svg/svg_mapper.hpp>
-
-
-inline char piece_type_char(bg::strategy::buffer::piece_type const& type)
-{
- using namespace bg::strategy::buffer;
- switch(type)
- {
- case buffered_segment : return 's';
- case buffered_join : return 'j';
- case buffered_round_end : return 'r';
- case buffered_flat_end : return 'f';
- case buffered_point : return 'p';
- case buffered_concave : return 'c';
- default : return '?';
- }
-}
-
-template <typename Geometry, typename Mapper, typename RescalePolicy>
-void post_map(Geometry const& geometry, Mapper& mapper, RescalePolicy const& rescale_policy)
-{
- typedef typename bg::point_type<Geometry>::type point_type;
- typedef bg::detail::overlay::turn_info
- <
- point_type,
- typename bg::segment_ratio_type<point_type, RescalePolicy>::type
- > turn_info;
-
- std::vector<turn_info> turns;
-
- bg::detail::self_get_turn_points::no_interrupt_policy policy;
- bg::self_turns
- <
- bg::detail::overlay::assign_null_policy
- >(geometry, rescale_policy, turns, policy);
-
- BOOST_FOREACH(turn_info const& turn, turns)
- {
- mapper.map(turn.point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1", 3);
- }
-}
-
-template <typename SvgMapper, typename Box, typename Tag>
-struct svg_visitor
-{
-#ifdef BOOST_GEOMETRY_BUFFER_TEST_SVG_USE_ALTERNATE_BOX
- Box m_alternate_box;
-#endif
-
- class si
- {
- private :
- bg::segment_identifier m_id;
-
- public :
- inline si(bg::segment_identifier const& id)
- : m_id(id)
- {}
-
- template <typename Char, typename Traits>
- inline friend std::basic_ostream<Char, Traits>& operator<<(
- std::basic_ostream<Char, Traits>& os,
- si const& s)
- {
- os << s.m_id.multi_index << "." << s.m_id.segment_index;
- return os;
- }
- };
-
-
- SvgMapper& m_mapper;
-
- svg_visitor(SvgMapper& mapper)
- : m_mapper(mapper)
- {}
-
- template <typename Turns>
- inline void map_turns(Turns const& turns, bool label_good_turns, bool label_wrong_turns)
- {
- namespace bgdb = boost::geometry::detail::buffer;
- typedef typename boost::range_value<Turns const>::type turn_type;
- typedef typename turn_type::point_type point_type;
- typedef typename turn_type::robust_point_type robust_point_type;
-
- std::map<robust_point_type, int, bg::less<robust_point_type> > offsets;
-
- for (typename boost::range_iterator<Turns const>::type it =
- boost::begin(turns); it != boost::end(turns); ++it)
- {
-#ifdef BOOST_GEOMETRY_BUFFER_TEST_SVG_USE_ALTERNATE_BOX
- if (bg::disjoint(it->point, m_alternate_box))
- {
- continue;
- }
-#endif
-
- bool is_good = true;
- char color = 'g';
- std::string fill = "fill:rgb(0,255,0);";
- switch(it->location)
- {
- case bgdb::inside_buffer :
- fill = "fill:rgb(255,0,0);";
- color = 'r';
- is_good = false;
- break;
- case bgdb::location_discard :
- fill = "fill:rgb(0,0,255);";
- color = 'b';
- is_good = false;
- break;
- }
- if (!it->selectable_start)
- {
- fill = "fill:rgb(255,192,0);";
- color = 'o'; // orange
- }
- if (it->blocked())
- {
- fill = "fill:rgb(128,128,128);";
- color = '-';
- is_good = false;
- }
-
- fill += "fill-opacity:0.7;";
-
- m_mapper.map(it->point, fill, 4);
-
- if ((label_good_turns && is_good) || (label_wrong_turns && ! is_good))
- {
- std::ostringstream out;
- out << it->turn_index
- << " " << it->operations[0].piece_index << "/" << it->operations[1].piece_index
- << " " << si(it->operations[0].seg_id) << "/" << si(it->operations[1].seg_id)
-
- // If you want to see travel information
- << std::endl
- << " nxt " << it->operations[0].enriched.travels_to_ip_index
- << "/" << it->operations[1].enriched.travels_to_ip_index
- << " or " << it->operations[0].enriched.next_ip_index
- << "/" << it->operations[1].enriched.next_ip_index
- //<< " frac " << it->operations[0].fraction
-
- // If you want to see robust-point coordinates (e.g. to find duplicates)
- // << std::endl
- // << " " << bg::get<0>(it->robust_point) << " , " << bg::get<1>(it->robust_point)
-
- << std::endl;
- out << " " << bg::method_char(it->method)
- << ":" << bg::operation_char(it->operations[0].operation)
- << "/" << bg::operation_char(it->operations[1].operation);
- out << " "
- << (it->count_on_offsetted > 0 ? "b" : "") // b: offsetted border
- << (it->count_within_near_offsetted > 0 ? "n" : "")
- << (it->count_within > 0 ? "w" : "")
- << (it->count_on_helper > 0 ? "h" : "")
- << (it->count_on_multi > 0 ? "m" : "")
- ;
-
- offsets[it->get_robust_point()] += 10;
- int offset = offsets[it->get_robust_point()];
-
- m_mapper.text(it->point, out.str(), "fill:rgb(0,0,0);font-family='Arial';font-size:9px;", 5, offset);
-
- offsets[it->get_robust_point()] += 25;
- }
- }
- }
-
- template <typename Pieces, typename OffsettedRings>
- inline void map_pieces(Pieces const& pieces,
- OffsettedRings const& offsetted_rings,
- bool do_pieces, bool do_indices)
- {
- typedef typename boost::range_value<Pieces const>::type piece_type;
- typedef typename boost::range_value<OffsettedRings const>::type ring_type;
-
- for(typename boost::range_iterator<Pieces const>::type it = boost::begin(pieces);
- it != boost::end(pieces);
- ++it)
- {
- const piece_type& piece = *it;
- bg::segment_identifier seg_id = piece.first_seg_id;
- if (seg_id.segment_index < 0)
- {
- continue;
- }
-
- ring_type corner;
-
-
- ring_type const& ring = offsetted_rings[seg_id.multi_index];
-
- std::copy(boost::begin(ring) + seg_id.segment_index,
- boost::begin(ring) + piece.last_segment_index,
- std::back_inserter(corner));
- std::copy(boost::begin(piece.helper_points),
- boost::end(piece.helper_points),
- std::back_inserter(corner));
-
- if (corner.empty())
- {
- continue;
- }
-#ifdef BOOST_GEOMETRY_BUFFER_TEST_SVG_USE_ALTERNATE_BOX
- if (bg::disjoint(corner, m_alternate_box))
- {
- continue;
- }
-#endif
-
- if (do_pieces)
- {
- std::string style = "opacity:0.3;stroke:rgb(0,0,0);stroke-width:1;";
- m_mapper.map(corner,
- piece.type == bg::strategy::buffer::buffered_segment
- ? style + "fill:rgb(255,128,0);"
- : style + "fill:rgb(255,0,0);");
- }
-
- if (do_indices)
- {
- // Label starting piece_index / segment_index
- typedef typename bg::point_type<ring_type>::type point_type;
-
- std::ostringstream out;
- out << piece.index << " (" << piece_type_char(piece.type) << ") " << piece.first_seg_id.segment_index << ".." << piece.last_segment_index - 1;
- point_type label_point = bg::return_centroid<point_type>(corner);
-
- if ((piece.type == bg::strategy::buffer::buffered_concave
- || piece.type == bg::strategy::buffer::buffered_flat_end)
- && corner.size() >= 2u)
- {
- bg::set<0>(label_point, (bg::get<0>(corner[0]) + bg::get<0>(corner[1])) / 2.0);
- bg::set<1>(label_point, (bg::get<1>(corner[0]) + bg::get<1>(corner[1])) / 2.0);
- }
- m_mapper.text(label_point, out.str(), "fill:rgb(255,0,0);font-family='Arial';font-size:10px;", 5, 5);
- }
- }
- }
-
- template <typename TraversedRings>
- inline void map_traversed_rings(TraversedRings const& traversed_rings)
- {
- for(typename boost::range_iterator<TraversedRings const>::type it
- = boost::begin(traversed_rings); it != boost::end(traversed_rings); ++it)
- {
- m_mapper.map(*it, "opacity:0.4;fill:none;stroke:rgb(0,255,0);stroke-width:2");
- }
- }
-
- template <typename OffsettedRings>
- inline void map_offsetted_rings(OffsettedRings const& offsetted_rings)
- {
- for(typename boost::range_iterator<OffsettedRings const>::type it
- = boost::begin(offsetted_rings); it != boost::end(offsetted_rings); ++it)
- {
- if (it->discarded())
- {
- m_mapper.map(*it, "opacity:0.4;fill:none;stroke:rgb(255,0,0);stroke-width:2");
- }
- else
- {
- m_mapper.map(*it, "opacity:0.4;fill:none;stroke:rgb(0,0,255);stroke-width:2");
- }
- }
- }
-
- template <typename PieceCollection>
- inline void apply(PieceCollection const& collection, int phase)
- {
- // Comment next return if you want to see pieces, turns, etc.
- return;
-
- if(phase == 0)
- {
- map_pieces(collection.m_pieces, collection.offsetted_rings, true, true);
- map_turns(collection.m_turns, true, false);
- }
-#if !defined(BOOST_GEOMETRY_BUFFER_TEST_SVG_USE_ALTERNATE_BOX)
- if (phase == 1)
- {
-// map_traversed_rings(collection.traversed_rings);
-// map_offsetted_rings(collection.offsetted_rings);
- }
-#endif
- }
-};
-
+# include <test_buffer_svg.hpp>
+# include <test_buffer_svg_per_turn.hpp>
#endif
//-----------------------------------------------------------------------------
@@ -446,7 +149,14 @@ void test_buffer(std::string const& caseid, Geometry const& geometry,
;
bg::model::box<point_type> envelope;
- bg::envelope(geometry, envelope);
+ if (bg::is_empty(geometry))
+ {
+ bg::assign_values(envelope, 0, 0, 1, 1);
+ }
+ else
+ {
+ bg::envelope(geometry, envelope);
+ }
std::string join_name = JoinTestProperties<JoinStrategy>::name();
std::string end_name = EndTestProperties<EndStrategy>::name();
@@ -472,40 +182,25 @@ void test_buffer(std::string const& caseid, Geometry const& geometry,
//std::cout << complete.str() << std::endl;
+#if defined(TEST_WITH_SVG_PER_TURN)
+ save_turns_visitor<point_type> visitor;
+#elif defined(TEST_WITH_SVG)
+
+ buffer_svg_mapper<point_type> buffer_mapper(complete.str());
+
std::ostringstream filename;
filename << "buffer_" << complete.str() << ".svg";
-
-#if defined(TEST_WITH_SVG)
std::ofstream svg(filename.str().c_str());
typedef bg::svg_mapper<point_type> mapper_type;
- mapper_type mapper(svg, 1000, 1000);
+ mapper_type mapper(svg, 1000, 800);
- svg_visitor<mapper_type, bg::model::box<point_type>, tag> visitor(mapper);
-
-#ifdef BOOST_GEOMETRY_BUFFER_TEST_SVG_USE_ALTERNATE_BOX
- // Create a zoomed-in view
- bg::model::box<point_type> alternate_box;
- bg::read_wkt(BOOST_GEOMETRY_BUFFER_TEST_SVG_ALTERNATE_BOX, alternate_box);
- mapper.add(alternate_box);
-
- // Take care non-visible elements are skipped
- visitor.m_alternate_box = alternate_box;
-#else
-
- {
- bg::model::box<point_type> box = envelope;
- if (distance_strategy.negative())
- {
- bg::buffer(box, box, 1.0);
- }
- else
- {
- bg::buffer(box, box, 1.1 * distance_strategy.max_distance(join_strategy, end_strategy));
- }
- mapper.add(box);
- }
-#endif
+ svg_visitor<mapper_type, bg::model::box<point_type> > visitor(mapper);
+ buffer_mapper.prepare(mapper, visitor, envelope,
+ distance_strategy.negative()
+ ? 1.0
+ : 1.1 * distance_strategy.max_distance(join_strategy, end_strategy)
+ );
#else
bg::detail::buffer::visit_pieces_default_policy visitor;
#endif
@@ -532,13 +227,40 @@ void test_buffer(std::string const& caseid, Geometry const& geometry,
rescale_policy,
visitor);
+#if defined(TEST_WITH_SVG)
+ buffer_mapper.map_input_output(mapper, geometry, buffered, distance_strategy.negative());
+#endif
+
+
typename bg::default_area_result<GeometryOut>::type area = bg::area(buffered);
- //std::cout << caseid << " " << distance_left << std::endl;
- //std::cout << "INPUT: " << bg::wkt(geometry) << std::endl;
- //std::cout << "OUTPUT: " << area << std::endl;
- //std::cout << bg::wkt(buffered) << std::endl;
+ //Uncomment to create simple CSV to compare/use in tests - adapt precision if necessary
+ //std::cout << complete.str() << "," << std::fixed << std::setprecision(0) << area << std::endl;
+ //return;
+ if (bg::is_empty(buffered) && bg::math::equals(expected_area, 0.0))
+ {
+ // As expected - don't get rescale policy for output (will be invalid)
+ return;
+ }
+
+ BOOST_CHECK_MESSAGE
+ (
+ ! bg::is_empty(buffered),
+ complete.str() << " output is empty (unexpected)."
+ );
+
+ bg::model::box<point_type> envelope_output;
+ bg::assign_values(envelope_output, 0, 0, 1, 1);
+ bg::envelope(buffered, envelope_output);
+ rescale_policy_type rescale_policy_output
+ = bg::get_rescale_policy<rescale_policy_type>(envelope_output);
+
+ // std::cout << caseid << std::endl;
+ // std::cout << "INPUT: " << bg::wkt(geometry) << std::endl;
+ // std::cout << "OUTPUT: " << area << std::endl;
+ // std::cout << "OUTPUT env: " << bg::wkt(envelope_output) << std::endl;
+ // std::cout << bg::wkt(buffered) << std::endl;
if (expected_area > -0.1)
{
@@ -557,14 +279,27 @@ void test_buffer(std::string const& caseid, Geometry const& geometry,
if (check_self_intersections)
{
- // Be sure resulting polygon does not contain
- // self-intersections
- BOOST_CHECK_MESSAGE
- (
- ! bg::detail::overlay::has_self_intersections(buffered,
- rescale_policy, false),
- complete.str() << " output is self-intersecting. "
- );
+
+ try
+ {
+ bool has_self_ips = bg::detail::overlay::has_self_intersections(
+ buffered, rescale_policy_output, false);
+ // Be sure resulting polygon does not contain
+ // self-intersections
+ BOOST_CHECK_MESSAGE
+ (
+ ! has_self_ips,
+ complete.str() << " output is self-intersecting. "
+ );
+ }
+ catch(...)
+ {
+ BOOST_CHECK_MESSAGE
+ (
+ false,
+ "Exception in checking self-intersections"
+ );
+ }
}
}
@@ -579,55 +314,34 @@ void test_buffer(std::string const& caseid, Geometry const& geometry,
// BOOST_CHECK_MESSAGE(bg::intersects(buffered) == false, complete.str() << " intersects");
#endif
-#if defined(TEST_WITH_SVG)
- bool const areal = boost::is_same
- <
- typename bg::tag_cast<tag, bg::areal_tag>::type, bg::areal_tag
- >::type::value;
-
- // Map input geometry in green
- if (areal)
- {
-#ifdef BOOST_GEOMETRY_BUFFER_TEST_SVG_USE_ALTERNATE_BOX_FOR_INPUT
- // Assuming input is areal
- bg::model::multi_polygon<GeometryOut> clipped;
- bg::intersection(geometry, alternate_box, clipped);
- mapper.map(clipped, "opacity:0.5;fill:rgb(0,128,0);stroke:rgb(0,64,0);stroke-width:2");
-#else
- mapper.map(geometry, "opacity:0.5;fill:rgb(0,128,0);stroke:rgb(0,64,0);stroke-width:2");
-#endif
- }
- else
+#if defined(TEST_WITH_SVG_PER_TURN)
{
- // TODO: clip input points/linestring
- mapper.map(geometry, "opacity:0.5;stroke:rgb(0,128,0);stroke-width:10");
+ // Create a per turn visitor to map per turn, and buffer again with it
+ per_turn_visitor<point_type> ptv(complete.str(), visitor.get_points());
+ bg::detail::buffer::buffer_inserter<GeometryOut>(geometry,
+ std::back_inserter(buffered),
+ distance_strategy,
+ side_strategy,
+ join_strategy,
+ end_strategy,
+ point_strategy,
+ rescale_policy,
+ ptv);
+ ptv.map_input_output(geometry, buffered, distance_strategy.negative());
+ // self_ips NYI here
}
-
- {
- // Map buffer in yellow (inflate) and with orange-dots (deflate)
- std::string style = distance_strategy.negative()
- ? "opacity:0.4;fill:rgb(255,255,192);stroke:rgb(255,128,0);stroke-width:3"
- : "opacity:0.4;fill:rgb(255,255,128);stroke:rgb(0,0,0);stroke-width:3";
-
-#ifdef BOOST_GEOMETRY_BUFFER_TEST_SVG_USE_ALTERNATE_BOX
- // Clip output multi-polygon with box
- bg::model::multi_polygon<GeometryOut> clipped;
- bg::intersection(buffered, alternate_box, clipped);
- mapper.map(clipped, style);
-#else
- mapper.map(buffered, style);
+#elif defined(TEST_WITH_SVG)
+ buffer_mapper.map_self_ips(mapper, buffered, rescale_policy_output);
#endif
- }
- post_map(buffered, mapper, rescale_policy);
-#endif // TEST_WITH_SVG
+ // Check for self-intersections
if (self_ip_count != NULL)
{
std::size_t count = 0;
if (bg::detail::overlay::has_self_intersections(buffered,
- rescale_policy, false))
+ rescale_policy_output, false))
{
- count = count_self_ips(buffered, rescale_policy);
+ count = count_self_ips(buffered, rescale_policy_output);
}
*self_ip_count += count;
@@ -653,7 +367,7 @@ template
void test_one(std::string const& caseid, std::string const& wkt,
JoinStrategy const& join_strategy, EndStrategy const& end_strategy,
double expected_area,
- double distance_left, double distance_right = -999,
+ double distance_left, double distance_right = same_distance,
bool check_self_intersections = true,
double tolerance = 0.01)
{
@@ -683,7 +397,8 @@ void test_one(std::string const& caseid, std::string const& wkt,
<
typename bg::coordinate_type<Geometry>::type
> distance_strategy(distance_left,
- distance_right > -998 ? distance_right : distance_left);
+ bg::math::equals(distance_right, same_distance)
+ ? distance_left : distance_right);
test_buffer<GeometryOut>
(caseid, g,
@@ -696,7 +411,7 @@ void test_one(std::string const& caseid, std::string const& wkt,
// Also test symmetric distance strategy if right-distance is not specified
// (only in release mode)
- if (bg::math::equals(distance_right, -999))
+ if (bg::math::equals(distance_right, same_distance))
{
bg::strategy::buffer::distance_symmetric
<
@@ -738,7 +453,8 @@ void test_one(std::string const& caseid, std::string const& wkt,
<
typename bg::coordinate_type<Geometry>::type
> distance_strategy(distance_left,
- distance_right > -998 ? distance_right : distance_left);
+ bg::math::equals(distance_right, same_distance)
+ ? distance_left : distance_right);
bg::strategy::buffer::point_circle circle_strategy(88);
bg::strategy::buffer::side_straight side_strategy;
diff --git a/libs/geometry/test/algorithms/buffer/test_buffer_svg.hpp b/libs/geometry/test/algorithms/buffer/test_buffer_svg.hpp
new file mode 100644
index 0000000000..82a04583ea
--- /dev/null
+++ b/libs/geometry/test/algorithms/buffer/test_buffer_svg.hpp
@@ -0,0 +1,473 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test Helper
+
+// Copyright (c) 2010-2015 Barend Gehrels, 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)
+
+
+#ifndef BOOST_GEOMETRY_TEST_BUFFER_SVG_HPP
+#define BOOST_GEOMETRY_TEST_BUFFER_SVG_HPP
+
+#include <fstream>
+#include <sstream>
+
+// Uncomment next lines if you want to have a zoomed view
+//#define BOOST_GEOMETRY_BUFFER_TEST_SVG_USE_ALTERNATE_BOX
+
+// If possible define box before including this unit with the right view
+#ifdef BOOST_GEOMETRY_BUFFER_TEST_SVG_USE_ALTERNATE_BOX
+# ifndef BOOST_GEOMETRY_BUFFER_TEST_SVG_ALTERNATE_BOX
+# define BOOST_GEOMETRY_BUFFER_TEST_SVG_ALTERNATE_BOX "BOX(0 0,100 100)"
+# endif
+#endif
+
+#include <boost/foreach.hpp>
+#include <boost/geometry/io/svg/svg_mapper.hpp>
+
+
+inline char piece_type_char(bg::strategy::buffer::piece_type const& type)
+{
+ using namespace bg::strategy::buffer;
+ switch(type)
+ {
+ case buffered_segment : return 's';
+ case buffered_join : return 'j';
+ case buffered_round_end : return 'r';
+ case buffered_flat_end : return 'f';
+ case buffered_point : return 'p';
+ case buffered_concave : return 'c';
+ default : return '?';
+ }
+}
+
+template <typename SvgMapper, typename Box>
+class svg_visitor
+{
+public :
+ svg_visitor(SvgMapper& mapper)
+ : m_mapper(mapper)
+ , m_zoom(false)
+ {
+ bg::assign_inverse(m_alternate_box);
+ }
+
+ void set_alternate_box(Box const& box)
+ {
+ m_alternate_box = box;
+ m_zoom = true;
+ }
+
+ template <typename PieceCollection>
+ inline void apply(PieceCollection const& collection, int phase)
+ {
+ // Comment next return if you want to see pieces, turns, etc.
+ return;
+
+ if(phase == 0)
+ {
+ map_pieces(collection.m_pieces, collection.offsetted_rings, true, true);
+ map_turns(collection.m_turns, true, false);
+ }
+ if (phase == 1 && ! m_zoom)
+ {
+// map_traversed_rings(collection.traversed_rings);
+// map_offsetted_rings(collection.offsetted_rings);
+ }
+ }
+
+private :
+ class si
+ {
+ private :
+ bg::segment_identifier m_id;
+
+ public :
+ inline si(bg::segment_identifier const& id)
+ : m_id(id)
+ {}
+
+ template <typename Char, typename Traits>
+ inline friend std::basic_ostream<Char, Traits>& operator<<(
+ std::basic_ostream<Char, Traits>& os,
+ si const& s)
+ {
+ os << s.m_id.multi_index << "." << s.m_id.segment_index;
+ return os;
+ }
+ };
+
+ template <typename Turns>
+ inline void map_turns(Turns const& turns, bool label_good_turns, bool label_wrong_turns)
+ {
+ namespace bgdb = boost::geometry::detail::buffer;
+ typedef typename boost::range_value<Turns const>::type turn_type;
+ typedef typename turn_type::point_type point_type;
+ typedef typename turn_type::robust_point_type robust_point_type;
+
+ std::map<robust_point_type, int, bg::less<robust_point_type> > offsets;
+
+ for (typename boost::range_iterator<Turns const>::type it =
+ boost::begin(turns); it != boost::end(turns); ++it)
+ {
+ if (m_zoom && bg::disjoint(it->point, m_alternate_box))
+ {
+ continue;
+ }
+
+ bool is_good = true;
+ char color = 'g';
+ std::string fill = "fill:rgb(0,255,0);";
+ switch(it->location)
+ {
+ case bgdb::inside_buffer :
+ fill = "fill:rgb(255,0,0);";
+ color = 'r';
+ is_good = false;
+ break;
+ case bgdb::location_discard :
+ fill = "fill:rgb(0,0,255);";
+ color = 'b';
+ is_good = false;
+ break;
+ }
+ if (!it->selectable_start)
+ {
+ fill = "fill:rgb(255,192,0);";
+ color = 'o'; // orange
+ }
+ if (it->blocked())
+ {
+ fill = "fill:rgb(128,128,128);";
+ color = '-';
+ is_good = false;
+ }
+
+ fill += "fill-opacity:0.7;";
+
+ m_mapper.map(it->point, fill, 4);
+
+ if ((label_good_turns && is_good) || (label_wrong_turns && ! is_good))
+ {
+ std::ostringstream out;
+ out << it->turn_index
+ << " " << it->operations[0].piece_index << "/" << it->operations[1].piece_index
+ << " " << si(it->operations[0].seg_id) << "/" << si(it->operations[1].seg_id)
+
+ // If you want to see travel information
+ << std::endl
+ << " nxt " << it->operations[0].enriched.travels_to_ip_index
+ << "/" << it->operations[1].enriched.travels_to_ip_index
+ << " or " << it->operations[0].enriched.next_ip_index
+ << "/" << it->operations[1].enriched.next_ip_index
+ //<< " frac " << it->operations[0].fraction
+
+ // If you want to see (robust)point coordinates (e.g. to find duplicates)
+ << std::endl << std::setprecision(16) << bg::wkt(it->point)
+ << std::endl << bg::wkt(it->robust_point)
+
+ << std::endl;
+ out << " " << bg::method_char(it->method)
+ << ":" << bg::operation_char(it->operations[0].operation)
+ << "/" << bg::operation_char(it->operations[1].operation);
+ out << " "
+ << (it->count_on_offsetted > 0 ? "b" : "") // b: offsetted border
+#if ! defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
+ << (it->count_within_near_offsetted > 0 ? "n" : "")
+#endif
+ << (it->count_within > 0 ? "w" : "")
+ << (it->count_on_helper > 0 ? "h" : "")
+ << (it->count_on_multi > 0 ? "m" : "")
+ ;
+
+ offsets[it->get_robust_point()] += 10;
+ int offset = offsets[it->get_robust_point()];
+
+ m_mapper.text(it->point, out.str(), "fill:rgb(0,0,0);font-family='Arial';font-size:9px;", 5, offset);
+
+ offsets[it->get_robust_point()] += 25;
+ }
+ }
+ }
+
+ template <typename Pieces, typename OffsettedRings>
+ inline void map_pieces(Pieces const& pieces,
+ OffsettedRings const& offsetted_rings,
+ bool do_pieces, bool do_indices)
+ {
+ typedef typename boost::range_value<Pieces const>::type piece_type;
+ typedef typename boost::range_value<OffsettedRings const>::type ring_type;
+
+ for(typename boost::range_iterator<Pieces const>::type it = boost::begin(pieces);
+ it != boost::end(pieces);
+ ++it)
+ {
+ const piece_type& piece = *it;
+ bg::segment_identifier seg_id = piece.first_seg_id;
+ if (seg_id.segment_index < 0)
+ {
+ continue;
+ }
+
+ ring_type corner;
+
+
+ ring_type const& ring = offsetted_rings[seg_id.multi_index];
+
+ std::copy(boost::begin(ring) + seg_id.segment_index,
+ boost::begin(ring) + piece.last_segment_index,
+ std::back_inserter(corner));
+ std::copy(boost::begin(piece.helper_points),
+ boost::end(piece.helper_points),
+ std::back_inserter(corner));
+
+ if (corner.empty())
+ {
+ continue;
+ }
+ if (m_zoom && bg::disjoint(corner, m_alternate_box))
+ {
+ continue;
+ }
+
+ if (m_zoom && do_pieces)
+ {
+ try
+ {
+ std::string style = "opacity:0.3;stroke:rgb(0,0,0);stroke-width:1;";
+ typedef typename bg::point_type<Box>::type point_type;
+ bg::model::multi_polygon<bg::model::polygon<point_type> > clipped;
+ bg::intersection(ring, m_alternate_box, clipped);
+ m_mapper.map(clipped,
+ piece.type == bg::strategy::buffer::buffered_segment
+ ? style + "fill:rgb(255,128,0);"
+ : style + "fill:rgb(255,0,0);");
+ }
+ catch (...)
+ {
+ std::cerr << "Error for piece " << piece.index << std::endl;
+ }
+ }
+ else if (do_pieces)
+ {
+ std::string style = "opacity:0.3;stroke:rgb(0,0,0);stroke-width:1;";
+ m_mapper.map(corner,
+ piece.type == bg::strategy::buffer::buffered_segment
+ ? style + "fill:rgb(255,128,0);"
+ : style + "fill:rgb(255,0,0);");
+ }
+
+ if (do_indices)
+ {
+ // Label starting piece_index / segment_index
+ typedef typename bg::point_type<ring_type>::type point_type;
+
+ std::ostringstream out;
+ out << piece.index << " (" << piece_type_char(piece.type) << ") " << piece.first_seg_id.segment_index << ".." << piece.last_segment_index - 1;
+ point_type label_point = bg::return_centroid<point_type>(corner);
+
+ if ((piece.type == bg::strategy::buffer::buffered_concave
+ || piece.type == bg::strategy::buffer::buffered_flat_end)
+ && corner.size() >= 2u)
+ {
+ bg::set<0>(label_point, (bg::get<0>(corner[0]) + bg::get<0>(corner[1])) / 2.0);
+ bg::set<1>(label_point, (bg::get<1>(corner[0]) + bg::get<1>(corner[1])) / 2.0);
+ }
+ m_mapper.text(label_point, out.str(), "fill:rgb(255,0,0);font-family='Arial';font-size:10px;", 5, 5);
+ }
+ }
+ }
+
+ template <typename TraversedRings>
+ inline void map_traversed_rings(TraversedRings const& traversed_rings)
+ {
+ for(typename boost::range_iterator<TraversedRings const>::type it
+ = boost::begin(traversed_rings); it != boost::end(traversed_rings); ++it)
+ {
+ m_mapper.map(*it, "opacity:0.4;fill:none;stroke:rgb(0,255,0);stroke-width:2");
+ }
+ }
+
+ template <typename OffsettedRings>
+ inline void map_offsetted_rings(OffsettedRings const& offsetted_rings)
+ {
+ for(typename boost::range_iterator<OffsettedRings const>::type it
+ = boost::begin(offsetted_rings); it != boost::end(offsetted_rings); ++it)
+ {
+ if (it->discarded())
+ {
+ m_mapper.map(*it, "opacity:0.4;fill:none;stroke:rgb(255,0,0);stroke-width:2");
+ }
+ else
+ {
+ m_mapper.map(*it, "opacity:0.4;fill:none;stroke:rgb(0,0,255);stroke-width:2");
+ }
+ }
+ }
+
+
+ SvgMapper& m_mapper;
+ Box m_alternate_box;
+ bool m_zoom;
+
+};
+
+template <typename Point>
+class buffer_svg_mapper
+{
+public :
+
+ buffer_svg_mapper(std::string const& casename)
+ : m_casename(casename)
+ , m_zoom(false)
+ {
+ bg::assign_inverse(m_alternate_box);
+ }
+
+ template <typename Mapper, typename Visitor, typename Envelope>
+ void prepare(Mapper& mapper, Visitor& visitor, Envelope const& envelope, double box_buffer_distance)
+ {
+#ifdef BOOST_GEOMETRY_BUFFER_TEST_SVG_USE_ALTERNATE_BOX
+ // Create a zoomed-in view
+ bg::model::box<Point> alternate_box;
+ bg::read_wkt(BOOST_GEOMETRY_BUFFER_TEST_SVG_ALTERNATE_BOX, alternate_box);
+ mapper.add(alternate_box);
+
+ // Take care non-visible elements are skipped
+ visitor.set_alternate_box(alternate_box);
+ set_alternate_box(alternate_box);
+#else
+ bg::model::box<Point> box = envelope;
+ bg::buffer(box, box, box_buffer_distance);
+ mapper.add(box);
+#endif
+
+ boost::ignore_unused(visitor);
+ }
+
+ void set_alternate_box(bg::model::box<Point> const& box)
+ {
+ m_alternate_box = box;
+ m_zoom = true;
+ }
+
+ template <typename Mapper, typename Geometry, typename GeometryBuffer>
+ void map_input_output(Mapper& mapper, Geometry const& geometry,
+ GeometryBuffer const& buffered, bool negative)
+ {
+ bool const areal = boost::is_same
+ <
+ typename bg::tag_cast
+ <
+ typename bg::tag<Geometry>::type,
+ bg::areal_tag
+ >::type, bg::areal_tag
+ >::type::value;
+
+ if (m_zoom)
+ {
+ map_io_zoomed(mapper, geometry, buffered, negative, areal);
+ }
+ else
+ {
+ map_io(mapper, geometry, buffered, negative, areal);
+ }
+ }
+
+ template <typename Mapper, typename Geometry, typename RescalePolicy>
+ void map_self_ips(Mapper& mapper, Geometry const& geometry, RescalePolicy const& rescale_policy)
+ {
+ typedef bg::detail::overlay::turn_info
+ <
+ Point,
+ typename bg::segment_ratio_type<Point, RescalePolicy>::type
+ > turn_info;
+
+ std::vector<turn_info> turns;
+
+ bg::detail::self_get_turn_points::no_interrupt_policy policy;
+ bg::self_turns
+ <
+ bg::detail::overlay::assign_null_policy
+ >(geometry, rescale_policy, turns, policy);
+
+ BOOST_FOREACH(turn_info const& turn, turns)
+ {
+ mapper.map(turn.point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1", 3);
+ }
+ }
+
+private :
+
+ template <typename Mapper, typename Geometry, typename GeometryBuffer>
+ void map_io(Mapper& mapper, Geometry const& geometry,
+ GeometryBuffer const& buffered, bool negative, bool areal)
+ {
+ // Map input geometry in green
+ if (areal)
+ {
+ mapper.map(geometry, "opacity:0.5;fill:rgb(0,128,0);stroke:rgb(0,64,0);stroke-width:2");
+ }
+ else
+ {
+ // TODO: clip input points/linestring
+ mapper.map(geometry, "opacity:0.5;stroke:rgb(0,128,0);stroke-width:10");
+ }
+
+ {
+ // Map buffer in yellow (inflate) and with orange-dots (deflate)
+ std::string style = negative
+ ? "opacity:0.4;fill:rgb(255,255,192);stroke:rgb(255,128,0);stroke-width:3"
+ : "opacity:0.4;fill:rgb(255,255,128);stroke:rgb(0,0,0);stroke-width:3";
+
+ mapper.map(buffered, style);
+ }
+ }
+
+ template <typename Mapper, typename Geometry, typename GeometryBuffer>
+ void map_io_zoomed(Mapper& mapper, Geometry const& geometry,
+ GeometryBuffer const& buffered, bool negative, bool areal)
+ {
+ // Map input geometry in green
+ if (areal)
+ {
+ // Assuming input is areal
+ GeometryBuffer clipped;
+// TODO: the next line does NOT compile for multi-point, TODO: implement that line
+// bg::intersection(geometry, m_alternate_box, clipped);
+ mapper.map(clipped, "opacity:0.5;fill:rgb(0,128,0);stroke:rgb(0,64,0);stroke-width:2");
+ }
+ else
+ {
+ // TODO: clip input (multi)point/linestring
+ mapper.map(geometry, "opacity:0.5;stroke:rgb(0,128,0);stroke-width:10");
+ }
+
+ {
+ // Map buffer in yellow (inflate) and with orange-dots (deflate)
+ std::string style = negative
+ ? "opacity:0.4;fill:rgb(255,255,192);stroke:rgb(255,128,0);stroke-width:3"
+ : "opacity:0.4;fill:rgb(255,255,128);stroke:rgb(0,0,0);stroke-width:3";
+
+ try
+ {
+ // Clip output multi-polygon with box
+ GeometryBuffer clipped;
+ bg::intersection(buffered, m_alternate_box, clipped);
+ mapper.map(clipped, style);
+ }
+ catch (...)
+ {
+ std::cout << "Error for buffered output " << m_casename << std::endl;
+ }
+ }
+ }
+
+ bg::model::box<Point> m_alternate_box;
+ bool m_zoom;
+ std::string m_casename;
+};
+
+
+#endif
diff --git a/libs/geometry/test/algorithms/buffer/test_buffer_svg_per_turn.hpp b/libs/geometry/test/algorithms/buffer/test_buffer_svg_per_turn.hpp
new file mode 100644
index 0000000000..1a06d6fbfc
--- /dev/null
+++ b/libs/geometry/test/algorithms/buffer/test_buffer_svg_per_turn.hpp
@@ -0,0 +1,164 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test Helper
+
+// Copyright (c) 2010-2015 Barend Gehrels, 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)
+
+
+#ifndef BOOST_GEOMETRY_TEST_BUFFER_SVG_PER_TURN_HPP
+#define BOOST_GEOMETRY_TEST_BUFFER_SVG_PER_TURN_HPP
+
+#include <fstream>
+#include <vector>
+
+#include <test_buffer_svg.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
+
+template <typename Point>
+class save_turns_visitor
+{
+public :
+ typedef std::vector<std::pair<Point, int> > vector_type;
+
+ template <typename Turns>
+ inline void get_turns(Turns const& turns)
+ {
+ for (typename boost::range_iterator<Turns const>::type it =
+ boost::begin(turns); it != boost::end(turns); ++it)
+ {
+ m_points.push_back(std::make_pair(it->point, it->turn_index));
+ }
+ }
+
+ template <typename PieceCollection>
+ inline void apply(PieceCollection const& collection, int phase)
+ {
+ if (phase == 0)
+ {
+ get_turns(collection.m_turns);
+ }
+ }
+
+ vector_type const& get_points() { return m_points; }
+
+private :
+ vector_type m_points;
+};
+
+
+
+template <typename Point>
+class mapper_visitor
+{
+public :
+ mapper_visitor(std::string const& complete, int index, Point const& point)
+ : m_filename(get_filename(complete, index))
+ , m_svg(m_filename.c_str())
+ , m_mapper(m_svg, 1000, 800)
+ , m_visitor(m_mapper)
+ , m_buffer_mapper(m_filename)
+ {
+ box_type box;
+ double half_size = 75.0; // specific for multi_point buffer
+ bg::set<bg::min_corner, 0>(box, bg::get<0>(point) - half_size);
+ bg::set<bg::min_corner, 1>(box, bg::get<1>(point) - half_size);
+ bg::set<bg::max_corner, 0>(box, bg::get<0>(point) + half_size);
+ bg::set<bg::max_corner, 1>(box, bg::get<1>(point) + half_size);
+
+ m_mapper.add(box);
+ m_visitor.set_alternate_box(box);
+ m_buffer_mapper.set_alternate_box(box);
+ }
+
+ // It is used in a ptr vector
+ virtual ~mapper_visitor()
+ {
+ }
+
+ template <typename PieceCollection>
+ inline void apply(PieceCollection const& collection, int phase)
+ {
+ m_visitor.apply(collection, phase);
+ }
+
+ template <typename Geometry, typename GeometryBuffer>
+ void map_input_output(Geometry const& geometry,
+ GeometryBuffer const& buffered, bool negative)
+ {
+ m_buffer_mapper.map_input_output(m_mapper, geometry, buffered, negative);
+ }
+
+private :
+ std::string get_filename(std::string const& complete, int index)
+ {
+ std::ostringstream filename;
+ filename << "buffer_per_turn_" << complete << "_" << index << ".svg";
+ return filename.str();
+ }
+
+ typedef bg::svg_mapper<Point> mapper_type;
+ typedef bg::model::box<Point> box_type;
+
+ std::string m_filename;
+ std::ofstream m_svg;
+ mapper_type m_mapper;
+ svg_visitor<mapper_type, box_type> m_visitor;
+ buffer_svg_mapper<Point> m_buffer_mapper;
+};
+
+template <typename Point>
+class per_turn_visitor
+{
+ // Both fstreams and svg mappers are non-copyable,
+ // therefore we need to use dynamic memory
+ typedef boost::ptr_vector<mapper_visitor<Point> > container_type;
+ container_type mappers;
+
+public :
+
+ typedef std::pair<Point, int> pair_type;
+ typedef std::vector<pair_type> vector_type;
+
+ per_turn_visitor(std::string const& complete_caseid,
+ vector_type const& points)
+ {
+ namespace bg = boost::geometry;
+
+ if (points.size() > 100u)
+ {
+ // Defensive check. Too much intersections. Don't create anything
+ return;
+ }
+
+ BOOST_FOREACH(pair_type const& p, points)
+ {
+ mappers.push_back(new mapper_visitor<Point>(complete_caseid, p.second, p.first));
+ }
+ }
+
+ template <typename PieceCollection>
+ inline void apply(PieceCollection const& collection, int phase)
+ {
+ for(typename container_type::iterator it = mappers.begin();
+ it != mappers.end(); ++it)
+ {
+ it->apply(collection, phase);
+ }
+ }
+
+ template <typename Geometry, typename GeometryBuffer>
+ void map_input_output(Geometry const& geometry,
+ GeometryBuffer const& buffered, bool negative)
+ {
+ for(typename container_type::iterator it = mappers.begin();
+ it != mappers.end(); ++it)
+ {
+ it->map_input_output(geometry, buffered, negative);
+ }
+ }
+};
+
+
+#endif // BOOST_GEOMETRY_TEST_BUFFER_SVG_PER_TURN_HPP
diff --git a/libs/geometry/test/algorithms/centroid.cpp b/libs/geometry/test/algorithms/centroid.cpp
index dc6993996e..4ffeb45f9e 100644
--- a/libs/geometry/test/algorithms/centroid.cpp
+++ b/libs/geometry/test/algorithms/centroid.cpp
@@ -1,9 +1,9 @@
// 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.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2014, 2015.
// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
@@ -56,6 +56,15 @@ void test_polygon()
// should (1.5 1) be returned?
// if yes, then all other Polygons degenerated to Linestrings should be handled
test_centroid<Polygon>("POLYGON((1 1,2 1,1 1,1 1))", 1.0, 1.0);
+
+ // reported 2015.04.24
+ // input INT, result FP
+ test_centroid
+ <
+ bg::model::polygon<bg::model::d2::point_xy<int> >,
+ typename bg::point_type<Polygon>::type,
+ typename bg::coordinate_type<Polygon>::type
+ >("POLYGON((1 1, 1 2, 2 2, 2 1, 1 1))", 1.5, 1.5);
}
@@ -73,6 +82,31 @@ void test_2d()
test_centroid<bg::model::linestring<P> >("LINESTRING(1 1, 1 1)", 1.0, 1.0);
test_centroid<bg::model::linestring<P> >("LINESTRING(1 1)", 1.0, 1.0);
+ {
+ bg::model::linestring<P> ls;
+ // LINESTRING(1 -1,1e308 -1e308,0.0001 0.000)
+ bg::append(ls, P(1, -1));
+ typedef typename bg::coordinate_type<P>::type coord_type;
+ //double m = 1.0e308;
+ coord_type m = (std::numeric_limits<coord_type>::max)();
+ bg::append(ls, P(coord_type(m), coord_type(-m)));
+ bg::append(ls, P(coord_type(0.0001), coord_type(0.000)));
+ if (BOOST_GEOMETRY_CONDITION((boost::is_same<typename bg::coordinate_type<P>::type, double>::value)))
+ {
+ // for doubles the INF is detected and the calculation stopped
+ // currently for Geometries for which the centroid can't be calculated
+ // the first Point is returned
+ test_centroid<bg::model::linestring<P> >(ls, 1.0, -1.0);
+ }
+ else
+ {
+ // for floats internally the double is used to store intermediate results
+ // this type is capable to store MAX_FLT and "correctly" calculate the centroid
+ // test_centroid<bg::model::linestring<P> >(ls, m/3, -m/3);
+ // the result is around (1.7e38 -1.7e38)
+ }
+ }
+
test_centroid<bg::model::segment<P> >("LINESTRING(1 1, 3 3)", 2.0, 2.0);
test_centroid<bg::model::ring<P> >(
@@ -97,6 +131,23 @@ void test_2d()
test_centroid<bg::model::box<P> >("POLYGON((1 2,3 4))", 2, 3);
test_centroid<P>("POINT(3 3)", 3, 3);
+
+ // INT -> FP
+ test_centroid
+ <
+ bg::model::ring<bg::model::d2::point_xy<int> >,
+ P, typename bg::coordinate_type<P>::type
+ >("POLYGON((1 1, 1 2, 2 2, 2 1, 1 1))", 1.5, 1.5);
+ test_centroid
+ <
+ bg::model::linestring<bg::model::d2::point_xy<int> >,
+ P, typename bg::coordinate_type<P>::type
+ >("LINESTRING(1 1, 2 2)", 1.5, 1.5);
+ test_centroid
+ <
+ bg::model::box<bg::model::d2::point_xy<int> >,
+ P, typename bg::coordinate_type<P>::type
+ >("BOX(1 1, 2 2)", 1.5, 1.5);
}
@@ -145,6 +196,7 @@ void test_large_integers()
bg::centroid(double_poly, double_centroid);
int_point_type double_centroid_as_int;
+ bg::assign_zero(double_centroid_as_int);
bg::assign(int_centroid, double_centroid_as_int);
BOOST_CHECK_EQUAL(bg::get<0>(int_centroid), bg::get<0>(double_centroid_as_int));
diff --git a/libs/geometry/test/algorithms/multi_centroid.cpp b/libs/geometry/test/algorithms/centroid_multi.cpp
index 03cb8ecde1..c98b3f164e 100644
--- a/libs/geometry/test/algorithms/multi_centroid.cpp
+++ b/libs/geometry/test/algorithms/centroid_multi.cpp
@@ -1,9 +1,9 @@
// 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.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@@ -17,18 +17,12 @@
#include <boost/core/ignore_unused.hpp>
-#include <boost/geometry/multi/core/point_order.hpp>
-#include <boost/geometry/multi/algorithms/centroid.hpp>
-#include <boost/geometry/multi/strategies/cartesian/centroid_average.hpp>
+#include <boost/geometry/core/point_order.hpp>
+#include <boost/geometry/strategies/cartesian/centroid_average.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
-#include <boost/geometry/multi/io/wkt/read.hpp>
-
// #define REPORT_RESULTS
diff --git a/libs/geometry/test/algorithms/multi_clear.cpp b/libs/geometry/test/algorithms/clear_multi.cpp
index 39d777930e..44f4716e09 100644
--- a/libs/geometry/test/algorithms/multi_clear.cpp
+++ b/libs/geometry/test/algorithms/clear_multi.cpp
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
-// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2011-2015 Barend Gehrels, 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)
@@ -9,17 +9,11 @@
#include <boost/geometry/algorithms/clear.hpp>
#include <boost/geometry/algorithms/num_points.hpp>
-#include <boost/geometry/multi/algorithms/clear.hpp>
-#include <boost/geometry/multi/algorithms/num_points.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <boost/variant/variant.hpp>
diff --git a/libs/geometry/test/algorithms/multi_convert.cpp b/libs/geometry/test/algorithms/convert_multi.cpp
index 0bfdf6ea67..ad24d3d7a1 100644
--- a/libs/geometry/test/algorithms/multi_convert.cpp
+++ b/libs/geometry/test/algorithms/convert_multi.cpp
@@ -1,22 +1,12 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, 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 <algorithms/test_convert.hpp>
-#include <boost/geometry/multi/algorithms/convert.hpp>
-#include <boost/geometry/multi/algorithms/num_points.hpp>
-
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
-
-#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
-
template <typename Point1, typename Point2>
void test_mixed_point_types()
diff --git a/libs/geometry/test/algorithms/multi_convex_hull.cpp b/libs/geometry/test/algorithms/convex_hull_multi.cpp
index ef493e8f51..eaf0ddc8d2 100644
--- a/libs/geometry/test/algorithms/multi_convex_hull.cpp
+++ b/libs/geometry/test/algorithms/convex_hull_multi.cpp
@@ -1,12 +1,12 @@
// 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.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
-// This file was modified by Oracle on 2014.
-// Modifications copyright (c) 2014 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2014, 2015.
+// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -26,22 +26,16 @@
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/core/point_order.hpp>
+#include <boost/geometry/core/point_type.hpp>
-#include <boost/geometry/multi/core/point_order.hpp>
-#include <boost/geometry/multi/core/point_type.hpp>
+#include <boost/geometry/views/detail/range_type.hpp>
-#include <boost/geometry/multi/views/detail/range_type.hpp>
+#include <boost/geometry/algorithms/detail/for_each_range.hpp>
-#include <boost/geometry/multi/algorithms/num_points.hpp>
-#include <boost/geometry/multi/algorithms/detail/for_each_range.hpp>
-
-#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
-
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/geometries/multi_point.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
diff --git a/libs/geometry/test/algorithms/multi_correct.cpp b/libs/geometry/test/algorithms/correct_multi.cpp
index 7359d3f76d..be61640cd6 100644
--- a/libs/geometry/test/algorithms/multi_correct.cpp
+++ b/libs/geometry/test/algorithms/correct_multi.cpp
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, 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)
@@ -11,10 +11,7 @@
#include <boost/geometry/strategies/strategies.hpp>
-#include <boost/geometry/multi/algorithms/correct.hpp>
-
#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/ring.hpp>
@@ -22,7 +19,7 @@
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/polygon.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
template <typename Geometry>
diff --git a/libs/geometry/test/algorithms/detail/Jamfile.v2 b/libs/geometry/test/algorithms/detail/Jamfile.v2
index b6bd159492..6509c9a5cd 100644
--- a/libs/geometry/test/algorithms/detail/Jamfile.v2
+++ b/libs/geometry/test/algorithms/detail/Jamfile.v2
@@ -1,8 +1,13 @@
# 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.
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
+#
+# This file was modified by Oracle on 2015.
+# Modifications copyright (c) 2015 Oracle and/or its affiliates.
+#
+# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
#
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -10,8 +15,8 @@
test-suite boost-geometry-algorithms-detail
:
- [ run as_range.cpp ]
- [ run partition.cpp ]
+ [ run as_range.cpp : : : : algorithms_as_range ]
+ [ run partition.cpp : : : : algorithms_partition ]
;
build-project sections ;
diff --git a/libs/geometry/test/algorithms/detail/partition.cpp b/libs/geometry/test/algorithms/detail/partition.cpp
index e55c87307a..bf50b880f1 100644
--- a/libs/geometry/test/algorithms/detail/partition.cpp
+++ b/libs/geometry/test/algorithms/detail/partition.cpp
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, 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)
@@ -11,14 +11,13 @@
#include <boost/geometry/geometry.hpp>
-#include <boost/geometry/multi/geometries/multi_point.hpp>
+#include <boost/geometry/geometries/multi_point.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/algorithms/detail/partition.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
#if defined(TEST_WITH_SVG)
# include <boost/geometry/io/svg/svg_mapper.hpp>
diff --git a/libs/geometry/test/algorithms/detail/sections/Jamfile.v2 b/libs/geometry/test/algorithms/detail/sections/Jamfile.v2
index 973ed75f6d..ff2d3e1e18 100644
--- a/libs/geometry/test/algorithms/detail/sections/Jamfile.v2
+++ b/libs/geometry/test/algorithms/detail/sections/Jamfile.v2
@@ -1,8 +1,13 @@
# 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.
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
+#
+# This file was modified by Oracle on 2015.
+# Modifications copyright (c) 2015 Oracle and/or its affiliates.
+#
+# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
#
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -10,6 +15,6 @@
test-suite boost-geometry-algorithms-detail-sections
:
- [ run sectionalize.cpp ]
- [ run range_by_section.cpp ]
+ [ run sectionalize.cpp : : : : algorithms_sectionalize ]
+ [ run range_by_section.cpp : : : : algorithms_range_by_section ]
;
diff --git a/libs/geometry/test/algorithms/distance/Jamfile.v2 b/libs/geometry/test/algorithms/distance/Jamfile.v2
index bb76a86226..656555a57d 100644
--- a/libs/geometry/test/algorithms/distance/Jamfile.v2
+++ b/libs/geometry/test/algorithms/distance/Jamfile.v2
@@ -4,8 +4,8 @@
# Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
# Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
#
-# This file was modified by Oracle on 2014.
-# Modifications copyright (c) 2014, Oracle and/or its affiliates.
+# This file was modified by Oracle on 2014, 2015.
+# Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
#
# Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -16,13 +16,14 @@
test-suite boost-geometry-algorithms-distance
:
- [ run distance.cpp ]
- [ run distance_areal_areal.cpp ]
- [ run distance_linear_areal.cpp ]
- [ run distance_linear_linear.cpp ]
- [ run distance_pointlike_areal.cpp ]
- [ run distance_pointlike_linear.cpp ]
- [ run distance_pointlike_pointlike.cpp ]
- [ run distance_se_pl_l.cpp ]
- [ run distance_se_pl_pl.cpp ]
+ [ run distance.cpp : : : : algorithms_distance ]
+ [ run distance_areal_areal.cpp : : : : algorithms_distance_areal_areal ]
+ [ run distance_linear_areal.cpp : : : : algorithms_distance_linear_areal ]
+ [ run distance_linear_linear.cpp : : : : algorithms_distance_linear_linear ]
+ [ run distance_pointlike_areal.cpp : : : : algorithms_distance_pointlike_areal ]
+ [ run distance_pointlike_linear.cpp : : : : algorithms_distance_pointlike_linear ]
+ [ run distance_pointlike_pointlike.cpp : : : : algorithms_distance_pointlike_pointlike ]
+ [ run distance_se_pl_l.cpp : : : : algorithms_distance_se_pl_l ]
+ [ run distance_se_pl_pl.cpp : : : : algorithms_distance_se_pl_pl ]
+ [ run distance_se_point_box.cpp : : : : algorithms_distance_se_point_box ]
;
diff --git a/libs/geometry/test/algorithms/distance/distance.cpp b/libs/geometry/test/algorithms/distance/distance.cpp
index 84e0668083..2f9c74c395 100644
--- a/libs/geometry/test/algorithms/distance/distance.cpp
+++ b/libs/geometry/test/algorithms/distance/distance.cpp
@@ -1,9 +1,9 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
-// Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
-// Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@@ -30,12 +30,6 @@
#include <test_geometries/custom_segment.hpp>
#include <test_geometries/wrapped_boost_array.hpp>
-// includes for multi-geometries
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
-#include <boost/geometry/multi/io/wkt/read.hpp>
-
#include <boost/variant/variant.hpp>
BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
diff --git a/libs/geometry/test/algorithms/distance/distance_brute_force.hpp b/libs/geometry/test/algorithms/distance/distance_brute_force.hpp
index e645ec5245..b62c09105f 100644
--- a/libs/geometry/test/algorithms/distance/distance_brute_force.hpp
+++ b/libs/geometry/test/algorithms/distance/distance_brute_force.hpp
@@ -40,6 +40,20 @@ namespace detail { namespace distance_brute_force
struct distance_from_bg
{
+ template <typename G>
+ struct use_distance_from_bg
+ {
+ typedef typename boost::mpl::or_
+ <
+ boost::is_same<typename tag<G>::type, point_tag>,
+ typename boost::mpl::or_
+ <
+ boost::is_same<typename tag<G>::type, segment_tag>,
+ boost::is_same<typename tag<G>::type, box_tag>
+ >::type
+ >::type type;
+ };
+
template <typename Geometry1, typename Geometry2, typename Strategy>
static inline
typename distance_result<Geometry1, Geometry2, Strategy>::type
@@ -47,19 +61,8 @@ struct distance_from_bg
Geometry2 const& geometry2,
Strategy const& strategy)
{
- BOOST_MPL_ASSERT
- ((typename boost::mpl::or_
- <
- boost::is_same<typename tag<Geometry1>::type, point_tag>,
- boost::is_same<typename tag<Geometry1>::type, segment_tag>
- >::type));
-
- BOOST_MPL_ASSERT
- ((typename boost::mpl::or_
- <
- boost::is_same<typename tag<Geometry2>::type, point_tag>,
- boost::is_same<typename tag<Geometry2>::type, segment_tag>
- >::type));
+ BOOST_MPL_ASSERT((typename use_distance_from_bg<Geometry1>::type));
+ BOOST_MPL_ASSERT((typename use_distance_from_bg<Geometry2>::type));
return geometry::distance(geometry1, geometry2, strategy);
}
@@ -197,6 +200,20 @@ struct distance_brute_force
template
<
+ typename Point,
+ typename Box,
+ typename Strategy
+>
+struct distance_brute_force
+<
+ Point, Box, Strategy,
+ point_tag, box_tag, false
+> : detail::distance_brute_force::distance_from_bg
+{};
+
+
+template
+<
typename Segment1,
typename Segment2,
typename Strategy
diff --git a/libs/geometry/test/algorithms/distance/distance_se_pl_l.cpp b/libs/geometry/test/algorithms/distance/distance_se_pl_l.cpp
index 65c80f8d28..4fcfaee3fa 100644
--- a/libs/geometry/test/algorithms/distance/distance_se_pl_l.cpp
+++ b/libs/geometry/test/algorithms/distance/distance_se_pl_l.cpp
@@ -122,19 +122,19 @@ void test_distance_point_segment(Strategy const& strategy)
#endif
typedef test_distance_of_geometries<point_type, segment_type> tester;
+ double const d2r = bg::math::d2r<double>();
+
tester::apply("p-s-01",
"POINT(0 0)",
"SEGMENT(2 0,3 0)",
- 2.0 * bg::math::d2r * strategy.radius(),
- to_comparable(strategy,
- 2.0 * bg::math::d2r * strategy.radius()),
+ 2.0 * d2r * strategy.radius(),
+ to_comparable(strategy, 2.0 * d2r * strategy.radius()),
strategy);
tester::apply("p-s-02",
"POINT(2.5 3)",
"SEGMENT(2 0,3 0)",
- 3.0 * bg::math::d2r * strategy.radius(),
- to_comparable(strategy,
- 3.0 * bg::math::d2r * strategy.radius()),
+ 3.0 * d2r * strategy.radius(),
+ to_comparable(strategy, 3.0 * d2r * strategy.radius()),
strategy);
tester::apply("p-s-03",
"POINT(2 0)",
@@ -163,44 +163,38 @@ void test_distance_point_segment(Strategy const& strategy)
tester::apply("p-s-07",
"POINT(90 1e-3)",
"SEGMENT(0.5 0,175.5 0)",
- 1e-3 * bg::math::d2r * strategy.radius(),
- to_comparable(strategy,
- 1e-3 * bg::math::d2r * strategy.radius()),
+ 1e-3 * d2r * strategy.radius(),
+ to_comparable(strategy, 1e-3 * d2r * strategy.radius()),
strategy);
tester::apply("p-s-08",
"POINT(90 1e-4)",
"SEGMENT(0.5 0,175.5 0)",
- 1e-4 * bg::math::d2r * strategy.radius(),
- to_comparable(strategy,
- 1e-4 * bg::math::d2r * strategy.radius()),
+ 1e-4 * d2r * strategy.radius(),
+ to_comparable(strategy, 1e-4 * d2r * strategy.radius()),
strategy);
tester::apply("p-s-09",
"POINT(90 1e-5)",
"SEGMENT(0.5 0,175.5 0)",
- 1e-5 * bg::math::d2r * strategy.radius(),
- to_comparable(strategy,
- 1e-5 * bg::math::d2r * strategy.radius()),
+ 1e-5 * d2r * strategy.radius(),
+ to_comparable(strategy, 1e-5 * d2r * strategy.radius()),
strategy);
tester::apply("p-s-10",
"POINT(90 1e-6)",
"SEGMENT(0.5 0,175.5 0)",
- 1e-6 * bg::math::d2r * strategy.radius(),
- to_comparable(strategy,
- 1e-6 * bg::math::d2r * strategy.radius()),
+ 1e-6 * d2r * strategy.radius(),
+ to_comparable(strategy, 1e-6 * d2r * strategy.radius()),
strategy);
tester::apply("p-s-11",
"POINT(90 1e-7)",
"SEGMENT(0.5 0,175.5 0)",
- 1e-7 * bg::math::d2r * strategy.radius(),
- to_comparable(strategy,
- 1e-7 * bg::math::d2r * strategy.radius()),
+ 1e-7 * d2r * strategy.radius(),
+ to_comparable(strategy, 1e-7 * d2r * strategy.radius()),
strategy);
tester::apply("p-s-12",
"POINT(90 1e-8)",
"SEGMENT(0.5 0,175.5 0)",
- 1e-8 * bg::math::d2r * strategy.radius(),
- to_comparable(strategy,
- 1e-8 * bg::math::d2r * strategy.radius()),
+ 1e-8 * d2r * strategy.radius(),
+ to_comparable(strategy, 1e-8 * d2r * strategy.radius()),
strategy);
}
@@ -215,26 +209,25 @@ void test_distance_point_linestring(Strategy const& strategy)
#endif
typedef test_distance_of_geometries<point_type, linestring_type> tester;
+ double const d2r = bg::math::d2r<double>();
+
tester::apply("p-l-01",
"POINT(0 0)",
"LINESTRING(2 0,2 0)",
- 2.0 * bg::math::d2r * strategy.radius(),
- to_comparable(strategy,
- 2.0 * bg::math::d2r * strategy.radius()),
+ 2.0 * d2r * strategy.radius(),
+ to_comparable(strategy, 2.0 * d2r * strategy.radius()),
strategy);
tester::apply("p-l-02",
"POINT(0 0)",
"LINESTRING(2 0,3 0)",
- 2.0 * bg::math::d2r * strategy.radius(),
- to_comparable(strategy,
- 2.0 * bg::math::d2r * strategy.radius()),
+ 2.0 * d2r * strategy.radius(),
+ to_comparable(strategy, 2.0 * d2r * strategy.radius()),
strategy);
tester::apply("p-l-03",
"POINT(2.5 3)",
"LINESTRING(2 0,3 0)",
- 3.0 * bg::math::d2r * strategy.radius(),
- to_comparable(strategy,
- 3.0 * bg::math::d2r * strategy.radius()),
+ 3.0 * d2r * strategy.radius(),
+ to_comparable(strategy, 3.0 * d2r * strategy.radius()),
strategy);
tester::apply("p-l-04",
"POINT(2 0)",
@@ -254,9 +247,8 @@ void test_distance_point_linestring(Strategy const& strategy)
tester::apply("p-l-07",
"POINT(7.5 10)",
"LINESTRING(1 0,2 0,3 0,4 0,5 0,6 0,7 0,8 0,9 0)",
- 10.0 * bg::math::d2r * strategy.radius(),
- to_comparable(strategy,
- 10.0 * bg::math::d2r * strategy.radius()),
+ 10.0 * d2r * strategy.radius(),
+ to_comparable(strategy, 10.0 * d2r * strategy.radius()),
strategy);
tester::apply("p-l-08",
"POINT(7.5 10)",
@@ -282,19 +274,19 @@ void test_distance_point_multilinestring(Strategy const& strategy)
point_type, multi_linestring_type
> tester;
+ double const d2r = bg::math::d2r<double>();
+
tester::apply("p-ml-01",
"POINT(0 0)",
"MULTILINESTRING((-5 0,-3 0),(2 0,3 0))",
- 2.0 * bg::math::d2r * strategy.radius(),
- to_comparable(strategy,
- 2.0 * bg::math::d2r * strategy.radius()),
+ 2.0 * d2r * strategy.radius(),
+ to_comparable(strategy, 2.0 * d2r * strategy.radius()),
strategy);
tester::apply("p-ml-02",
"POINT(2.5 3)",
"MULTILINESTRING((-5 0,-3 0),(2 0,3 0))",
- 3.0 * bg::math::d2r * strategy.radius(),
- to_comparable(strategy,
- 3.0 * bg::math::d2r * strategy.radius()),
+ 3.0 * d2r * strategy.radius(),
+ to_comparable(strategy, 3.0 * d2r * strategy.radius()),
strategy);
tester::apply("p-ml-03",
"POINT(2 0)",
@@ -431,6 +423,8 @@ void test_distance_multipoint_segment(Strategy const& strategy)
#endif
typedef test_distance_of_geometries<multi_point_type, segment_type> tester;
+ double d2r = bg::math::d2r<double>();
+
tester::apply("mp-s-01",
"MULTIPOINT(0 0,1 0,0 1,1 1)",
"SEGMENT(2 0,0 2)",
@@ -442,9 +436,8 @@ void test_distance_multipoint_segment(Strategy const& strategy)
tester::apply("mp-s-02",
"MULTIPOINT(0 0,1 0,0 1,1 1)",
"SEGMENT(0 -3,1 -10)",
- 3.0 * bg::math::d2r * strategy.radius(),
- to_comparable(strategy,
- 3.0 * bg::math::d2r * strategy.radius()),
+ 3.0 * d2r * strategy.radius(),
+ to_comparable(strategy, 3.0 * d2r * strategy.radius()),
strategy);
tester::apply("mp-s-03",
"MULTIPOINT(0 0,1 0,0 1,1 1)",
diff --git a/libs/geometry/test/algorithms/distance/distance_se_pl_pl.cpp b/libs/geometry/test/algorithms/distance/distance_se_pl_pl.cpp
index 2e14e8892a..c7dfda2a92 100644
--- a/libs/geometry/test/algorithms/distance/distance_se_pl_pl.cpp
+++ b/libs/geometry/test/algorithms/distance/distance_se_pl_pl.cpp
@@ -89,7 +89,7 @@ void test_distance_point_point(Strategy const& strategy,
"POINT(180 -10)",
(is_comparable_strategy
? 1.0
- : (180.0 * bg::math::d2r * strategy.radius())),
+ : (bg::math::pi<double>() * strategy.radius())),
1.0,
strategy);
tester::apply("p-p-04",
@@ -97,7 +97,7 @@ void test_distance_point_point(Strategy const& strategy,
"POINT(180 0)",
(is_comparable_strategy
? 1.0
- : (180.0 * bg::math::d2r * strategy.radius())),
+ : (bg::math::pi<double>() * strategy.radius())),
1.0,
strategy);
}
diff --git a/libs/geometry/test/algorithms/distance/distance_se_point_box.cpp b/libs/geometry/test/algorithms/distance/distance_se_point_box.cpp
new file mode 100644
index 0000000000..0237149ad2
--- /dev/null
+++ b/libs/geometry/test/algorithms/distance/distance_se_point_box.cpp
@@ -0,0 +1,464 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2015, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
+
+// Licensed under the Boost Software License version 1.0.
+// http://www.boost.org/users/license.html
+
+#include <iostream>
+
+#ifndef BOOST_TEST_MODULE
+#define BOOST_TEST_MODULE test_distance_spherical_equatorial_point_box
+#endif
+
+#include <boost/range.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/test/included/unit_test.hpp>
+#include <boost/geometry/util/condition.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include "test_distance_se_common.hpp"
+
+
+typedef bg::cs::spherical_equatorial<bg::degree> cs_type;
+typedef bg::model::point<double, 2, cs_type> point_type;
+typedef bg::model::segment<point_type> segment_type;
+typedef bg::model::box<point_type> box_type;
+
+namespace distance = bg::strategy::distance;
+namespace services = distance::services;
+typedef bg::default_distance_result<point_type, point_type>::type return_type;
+
+typedef distance::cross_track_point_box<> point_box_strategy;
+typedef distance::cross_track_point_box
+ <
+ void, distance::comparable::cross_track<>
+ > comparable_point_box_strategy;
+
+//===========================================================================
+
+inline bg::distance_result
+ <
+ point_type, point_type, distance::haversine<double>
+ >::type
+distance_pp(std::string const& wkt1,
+ std::string const& wkt2,
+ double radius)
+{
+ point_type p1, p2;
+ bg::read_wkt(wkt1, p1);
+ bg::read_wkt(wkt2, p2);
+
+ distance::haversine<double> strategy(radius);
+ return bg::distance(p1, p2, strategy);
+}
+
+inline bg::default_comparable_distance_result<point_type>::type
+comparable_distance_pp(std::string const& wkt1,
+ std::string const& wkt2)
+{
+ point_type p1, p2;
+ bg::read_wkt(wkt1, p1);
+ bg::read_wkt(wkt2, p2);
+ return bg::comparable_distance(p1, p2);
+}
+
+inline bg::distance_result
+ <
+ point_type, point_type, distance::cross_track<>
+ >::type
+distance_ps(std::string const& wkt_point,
+ std::string const& wkt_segment,
+ double radius)
+{
+ point_type point;
+ segment_type segment;
+ bg::read_wkt(wkt_point, point);
+ bg::read_wkt(wkt_segment, segment);
+
+ distance::cross_track<> strategy(radius);
+ return bg::distance(point, segment, strategy);
+}
+
+inline bg::default_comparable_distance_result<point_type>::type
+comparable_distance_ps(std::string const& wkt_point,
+ std::string const& wkt_segment)
+{
+ point_type point;
+ segment_type segment;
+ bg::read_wkt(wkt_point, point);
+ bg::read_wkt(wkt_segment, segment);
+ return bg::comparable_distance(point, segment);
+}
+
+enum features_type { pp, ps };
+
+template <typename Geometry1, typename Geometry2>
+struct test_distances
+{
+ template <typename Strategy>
+ static inline void apply(std::string const& case_id,
+ std::string const& wkt1,
+ std::string const& wkt2,
+ double expected_distance,
+ double expected_comparable_distance,
+ Strategy const& strategy)
+ {
+ typedef test_distance_of_geometries<Geometry1, Geometry2> tester;
+
+ bool const is_comparable = boost::is_same
+ <
+ Strategy,
+ typename services::comparable_type<Strategy>::type
+ >::value;
+
+ if (BOOST_GEOMETRY_CONDITION(is_comparable))
+ {
+ tester::apply(case_id, wkt1, wkt2,
+ expected_comparable_distance,
+ expected_comparable_distance,
+ strategy);
+ }
+ else
+ {
+ tester::apply(case_id, wkt1, wkt2,
+ expected_distance,
+ expected_comparable_distance,
+ strategy);
+ }
+ }
+
+ template <typename Strategy>
+ static inline void apply(std::string const& case_id,
+ std::string const& wkt1,
+ std::string const& wkt2,
+ std::string const& feature1,
+ std::string const& feature2,
+ features_type ftype,
+ Strategy const& strategy)
+ {
+ double const radius = strategy.radius();
+ double expected_distance, expected_comparable_distance;
+
+ if (ftype == pp)
+ {
+ expected_distance = distance_pp(feature1, feature2, radius);
+ expected_comparable_distance
+ = comparable_distance_pp(feature1, feature2);
+ }
+ else
+ {
+ expected_distance = distance_ps(feature1, feature2, radius);
+ expected_comparable_distance
+ = comparable_distance_ps(feature1, feature2);
+ }
+
+ apply(case_id, wkt1, wkt2,
+ expected_distance, expected_comparable_distance,
+ strategy);
+ }
+};
+
+template <typename T, typename U>
+T to_comparable(T const& value, U const& radius)
+{
+ T x = sin(value / (radius * 2.0));
+ return x * x;
+}
+
+//===========================================================================
+
+template <typename Strategy>
+void test_distance_point_box(Strategy const& strategy)
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl;
+ std::cout << "point/box distance tests" << std::endl;
+#endif
+ typedef test_distances<point_type, box_type> tester;
+
+ double const radius = strategy.radius();
+ double const d2r = bg::math::d2r<double>();
+
+ // Cases for relative location of a point wrt to a box
+ //
+ // | |
+ // | 3 |
+ // | |
+ // +---------+
+ // | |
+ // 1 | 5 | 2
+ // | |
+ // +---------+
+ // | |
+ // | 4 |
+ // | |
+ //
+ // and also the following cases
+ //
+ // | |
+ // A B
+ // | |
+ // +----C----+
+ // | |
+ // D E
+ // | |
+ // +----F----+
+ // | |
+ // G H
+ // | |
+ //
+ // and finally we have the corners
+ //
+ // | |
+ // | |
+ // | |
+ // a---------b
+ // | |
+ // | |
+ // | |
+ // c---------d
+ // | |
+ // | |
+ // | |
+ //
+ // for each relative position we also have to test the shifted point
+ // (this is due to the fact that boxes have longitudes in the
+ // range [-180, 540)
+
+ std::string const box1 = "BOX(10 10,20 20)";
+
+ // case 1
+ tester::apply("pb1-1a", "POINT(5 25)", box1,
+ "POINT(5 25)", "POINT(10 20)", pp,
+ strategy);
+
+ // case 1
+ tester::apply("pb1-1b", "POINT(3 12)", box1,
+ "POINT(3 12)", "SEGMENT(10 10,10 20)", ps,
+ strategy);
+
+ // case 1
+ tester::apply("pb1-1c", "POINT(3 17)", box1,
+ "POINT(3 17)", "SEGMENT(10 10,10 20)", ps,
+ strategy);
+
+ // case 1
+ tester::apply("pb1-1d", "POINT(5 4)", box1,
+ "POINT(5 4)", "POINT(10 10)", pp,
+ strategy);
+
+ // case 1
+ tester::apply("pb1-1e", "POINT(-100 20)", box1,
+ "POINT(-100 20)", "POINT(10 20)", pp,
+ strategy);
+
+ // case 1
+ tester::apply("pb1-1g", "POINT(-100 10)", box1,
+ "POINT(-100 10)", "SEGMENT(10 10,10 20)", ps,
+ strategy);
+
+ // case 2
+ tester::apply("pb1-2a", "POINT(31 25)", box1,
+ "POINT(31 25)", "POINT(20 20)", pp,
+ strategy);
+
+ // case 2
+ tester::apply("pb1-2b", "POINT(23 17)", box1,
+ "POINT(23 17)", "SEGMENT(20 10,20 20)", ps,
+ strategy);
+
+ // case 2
+ tester::apply("pb1-2c", "POINT(29 3)", box1,
+ "POINT(29 3)", "POINT(20 10)", pp,
+ strategy);
+
+ // case 2
+ tester::apply("pb1-2d", "POINT(131 65)", box1,
+ "POINT(131 65)", "POINT(20 20)", pp,
+ strategy);
+
+ // case 2
+ tester::apply("pb1-2e", "POINT(110 10)", box1,
+ "POINT(110 10)", "SEGMENT(20 10,20 20)", ps,
+ strategy);
+
+ // case 2
+ tester::apply("pb1-2f", "POINT(150 20)", box1,
+ "POINT(150 20)", "POINT(20 20)", pp,
+ strategy);
+
+ // case 3
+ tester::apply("pb1-3a", "POINT(11 25)", box1,
+ 5.0 * d2r * radius,
+ to_comparable(5.0 * d2r * radius, radius),
+ strategy);
+
+ // case 3
+ tester::apply("pb1-3b", "POINT(15 25)", box1,
+ 5.0 * d2r * radius,
+ to_comparable(5.0 * d2r * radius, radius),
+ strategy);
+
+ // case 3
+ tester::apply("pb1-3c", "POINT(18 25)", box1,
+ 5.0 * d2r * radius,
+ to_comparable(5.0 * d2r * radius, radius),
+ strategy);
+
+ // case 4
+ tester::apply("pb1-4a", "POINT(13 4)", box1,
+ 6.0 * radius * d2r,
+ to_comparable(6.0 * radius * d2r, radius),
+ strategy);
+
+ // case 4
+ tester::apply("pb1-4b", "POINT(19 4)", box1,
+ 6.0 * radius * d2r,
+ to_comparable(6.0 * radius * d2r, radius),
+ strategy);
+
+ // case 5
+ tester::apply("pb1-5", "POINT(15 14)", box1, 0, 0, strategy);
+
+ // case A
+ tester::apply("pb1-A", "POINT(10 28)", box1,
+ 8.0 * d2r * radius,
+ to_comparable(8.0 * d2r * radius, radius),
+ strategy);
+
+ // case B
+ tester::apply("pb1-B", "POINT(20 28)", box1,
+ 8.0 * d2r * radius,
+ to_comparable(8.0 * d2r * radius, radius),
+ strategy);
+
+ // case C
+ tester::apply("pb1-C", "POINT(14 20)", box1, 0, 0, strategy);
+
+ // case D
+ tester::apply("pb1-D", "POINT(10 17)", box1, 0, 0, strategy);
+
+ // case E
+ tester::apply("pb1-E", "POINT(20 11)", box1, 0, 0, strategy);
+
+ // case F
+ tester::apply("pb1-F", "POINT(19 10)", box1, 0, 0, strategy);
+
+ // case G
+ tester::apply("pb1-G", "POINT(10 -40)", box1,
+ 50.0 * d2r * radius,
+ to_comparable(50.0 * d2r * radius, radius),
+ strategy);
+
+ // case H
+ tester::apply("pb1-H",
+ "POINT(20 -50)", box1,
+ 60.0 * d2r * radius,
+ to_comparable(60.0 * d2r * radius, radius),
+ strategy);
+
+ // case a
+ tester::apply("pb1-a", "POINT(10 20)", box1, 0, 0, strategy);
+ // case b
+ tester::apply("pb1-b", "POINT(20 20)", box1, 0, 0, strategy);
+ // case c
+ tester::apply("pb1-c", "POINT(10 10)", box1, 0, 0, strategy);
+ // case d
+ tester::apply("pb1-d", "POINT(20 10)", box1, 0, 0, strategy);
+
+
+
+ std::string const box2 = "BOX(170 -60,400 80)";
+
+ // case 1 - point is closer to western meridian
+ tester::apply("pb2-1a", "POINT(160 0)", box2,
+ "POINT(160 0)", "SEGMENT(170 -60,170 80)", ps,
+ strategy);
+
+ // case 1 - point is closer to eastern meridian
+ tester::apply("pb2-1b", "POINT(50 0)", box2,
+ "POINT(50 0)", "SEGMENT(40 -60,40 80)", ps,
+ strategy);
+
+ // case 3 - equivalent point POINT(390 85) is above the box
+ tester::apply("pb2-3", "POINT(30 85)", box2,
+ 5.0 * d2r * radius,
+ to_comparable(5.0 * d2r * radius, radius),
+ strategy);
+
+ // case 4 - equivalent point POINT(390 -75) is below the box
+ tester::apply("pb2-4", "POINT(30 -75)", box2,
+ 15.0 * d2r * radius,
+ to_comparable(15.0 * d2r * radius, radius),
+ strategy);
+
+ // case 5 - equivalent point POINT(390 0) is inside box
+ tester::apply("pb2-5", "POINT(30 0)", box2, 0, 0, strategy);
+
+
+ std::string const box3 = "BOX(-150 -50,-40 70)";
+
+ // case 1 - point is closer to western meridian
+ tester::apply("pb3-1a", "POINT(-170 10)", box3,
+ "POINT(-170 10)", "SEGMENT(-150 -50,-150 70)", ps,
+ strategy);
+
+ // case 2 - point is closer to eastern meridian
+ tester::apply("pb3-2a", "POINT(5 10)", box3,
+ "POINT(5 10)", "SEGMENT(-40 -50,-40 70)", ps,
+ strategy);
+
+ // case 2 - point is closer to western meridian
+ tester::apply("pb3-2a", "POINT(160 10)", box3,
+ "POINT(160 10)", "SEGMENT(-150 -50,-150 70)", ps,
+ strategy);
+
+ // case 2 - point is at equal distance from eastern and western meridian
+ tester::apply("pb3-2c1", "POINT(85 20)", box3,
+ "POINT(85 20)", "SEGMENT(-150 -50,-150 70)", ps,
+ strategy);
+
+ // case 2 - point is at equal distance from eastern and western meridian
+ tester::apply("pb3-2c2", "POINT(85 20)", box3,
+ "POINT(85 20)", "SEGMENT(-40 -50,-40 70)", ps,
+ strategy);
+
+ // box that is symmetric wrt the prime meridian
+ std::string const box4 = "BOX(-75 -45,75 65)";
+
+ // case 1 - point is closer to western meridian
+ tester::apply("pb4-1a", "POINT(-100 10)", box4,
+ "POINT(-100 10)", "SEGMENT(-75 -45,-75 65)", ps,
+ strategy);
+
+ // case 2 - point is closer to eastern meridian
+ tester::apply("pb4-2a", "POINT(90 15)", box4,
+ "POINT(90 15)", "SEGMENT(75 -45,75 65)", ps,
+ strategy);
+
+ // case 2 - point is at equal distance from eastern and western meridian
+ tester::apply("pb4-2c1", "POINT(-180 20)", box4,
+ "POINT(-180 20)", "SEGMENT(-75 -45,-75 65)", ps,
+ strategy);
+
+ // case 2 - point is at equal distance from eastern and western meridian
+ tester::apply("pb4-2c2", "POINT(-180 20)", box4,
+ "POINT(-180 20)", "SEGMENT(75 -45,75 65)", ps,
+ strategy);
+}
+
+BOOST_AUTO_TEST_CASE( test_point_box )
+{
+ test_distance_point_box(point_box_strategy());
+ test_distance_point_box(point_box_strategy(earth_radius_km));
+ test_distance_point_box(point_box_strategy(earth_radius_miles));
+
+ test_distance_point_box(comparable_point_box_strategy());
+ test_distance_point_box(comparable_point_box_strategy(earth_radius_km));
+ test_distance_point_box(comparable_point_box_strategy(earth_radius_miles));
+}
diff --git a/libs/geometry/test/algorithms/distance/test_distance_se_common.hpp b/libs/geometry/test/algorithms/distance/test_distance_se_common.hpp
index 5e846346df..5d514c826e 100644
--- a/libs/geometry/test/algorithms/distance/test_distance_se_common.hpp
+++ b/libs/geometry/test/algorithms/distance/test_distance_se_common.hpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2014, Oracle and/or its affiliates.
+// Copyright (c) 2014-2015, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
@@ -25,15 +25,12 @@
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/ring.hpp>
#include <boost/geometry/geometries/box.hpp>
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/geometries/multi_point.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/io/wkt/write.hpp>
-#include <boost/geometry/multi/io/wkt/write.hpp>
-
#include <boost/geometry/io/dsv/write.hpp>
-#include <boost/geometry/multi/io/dsv/write.hpp>
#include <boost/geometry/algorithms/num_interior_rings.hpp>
#include <boost/geometry/algorithms/distance.hpp>
diff --git a/libs/geometry/test/algorithms/envelope.cpp b/libs/geometry/test/algorithms/envelope.cpp
index 92d69e8acf..1cb9897861 100644
--- a/libs/geometry/test/algorithms/envelope.cpp
+++ b/libs/geometry/test/algorithms/envelope.cpp
@@ -1,9 +1,14 @@
// 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.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
+
+// This file was modified by Oracle on 2015.
+// Modifications copyright (c) 2015, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@@ -12,6 +17,7 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
+#include <boost/numeric/conversion/bounds.hpp>
#include <algorithms/test_envelope.hpp>
@@ -57,6 +63,144 @@ void test_3d()
test_envelope<bg::model::box<P> >("BOX(1 1 1,3 3 3)", 1, 3, 1, 3, 1, 3);
}
+template <typename Geometry>
+void test_empty_geometry(std::string const& wkt)
+{
+ typedef typename bg::coordinate_type<Geometry>::type ct;
+ ct high_val = boost::numeric::bounds<ct>::highest();
+ ct low_val = boost::numeric::bounds<ct>::lowest();
+
+ test_envelope<Geometry>(wkt, high_val, low_val, high_val, low_val);
+}
+
+template <typename P>
+void test_empty()
+{
+ test_empty_geometry<bg::model::linestring<P> >("LINESTRING()");
+ test_empty_geometry<bg::model::ring<P> >("POLYGON(())");
+
+ test_empty_geometry<bg::model::polygon<P> >("POLYGON(())");
+
+ test_empty_geometry<bg::model::multi_point<P> >("MULTIPOINT()");
+
+ test_empty_geometry
+ <
+ bg::model::multi_linestring<bg::model::linestring<P> >
+ >("MULTILINESTRING()");
+
+ test_empty_geometry
+ <
+ bg::model::multi_polygon<bg::model::polygon<P> >
+ >("MULTIPOLYGON()");
+}
+
+template <typename P>
+void test_invalid()
+{
+ // polygon with empty exterior and interior rings
+ test_empty_geometry<bg::model::polygon<P> >("POLYGON((),(),())");
+
+ // polygon with empty interior rings
+ test_envelope
+ <
+ bg::model::polygon<P>
+ >("POLYGON((1 2,1 20,22 20,22 2,1 2),(),())",
+ 1, 22, 2, 20);
+
+ // another polygon with empty interior rings
+ test_envelope
+ <
+ bg::model::polygon<P>
+ >("POLYGON((1 2,1 20,22 20,22 2,1 2),(),(3 4,19 4,19 18,3 18,3 4),())",
+ 1, 22, 2, 20);
+
+ // polygon with empty exterior ring
+ test_envelope
+ <
+ bg::model::polygon<P>
+ >("POLYGON((),(),(3 4,19 4,19 18,3 18,3 4),())",
+ 3, 19, 4, 18);
+
+ // another polygon with empty exterior ring
+ test_envelope
+ <
+ bg::model::polygon<P>
+ >("POLYGON((),(),(3 4,19 4,19 18,3 18,3 4),(4 5,18 5,18 17,4 17,4 5))",
+ 3, 19, 4, 18);
+
+ // yet one more polygon with empty exterior ring
+ test_envelope
+ <
+ bg::model::polygon<P>
+ >("POLYGON((),(),(4 5,18 5,18 17,4 17,4 5),(3 4,19 4,19 18,3 18,3 4))",
+ 3, 19, 4, 18);
+
+ // multilinestring with empty linestrings
+ test_empty_geometry
+ <
+ bg::model::multi_linestring<bg::model::linestring<P> >
+ >("MULTILINESTRING((),(),())");
+
+ // multilinestring with empty and non-empty linestrings
+ test_envelope
+ <
+ bg::model::multi_linestring<bg::model::linestring<P> >
+ >("MULTILINESTRING((),(10 20),())", 10, 10, 20, 20);
+
+ // multipolygon with empty polygon
+ test_empty_geometry
+ <
+ bg::model::multi_polygon<bg::model::polygon<P> >
+ >("MULTIPOLYGON((()))");
+
+ // multipolygon with many empty polygons
+ test_empty_geometry
+ <
+ bg::model::multi_polygon<bg::model::polygon<P> >
+ >("MULTIPOLYGON(((),(),()),(()),((),(),(),(),()))");
+
+ // multipolygon with empty polygons and non-empty (valid) polygon
+ test_envelope
+ <
+ bg::model::multi_polygon<bg::model::polygon<P> >
+ >("MULTIPOLYGON(((),(),()),((10 30,10 40,20 30,10 30)),\
+ ((),(),()),(()))", 10, 20, 30, 40);
+
+ // multipolygon with empty polygons and non-empty (valid) polygon
+ // that has an interior ring
+ test_envelope
+ <
+ bg::model::multi_polygon<bg::model::polygon<P> >
+ >("MULTIPOLYGON(((),(),()),(()),\
+ ((1 2,1 20,22 20,22 2,1 2),(3 4,19 4,19 18,3 18,3 4)),(()))",
+ 1, 22, 2, 20);
+
+ // multipolygon with empty polygons and non-empty (invalid) polygon
+ // that has an interior ring but empty exterior ring
+ test_envelope
+ <
+ bg::model::multi_polygon<bg::model::polygon<P> >
+ >("MULTIPOLYGON(((),(),()),(()),((),(3 4,19 4,19 18,3 18,3 4)),(()))",
+ 3, 19, 4, 18);
+
+ // multipolygon with empty polygons and non-empty (invalid) polygon
+ // that has an interior ring but empty exterior ring
+ test_envelope
+ <
+ bg::model::multi_polygon<bg::model::polygon<P> >
+ >("MULTIPOLYGON(((),(),()),((),(),(3 4,19 4,19 18,3 18,3 4),()),(()))",
+ 3, 19, 4, 18);
+
+ // multipolygon with empty polygons and non-empty (invalid) polygon
+ // that has two non-empty interior rings but empty exterior ring
+ test_envelope
+ <
+ bg::model::multi_polygon<bg::model::polygon<P> >
+ >("MULTIPOLYGON(((),(),()),\
+ ((),(),(3 4,19 4,19 18,3 18,3 4),(4 5,18 5,18 17,4 17,4 5),()),\
+ (()))",
+ 3, 19, 4, 18);
+}
int test_main(int, char* [])
{
@@ -71,6 +215,16 @@ int test_main(int, char* [])
test_3d<test::test_point>();
test_3d<boost::tuple<int, int, int> >();
+ test_empty<boost::tuple<float, float> >();
+ test_empty<bg::model::d2::point_xy<int> >();
+ test_empty<bg::model::d2::point_xy<float> >();
+ test_empty<bg::model::d2::point_xy<double> >();
+
+ test_invalid<boost::tuple<float, float> >();
+ test_invalid<bg::model::d2::point_xy<int> >();
+ test_invalid<bg::model::d2::point_xy<float> >();
+ test_invalid<bg::model::d2::point_xy<double> >();
+
#ifdef HAVE_TTMATH
test_2d<bg::model::d2::point_xy<ttmath_big> >();
test_3d<boost::tuple<ttmath_big, ttmath_big, ttmath_big> >();
diff --git a/libs/geometry/test/algorithms/multi_envelope.cpp b/libs/geometry/test/algorithms/envelope_multi.cpp
index bafa5dc25f..5ebbc6eeec 100644
--- a/libs/geometry/test/algorithms/multi_envelope.cpp
+++ b/libs/geometry/test/algorithms/envelope_multi.cpp
@@ -1,9 +1,9 @@
// 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.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@@ -15,14 +15,6 @@
#include <algorithms/test_envelope.hpp>
-
-#include <boost/geometry/multi/algorithms/envelope.hpp>
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
-
-#include <boost/geometry/multi/io/wkt/read.hpp>
-
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/adapted/c_array.hpp>
diff --git a/libs/geometry/test/algorithms/envelope_on_spheroid.cpp b/libs/geometry/test/algorithms/envelope_on_spheroid.cpp
new file mode 100644
index 0000000000..182c0bffcc
--- /dev/null
+++ b/libs/geometry/test/algorithms/envelope_on_spheroid.cpp
@@ -0,0 +1,1506 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2015, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Menelaos Karavelas, 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_envelope_on_spheroid
+#endif
+
+#include <boost/test/included/unit_test.hpp>
+
+#include <cstddef>
+#include <limits>
+#include <iostream>
+#include <string>
+
+#include <geometry_test_common.hpp>
+#include <from_wkt.hpp>
+
+#include <boost/numeric/conversion/bounds.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/geometry/core/coordinate_dimension.hpp>
+#include <boost/geometry/core/tag.hpp>
+#include <boost/geometry/core/tags.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/util/condition.hpp>
+
+#include <boost/geometry/io/dsv/write.hpp>
+#include <boost/geometry/io/wkt/wkt.hpp>
+
+#include <boost/geometry/algorithms/convert.hpp>
+#include <boost/geometry/algorithms/envelope.hpp>
+#include <boost/geometry/algorithms/reverse.hpp>
+
+#include "test_envelope_expand_on_spheroid.hpp"
+
+
+template <typename MBR>
+class envelope_on_spheroid_basic_tester
+{
+private:
+ template
+ <
+ typename Geometry,
+ typename Tag = typename bg::tag<Geometry>::type
+ >
+ struct write_geometry
+ {
+ template <typename OutputStream>
+ static inline OutputStream& apply(OutputStream& os,
+ Geometry const& geometry)
+ {
+ os << bg::wkt(geometry);
+ return os;
+ }
+ };
+
+ template <typename Segment>
+ struct write_geometry<Segment, bg::segment_tag>
+ {
+ template <typename OutputStream>
+ static inline OutputStream& apply(OutputStream& os,
+ Segment const& segment)
+ {
+ os << "SEGMENT" << bg::dsv(segment);
+ return os;
+ }
+ };
+
+ template <typename Box>
+ struct write_geometry<Box, bg::box_tag>
+ {
+ template <typename OutputStream>
+ static inline OutputStream& apply(OutputStream& os,
+ Box const& box)
+ {
+ os << "BOX" << bg::dsv(box);
+ return os;
+ }
+ };
+
+ template <typename Geometry, typename Box>
+ static inline void check_message(bool same_boxes,
+ std::string const& case_id,
+ std::string const& units_str,
+ Geometry const& geometry,
+ Box const& expected,
+ Box const& detected)
+ {
+ std::ostringstream stream;
+ stream << "case ID: " << case_id << ", "
+ << "MBR units: " << units_str << "; "
+ << "geometry: ";
+
+ write_geometry<Geometry>::apply(stream, geometry);
+
+ stream << "; " << "expected: " << bg::dsv(expected)
+ << ", " << "detected: " << bg::dsv(detected);
+
+ BOOST_CHECK_MESSAGE(same_boxes, stream.str());
+ }
+
+ template <typename Box, typename Geometry>
+ static inline void base_test(std::string const& case_id,
+ Geometry const& geometry,
+ double lon_min, double lat_min, double height_min,
+ double lon_max, double lat_max, double height_max,
+ double tolerance)
+ {
+ typedef typename bg::coordinate_system<Box>::type::units box_units_type;
+
+ std::string const units_str = units2string<box_units_type>();
+
+ Box detected;
+ bg::envelope(geometry, detected);
+
+ Box expected;
+ initialize_box<Box>::apply(expected,
+ lon_min, lat_min, height_min,
+ lon_max, lat_max, height_max);
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "geometry: ";
+ write_geometry<Geometry>::apply(std::cout, geometry);
+
+ std::cout << std::endl
+ << "MBR units: " << units_str
+ << std::endl
+ << "expected: " << bg::dsv(expected)
+ << std::endl
+ << "detected: " << bg::dsv(detected)
+ << std::endl << std::endl;
+#endif
+
+ check_message(box_equals<Box>::apply(detected, expected, tolerance),
+ case_id, units_str,
+ geometry, expected, detected);
+ }
+
+public:
+ template <typename Geometry>
+ static inline void apply(std::string const& case_id,
+ Geometry const& geometry,
+ double lon_min, double lat_min, double height_min,
+ double lon_max, double lat_max, double height_max,
+ double tolerance)
+ {
+ typedef other_system_info
+ <
+ typename bg::coordinate_system<MBR>::type
+ > other;
+
+ typedef bg::model::box
+ <
+ bg::model::point
+ <
+ typename bg::coordinate_type<MBR>::type,
+ bg::dimension<MBR>::value,
+ typename other::type
+ >
+ > other_mbr_type;
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl;
+ std::cout << "case ID: " << case_id << std::endl << std::endl;
+#endif
+
+ base_test<MBR>(case_id, geometry,
+ lon_min, lat_min, height_min,
+ lon_max, lat_max, height_max,
+ tolerance);
+
+ if (lon_max < lon_min)
+ {
+ // we are in the case were a special MBR is returned;
+ // makes no sense to change units
+ base_test<other_mbr_type>(case_id, geometry,
+ lon_min, lat_min, height_min,
+ lon_max, lat_max, height_max,
+ tolerance);
+ }
+ else
+ {
+ base_test<other_mbr_type>(case_id, geometry,
+ other::convert(lon_min),
+ other::convert(lat_min),
+ height_min,
+ other::convert(lon_max),
+ other::convert(lat_max),
+ height_max,
+ tolerance);
+ }
+ }
+};
+
+
+// test the reverse of a geometry if it is either linear or ring
+template <typename Geometry, typename Tag = typename bg::tag<Geometry>::type>
+struct test_reverse_geometry
+{
+ static bool const is_linear =
+ boost::is_same<Tag, bg::segment_tag>::value
+ || boost::is_same<Tag, bg::linestring_tag>::value
+ || boost::is_same<Tag, bg::multi_linestring_tag>::value;
+
+ // currently disable rings
+ static bool const is_ring = false;
+ // static bool const is_ring = boost::is_same<Tag, bg::ring_tag>::value;
+
+ typedef typename boost::mpl::if_c
+ <
+ is_linear || is_ring,
+ boost::true_type,
+ boost::false_type
+ >::type type;
+
+ static bool const value = type::value;
+};
+
+template
+<
+ typename Geometry,
+ typename MBR,
+ typename Tag = typename bg::tag<Geometry>::type,
+ bool TestReverse = test_reverse_geometry<Geometry>::value
+>
+struct test_envelope_on_spheroid
+{
+ static inline void apply(std::string const& case_id,
+ Geometry const& geometry,
+ double lon_min1, double lat_min1, double height_min1,
+ double lon_max1, double lat_max1, double height_max1,
+ double lon_min2, double lat_min2, double height_min2,
+ double lon_max2, double lat_max2, double height_max2,
+ double tolerance = std::numeric_limits<double>::epsilon())
+ {
+ envelope_on_spheroid_basic_tester
+ <
+ MBR
+ >::apply(case_id, geometry,
+ lon_min1, lat_min1, height_min1,
+ lon_max1, lat_max1, height_max1,
+ tolerance);
+
+ if (BOOST_GEOMETRY_CONDITION(TestReverse))
+ {
+ std::string reversed_case_id = case_id + "-reverse";
+
+ Geometry reversed_geometry = geometry;
+ bg::reverse(reversed_geometry);
+ envelope_on_spheroid_basic_tester
+ <
+ MBR
+ >::apply(reversed_case_id, reversed_geometry,
+ lon_min2, lat_min2, height_min2,
+ lon_max2, lat_max2, height_max2,
+ tolerance);
+ }
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "=================="
+ << std::endl << std::endl;
+#endif
+ }
+
+ static inline void apply(std::string const& case_id,
+ Geometry const& geometry,
+ double lon_min1, double lat_min1,
+ double lon_max1, double lat_max1,
+ double lon_min2, double lat_min2,
+ double lon_max2, double lat_max2,
+ double tolerance = std::numeric_limits<double>::epsilon())
+ {
+ apply(case_id, geometry,
+ lon_min1, lat_min1, 0, lon_max1, lat_max1, 0,
+ lon_min2, lat_min2, 0, lon_max2, lat_max2, 0,
+ tolerance);
+ }
+
+ static inline void apply(std::string const& case_id,
+ Geometry const& geometry,
+ double lon_min, double lat_min, double height_min,
+ double lon_max, double lat_max, double height_max,
+ double tolerance = std::numeric_limits<double>::epsilon())
+ {
+ apply(case_id, geometry,
+ lon_min, lat_min, height_min,
+ lon_max, lat_max, height_max,
+ lon_min, lat_min, height_min,
+ lon_max, lat_max, height_max,
+ tolerance);
+ }
+
+ static inline void apply(std::string const& case_id,
+ Geometry const& geometry,
+ double lon_min, double lat_min,
+ double lon_max, double lat_max,
+ double tolerance = std::numeric_limits<double>::epsilon())
+ {
+ apply(case_id, geometry,
+ lon_min, lat_min, 0, lon_max, lat_max, 0,
+ tolerance);
+ }
+};
+
+
+// special tester for rings
+template <typename Geometry, typename MBR, bool TestReverse>
+struct test_envelope_on_spheroid<Geometry, MBR, bg::ring_tag, TestReverse>
+{
+ static inline void apply(std::string const& case_id,
+ Geometry const& geometry,
+ double lon_min1, double lat_min1,
+ double lon_max1, double lat_max1,
+ double lon_min2, double lat_min2,
+ double lon_max2, double lat_max2,
+ double tolerance = std::numeric_limits<double>::epsilon())
+ {
+ envelope_on_spheroid_basic_tester
+ <
+ MBR
+ >::apply(case_id, geometry,
+ lon_min1, lat_min1, lon_max1, lat_max1,
+ tolerance);
+
+ std::string ccw_case_id = case_id + "-2ccw";
+
+ bg::model::ring
+ <
+ typename bg::point_type<Geometry>::type, false
+ > ccw_ring;
+ bg::convert(geometry, ccw_ring);
+
+ envelope_on_spheroid_basic_tester
+ <
+ MBR
+ >::apply(ccw_case_id, ccw_ring,
+ lon_min2, lat_min2, lon_max2, lat_max2,
+ tolerance);
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "=================="
+ << std::endl << std::endl;
+#endif
+ }
+
+ static inline void apply(std::string const& case_id,
+ Geometry const& geometry,
+ double lon_min, double lat_min,
+ double lon_max, double lat_max,
+ double tolerance = std::numeric_limits<double>::epsilon())
+ {
+ apply(case_id, geometry,
+ lon_min, lat_min, lon_max, lat_max,
+ lon_min, lat_min, lon_max, lat_max,
+ tolerance);
+ }
+};
+
+
+template <typename CoordinateSystem, typename Geometry>
+void test_empty_geometry(std::string const& case_id, std::string const& wkt)
+{
+ std::size_t const dim = bg::dimension<Geometry>::value;
+
+ typedef bg::model::point<double, dim, CoordinateSystem> point_type;
+ typedef bg::model::box<point_type> B;
+ typedef test_envelope_on_spheroid<Geometry, B> tester;
+
+ typedef typename bg::coordinate_type<Geometry>::type ct;
+ ct high_val = boost::numeric::bounds<ct>::highest();
+ ct low_val = boost::numeric::bounds<ct>::lowest();
+
+ if (BOOST_GEOMETRY_CONDITION(dim == 2))
+ {
+ tester::apply(case_id,
+ from_wkt<Geometry>(wkt),
+ high_val, high_val, low_val, low_val);
+ }
+ else
+ {
+ tester::apply(case_id,
+ from_wkt<Geometry>(wkt),
+ high_val, high_val, high_val, low_val, low_val, low_val);
+ }
+}
+
+
+template <typename CoordinateSystem>
+void test_envelope_point()
+{
+ typedef bg::model::point<double, 2, CoordinateSystem> point_type;
+ typedef point_type G;
+ typedef bg::model::box<point_type> B;
+ typedef test_envelope_on_spheroid<G, B> tester;
+
+ tester::apply("p01",
+ from_wkt<G>("POINT(10 10)"),
+ 10, 10, 10, 10);
+
+ tester::apply("p02",
+ from_wkt<G>("POINT(370 10)"),
+ 10, 10, 10, 10);
+
+#ifdef BOOST_GEOMETRY_NORMALIZE_LATITUDE
+ tester::apply("p03",
+ from_wkt<G>("POINT(370 -350)"),
+ 10, 10, 10, 10);
+#endif
+
+ // north and south poles
+ tester::apply("p04",
+ from_wkt<G>("POINT(0 90)"),
+ 0, 90, 0, 90);
+
+ tester::apply("p04a",
+ from_wkt<G>("POINT(10 90)"),
+ 0, 90, 0, 90);
+
+ tester::apply("p04b",
+ from_wkt<G>("POINT(270 90)"),
+ 0, 90, 0, 90);
+
+#ifdef BOOST_GEOMETRY_NORMALIZE_LATITUDE
+ tester::apply("p04c",
+ from_wkt<G>("POINT(270 450)"),
+ 0, 90, 0, 90);
+#endif
+
+ tester::apply("p04d",
+ from_wkt<G>("POINT(190 90)"),
+ 0, 90, 0, 90);
+
+ tester::apply("p04e",
+ from_wkt<G>("POINT(-100 90)"),
+ 0, 90, 0, 90);
+
+ tester::apply("p05",
+ from_wkt<G>("POINT(0 -90)"),
+ 0, -90, 0, -90);
+
+ tester::apply("p05a",
+ from_wkt<G>("POINT(10 -90)"),
+ 0, -90, 0, -90);
+
+ tester::apply("p05b",
+ from_wkt<G>("POINT(270 -90)"),
+ 0, -90, 0, -90);
+
+#ifdef BOOST_GEOMETRY_NORMALIZE_LATITUDE
+ tester::apply("p05c",
+ from_wkt<G>("POINT(270 -450)"),
+ 0, -90, 0, -90);
+#endif
+
+ tester::apply("p05d",
+ from_wkt<G>("POINT(190 -90)"),
+ 0, -90, 0, -90);
+
+ tester::apply("p05e",
+ from_wkt<G>("POINT(-100 -90)"),
+ 0, -90, 0, -90);
+
+ tester::apply("p05f",
+ from_wkt<G>("POINT(-100 -90)"),
+ 0, -90, 0, -90);
+}
+
+BOOST_AUTO_TEST_CASE( envelope_point )
+{
+ test_envelope_point<bg::cs::spherical_equatorial<bg::degree> >();
+ test_envelope_point<bg::cs::geographic<bg::degree> >();
+}
+
+
+template <typename CoordinateSystem>
+void test_envelope_point_with_height()
+{
+ typedef bg::model::point<double, 3, CoordinateSystem> point_type;
+ typedef point_type G;
+ typedef bg::model::box<point_type> B;
+ typedef test_envelope_on_spheroid<G, B> tester;
+
+ tester::apply("ph01",
+ from_wkt<G>("POINT(10 10 1256)"),
+ 10, 10, 1256, 10, 10, 1256);
+}
+
+BOOST_AUTO_TEST_CASE( envelope_point_with_height )
+{
+ test_envelope_point_with_height
+ <
+ bg::cs::spherical_equatorial<bg::degree>
+ >();
+ test_envelope_point_with_height<bg::cs::geographic<bg::degree> >();
+}
+
+
+BOOST_AUTO_TEST_CASE( envelope_segment )
+{
+ typedef bg::cs::spherical_equatorial<bg::degree> coordinate_system_type;
+ typedef bg::model::point<double, 2, coordinate_system_type> point_type;
+ typedef bg::model::segment<point_type> G;
+ typedef bg::model::box<point_type> B;
+ typedef test_envelope_on_spheroid<G, B> tester;
+
+ tester::apply("s01",
+ from_wkt<G>("SEGMENT(10 10,40 40)"),
+ 10, 10, 40, 40);
+
+ tester::apply("s02",
+ from_wkt<G>("SEGMENT(10 10,40 10)"),
+ 10, 10, 40, 10.34527004614999);
+
+ tester::apply("s02a",
+ from_wkt<G>("SEGMENT(40 10,10 10)"),
+ 10, 10, 40, 10.34527004614999);
+
+ tester::apply("s03",
+ from_wkt<G>("SEGMENT(160 10,-170 10)"),
+ 160, 10, 190, 10.34527004614999);
+
+ tester::apply("s03a",
+ from_wkt<G>("SEGMENT(-170 10,160 10)"),
+ 160, 10, 190, 10.34527004614999);
+
+ tester::apply("s03b",
+ from_wkt<G>("SEGMENT(-170 -10,160 -10)"),
+ 160, -10.34527004614999, 190, -10);
+
+ tester::apply("s04",
+ from_wkt<G>("SEGMENT(-40 45,140 60)"),
+ -40, 45, 140, 90);
+
+ tester::apply("s04a",
+ from_wkt<G>("SEGMENT(-40 45,140 25)"),
+ -40, 25, 140, 90);
+
+ // segment ending at the north pole
+ tester::apply("s05",
+ from_wkt<G>("SEGMENT(40 45,80 90)"),
+ 40, 45, 40, 90);
+
+ // segment starting at the north pole
+ tester::apply("s05a",
+ from_wkt<G>("SEGMENT(80 90,40 45)"),
+ 40, 45, 40, 90);
+
+ // segment ending at the north pole
+ tester::apply("s06",
+ from_wkt<G>("SEGMENT(-40 45,80 90)"),
+ -40, 45, -40, 90);
+
+ // segment starting at the north pole
+ tester::apply("s06a",
+ from_wkt<G>("SEGMENT(70 90,-40 45)"),
+ -40, 45, -40, 90);
+
+ // segment ending at the north pole
+ tester::apply("s07",
+ from_wkt<G>("SEGMENT(40 -45,80 90)"),
+ 40, -45, 40, 90);
+
+ // segment passing through the south pole
+ tester::apply("s08",
+ from_wkt<G>("SEGMENT(-170 -45,10 -30)"),
+ -170, -90, 10, -30);
+
+ tester::apply("s09",
+ from_wkt<G>("SEGMENT(1 -45,179 30)"),
+ 1, -85.28884376852972, 179, 30);
+
+ tester::apply("s09a",
+ from_wkt<G>("SEGMENT(2 -45,181 30)"),
+ 2, -87.63659983704828, 181, 30);
+
+ // very long segment
+ tester::apply("s10",
+ from_wkt<G>("SEGMENT(0 -45,181 30)"),
+ -179, -88.07047433509489, 0, 30,
+ 2.0 * std::numeric_limits<double>::epsilon());
+
+ tester::apply("s11",
+ from_wkt<G>("SEGMENT(260 30,20 45)"),
+ -100, 30, 20, 57.93195594009233);
+
+ tester::apply("s11a",
+ from_wkt<G>("SEGMENT(260 45,20 30)"),
+ -100, 30, 20, 49.43962741846035);
+
+ // segment degenerating to the north pole
+ tester::apply("s12",
+ from_wkt<G>("SEGMENT(10 90,20 90)"),
+ 0, 90, 0, 90);
+
+ // segment degenerating to the south pole
+ tester::apply("s13",
+ from_wkt<G>("SEGMENT(10 -90,20 -90)"),
+ 0, -90, 0, -90);
+
+ tester::apply("s14",
+ from_wkt<G>("SEGMENT(20 20,10 30)"),
+ 10, 20, 20, 30);//48.87458730907602);
+
+ tester::apply("s15",
+ from_wkt<G>("SEGMENT(50 45,185 45)"),
+ 50, 45, 185, 69.05897952775615);
+
+ // segment that lies on the equator
+ tester::apply("s16",
+ from_wkt<G>("SEGMENT(0 0,50 0)"),
+ 0, 0, 50, 0);
+
+ // segment that lies on the equator
+ tester::apply("s16a",
+ from_wkt<G>("SEGMENT(-50 0,50 0)"),
+ -50, 0, 50, 0);
+
+ // segment that lies on the equator and touches antimeridian
+ tester::apply("s16b",
+ from_wkt<G>("SEGMENT(50 0,180 0)"),
+ 50, 0, 180, 0);
+
+ // segment that lies on the equator and crosses antimeridian
+ tester::apply("s16c",
+ from_wkt<G>("SEGMENT(-170 0,160 0)"),
+ 160, 0, 190, 0);
+
+ tester::apply("s17",
+ from_wkt<G>("SEGMENT(140 10, -140 80)"),
+ 140, 10, 220, 80);
+
+ tester::apply("s17-r",
+ from_wkt<G>("SEGMENT(-140 80, 140 10)"),
+ 140, 10, 220, 80);
+
+ tester::apply("s18",
+ from_wkt<G>("SEGMENT(20 10, 100 80)"),
+ 20, 10, 100, 80);
+
+ tester::apply("s18-r",
+ from_wkt<G>("SEGMENT(100 80, 20 10)"),
+ 20, 10, 100, 80);
+
+ // segment connecting the north and south pole
+ //
+ // this should be forbidden actually, as it is not well-defined
+ // with this test we demonstrate that the algorithm still returns
+ // something meaningful
+ tester::apply("s99",
+ from_wkt<G>("SEGMENT(10 90,20 -90)"),
+ 0, -90, 0, 90);
+}
+
+
+BOOST_AUTO_TEST_CASE( envelope_segment_with_height )
+{
+ typedef bg::cs::spherical_equatorial<bg::degree> coordinate_system_type;
+ typedef bg::model::point<double, 3, coordinate_system_type> point_type;
+ typedef bg::model::segment<point_type> G;
+ typedef bg::model::box<point_type> B;
+ typedef test_envelope_on_spheroid<G, B> tester;
+
+ tester::apply("sh01",
+ from_wkt<G>("SEGMENT(10 10 567,40 40 1356)"),
+ 10, 10, 567, 40, 40, 1356);
+
+ tester::apply("sh02",
+ from_wkt<G>("SEGMENT(10 10 1356,40 40 567)"),
+ 10, 10, 567, 40, 40, 1356);
+}
+
+
+template <typename CoordinateSystem>
+void test_envelope_multipoint()
+{
+ typedef bg::model::point<double, 2, CoordinateSystem> point_type;
+ typedef bg::model::multi_point<point_type> G;
+ typedef bg::model::box<point_type> B;
+ typedef test_envelope_on_spheroid<G, B> tester;
+
+ // empty multipoint
+ test_empty_geometry<CoordinateSystem, G>("mp00", "MULTIPOINT()");
+
+ tester::apply("mp01",
+ from_wkt<G>("MULTIPOINT(0 0,10 10)"),
+ 0, 0, 10, 10);
+
+ tester::apply("mp02",
+ from_wkt<G>("MULTIPOINT(0 10,10 0)"),
+ 0, 0, 10, 10);
+
+ tester::apply("mp03",
+ from_wkt<G>("MULTIPOINT(-10 20,0 10,10 0)"),
+ -10, 0, 10, 20);
+
+ tester::apply("mp04",
+ from_wkt<G>("MULTIPOINT(-10 20,0 10,10 -15)"),
+ -10, -15, 10, 20);
+
+ tester::apply("mp05",
+ from_wkt<G>("MULTIPOINT(-85 10,85 -20)"),
+ -85, -20, 85, 10);
+
+ tester::apply("mp06",
+ from_wkt<G>("MULTIPOINT(-95 10,85 -20)"),
+ -95, -20, 85, 10);
+
+ tester::apply("mp07",
+ from_wkt<G>("MULTIPOINT(-96 10,85 -20)"),
+ 85, -20, -96+360, 10);
+
+ tester::apply("mp08",
+ from_wkt<G>("MULTIPOINT(175 15,-175 -20)"),
+ 175, -20, -175+360, 15);
+
+ tester::apply("mp09",
+ from_wkt<G>("MULTIPOINT(170 15,170 20,-175 10,-90 10,10 10)"),
+ 170, 10, 10+360, 20);
+
+ // this should fail
+ tester::apply("mp09a",
+ from_wkt<G>("MULTIPOINT(10 10,170 15,170 20,-175 10,-90 10)"),
+ 170, 10, 10+360, 20);
+
+
+ tester::apply("mp10",
+ from_wkt<G>("MULTIPOINT(10 10,20 90,30 -90)"),
+ 10, -90, 10, 90);
+
+ // this should fail
+ tester::apply("mp11",
+ from_wkt<G>("MULTIPOINT(179 90,-179 -90,10 10)"),
+ 10, -90, 10, 90);
+
+ tester::apply("mp11a",
+ from_wkt<G>("MULTIPOINT(10 10,179 90,-179 -90)"),
+ 10, -90, 10, 90);
+
+ // this should fail
+ tester::apply("mp11b",
+ from_wkt<G>("MULTIPOINT(179 90,-179 -90,-90 0)"),
+ -90, -90, -90, 90);
+
+ tester::apply("mp11c",
+ from_wkt<G>("MULTIPOINT(-90 0,179 90,-179 -90,-90 0)"),
+ -90, -90, -90, 90);
+
+ tester::apply("mp12",
+ from_wkt<G>("MULTIPOINT(170 -30,175 60,-178 10)"),
+ 170, -30, -178+360, 60);
+
+ tester::apply("mp13",
+ from_wkt<G>("MULTIPOINT(-170 -30,-175 40,178 50)"),
+ 178, -30, -170+360, 50);
+
+ tester::apply("mp13a",
+ from_wkt<G>("MULTIPOINT(-170 -30,178 50)"),
+ 178, -30, -170+360, 50);
+
+ tester::apply("mp13b",
+ from_wkt<G>("MULTIPOINT(-170 -30,178 50,-175 40)"),
+ 178, -30, -170+360, 50);
+
+ tester::apply("mp15",
+ from_wkt<G>("MULTIPOINT(10 -20)"),
+ 10, -20, 10, -20);
+
+ tester::apply("mp16",
+ from_wkt<G>("MULTIPOINT(0 90,10 90)"),
+ 0, 90, 0, 90);
+
+ tester::apply("mp17",
+ from_wkt<G>("MULTIPOINT(179 80,-179 -80,10 10)"),
+ 10, -80, -179+360, 80);
+
+ tester::apply("mp17a",
+ from_wkt<G>("MULTIPOINT(10 10,179 80,-179 -80)"),
+ 10, -80, -179+360, 80);
+
+ tester::apply("mp17b",
+ from_wkt<G>("MULTIPOINT(179 80,-179 -80,-90 0)"),
+ 179, -80, -90+360, 80);
+
+ tester::apply("mp17c",
+ from_wkt<G>("MULTIPOINT(-90 0,179 80,-179 -80,-90 0)"),
+ 179, -80, -90+360, 80);
+
+ tester::apply("mp18",
+ from_wkt<G>("MULTIPOINT(-170 45,20 25,40 40)"),
+ 20, 25, 190, 45);
+
+#ifdef BOOST_GEOMETRY_NORMALIZE_LATITUDE
+ tester::apply("mp18a",
+ from_wkt<G>("MULTIPOINT(10 135,20 25,40 40)"),
+ 20, 25, 190, 45);
+#endif
+
+ tester::apply("mp19",
+ from_wkt<G>("MULTIPOINT(350 45,20 25,40 40)"),
+ -10, 25, 40, 45);
+
+#ifdef BOOST_GEOMETRY_NORMALIZE_LATITUDE
+ tester::apply("mp19a",
+ from_wkt<G>("MULTIPOINT(170 135,20 25,40 40)"),
+ -10, 25, 40, 45);
+#endif
+}
+
+BOOST_AUTO_TEST_CASE( envelope_multipoint )
+{
+ test_envelope_multipoint<bg::cs::spherical_equatorial<bg::degree> >();
+ test_envelope_multipoint<bg::cs::geographic<bg::degree> >();
+}
+
+
+template <typename CoordinateSystem>
+void test_envelope_multipoint_with_height()
+{
+ typedef bg::model::point<double, 3, CoordinateSystem> point_type;
+ typedef bg::model::multi_point<point_type> G;
+ typedef bg::model::box<point_type> B;
+ typedef test_envelope_on_spheroid<G, B> tester;
+
+ // empty multipoint
+ test_empty_geometry<CoordinateSystem, G>("mph00", "MULTIPOINT()");
+
+ tester::apply("mph01",
+ from_wkt<G>("MULTIPOINT(0 0 567,10 10 1456)"),
+ 0, 0, 567, 10, 10, 1456);
+
+ tester::apply("mph02",
+ from_wkt<G>("MULTIPOINT(0 0 567,10 10 1456,20 90 967)"),
+ 0, 0, 567, 10, 90, 1456);
+}
+
+BOOST_AUTO_TEST_CASE( envelope_multipoint_with_height )
+{
+ test_envelope_multipoint_with_height
+ <
+ bg::cs::spherical_equatorial<bg::degree>
+ >();
+ test_envelope_multipoint_with_height<bg::cs::geographic<bg::degree> >();
+}
+
+
+template <typename CoordinateSystem>
+void test_envelope_box()
+{
+ typedef bg::cs::spherical_equatorial<bg::degree> coordinate_system_type;
+ typedef bg::model::point<double, 2, coordinate_system_type> point_type;
+ typedef bg::model::box<point_type> G;
+ typedef bg::model::box<point_type> B;
+ typedef test_envelope_on_spheroid<G, B> tester;
+
+ tester::apply("b01",
+ from_wkt<G>("BOX(10 10,20 20)"),
+ 10, 10, 20, 20);
+
+#ifdef BOOST_GEOMETRY_NORMALIZE_LATITUDE
+ tester::apply("b02",
+ from_wkt<G>("BOX(10 370,20 20)"),
+ 10, 10, 20, 20);
+#endif
+
+ // box crosses anti-meridian
+ tester::apply("b02a",
+ from_wkt<G>("BOX(170 10,-170 20)"),
+ 170, 10, 190, 20);
+
+ tester::apply("b03",
+ from_wkt<G>("BOX(-170 10,170 20)"),
+ -170, 10, 170, 20);
+
+ tester::apply("b04",
+ from_wkt<G>("BOX(10 10,350 20)"),
+ 10, 10, 350, 20);
+
+ tester::apply("b04a",
+ from_wkt<G>("BOX(10 10,-10 20)"),
+ 10, 10, 350, 20);
+
+ // box is a band
+ tester::apply("b05",
+ from_wkt<G>("BOX(0 10,360 20)"),
+ -180, 10, 180, 20);
+
+ tester::apply("b05a",
+ from_wkt<G>("BOX(0 10,0 20)"),
+ 0, 10, 0, 20);
+
+ // box is almost a band
+ tester::apply("b06",
+ from_wkt<G>("BOX(10 10,5 20)"),
+ 10, 10, 365, 20);
+
+ // initial box is a band that crosses itself
+ tester::apply("b07",
+ from_wkt<G>("BOX(0 10,540 20)"),
+ -180, 10, 180, 20);
+
+ // initial box is a band that crosses itself
+ tester::apply("b08",
+ from_wkt<G>("BOX(0 10,720 20)"),
+ -180, 10, 180, 20);
+
+ tester::apply("b09",
+ from_wkt<G>("BOX(10 10,10 10)"),
+ 10, 10, 10, 10);
+
+ tester::apply("b09a",
+ from_wkt<G>("BOX(370 10,370 10)"),
+ 10, 10, 10, 10);
+
+ // box contains north and south pole
+ tester::apply("b10",
+ from_wkt<G>("BOX(0 -90,0 90)"),
+ 0, -90, 0, 90);
+
+ // box contains north and south pole
+ tester::apply("b10a",
+ from_wkt<G>("BOX(10 -90,10 90)"),
+ 10, -90, 10, 90);
+
+ // box contains north and south pole
+ tester::apply("b10b",
+ from_wkt<G>("BOX(0 -90,10 90)"),
+ 0, -90, 10, 90);
+
+ // box contains north and south pole
+ tester::apply("b11",
+ from_wkt<G>("BOX(0 -90,180 90)"),
+ 0, -90, 180, 90);
+
+ // box contains north and south pole
+ tester::apply("b11a",
+ from_wkt<G>("BOX(10 -90,190 90)"),
+ 10, -90, 190, 90);
+
+ // box contains north and south pole
+ tester::apply("b11b",
+ from_wkt<G>("BOX(10 -90,110 90)"),
+ 10, -90, 110, 90);
+
+ // box contains north and south pole and is a band
+ // (box covers the entire spheroid)
+ tester::apply("b12",
+ from_wkt<G>("BOX(0 -90,360 90)"),
+ -180, -90, 180, 90);
+
+ // box contains north and south pole and is a band
+ // (box covers the entire spheroid)
+ tester::apply("b12a",
+ from_wkt<G>("BOX(10 -90,370 90)"),
+ -180, -90, 180, 90);
+
+ // box contains north and south pole and is a band
+ // (box covers the entire spheroid)
+ tester::apply("b12b",
+ from_wkt<G>("BOX(-175 -90,185 90)"),
+ -180, -90, 180, 90);
+
+ // box contains north and south pole and is a band
+ // (box covers the entire spheroid)
+ tester::apply("b12c",
+ from_wkt<G>("BOX(-175 -90,185 90)"),
+ -180, -90, 180, 90);
+
+ // box contains north and south pole and is a band and is self-intersecting
+ // (box covers the entire spheroid)
+ tester::apply("b12d",
+ from_wkt<G>("BOX(-175 -90,186 90)"),
+ -180, -90, 180, 90);
+
+ // box contains north and south pole and is a band and is self-intersecting
+ // (box covers the entire spheroid)
+ tester::apply("b12e",
+ from_wkt<G>("BOX(0 -90,540 90)"),
+ -180, -90, 180, 90);
+
+ // box contains north and south pole and is a band and is self-intersecting
+ // (box covers the entire spheroid)
+ tester::apply("b12f",
+ from_wkt<G>("BOX(10 -90,540 90)"),
+ -180, -90, 180, 90);
+
+ // box is a band
+ tester::apply("b13",
+ from_wkt<G>("BOX(180 -10,-180 10)"),
+ -180, -10, 180, 10);
+
+ // box contains north and south pole and is a band
+ // (box covers the entire spheroid)
+ tester::apply("b13a",
+ from_wkt<G>("BOX(180 -90,-180 90)"),
+ -180, -90, 180, 90);
+
+ tester::apply("b14",
+ from_wkt<G>("BOX(0 10,30 90)"),
+ 0, 10, 30, 90);
+
+ tester::apply("b15",
+ from_wkt<G>("BOX(179 10,178 70)"),
+ 179, 10, 538, 70);
+
+ // box contains north pole
+ tester::apply("b16",
+ from_wkt<G>("BOX(10 40,20 90)"),
+ 10, 40, 20, 90);
+
+ tester::apply("b16a",
+ from_wkt<G>("BOX(170 40,-170 90)"),
+ 170, 40, 190, 90);
+
+ // box contains south pole
+ tester::apply("b17",
+ from_wkt<G>("BOX(10 -90,20 40)"),
+ 10, -90, 20, 40);
+
+ tester::apply("b17a",
+ from_wkt<G>("BOX(150 -90,-150 40)"),
+ 150, -90, 210, 40);
+
+ // box degenerates to the north pole
+ tester::apply("b98",
+ from_wkt<G>("BOX(10 90,20 90)"),
+ 0, 90, 0, 90);
+
+ // box degenerates to the south pole
+ tester::apply("b99",
+ from_wkt<G>("BOX(10 -90,20 -90)"),
+ 0, -90, 0, -90);
+}
+
+BOOST_AUTO_TEST_CASE( envelope_box )
+{
+ test_envelope_box<bg::cs::spherical_equatorial<bg::degree> >();
+ test_envelope_box<bg::cs::geographic<bg::degree> >();
+}
+
+
+template <typename CoordinateSystem>
+void test_envelope_box_with_height()
+{
+ typedef bg::cs::spherical_equatorial<bg::degree> coordinate_system_type;
+ typedef bg::model::point<double, 3, coordinate_system_type> point_type;
+ typedef bg::model::box<point_type> G;
+ typedef bg::model::box<point_type> B;
+ typedef test_envelope_on_spheroid<G, B> tester;
+
+ tester::apply("bh01",
+ from_wkt<G>("BOX(10 10 567,20 20 2834)"),
+ 10, 10, 567, 20, 20, 2834);
+
+ tester::apply("bh02",
+ from_wkt<G>("BOX(10 10 567,20 20 567)"),
+ 10, 10, 567, 20, 20, 567);
+
+ tester::apply("bh03",
+ from_wkt<G>("BOX(0 10 567,170 90 1567)"),
+ 0, 10, 567, 170, 90, 1567);
+}
+
+BOOST_AUTO_TEST_CASE( envelope_box_with_height )
+{
+ test_envelope_box_with_height<bg::cs::spherical_equatorial<bg::degree> >();
+ test_envelope_box_with_height<bg::cs::geographic<bg::degree> >();
+}
+
+
+BOOST_AUTO_TEST_CASE( envelope_linestring )
+{
+ typedef bg::cs::spherical_equatorial<bg::degree> coordinate_system_type;
+ typedef bg::model::point<double, 2, coordinate_system_type> point_type;
+ typedef bg::model::linestring<point_type> G;
+ typedef bg::model::box<point_type> B;
+ typedef test_envelope_on_spheroid<G, B> tester;
+
+ // empty linestring
+ test_empty_geometry<coordinate_system_type, G>("l00", "LINESTRING()");
+
+ tester::apply("l01",
+ from_wkt<G>("LINESTRING(10 15)"),
+ 10, 15, 10, 15);
+
+ tester::apply("l01a",
+ from_wkt<G>("LINESTRING(370 15)"),
+ 10, 15, 10, 15);
+
+ tester::apply("l01b",
+ from_wkt<G>("LINESTRING(370 90)"),
+ 0, 90, 0, 90);
+
+ tester::apply("l02",
+ from_wkt<G>("LINESTRING(10 10,20 20,10 30)"),
+ 10, 10, 20, 30);
+
+ // linestring that circles the entire globe
+ tester::apply("l03",
+ from_wkt<G>("LINESTRING(-185 0,-170 25,-50 10,10 10,20 20,100 5,180 15)"),
+ -180, 0, 180, 25.15036418555258,
+ 4.0 * std::numeric_limits<double>::epsilon());
+
+ // linestring that crosses the antimeridian but staying close to it
+ tester::apply("l04",
+ from_wkt<G>("LINESTRING(-170 10,170 45,160 5,-160 25)"),
+ 160, 5, 200, 45);
+
+ // linestring that goes through the north pole (twice)
+ tester::apply("l05",
+ from_wkt<G>("LINESTRING(-170 80,10 60,20 80,-160 30)"),
+ -170, 30, 20, 90);
+
+ // linestring that goes through the north pole (three times)
+ tester::apply("l05a",
+ from_wkt<G>("LINESTRING(-170 80,10 60,20 80,-160 30,-150 30,30 70)"),
+ -170, 30, 30, 90);
+
+ // linestring that goes through the north pole (four times)
+ tester::apply("l05b",
+ from_wkt<G>("LINESTRING(-170 80,10 60,20 80,-160 30,-150 30,30 70,40 85,-140 25)"),
+ -170, 25, 40, 90);
+
+ // linestring that goes through the north pole (five times)
+ tester::apply("l05c",
+ from_wkt<G>("LINESTRING(-170 80,10 60,20 80,-160 30,-150 30,30 70,40 85,-140 25,-130 25,50 45)"),
+ -170, 25, 50, 90);
+
+ // linestring that goes through the north pole (five times)
+ tester::apply("l05d",
+ from_wkt<G>("LINESTRING(-170 80,10 60,20 80,-160 30,-150 30,30 70,40 85,-140 25,-130 25,50 45,185 45)"),
+ -170, 25, 185, 90);
+
+ // linestring that crosses the antimeridian
+ tester::apply("l06",
+ from_wkt<G>("LINESTRING(-160 85,-170 80,170 40,160 80)"),
+ 160, 40, 200, 85);
+
+ // linestring that crosses the antimeridian
+ tester::apply("l06a",
+ from_wkt<G>("LINESTRING(-130 85,-170 84,170 40,160 80)"),
+ 160, 40, 230, 85.02629680862029);
+
+ // linestring that goes through the north pole
+ tester::apply("l07",
+ from_wkt<G>("LINESTRING(-160 40,-170 90,-140 40,-50 30)"),
+ -160, 30, -50, 90);
+
+ // linestring that degenerates to the north pole
+ tester::apply("l08",
+ from_wkt<G>("LINESTRING(-40 90,-30 90,-140 90,10 90)"),
+ 0, 90, 0, 90);
+
+ // linestring with duplicate points
+ tester::apply("l09",
+ from_wkt<G>("LINESTRING(-40 20,-40 20,-140 85,-10 5,-10 5)"),
+ -140, 5, -10, 85);
+
+ // linestring with duplicate points
+ tester::apply("l09a",
+ from_wkt<G>("LINESTRING(-40 20,320 20,-140 85,-10 5,350 5)"),
+ -140, 5, -10, 85);
+
+ // linestring that lies on the equator
+ tester::apply("l10",
+ from_wkt<G>("LINESTRING(0 0,50 0)"),
+ 0, 0, 50, 0);
+
+ // linestring that lies on the equator
+ tester::apply("l10a",
+ from_wkt<G>("LINESTRING(-50 0,50 0)"),
+ -50, 0, 50, 0);
+
+ // linestring that lies on the equator and touches antimeridian
+ tester::apply("l10b",
+ from_wkt<G>("LINESTRING(50 0,180 0)"),
+ 50, 0, 180, 0);
+
+ // linestring that lies on the equator and crosses antimeridian
+ tester::apply("l10c",
+ from_wkt<G>("LINESTRING(-170 0,160 0)"),
+ 160, 0, 190, 0);
+}
+
+
+BOOST_AUTO_TEST_CASE( envelope_linestring_with_height )
+{
+ typedef bg::cs::spherical_equatorial<bg::degree> coordinate_system_type;
+ typedef bg::model::point<double, 3, coordinate_system_type> point_type;
+ typedef bg::model::linestring<point_type> G;
+ typedef bg::model::box<point_type> B;
+ typedef test_envelope_on_spheroid<G, B> tester;
+
+ // empty linestring
+ test_empty_geometry<coordinate_system_type, G>("lh00", "LINESTRING()");
+
+ tester::apply("lh01",
+ from_wkt<G>("LINESTRING(10 15 30,20 25 434,30 35 186)"),
+ 10, 15, 30, 30, 35, 434);
+}
+
+
+BOOST_AUTO_TEST_CASE( envelope_multilinestring )
+{
+ typedef bg::cs::spherical_equatorial<bg::degree> coordinate_system_type;
+ typedef bg::model::point<double, 2, coordinate_system_type> point_type;
+ typedef bg::model::multi_linestring<bg::model::linestring<point_type> > G;
+ typedef bg::model::box<point_type> B;
+ typedef test_envelope_on_spheroid<G, B> tester;
+
+ // empty multilinestring
+ test_empty_geometry<coordinate_system_type, G>("ml00", "MULTILINESTRING()");
+
+ // invalid multilinestring
+ test_empty_geometry<coordinate_system_type, G>("ml00a",
+ "MULTILINESTRING(())");
+
+ // invalid multilinestring
+ test_empty_geometry<coordinate_system_type, G>("ml00b",
+ "MULTILINESTRING((),())");
+
+ // invalid multilinestring
+ tester::apply("ml00c",
+ from_wkt<G>("MULTILINESTRING((10 15),(),())"),
+ 10, 15, 10, 15);
+
+ // invalid multilinestring
+ tester::apply("ml00d",
+ from_wkt<G>("MULTILINESTRING((),(10 15),())"),
+ 10, 15, 10, 15);
+
+ tester::apply("ml01",
+ from_wkt<G>("MULTILINESTRING((10 15))"),
+ 10, 15, 10, 15);
+
+#ifdef BOOST_GEOMETRY_INCLUDE_FAILING_TESTS
+ tester::apply("ml01a",
+ from_wkt<G>("MULTILINESTRING((),(),(10 15),())"),
+ 10, 15, 10, 15);
+#endif // BOOST_GEOMETRY_INCLUDE_FAILING_TESTS
+
+ tester::apply("ml02",
+ from_wkt<G>("MULTILINESTRING((-170 40,-100 80,10 40),(-10 25,10 35,100 45),(50 30,150 45,-160 30))"),
+ -180, 25, 180, 80);
+
+ tester::apply("ml03",
+ from_wkt<G>("MULTILINESTRING((-150 40,-100 80,10 40),(-10 25,10 35,100 45),(50 30,150 45,-160 30))"),
+ -150, 25, 200, 80);
+
+ tester::apply("ml04",
+ from_wkt<G>("MULTILINESTRING((-150 40,-100 80),(10 35,100 80))"),
+ -150, 35, 100, 80.07385383411011);
+
+ tester::apply("ml04a",
+ from_wkt<G>("MULTILINESTRING((-150 40,-100 80),(10 35,100 80),(170 25,-160 80))"),
+ 10, 25, 260, 80.07385383411011);
+
+ tester::apply("ml05",
+ from_wkt<G>("MULTILINESTRING((-140 40,-100 80),(10 35,100 80))"),
+ -140, 35, 100, 80.07385383411011);
+
+ tester::apply("ml05a",
+ from_wkt<G>("MULTILINESTRING((-140 40,-100 80),(10 35,100 80),(170 25,-160 80))"),
+ 10, 25, 260, 80.07385383411011);
+}
+
+
+BOOST_AUTO_TEST_CASE( envelope_multilinestring_with_height )
+{
+ typedef bg::cs::spherical_equatorial<bg::degree> coordinate_system_type;
+ typedef bg::model::point<double, 3, coordinate_system_type> point_type;
+ typedef bg::model::multi_linestring<bg::model::linestring<point_type> > G;
+ typedef bg::model::box<point_type> B;
+ typedef test_envelope_on_spheroid<G, B> tester;
+
+ tester::apply("mlh01",
+ from_wkt<G>("MULTILINESTRING((10 15 1000))"),
+ 10, 15, 1000, 10, 15, 1000);
+
+#ifdef BOOST_GEOMETRY_INCLUDE_FAILING_TESTS
+ tester::apply("mlh01a",
+ from_wkt<G>("MULTILINESTRING((),(),(10 15 1000),())"),
+ 10, 15, 1000, 10, 15, 1000);
+#endif // BOOST_GEOMETRY_INCLUDE_FAILING_TESTS
+
+ tester::apply("mlh02",
+ from_wkt<G>("MULTILINESTRING((-170 40 400,-100 80 300),(-10 25 600,10 35 700,120 45 450))"),
+ -10, 25, 300, 260, 80, 700);
+}
+
+
+#if 0
+// unit test for rings de-activated for now (current implementation
+// for area on the spherical equatorial coordinate system is not complete)
+// TODO: re-activate once implementation is done
+BOOST_AUTO_TEST_CASE( envelope_cw_ring )
+{
+ typedef deg_cw_ring_type G;
+ typedef test_envelope_on_spheroid<G, deg_box_type> tester;
+
+ double const eps = std::numeric_limits<double>::epsilon();
+
+ tester::apply("r01cw",
+ from_wkt<G>("POLYGON((0 10,0 45,50 10,0 10))"),
+ 0, 10, 50, 45);
+
+ // ring that contains both the north and south poles in its interior
+ tester::apply("r01cw-r",
+ from_wkt<G>("POLYGON((0 10,50 10,0 45,0 10))"),
+ -180, -90, 180, 90);
+
+ // ring that contains the north pole in its interior
+ tester::apply("r02cw",
+ from_wkt<G>("POLYGON((0 0,-50 0,-170 0,180 0,100 0,0 0))"),
+ -180, 0, 180, 90);
+ // -180, -90, 180, 0);
+
+ // ring that contains the south pole in its interior
+ tester::apply("r02cw-r",
+ from_wkt<G>("POLYGON((0 0,100 0,180 0,-170 0,-50 0,0 0))"),
+ -180, -90, 180, 0);
+ // -180, 0, 180, 90);
+
+ // ring that contains the north pole in its interior
+ tester::apply("r03cw",
+ from_wkt<G>("POLYGON((0 -10,-50 -10,-170 -10,180 -10,100 -10,0 -10))"),
+ -180, -19.42540014068282, 180, 90);
+ // -180, -90, 180, -10);
+
+ // ring that contains both the south and north poles in its interior
+ tester::apply("r03cw-r",
+ from_wkt<G>("POLYGON((0 -10,100 -10,180 -10,-170 -10,-50 -10,0 -10))"),
+ -180, -90, 180, -10);
+ // -180, -19.42540014068282, 180, 90);
+
+ // ring that has the north pole as vertex and contains the south pole
+ tester::apply("r04cw",
+ from_wkt<G>("POLYGON((0 0,-50 90,-50 0,0 0))"),
+ -180, -90, 180, 90);
+
+ // ring that has the north pole as vertex
+ tester::apply("r04cw-r",
+ from_wkt<G>("POLYGON((0 0,-50 0,-50 90,0 0))"),
+ -50, 0, 0, 90);
+
+ // ring that crosses antimeridian but does not contain any pole
+ tester::apply("r05cw",
+ from_wkt<G>("POLYGON((-140 0,140 10,-140 80,-140 0))"),
+ 140, 0, 220, 80);
+
+ // ring that crosses antimeridian multiple times but does not
+ // contain any pole
+ tester::apply("r06cw",
+ from_wkt<G>("POLYGON((-140 10,140 10,140 80,-140 80,-140 10))"),
+ 140, 10, 220, 82.30737118075496,
+ 2 * eps);
+
+ // ring that crosses antimeridian multiple times but does not
+ // contain any pole
+ tester::apply("r07cw",
+ from_wkt<G>("POLYGON((-140 10,140 10,180 80,-140 10))"),
+ 140, 10, 220, 80);
+
+ // ring that goes through the north pole
+ tester::apply("r08cw",
+ from_wkt<G>("POLYGON((0 0,-50 0,-50 90,0 0))"),
+ -50, 0, 0, 90);
+
+ // ring that goes through the south pole and contains the north pole
+ tester::apply("r09cw",
+ from_wkt<G>("POLYGON((0 0,0 -90,50 0,0 0))"),
+ -180, -90, 180, 90);
+
+ // ring that goes through the south pole
+ tester::apply("r09cw-r",
+ from_wkt<G>("POLYGON((0 0,50 0,50 -90,0 0))"),
+ 0, -90, 50, 0);
+
+ // ring that goes through both south and north pole
+ tester::apply("r10cw",
+ from_wkt<G>("POLYGON((50 0,50 -90,40 0,40 90,50 0))"),
+ 40, -90, 50, 90);
+
+ // ring that goes through both south and north pole and crosses antimeridian
+ tester::apply("r11cw",
+ from_wkt<G>("POLYGON((-170 0,-170 -90,160 0,160 90,-170 0))"),
+ 160, -90, 190, 90);
+
+ // ring with edge that goes through the north pole and contains
+ // south pole (the bounding box is the entire globe)
+ tester::apply("r12cw",
+ from_wkt<G>("POLYGON((-50 40,130 10,170 80,-50 40))"),
+ -180, -90, 180, 90);
+ // -180, 10, 180, 90);
+
+ // ring with edge that goes through the north pole
+ tester::apply("r12cw-r",
+ from_wkt<G>("POLYGON((-50 40,170 80,130 10,-50 40))"),
+ -180, 10, 180, 90);
+ // -180, -90, 180, 90);
+
+ // ring that represents a spherical cap near the north pole
+ tester::apply("r13cw",
+ from_wkt<G>("POLYGON((100 45,0 45,-100 45,-100 90,100 45))"),
+ -100, 45, 100, 90);
+
+ // ring that represents the complement of a spherical cap
+ // near the north pole
+ tester::apply("r13cw-r",
+ from_wkt<G>("POLYGON((-100 45,0 45,100 45,100 90,-100 45))"),
+ -180, -90, 180, 90);
+
+ // ring that represents the complement of a spherical cap
+ // that touches the south pole
+ tester::apply("r14cw",
+ from_wkt<G>("POLYGON((-100 45,0 45,100 45,100 -90,-100 45))"),
+ -100, -90, 100, 57.26759279038765);
+
+ // ring that represents a spherical cap that touches the south pole
+ tester::apply("r14cw-r",
+ from_wkt<G>("POLYGON((100 45,0 45,-100 45,-100 -90,100 45))"),
+ -180, -90, 180, 90);
+
+ // ring with edge that goes through the south pole
+ tester::apply("r15cw",
+ from_wkt<G>("POLYGON((-50 -40,130 -10,170 -80,-50 -40))"),
+ -180, -90, 180, -10);
+
+ // ring with edge that goes through the south pole and contains
+ // north pole (the bounding box is the entire globe)
+ tester::apply("r15cw-r",
+ from_wkt<G>("POLYGON((-50 -40,170 -80,130 -10,-50 -40))"),
+ -180, -90, 180, 90);
+
+ // ring that does not contain any pole and lies in the lower hemisphere
+ tester::apply("r16",
+ from_wkt<G>("POLYGON((-50 -80,-50 -40,-30 -40,-30 -80,-50 -80))"),
+ -50, -80.14892388341609, -30, -40);
+
+ // ring that lies in the lower hemisphere and contains both poles
+ tester::apply("r16-r",
+ from_wkt<G>("POLYGON((-50 -80,-30 -80,-30 -40,-50 -40,-50 -80))"),
+ -180, -90, 180, 90);
+
+ // ring that goes through the south pole and contains the north pole
+ tester::apply("r17cw",
+ from_wkt<G>("POLYGON((50 0,50 -90,100 0,50 0))"),
+ -180, -90, 180, 90);
+
+ // ring that goes through the south pole
+ tester::apply("r17cw-r",
+ from_wkt<G>("POLYGON((50 0,100 0,100 -90,50 0))"),
+ 50, -90, 100, 0);
+
+ // ring that goes through the south pole and contains the north pole
+ tester::apply("r18cw",
+ from_wkt<G>("POLYGON((50 0,50 -90,460 0,50 0))"),
+ -180, -90, 180, 90);
+
+ // ring that goes through the south pole
+ tester::apply("r18cw-r",
+ from_wkt<G>("POLYGON((50 0,460 0,100 -90,50 0))"),
+ 50, -90, 100, 0);
+
+ // ring that goes through the south pole and contains the north pole
+ tester::apply("r19cw",
+ from_wkt<G>("POLYGON((50 0,50 -90,-260 0,50 0))"),
+ -180, -90, 180, 90);
+
+ // ring that goes through the south pole
+ tester::apply("r19cw-r",
+ from_wkt<G>("POLYGON((50 0,-260 0,100 -90,50 0))"),
+ 50, -90, 100, 0);
+
+ // ring that goes through both poles
+ tester::apply("r20cw",
+ from_wkt<G>("POLYGON((10 0,10 90,20 0,20 -90,10 0))"),
+ 10, -90, 20, 90); // SUCCEEDS FOR WRONG REASON
+
+ // ring that goes through both poles
+ tester::apply("r20cw-r",
+ from_wkt<G>("POLYGON((10 0,10 -90,20 0,20 90,10 0))"),
+ -180, -90, 180, 90); // FAILS NOW
+
+ // ring that goes through both poles and its boundary forms
+ // a great circle
+ tester::apply("r21cw",
+ from_wkt<G>("POLYGON((-10 0,-10 90,170 0,170 -90,-10 0))"),
+ -10, -90, 170, 90); // SUCCEEDS FOR WRONG REASON
+
+ // ring that goes through both poles and its boundary forms
+ // a great circle
+ tester::apply("r21cw-r",
+ from_wkt<G>("POLYGON((-10 0,-10 -90,170 0,170 90,-10 0))"),
+ 170, -90, 350, 90); // FAILS NOW
+}
+#endif
diff --git a/libs/geometry/test/algorithms/expand_on_spheroid.cpp b/libs/geometry/test/algorithms/expand_on_spheroid.cpp
new file mode 100644
index 0000000000..60692869d2
--- /dev/null
+++ b/libs/geometry/test/algorithms/expand_on_spheroid.cpp
@@ -0,0 +1,948 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2015, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Menelaos Karavelas, 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_expand_on_spheroid
+#endif
+
+#include <boost/test/included/unit_test.hpp>
+
+#include <cstddef>
+
+#include <iostream>
+#include <string>
+
+#include <geometry_test_common.hpp>
+#include <from_wkt.hpp>
+
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/geometry/core/coordinate_dimension.hpp>
+#include <boost/geometry/core/tag.hpp>
+#include <boost/geometry/core/tags.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/views/detail/indexed_point_view.hpp>
+
+#include <boost/geometry/util/condition.hpp>
+
+#include <boost/geometry/io/dsv/write.hpp>
+#include <boost/geometry/io/wkt/wkt.hpp>
+
+#include <boost/geometry/algorithms/assign.hpp>
+#include <boost/geometry/algorithms/envelope.hpp>
+#include <boost/geometry/algorithms/expand.hpp>
+#include <boost/geometry/algorithms/transform.hpp>
+
+#include "test_envelope_expand_on_spheroid.hpp"
+
+
+class test_expand_on_spheroid
+{
+private:
+ template
+ <
+ typename Geometry,
+ typename Tag = typename bg::tag<Geometry>::type
+ >
+ struct write_geometry
+ {
+ template <typename OutputStream>
+ static inline OutputStream& apply(OutputStream& os,
+ Geometry const& geometry)
+ {
+ os << bg::wkt(geometry);
+ return os;
+ }
+ };
+
+ template <typename Segment>
+ struct write_geometry<Segment, bg::segment_tag>
+ {
+ template <typename OutputStream>
+ static inline OutputStream& apply(OutputStream& os,
+ Segment const& segment)
+ {
+ os << "SEGMENT" << bg::dsv(segment);
+ return os;
+ }
+ };
+
+ template <typename Box>
+ struct write_geometry<Box, bg::box_tag>
+ {
+ template <typename OutputStream>
+ static inline OutputStream& apply(OutputStream& os,
+ Box const& box)
+ {
+ os << "BOX" << bg::dsv(box);
+ return os;
+ }
+ };
+
+ template <typename Box, typename Geometry>
+ static inline void check_message(bool same_boxes,
+ std::string const& case_id,
+ std::string const& units_str,
+ Box const& box,
+ Geometry const& geometry,
+ bool expected_are_different,
+ Box const& expected1,
+ Box const& expected2,
+ Box const& detected)
+ {
+ std::ostringstream stream;
+ stream << "case ID: " << case_id << ", "
+ << "MBR units: " << units_str << "; "
+ << "input box: BOX" << bg::dsv(box) << ", "
+ << "geometry: ";
+
+ write_geometry<Geometry>::apply(stream, geometry);
+ stream << "; " << "expected: " << bg::dsv(expected1);
+
+ if (expected_are_different)
+ {
+ stream << " or: " << bg::dsv(expected2);
+ }
+ stream << ", " << "detected: " << bg::dsv(detected);
+
+ BOOST_CHECK_MESSAGE(same_boxes, stream.str());
+ }
+
+
+ template <bool Reverse = false, typename = void>
+ struct basic_tester
+ {
+ template <typename Box, typename Geometry>
+ static inline void base_test(std::string const& case_id,
+ Box const& box,
+ Geometry const& geometry,
+ double lon_min1, double lat_min1,
+ double height_min1,
+ double lon_max1, double lat_max1,
+ double height_max1,
+ double lon_min2, double lat_min2,
+ double height_min2,
+ double lon_max2, double lat_max2,
+ double height_max2,
+ double tolerance)
+ {
+ typedef typename bg::coordinate_system
+ <
+ Box
+ >::type::units box_units_type;
+
+ std::string const units_str = units2string<box_units_type>();
+
+ Box detected;
+ bg::convert(box, detected);
+ bg::expand(detected, geometry);
+
+ bool expected_are_different =
+ (lon_min1 != lon_min2) || (lat_min1 != lat_min2)
+ || (lon_max1 != lon_max2) || (lat_max1 != lat_max2);
+
+ Box expected1;
+ initialize_box<Box>::apply(expected1,
+ lon_min1, lat_min1, height_min1,
+ lon_max1, lat_max1, height_max1);
+
+ Box expected2;
+ initialize_box<Box>::apply(expected2,
+ lon_min2, lat_min2, height_min2,
+ lon_max2, lat_max2, height_max2);
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "input box: BOX" << bg::dsv(box) << std::endl;
+
+ std::cout << "geometry: ";
+ write_geometry<Geometry>::apply(std::cout, geometry);
+
+ std::cout << std::endl
+ << "MBR units: " << units_str
+ << std::endl
+ << "expected: " << bg::dsv(expected1);
+
+ if (expected_are_different)
+ {
+ std::cout << " or: " << bg::dsv(expected2);
+ }
+
+ std::cout << std::endl
+ << "detected: " << bg::dsv(detected)
+ << std::endl << std::endl;
+#endif
+ bool same_boxes
+ = box_equals<Box>::apply(detected, expected1, tolerance);
+
+ if (expected_are_different)
+ {
+ same_boxes = same_boxes
+ || box_equals<Box>::apply(detected, expected2, tolerance);
+ }
+
+ check_message(same_boxes, case_id, units_str,
+ box, geometry, expected_are_different,
+ expected1, expected2, detected);
+ }
+
+ template <typename Box, typename Geometry>
+ static inline void apply(std::string const& case_id,
+ Box const& box,
+ Geometry const& geometry,
+ double lon_min1, double lat_min1,
+ double height_min1,
+ double lon_max1, double lat_max1,
+ double height_max1,
+ double lon_min2, double lat_min2,
+ double height_min2,
+ double lon_max2, double lat_max2,
+ double height_max2,
+ double tolerance)
+ {
+ typedef other_system_info
+ <
+ typename bg::coordinate_system<Box>::type
+ > other;
+
+ typedef bg::model::box
+ <
+ bg::model::point
+ <
+ typename bg::coordinate_type<Box>::type,
+ bg::dimension<Box>::value,
+ typename other::type
+ >
+ > other_mbr_type;
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "case ID: " << case_id
+ << std::endl << std::endl;
+#endif
+
+ base_test(case_id, box, geometry,
+ lon_min1, lat_min1, height_min1,
+ lon_max1, lat_max1, height_max1,
+ lon_min2, lat_min2, height_min2,
+ lon_max2, lat_max2, height_max2,
+ tolerance);
+
+ other_mbr_type other_box;
+ bg::detail::indexed_point_view<Box const, 0> p_min(box);
+ bg::detail::indexed_point_view<Box const, 1> p_max(box);
+ bg::detail::indexed_point_view
+ <
+ other_mbr_type, 0
+ > other_min(other_box);
+
+ bg::detail::indexed_point_view
+ <
+ other_mbr_type, 1
+ > other_max(other_box);
+
+ bg::transform(p_min, other_min);
+ bg::transform(p_max, other_max);
+
+ base_test(case_id, other_box, geometry,
+ other::convert(lon_min1),
+ other::convert(lat_min1),
+ height_min1,
+ other::convert(lon_max1),
+ other::convert(lat_max1),
+ height_max1,
+ other::convert(lon_min2),
+ other::convert(lat_min2),
+ height_min2,
+ other::convert(lon_max2),
+ other::convert(lat_max2),
+ height_max2,
+ tolerance);
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "=================="
+ << std::endl << std::endl;
+#endif
+ }
+ };
+
+ template <typename Dummy>
+ struct basic_tester<true, Dummy>
+ {
+ template <typename Box, typename Geometry>
+ static inline void apply(std::string const& case_id,
+ Box const& box,
+ Geometry const& geometry,
+ double lon_min1, double lat_min1,
+ double height_min1,
+ double lon_max1, double lat_max1,
+ double height_max1,
+ double lon_min2, double lat_min2,
+ double height_min2,
+ double lon_max2, double lat_max2,
+ double height_max2,
+ double tolerance)
+ {
+ basic_tester
+ <
+ false
+ >::apply(case_id, box, geometry,
+ lon_min1, lat_min1, height_min1,
+ lon_max1, lat_max1, height_max1,
+ lon_min2, lat_min2, height_min1,
+ lon_max2, lat_max2, height_max2,
+ tolerance);
+
+ std::string case_id_r = case_id + "[R]";
+
+ basic_tester
+ <
+ false
+ >::apply(case_id_r, geometry, box,
+ lon_min1, lat_min1, height_min1,
+ lon_max1, lat_max1, height_max1,
+ lon_min2, lat_min2, height_min2,
+ lon_max2, lat_max2, height_max2,
+ tolerance);
+ }
+ };
+
+
+public:
+ template <typename Box, typename Geometry>
+ static inline void apply(std::string const& case_id,
+ Box const& box,
+ Geometry const& geometry,
+ double lon_min1, double lat_min1, double height_min1,
+ double lon_max1, double lat_max1, double height_max1,
+ double lon_min2, double lat_min2, double height_min2,
+ double lon_max2, double lat_max2, double height_max2,
+ double tolerance = std::numeric_limits<double>::epsilon())
+ {
+
+ basic_tester
+ <
+ boost::is_same
+ <
+ typename bg::tag<Geometry>::type,
+ bg::box_tag
+ >::value
+ >::apply(case_id, box, geometry,
+ lon_min1, lat_min1, height_min1,
+ lon_max1, lat_max1, height_max1,
+ lon_min2, lat_min2, height_min2,
+ lon_max2, lat_max2, height_max2,
+ tolerance);
+ }
+
+ template <typename Box, typename Geometry>
+ static inline void apply(std::string const& case_id,
+ Box const& box,
+ Geometry const& geometry,
+ double lon_min1, double lat_min1,
+ double lon_max1, double lat_max1,
+ double lon_min2, double lat_min2,
+ double lon_max2, double lat_max2,
+ double tolerance = std::numeric_limits<double>::epsilon())
+ {
+ apply(case_id, box, geometry,
+ lon_min1, lat_min1, 0, lon_max1, lat_max1, 0,
+ lon_min2, lat_min2, 0, lon_max2, lat_max2, 0,
+ tolerance);
+ }
+
+ template <typename Box, typename Geometry>
+ static inline void apply(std::string const& case_id,
+ Box const& box,
+ Geometry const& geometry,
+ double lon_min, double lat_min,
+ double lon_max, double lat_max,
+ double tolerance = std::numeric_limits<double>::epsilon())
+ {
+ apply(case_id, box, geometry,
+ lon_min, lat_min, 0, lon_max, lat_max, 0,
+ lon_min, lat_min, 0, lon_max, lat_max, 0,
+ tolerance);
+ }
+
+ template <typename Box, typename Geometry>
+ static inline void apply(std::string const& case_id,
+ Box const& box,
+ Geometry const& geometry,
+ double lon_min, double lat_min, double height_min,
+ double lon_max, double lat_max, double height_max,
+ double tolerance = std::numeric_limits<double>::epsilon())
+ {
+ apply(case_id, box, geometry,
+ lon_min, lat_min, height_min, lon_max, lat_max, height_max,
+ lon_min, lat_min, height_min, lon_max, lat_max, height_max,
+ tolerance);
+ }
+};
+
+
+template <typename CoordinateSystem>
+void test_expand_point()
+{
+ typedef bg::model::point<double, 2, CoordinateSystem> point_type;
+ typedef bg::model::box<point_type> B;
+ typedef point_type G;
+ typedef test_expand_on_spheroid tester;
+
+ tester::apply("p01",
+ from_wkt<B>("BOX(0 0,5 5)"),
+ from_wkt<G>("POINT(10 10)"),
+ 0, 0, 10, 10);
+
+ tester::apply("p02",
+ from_wkt<B>("BOX(0 0,5 5)"),
+ from_wkt<G>("POINT(370 10)"),
+ 0, 0, 10, 10);
+
+ tester::apply("p03",
+ from_wkt<B>("BOX(10 10,10 10)"),
+ from_wkt<G>("POINT(20 20)"),
+ 10, 10, 20, 20);
+
+ tester::apply("p04",
+ from_wkt<B>("BOX(10 10,10 10)"),
+ from_wkt<G>("POINT(10 20)"),
+ 10, 10, 10, 20);
+
+ // there are two possible valid longitude ranges:
+ // [10, 190] and [-170, 10]
+ tester::apply("p05",
+ from_wkt<B>("BOX(10 10,10 10)"),
+ from_wkt<G>("POINT(190 20)"),
+ 10, 10, 190, 20);
+
+ // there are two possible valid longitude ranges:
+ // [10, 190] and [-170, 10]
+ tester::apply("p05a",
+ from_wkt<B>("BOX(10 10,10 10)"),
+ from_wkt<G>("POINT(-170 20)"),
+ 10, 10, 190, 20,
+ -170, 10, 10, 20);
+
+ tester::apply("p06",
+ from_wkt<B>("BOX(170 10,175 20)"),
+ from_wkt<G>("POINT(-170 15)"),
+ 170, 10, 190, 20);
+
+ tester::apply("p06a",
+ from_wkt<B>("BOX(170 10,175 20)"),
+ from_wkt<G>("POINT(-170 -6)"),
+ 170, -6, 190, 20);
+
+ tester::apply("p06b",
+ from_wkt<B>("BOX(170 10,175 20)"),
+ from_wkt<G>("POINT(-170 36)"),
+ 170, 10, 190, 36);
+
+ // point is inside box
+ tester::apply("p07",
+ from_wkt<B>("BOX(-30 -45,60 55)"),
+ from_wkt<G>("POINT(0 0)"),
+ -30, -45, 60, 55);
+
+ // point is inside box
+ tester::apply("p07a",
+ from_wkt<B>("BOX(-30 -45,60 55)"),
+ from_wkt<G>("POINT(360 0)"),
+ -30, -45, 60, 55);
+
+ tester::apply("p08",
+ from_wkt<B>("BOX(-100 -45,-90 55)"),
+ from_wkt<G>("POINT(80 60)"),
+ -100, -45, 80, 60);
+
+ tester::apply("p09",
+ from_wkt<B>("BOX(-100 -45,-90 55)"),
+ from_wkt<G>("POINT(170 60)"),
+ 170, -45, 270, 60);
+
+ // point is north pole
+ tester::apply("p10",
+ from_wkt<B>("BOX(-100 -45,-90 55)"),
+ from_wkt<G>("POINT(-80 90)"),
+ -100, -45, -90, 90);
+
+ // point is north pole
+ tester::apply("p10a",
+ from_wkt<B>("BOX(-100 -45,-90 55)"),
+ from_wkt<G>("POINT(170 90)"),
+ -100, -45, -90, 90);
+
+ tester::apply("p10b",
+ from_wkt<B>("BOX(-100 -45,-90 55)"),
+ from_wkt<G>("POINT(170 80)"),
+ 170, -45, 270, 80);
+
+ // box is north pole
+ tester::apply("p11",
+ from_wkt<B>("BOX(10 90,20 90)"),
+ from_wkt<G>("POINT(15 89)"),
+ 15, 89, 15, 90);
+
+ // box is south pole
+ tester::apply("p11a",
+ from_wkt<B>("BOX(10 -90,20 -90)"),
+ from_wkt<G>("POINT(15 89)"),
+ 15, -90, 15, 89);
+
+ // point is south pole
+ tester::apply("p12",
+ from_wkt<B>("BOX(10 80,20 85)"),
+ from_wkt<G>("POINT(15 -90)"),
+ 10, -90, 20, 85);
+
+ // point is south pole
+ tester::apply("p12a",
+ from_wkt<B>("BOX(10 80,20 85)"),
+ from_wkt<G>("POINT(25 -90)"),
+ 10, -90, 20, 85);
+
+ // box is north pole and point is south pole
+ tester::apply("p13",
+ from_wkt<B>("BOX(10 90,20 90)"),
+ from_wkt<G>("POINT(25 -90)"),
+ 0, -90, 0, 90);
+
+ // box contains north pole and point is south pole
+ tester::apply("p14",
+ from_wkt<B>("BOX(10 80,20 90)"),
+ from_wkt<G>("POINT(25 -90)"),
+ 10, -90, 20, 90);
+
+ // box contains south pole and point is north pole
+ tester::apply("p15",
+ from_wkt<B>("BOX(10 -90,30 0)"),
+ from_wkt<G>("POINT(25 90)"),
+ 10, -90, 30, 90);
+
+ // box and point are north pole
+ tester::apply("p15",
+ from_wkt<B>("BOX(10 90,20 90)"),
+ from_wkt<G>("POINT(25 90)"),
+ 0, 90, 0, 90);
+
+ // box and point are south pole
+ tester::apply("p16",
+ from_wkt<B>("BOX(10 -90,20 -90)"),
+ from_wkt<G>("POINT(-25 -90)"),
+ 0, -90, 0, -90);
+
+ // box contains both poles
+ tester::apply("p17",
+ from_wkt<B>("BOX(10 -90,10 90)"),
+ from_wkt<G>("POINT(10 80)"),
+ 10, -90, 10, 90);
+
+ // box contains both poles
+ tester::apply("p17a",
+ from_wkt<B>("BOX(10 -90,10 90)"),
+ from_wkt<G>("POINT(25 80)"),
+ 10, -90, 25, 90);
+
+ // box contains both poles
+ tester::apply("p18",
+ from_wkt<B>("BOX(10 -90,100 90)"),
+ from_wkt<G>("POINT(25 80)"),
+ 10, -90, 100, 90);
+
+ // box contains both poles
+ tester::apply("p18a",
+ from_wkt<B>("BOX(10 -90,100 90)"),
+ from_wkt<G>("POINT(-175 80)"),
+ 10, -90, 185, 90);
+
+ // box contains both poles
+ tester::apply("p18b",
+ from_wkt<B>("BOX(10 -90,100 90)"),
+ from_wkt<G>("POINT(-95 80)"),
+ -95, -90, 100, 90);
+
+ // box contains both poles and point is north pole
+ tester::apply("p19",
+ from_wkt<B>("BOX(10 -90,100 90)"),
+ from_wkt<G>("POINT(-95 90)"),
+ 10, -90, 100, 90);
+
+ // box contains both poles and point is south pole
+ tester::apply("p20",
+ from_wkt<B>("BOX(10 -90,100 90)"),
+ from_wkt<G>("POINT(-95 -90)"),
+ 10, -90, 100, 90);
+}
+
+BOOST_AUTO_TEST_CASE( expand_point )
+{
+ test_expand_point<bg::cs::spherical_equatorial<bg::degree> >();
+ test_expand_point<bg::cs::geographic<bg::degree> >();
+}
+
+
+template <typename CoordinateSystem>
+void test_expand_point_with_height()
+{
+ typedef bg::model::point<double, 3, CoordinateSystem> point_type;
+ typedef bg::model::box<point_type> B;
+ typedef point_type G;
+ typedef test_expand_on_spheroid tester;
+
+ // deactivate this for now
+ tester::apply("ph01",
+ from_wkt<B>("BOX(0 0 20,5 5 100)"),
+ from_wkt<G>("POINT(10 10 80)"),
+ 0, 0, 20, 10, 10, 100);
+
+ tester::apply("ph02",
+ from_wkt<B>("BOX(0 0 20,5 5 100)"),
+ from_wkt<G>("POINT(10 10 120)"),
+ 0, 0, 20, 10, 10, 120);
+
+ tester::apply("ph03",
+ from_wkt<B>("BOX(0 0 20,5 5 100)"),
+ from_wkt<G>("POINT(10 10 5)"),
+ 0, 0, 5, 10, 10, 100);
+}
+
+BOOST_AUTO_TEST_CASE( expand_point_with_height )
+{
+ test_expand_point_with_height<bg::cs::spherical_equatorial<bg::degree> >();
+ test_expand_point_with_height<bg::cs::geographic<bg::degree> >();
+}
+
+
+BOOST_AUTO_TEST_CASE( expand_segment )
+{
+ typedef bg::cs::spherical_equatorial<bg::degree> coordinate_system_type;
+ typedef bg::model::point<double, 2, coordinate_system_type> point_type;
+ typedef bg::model::box<point_type> B;
+ typedef bg::model::segment<point_type> G;
+ typedef test_expand_on_spheroid tester;
+
+ tester::apply("s01",
+ from_wkt<B>("BOX(20 20,50 50)"),
+ from_wkt<G>("SEGMENT(10 10,40 40)"),
+ 10, 10, 50, 50);
+
+ tester::apply("s02",
+ from_wkt<B>("BOX(20 20,50 50)"),
+ from_wkt<G>("SEGMENT(10 10,40 10)"),
+ 10, 10, 50, 50);
+
+ tester::apply("s03",
+ from_wkt<B>("BOX(5 5,50 10)"),
+ from_wkt<G>("SEGMENT(40 10,10 10)"),
+ 5, 5, 50, 10.34527004614999,
+ 4.0 * std::numeric_limits<double>::epsilon());
+
+ // segment ending at the north pole
+ tester::apply("s04",
+ from_wkt<B>("BOX(5 15,50 50)"),
+ from_wkt<G>("SEGMENT(40 45,80 90)"),
+ 5, 15, 50, 90);
+
+ // segment ending at the north pole
+ tester::apply("s04a",
+ from_wkt<B>("BOX(5 15,30 30)"),
+ from_wkt<G>("SEGMENT(40 45,80 90)"),
+ 5, 15, 40, 90);
+
+ // segment starting at the north pole
+ tester::apply("s05",
+ from_wkt<B>("BOX(5 15,50 50)"),
+ from_wkt<G>("SEGMENT(80 90,40 45)"),
+ 5, 15, 50, 90);
+
+ // segment starting at the north pole
+ tester::apply("s05a",
+ from_wkt<B>("BOX(5 15,30 30)"),
+ from_wkt<G>("SEGMENT(80 90,40 45)"),
+ 5, 15, 40, 90);
+
+ // segment passing through the south pole
+ tester::apply("s06",
+ from_wkt<B>("BOX(5 15,30 40)"),
+ from_wkt<G>("SEGMENT(-170 -45,10 -30)"),
+ -170, -90, 30, 40);
+
+ // segment degenerating to the north pole
+ tester::apply("s07",
+ from_wkt<B>("BOX(5 15,30 40)"),
+ from_wkt<G>("SEGMENT(10 90,20 90)"),
+ 5, 15, 30, 90);
+
+ // segment degenerating to the south pole
+ tester::apply("s08",
+ from_wkt<B>("BOX(5 15,30 40)"),
+ from_wkt<G>("SEGMENT(10 -90,20 -90)"),
+ 5, -90, 30, 40);
+
+ // box degenerating to the south pole
+ tester::apply("s09",
+ from_wkt<B>("BOX(10 -90,30 -90)"),
+ from_wkt<G>("SEGMENT(10 -30,100 45)"),
+ 10, -90, 100, 45);
+
+ // box degenerating to the south pole
+ tester::apply("s09a",
+ from_wkt<B>("BOX(10 -90,130 -90)"),
+ from_wkt<G>("SEGMENT(10 -30,100 45)"),
+ 10, -90, 100, 45);
+}
+
+
+BOOST_AUTO_TEST_CASE( expand_segment_with_height )
+{
+ typedef bg::cs::spherical_equatorial<bg::degree> coordinate_system_type;
+ typedef bg::model::point<double, 3, coordinate_system_type> point_type;
+ typedef bg::model::box<point_type> B;
+ typedef bg::model::segment<point_type> G;
+ typedef test_expand_on_spheroid tester;
+
+ tester::apply("sh01",
+ from_wkt<B>("BOX(20 20 100,50 50 1000)"),
+ from_wkt<G>("SEGMENT(10 10 150,40 40 500)"),
+ 10, 10, 100, 50, 50, 1000);
+
+ tester::apply("sh02",
+ from_wkt<B>("BOX(20 20 100,50 50 1000)"),
+ from_wkt<G>("SEGMENT(10 10 60,40 40 1500)"),
+ 10, 10, 60, 50, 50, 1500);
+
+ tester::apply("sh03",
+ from_wkt<B>("BOX(20 20 100,50 50 1000)"),
+ from_wkt<G>("SEGMENT(10 10 150,40 40 1500)"),
+ 10, 10, 100, 50, 50, 1500);
+
+ tester::apply("sh04",
+ from_wkt<B>("BOX(20 20 100,50 50 1000)"),
+ from_wkt<G>("SEGMENT(10 10 60,40 40 800)"),
+ 10, 10, 60, 50, 50, 1000);
+}
+
+
+template <typename CoordinateSystem>
+void test_expand_box()
+{
+ typedef bg::model::point<double, 2, CoordinateSystem> point_type;
+ typedef bg::model::box<point_type> B;
+ typedef bg::model::box<point_type> G;
+ typedef test_expand_on_spheroid tester;
+
+ tester::apply("b01",
+ from_wkt<B>("BOX(11 11,19 19)"),
+ from_wkt<G>("BOX(10 10,20 20)"),
+ 10, 10, 20, 20);
+
+ tester::apply("b02",
+ from_wkt<B>("BOX(11 11,29 29)"),
+ from_wkt<G>("BOX(10 10,20 20)"),
+ 10, 10, 29, 29);
+
+ tester::apply("b03",
+ from_wkt<B>("BOX(21 21,29 29)"),
+ from_wkt<G>("BOX(10 10,20 20)"),
+ 10, 10, 29, 29);
+
+ tester::apply("b04",
+ from_wkt<B>("BOX(150 -10,200 60)"),
+ from_wkt<G>("BOX(-175 -20,-150 55)"),
+ 150, -20, 210, 60);
+
+ tester::apply("b04a",
+ from_wkt<B>("BOX(150 -10,200 60)"),
+ from_wkt<G>("BOX(-175 -20,-170 55)"),
+ 150, -20, 200, 60);
+
+ tester::apply("b04b",
+ from_wkt<B>("BOX(150 -10,200 60)"),
+ from_wkt<G>("BOX(-175 -20,-140 55)"),
+ 150, -20, 220, 60);
+
+ tester::apply("b05",
+ from_wkt<B>("BOX(150 -10,170 60)"),
+ from_wkt<G>("BOX(179 -20,535 55)"),
+ 179, -20, 535, 60);
+
+ tester::apply("b06",
+ from_wkt<B>("BOX(150 -10,170 60)"),
+ from_wkt<G>("BOX(179 -20,520 55)"),
+ 179, -20, 530, 60);
+
+ tester::apply("b07",
+ from_wkt<B>("BOX(-100 -10,170 60)"),
+ from_wkt<G>("BOX(100 -20,400 55)"),
+ -180, -20, 180, 60);
+
+ tester::apply("b08",
+ from_wkt<B>("BOX(-100 -10,100 60)"),
+ from_wkt<G>("BOX(150 -20,150 55)"),
+ -100, -20, 150, 60);
+
+ tester::apply("b09",
+ from_wkt<B>("BOX(100 -10,400 60)"),
+ from_wkt<G>("BOX(0 -20,0 55)"),
+ 100, -20, 400, 60);
+
+ // this is a border case:
+ // there are two possible MBRs with longitude intervals:
+ // [100, 430] and [70, 400]
+ tester::apply("b10",
+ from_wkt<B>("BOX(100 -10,400 60)"),
+ from_wkt<G>("BOX(70 -20,70 55)"),
+ 70, -20, 400, 60,
+ 100, -20, 430, 60);
+
+ tester::apply("b10a",
+ from_wkt<B>("BOX(100 -10,400 60)"),
+ from_wkt<G>("BOX(71 -20,71 55)"),
+ 71, -20, 400, 60);
+
+ tester::apply("b10b",
+ from_wkt<B>("BOX(100 -10,400 60)"),
+ from_wkt<G>("BOX(69 -20,69 55)"),
+ 100, -20, 429, 60);
+
+ tester::apply("b11",
+ from_wkt<B>("BOX(-90 -10,-90 60)"),
+ from_wkt<G>("BOX(90 -20,90 55)"),
+ -90, -20, 90, 60);
+
+ // first box is the south pole
+ tester::apply("b12",
+ from_wkt<B>("BOX(-90 -90,80 -90)"),
+ from_wkt<G>("BOX(90 -20,90 55)"),
+ 90, -90, 90, 55);
+
+ // first box is the south pole
+ tester::apply("b12a",
+ from_wkt<B>("BOX(-90 -90,80 -90)"),
+ from_wkt<G>("BOX(90 -20,130 55)"),
+ 90, -90, 130, 55);
+
+ // first box is the north pole
+ tester::apply("b13",
+ from_wkt<B>("BOX(-90 90,80 90)"),
+ from_wkt<G>("BOX(90 -20,90 55)"),
+ 90, -20, 90, 90);
+
+ // first box is the north pole
+ tester::apply("b13a",
+ from_wkt<B>("BOX(-90 90,80 90)"),
+ from_wkt<G>("BOX(90 -20,190 55)"),
+ 90, -20, 190, 90);
+
+ // both boxes are the north pole
+ tester::apply("b14",
+ from_wkt<B>("BOX(-90 90,80 90)"),
+ from_wkt<G>("BOX(90 90,190 90)"),
+ 0, 90, 0, 90);
+
+ // both boxes are the south pole
+ tester::apply("b15",
+ from_wkt<B>("BOX(-90 -90,80 -90)"),
+ from_wkt<G>("BOX(90 -90,190 -90)"),
+ 0, -90, 0, -90);
+
+ // one box is the south pole and the other the north pole
+ tester::apply("b16",
+ from_wkt<B>("BOX(-90 -90,80 -90)"),
+ from_wkt<G>("BOX(90 90,190 90)"),
+ 0, -90, 0, 90);
+
+ // both boxes contain both poles but at different longitudes
+ tester::apply("b17",
+ from_wkt<B>("BOX(10 -90,10 90)"),
+ from_wkt<G>("BOX(20 -90,20 90)"),
+ 10, -90, 20, 90);
+
+ // both boxes contain both poles but at different longitude ranges
+ tester::apply("b17",
+ from_wkt<B>("BOX(10 -90,20 90)"),
+ from_wkt<G>("BOX(40 -90,60 90)"),
+ 10, -90, 60, 90);
+
+
+ // first box is a band
+ tester::apply("b18",
+ from_wkt<B>("BOX(0 10,360 20)"),
+ from_wkt<G>("BOX(-10 -40,20 10)"),
+ -180, -40, 180, 20);
+
+ // first box contains south and north pole and is a band
+ // (box covers the entire spheroid)
+ tester::apply("b19",
+ from_wkt<B>("BOX(0 -90,360 90)"),
+ from_wkt<G>("BOX(-10 -40,20 10)"),
+ -180, -90, 180, 90);
+
+ // the envelope of the two boxes is a band
+ tester::apply("b20",
+ from_wkt<B>("BOX(-180 -40,0 -30)"),
+ from_wkt<G>("BOX(0 -10,180 50)"),
+ -180, -40, 180, 50);
+
+ // the envelope of the two boxes is a band
+ tester::apply("b20a",
+ from_wkt<B>("BOX(-180 -40,0 -30)"),
+ from_wkt<G>("BOX(0 -10,185 50)"),
+ -180, -40, 180, 50);
+
+ // the envelope of the two boxes is a band
+ tester::apply("b20b",
+ from_wkt<B>("BOX(-179 -40,0 -30)"),
+ from_wkt<G>("BOX(0 -10,185 50)"),
+ -180, -40, 180, 50);
+}
+
+BOOST_AUTO_TEST_CASE( expand_box )
+{
+ test_expand_box<bg::cs::spherical_equatorial<bg::degree> >();
+ test_expand_box<bg::cs::geographic<bg::degree> >();
+}
+
+
+template <typename CoordinateSystem>
+void test_expand_box_with_height()
+{
+ typedef bg::model::point<double, 3, CoordinateSystem> point_type;
+ typedef bg::model::box<point_type> B;
+ typedef bg::model::box<point_type> G;
+ typedef test_expand_on_spheroid tester;
+
+ tester::apply("bh01",
+ from_wkt<B>("BOX(11 11 100,19 19 1000)"),
+ from_wkt<G>("BOX(10 10 200,20 20 800)"),
+ 10, 10, 100, 20, 20, 1000);
+
+ tester::apply("bh02",
+ from_wkt<B>("BOX(11 11 200,19 19 1000)"),
+ from_wkt<G>("BOX(10 10 100,20 20 800)"),
+ 10, 10, 100, 20, 20, 1000);
+
+ tester::apply("bh03",
+ from_wkt<B>("BOX(11 11 100,19 19 800)"),
+ from_wkt<G>("BOX(10 10 200,20 20 1000)"),
+ 10, 10, 100, 20, 20, 1000);
+
+ tester::apply("bh04",
+ from_wkt<B>("BOX(11 11 200,19 19 1000)"),
+ from_wkt<G>("BOX(10 10 100,20 20 800)"),
+ 10, 10, 100, 20, 20, 1000);
+}
+
+BOOST_AUTO_TEST_CASE( expand_box_with_height )
+{
+ test_expand_box_with_height<bg::cs::spherical_equatorial<bg::degree> >();
+ test_expand_box_with_height<bg::cs::geographic<bg::degree> >();
+}
diff --git a/libs/geometry/test/algorithms/multi_for_each.cpp b/libs/geometry/test/algorithms/for_each_multi.cpp
index 70165a44f7..e9c02b6856 100644
--- a/libs/geometry/test/algorithms/multi_for_each.cpp
+++ b/libs/geometry/test/algorithms/for_each_multi.cpp
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, 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)
@@ -8,10 +8,8 @@
#include <geometry_test_common.hpp>
#include <boost/geometry/algorithms/for_each.hpp>
-#include <boost/geometry/multi/algorithms/for_each.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/ring.hpp>
@@ -20,9 +18,9 @@
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/geometries/multi_point.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
#include <algorithms/test_for_each.hpp>
diff --git a/libs/geometry/test/algorithms/is_convex.cpp b/libs/geometry/test/algorithms/is_convex.cpp
new file mode 100644
index 0000000000..7fcc8a9138
--- /dev/null
+++ b/libs/geometry/test/algorithms/is_convex.cpp
@@ -0,0 +1,61 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2015 Barend Gehrels, 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 <cstddef>
+#include <string>
+
+#include <boost/geometry/algorithms/is_convex.hpp>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/correct.hpp>
+#include <boost/geometry/io/wkt/wkt.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/ring.hpp>
+
+
+template <typename Geometry>
+void test_one(std::string const& case_id, std::string const& wkt, bool expected)
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ bg::correct(geometry);
+
+ bool detected = bg::is_convex(geometry);
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "Not as expected, case: " << case_id
+ << " / expected: " << expected
+ << " / detected: " << detected);
+}
+
+
+template <typename P>
+void test_all()
+{
+ // rectangular, with concavity
+ std::string const concave1 = "polygon((1 1, 1 4, 3 4, 3 3, 4 3, 4 4, 5 4, 5 1, 1 1))";
+ std::string const triangle = "polygon((1 1, 1 4, 5 1, 1 1))";
+
+ test_one<bg::model::ring<P> >("triangle", triangle, true);
+ test_one<bg::model::ring<P> >("concave1", concave1, false);
+ test_one<bg::model::ring<P, false, false> >("triangle", triangle, true);
+ test_one<bg::model::ring<P, false, false> >("concave1", concave1, false);
+
+ test_one<bg::model::box<P> >("box", "box(0 0,2 2)", true);
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<int> >();
+ test_all<bg::model::d2::point_xy<double> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/is_empty.cpp b/libs/geometry/test/algorithms/is_empty.cpp
new file mode 100644
index 0000000000..089f09067a
--- /dev/null
+++ b/libs/geometry/test/algorithms/is_empty.cpp
@@ -0,0 +1,335 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2015, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Menelaos Karavelas, 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_is_empty
+#endif
+
+#include <iostream>
+
+#include <boost/test/included/unit_test.hpp>
+
+#include <boost/variant/variant.hpp>
+
+#include <boost/geometry/algorithms/is_empty.hpp>
+#include <boost/geometry/algorithms/num_points.hpp>
+
+#include <boost/geometry/core/closure.hpp>
+#include <boost/geometry/core/tag.hpp>
+#include <boost/geometry/core/tags.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/io/wkt/wkt.hpp>
+#include <boost/geometry/io/dsv/write.hpp>
+
+namespace bg = boost::geometry;
+
+
+typedef bg::model::point<double, 2, bg::cs::cartesian> point;
+typedef bg::model::linestring<point> linestring;
+typedef bg::model::segment<point> segment;
+typedef bg::model::box<point> box;
+typedef bg::model::ring<point, true, true> ring_cw_closed;
+typedef bg::model::ring<point, true, false> ring_cw_open;
+typedef bg::model::ring<point, false, true> ring_ccw_closed;
+typedef bg::model::ring<point, false, false> ring_ccw_open;
+typedef bg::model::polygon<point, true, true> polygon_cw_closed;
+typedef bg::model::polygon<point, true, false> polygon_cw_open;
+typedef bg::model::polygon<point, false, true> polygon_ccw_closed;
+typedef bg::model::polygon<point, false, false> polygon_ccw_open;
+typedef bg::model::multi_point<point> multi_point;
+typedef bg::model::multi_linestring<linestring> multi_linestring;
+typedef bg::model::multi_polygon<polygon_cw_closed> multi_polygon_cw_closed;
+typedef bg::model::multi_polygon<polygon_cw_open> multi_polygon_cw_open;
+typedef bg::model::multi_polygon<polygon_ccw_closed> multi_polygon_ccw_closed;
+typedef bg::model::multi_polygon<polygon_ccw_open> multi_polygon_ccw_open;
+
+template <std::size_t D, typename T = double>
+struct box_dD
+{
+ typedef boost::geometry::model::box
+ <
+ boost::geometry::model::point<T, D, boost::geometry::cs::cartesian>
+ > type;
+};
+
+template <typename Geometry, typename Tag = typename bg::tag<Geometry>::type>
+struct test_is_empty
+{
+ static inline void apply(Geometry const& geometry, bool expected)
+ {
+ bool detected = bg::is_empty(geometry);
+ BOOST_CHECK_MESSAGE( detected == expected,
+ std::boolalpha
+ << "Expected: " << expected
+ << " detected: " << detected
+ << " wkt: " << bg::wkt(geometry)
+ << std::noboolalpha );
+ BOOST_CHECK_EQUAL(detected, bg::num_points(geometry) == 0);
+ }
+
+ static inline void apply(std::string const& wkt, bool expected)
+ {
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ apply(geometry, expected);
+ }
+};
+
+template <typename Box>
+struct test_is_empty<Box, bg::box_tag>
+{
+ static inline void apply(Box const& box, bool expected)
+ {
+ bool detected = bg::is_empty(box);
+ BOOST_CHECK_MESSAGE( detected == expected,
+ std::boolalpha
+ << "Expected: " << expected
+ << " detected: " << detected
+ << " dsv: " << bg::dsv(box)
+ << std::noboolalpha );
+ BOOST_CHECK_EQUAL(detected, bg::num_points(box) == 0);
+ }
+
+ static inline void apply(std::string const& wkt, bool expected)
+ {
+ Box box;
+ bg::read_wkt(wkt, box);
+ apply(box, expected);
+ }
+};
+
+BOOST_AUTO_TEST_CASE( test_point )
+{
+ test_is_empty<point>::apply("POINT(0 0)", false);
+ test_is_empty<point>::apply("POINT(1 1)", false);
+}
+
+BOOST_AUTO_TEST_CASE( test_segment )
+{
+ test_is_empty<segment>::apply("SEGMENT(0 0,0 0)", false);
+ test_is_empty<segment>::apply("SEGMENT(0 0,1 1)", false);
+}
+
+BOOST_AUTO_TEST_CASE( test_box )
+{
+ test_is_empty<box>::apply("BOX(0 0,1 1)", false);
+
+ // test higher-dimensional boxes
+ test_is_empty<box_dD<3>::type>::apply("BOX(0 0 0,1 1 1)", false);
+ test_is_empty<box_dD<4>::type>::apply("BOX(0 0 0 0,1 1 1 1)", false);
+ test_is_empty<box_dD<5>::type>::apply("BOX(0 0 0 0 0,1 1 1 1 1)", false);
+}
+
+BOOST_AUTO_TEST_CASE( test_linestring )
+{
+ typedef test_is_empty<linestring> tester;
+
+ tester::apply("LINESTRING()", true);
+ tester::apply("LINESTRING(0 0)", false);
+ tester::apply("LINESTRING(0 0,0 0)", false);
+ tester::apply("LINESTRING(0 0,0 0,1 1)", false);
+ tester::apply("LINESTRING(0 0,0 0,0 0,1 1)", false);
+}
+
+BOOST_AUTO_TEST_CASE( test_multipoint )
+{
+ typedef test_is_empty<multi_point> tester;
+
+ tester::apply("MULTIPOINT()", true);
+ tester::apply("MULTIPOINT(0 0)", false);
+ tester::apply("MULTIPOINT(0 0,0 0)", false);
+ tester::apply("MULTIPOINT(0 0,0 0,1 1)", false);
+}
+
+BOOST_AUTO_TEST_CASE( test_multilinestring )
+{
+ typedef test_is_empty<multi_linestring> tester;
+
+ tester::apply("MULTILINESTRING()", true);
+ tester::apply("MULTILINESTRING(())", true);
+ tester::apply("MULTILINESTRING((),())", true);
+ tester::apply("MULTILINESTRING((),(0 0))", false);
+ tester::apply("MULTILINESTRING((),(0 0),())", false);
+ tester::apply("MULTILINESTRING((0 0))", false);
+ tester::apply("MULTILINESTRING((0 0,1 0))", false);
+ tester::apply("MULTILINESTRING((),(),(0 0,1 0))", false);
+ tester::apply("MULTILINESTRING((0 0,1 0,0 1),(0 0,1 0,0 1,0 0))", false);
+}
+
+template <typename OpenRing>
+void test_open_ring()
+{
+ typedef test_is_empty<OpenRing> tester;
+
+ tester::apply("POLYGON(())", true);
+ tester::apply("POLYGON((0 0))", false);
+ tester::apply("POLYGON((0 0,1 0))", false);
+ tester::apply("POLYGON((0 0,1 0,0 1))", false);
+ tester::apply("POLYGON((0 0,0 0,1 0,0 1))", false);
+}
+
+template <typename ClosedRing>
+void test_closed_ring()
+{
+ typedef test_is_empty<ClosedRing> tester;
+
+ tester::apply("POLYGON(())", true);
+ tester::apply("POLYGON((0 0))", false);
+ tester::apply("POLYGON((0 0,0 0))", false);
+ tester::apply("POLYGON((0 0,1 0,0 0))", false);
+ tester::apply("POLYGON((0 0,1 0,0 1,0 0))", false);
+ tester::apply("POLYGON((0 0,1 0,1 0,0 1,0 0))", false);
+}
+
+BOOST_AUTO_TEST_CASE( test_ring )
+{
+ test_open_ring<ring_ccw_open>();
+ test_open_ring<ring_cw_open>();
+ test_closed_ring<ring_ccw_closed>();
+ test_closed_ring<ring_cw_closed>();
+}
+
+template <typename OpenPolygon>
+void test_open_polygon()
+{
+ typedef test_is_empty<OpenPolygon> tester;
+
+ tester::apply("POLYGON(())", true);
+ tester::apply("POLYGON((),())", true);
+ tester::apply("POLYGON((),(),())", true);
+ tester::apply("POLYGON((),(0 0,0 1,1 0))", false);
+ tester::apply("POLYGON((),(0 0,0 1,1 0),())", false);
+ tester::apply("POLYGON((),(),(0 0,0 1,1 0))", false);
+ tester::apply("POLYGON((0 0))", false);
+ tester::apply("POLYGON((0 0,10 0),(0 0))", false);
+ tester::apply("POLYGON((0 0,10 0),(1 1,2 1))", false);
+ tester::apply("POLYGON((0 0,10 0,0 10))", false);
+ tester::apply("POLYGON((0 0,10 0,0 10),())", false);
+ tester::apply("POLYGON((0 0,10 0,0 10),(1 1))", false);
+ tester::apply("POLYGON((0 0,10 0,0 10),(1 1,2 1))", false);
+ tester::apply("POLYGON((0 0,10 0,0 10),(1 1,2 1,1 2))", false);
+ tester::apply("POLYGON((0 0,10 0,10 10,0 10),(1 1,2 1,1 2))", false);
+}
+
+template <typename ClosedPolygon>
+void test_closed_polygon()
+{
+ typedef test_is_empty<ClosedPolygon> tester;
+
+ tester::apply("POLYGON(())", true);
+ tester::apply("POLYGON((),())", true);
+ tester::apply("POLYGON((),(),())", true);
+ tester::apply("POLYGON((),(0 0,0 1,1 0,0 0))", false);
+ tester::apply("POLYGON((),(0 0,0 1,1 0,0 0),())", false);
+ tester::apply("POLYGON((),(),(0 0,0 1,1 0,0 0))", false);
+ tester::apply("POLYGON((0 0))", false);
+ tester::apply("POLYGON((0 0,10 0,0 0),(0 0))", false);
+ tester::apply("POLYGON((0 0,10 0,0 0),(1 1,2 1,1 1))", false);
+ tester::apply("POLYGON((0 0,10 0,0 10,0 0))", false);
+ tester::apply("POLYGON((0 0,10 0,0 10,0 0),())", false);
+ tester::apply("POLYGON((0 0,10 0,0 10,0 0),(1 1))", false);
+ tester::apply("POLYGON((0 0,10 0,0 10,0 0),(1 1,2 1,1 1))", false);
+ tester::apply("POLYGON((0 0,10 0,0 10,0 0),(1 1,2 1,1 2,1 1))", false);
+ tester::apply("POLYGON((0 0,10 0,10 10,0 10,0 0),(1 1,2 1,1 2,1 1))", false);
+}
+
+BOOST_AUTO_TEST_CASE( test_polygon )
+{
+ test_open_polygon<polygon_ccw_open>();
+ test_open_polygon<polygon_cw_open>();
+ test_closed_polygon<polygon_ccw_closed>();
+ test_closed_polygon<polygon_cw_closed>();
+}
+
+template <typename OpenMultiPolygon>
+void test_open_multipolygon()
+{
+ typedef test_is_empty<OpenMultiPolygon> tester;
+
+ tester::apply("MULTIPOLYGON()", true);
+ tester::apply("MULTIPOLYGON((()))", true);
+ tester::apply("MULTIPOLYGON(((),()))", true);
+ tester::apply("MULTIPOLYGON(((),()),((),(),()))", true);
+ tester::apply("MULTIPOLYGON(((),()),((),(0 0,10 0,10 10,0 10),()))", false);
+ tester::apply("MULTIPOLYGON(((0 0,10 0,10 10,0 10),(1 1,2 1,1 2)))", false);
+ tester::apply("MULTIPOLYGON(((0 0,10 0,10 10,0 10),(1 1,2 1,2 2,1 2),(5 5,6 5,6 6,5 6)))", false);
+ tester::apply("MULTIPOLYGON(((0 0,10 0,10 10,0 10),(1 1,2 1,1 2)),((100 100,110 100,110 110),(101 101,102 101,102 102)))", false);
+}
+
+template <typename ClosedMultiPolygon>
+void test_closed_multipolygon()
+{
+ typedef test_is_empty<ClosedMultiPolygon> tester;
+
+ tester::apply("MULTIPOLYGON()", true);
+ tester::apply("MULTIPOLYGON((()))", true);
+ tester::apply("MULTIPOLYGON(((),()))", true);
+ tester::apply("MULTIPOLYGON(((),()),((),(),()))", true);
+ tester::apply("MULTIPOLYGON(((),()),((),(0 0,10 0,10 10,0 10,0 0),()))", false);
+ tester::apply("MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(1 1,2 1,1 2,1 1)))", false);
+ tester::apply("MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(1 1,2 1,2 2,1 2,1 1),(5 5,6 5,6 6,5 6,5 5)))", false);
+ tester::apply("MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(1 1,2 1,1 2,1 1)),((100 100,110 100,110 110,100 100),(101 101,102 101,102 102,101 101)))", false);
+}
+
+BOOST_AUTO_TEST_CASE( test_multipolygon )
+{
+ test_open_multipolygon<multi_polygon_ccw_open>();
+ test_open_multipolygon<multi_polygon_cw_open>();
+ test_closed_multipolygon<multi_polygon_ccw_closed>();
+ test_closed_multipolygon<multi_polygon_cw_closed>();
+}
+
+BOOST_AUTO_TEST_CASE( test_variant )
+{
+ typedef boost::variant
+ <
+ linestring, polygon_cw_open, polygon_cw_closed, multi_point
+ > variant_geometry_type;
+
+ typedef test_is_empty<variant_geometry_type> tester;
+
+ linestring ls_empty;
+ bg::read_wkt("LINESTRING()", ls_empty);
+
+ linestring ls;
+ bg::read_wkt("LINESTRING(1 1,2 2,5 6)", ls);
+
+ polygon_cw_open p_open;
+ bg::read_wkt("POLYGON((0 0,0 1,1 0))", p_open);
+
+ polygon_cw_closed p_closed;
+ bg::read_wkt("POLYGON(())", p_closed);
+
+ multi_point mp;
+ bg::read_wkt("MULTIPOINT((1 10))", mp);
+
+ multi_point mp_empty;
+ bg::read_wkt("MULTIPOINT((1 10))", mp);
+
+ variant_geometry_type variant_geometry;
+
+ variant_geometry = ls_empty;
+ tester::apply(variant_geometry, true);
+
+ variant_geometry = p_open;
+ tester::apply(variant_geometry, false);
+
+ variant_geometry = p_closed;
+ tester::apply(variant_geometry, true);
+
+ variant_geometry = mp;
+ tester::apply(variant_geometry, false);
+
+ variant_geometry = mp_empty;
+ tester::apply(variant_geometry, true);
+
+ variant_geometry = ls;
+ tester::apply(variant_geometry, false);
+}
diff --git a/libs/geometry/test/algorithms/is_simple.cpp b/libs/geometry/test/algorithms/is_simple.cpp
index bd6ceb6689..f73d6309c3 100644
--- a/libs/geometry/test/algorithms/is_simple.cpp
+++ b/libs/geometry/test/algorithms/is_simple.cpp
@@ -33,6 +33,7 @@
#include <boost/geometry/io/wkt/wkt.hpp>
+#include <boost/geometry/algorithms/intersection.hpp>
#include <boost/geometry/algorithms/is_valid.hpp>
#include <boost/geometry/algorithms/is_simple.hpp>
@@ -296,6 +297,27 @@ BOOST_AUTO_TEST_CASE( test_is_simple_areal )
false);
}
+BOOST_AUTO_TEST_CASE( test_geometry_with_NaN_coordinates )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl;
+ std::cout << "************************************" << std::endl;
+ std::cout << " is_valid: geometry with NaN coordinates" << std::endl;
+ std::cout << "************************************" << std::endl;
+#endif
+
+ linestring_type ls1, ls2;
+ bg::read_wkt("LINESTRING(1 1,1.115235e+308 1.738137e+308)", ls1);
+ bg::read_wkt("LINESTRING(-1 1,1.115235e+308 1.738137e+308)", ls2);
+
+ // the intersection of the two linestrings is a new linestring
+ // (multilinestring with a single element) that has NaN coordinates
+ multi_linestring_type mls;
+ bg::intersection(ls1, ls2, mls);
+
+ test_simple(mls, true);
+}
+
BOOST_AUTO_TEST_CASE( test_is_simple_variant )
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
diff --git a/libs/geometry/test/algorithms/is_valid.cpp b/libs/geometry/test/algorithms/is_valid.cpp
index ad86e61386..7ec61eece8 100644
--- a/libs/geometry/test/algorithms/is_valid.cpp
+++ b/libs/geometry/test/algorithms/is_valid.cpp
@@ -4,6 +4,7 @@
// Copyright (c) 2014-2015, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
@@ -17,8 +18,10 @@
#include <boost/test/included/unit_test.hpp>
#include "test_is_valid.hpp"
-#include <boost/geometry/algorithms/reverse.hpp>
+#include <boost/geometry/algorithms/correct.hpp>
+#include <boost/geometry/algorithms/intersection.hpp>
+#include <boost/geometry/algorithms/reverse.hpp>
BOOST_AUTO_TEST_CASE( test_is_valid_point )
{
@@ -881,6 +884,226 @@ inline void test_open_multipolygons()
// polygon contains a spike
test::apply("mpg20", open_mpgn, false);
}
+
+ // MySQL report 12.06.2015
+ {
+ std::string wkt = "MULTIPOLYGON("
+ "((-40.314872143936725 -85.6567579487603,-53.1473643859603 -98.48925019078388,-41.29168745244485 -90.56754012573627,-40.314872143936725 -85.6567579487603)),"
+ "((-186.91433298215597 -88.80210078879976,-192.54783347494038 -75.53420159905284,-192.7944062150986 -78.03769664281869,-186.91433298215597 -88.80210078879976)),"
+ "((170.89089207158912 -44.35600339378721,191.8949969913326 -31.3460752560506,169.32805525181837 -43.07341636227523,170.89089207158912 -44.35600339378721)),"
+ "((-2.6035109435630504 -13.058121512403435,26.839412016794036 43.97610638055074,26.974733141577826 43.72289807427111,26.97470368529088 43.722907009738066,-2.6035109435630504 -13.058121512403435))"
+ ")";
+
+ std::string msg;
+ CG mpoly = from_wkt<CG>(wkt);
+ BOOST_CHECK_MESSAGE(! bg::is_valid(mpoly, msg), msg);
+ BOOST_CHECK_MESSAGE(bg::is_valid(mpoly[0], msg), msg);
+ BOOST_CHECK_MESSAGE(bg::is_valid(mpoly[1], msg), msg);
+ BOOST_CHECK_MESSAGE(bg::is_valid(mpoly[2], msg), msg);
+ BOOST_CHECK_MESSAGE(! bg::is_valid(mpoly[3], msg), msg);
+
+ // The last Polygon has wrong orientation, so correct it
+ bg::reverse(mpoly[3]);
+ BOOST_CHECK_MESSAGE(bg::is_valid(mpoly, msg), msg);
+ BOOST_CHECK_MESSAGE(bg::is_valid(mpoly[0], msg), msg);
+ BOOST_CHECK_MESSAGE(bg::is_valid(mpoly[1], msg), msg);
+ BOOST_CHECK_MESSAGE(bg::is_valid(mpoly[2], msg), msg);
+ BOOST_CHECK_MESSAGE(bg::is_valid(mpoly[3], msg), msg);
+ }
+
+ // MySQL report 30.06.2015
+#ifdef BOOST_GEOMETRY_TEST_ENABLE_FAILING
+ {
+ std::string wkt = "MULTIPOLYGON(((153.60036248974487 -86.4072234353084,134.8924761503673 -92.0821987136617,151.87887755950274 -92.0821987136617,153.60036248974487 -86.4072234353084)),((-162.3619975827558 -20.37135271519032,-170.42498886764488 -34.35970444494861,-168.21072335866987 -37.67358696575207,-162.3619975827558 -20.37135271519032)),((25.982352329146433 -1.793573272167862,25.81900562736861 -2.0992322130216032,24.216310496207715 -2.737558757030656,25.9822948153016 -1.7936204725604972,25.982352329146433 -1.793573272167862)))";
+
+ std::string msg;
+ CG mpoly = from_wkt<CG>(wkt);
+ bg::correct(mpoly);
+
+ BOOST_CHECK_MESSAGE(bg::is_valid(mpoly, msg), msg);
+ BOOST_CHECK_MESSAGE(bg::is_valid(mpoly[2], msg), msg);
+ }
+ {
+ std::string wkt = "MULTIPOLYGON(("
+ "(176.37937452790632 33.81070321484654,165.31874654406195 30.429623478264823,164.22653456196667 40.57205841516082,169.96584109309163 43.760662373477935,169.96717084197783 43.76157019827226,169.96831223949295 43.76270579928938,169.96922682269394 43.76403090891733,169.96988377185227 43.76550087346144,169.97026094902066 43.767066157889666,169.97034564404004 43.768674015069664,169.97013500284808 43.77027026324768,169.96963612365553 43.77180111187144,169.9688658177501 43.773214974230235,169.9678500429876 43.77446420582984,169.96662302906125 43.775506709921984,169.96522612402566 43.77630735608547,169.96370640094523 43.77683916405498,169.96211507162087 43.777084212905194,169.96050576084875 43.777034244952155,163.96123663641703 43.03565247280777,161.69252016076334 64.10327452950632,161.69220086043657 64.10485513588213,161.69159759286657 64.10635057476519,161.6907307489143 64.1077102992874,161.68962962850455 64.10888834981994,161.68833145026844 64.10984490744038,161.6868800935278 64.11054763983988,161.68532461514377 64.11097279417753,161.68371759136113 64.11110599994278,161.68211334069463 64.1109427546887,161.68056608792585 64.11048857621772,161.67912813126807 64.10975881607614,127.83620579794024 42.81253476817878,91.03182023020634 47.701488147167275,136.39039242955064 83.14688773021612,136.39163693720113 83.14807413530517,136.39262607583518 83.14948053535137,136.39332183340986 83.15105288318968,136.39369747235173 83.15273075437446,136.3937385570669 83.15444966925705,136.39344350869288 83.15614357090246,136.39282366577314 83.15774736362043,136.39190284852347 83.15919941455623,136.39071644343446 83.1604439222067,136.38931004338824 83.16143306084076,136.38773769554993 83.16212881841544,136.38605982436513 83.16250445735731,136.38434090948257 83.16254554207251,136.38264700783714 83.16225049369845,136.38104321511918 83.1616306507787,136.37959116418338 83.16070983352907,91.00745759860087 47.70471273777429,-11.691678619246499 61.34689554994591,-33.79755445921219 85.09421525362518,-33.7987816906185 85.09530774427819,-33.80019114476049 85.09615218005024,-33.80173336063651 85.09671892773947,-33.80335421832898 85.0969880988603,-33.8049968381973 85.09695024757627,-33.80660357691587 85.09660670217643,-33.808118050311506 85.09596951846243,-33.80948711201435 85.09506105668265,-33.81066271848674 85.0939131968595,-33.81160361498191 85.09256622004571,-33.812276783268395 85.09106739476917,-33.81265860031601 85.08946931827111,-33.812735667282574 85.08782807074738,-32.830674277011205 64.15491927762633,-166.9120300852194 81.96578933819151,-166.91372994506622 81.96584876974394,-166.9154093128506 81.96557899307163,-166.91700503326308 81.96499015355748,-166.91845709668723 81.96410439545254,-166.91971089595725 81.96295502910593,-166.92071927994778 81.96158527827609,-166.92144432676722 81.96004665463211,-166.9218587698712 81.95839702057518,-166.92194702346433 81.95669841323047,-166.9217057686293 81.95501471144192,-135.70224400417752 -45.9322191166313,-138.57126185553517 -49.74180297177792,-161.44988958707904 -54.37476978072864,-161.45143808151082 -54.37523543008462,-161.45287478035848 -54.37597742789392,-161.45415085337137 -54.37697055527431,-161.4552229296195 -54.37818105799885,-161.45605457157663 -54.3795677937282,-161.45661751355206 -54.381083630348755,-161.4568926223796 -54.382677047890056,-161.4568705477121 -54.384293889575865,-161.45655203981923 -54.38587920249453,-161.4559479240874 -54.38737910532821,-161.45507873308873 -54.388742619660995,-161.45397400872366 -54.38992340262376,-161.4526712981565 -54.39088132198683,-161.45121487766946 -54.391583820166765,-161.44965424780858 -54.39200702078731,-161.44804245096856 -54.392136540185234,-141.89488089543744 -54.15502243957519,-153.27347396169714 -69.26392265746459,-153.2743589702193 -69.26537072588309,-153.2749485381606 -69.26696212522691,-153.2752205928412 -69.26863727551263,-153.27516494887718 -69.27033346122717,-153.27478368950827 -69.27198717931759,-153.27409108860425 -69.27353651666519,-153.27311307626903 -69.27492346803459,-153.2718862680504 -69.27609610771653,-153.27045659410012 -69.27701053356093,-153.268877579607 -69.27763251061793,-153.2672083408813 -69.27793875285136,-153.26551137211467 -69.27791779493838,-153.26385020567662 -69.27757042151681,-107.17294666067983 -54.86628398298008,-106.1185414985015 -57.820838687964276,-161.49299710582102 -75.80397143603332,-161.49452500826962 -75.80463385281091,-161.49590016714416 -75.80557311845463,-161.4970730084222 -75.80675537274882,-161.49800125156384 -75.8081379958174,-161.49865143371088 -75.80967114455622,-161.4990001160121 -75.81129954946056,-161.4990347285859 -75.81296450707245,-161.49875402366052 -75.81460599622092,-161.49816812055553 -75.81616484176531,-161.49729814088408 -75.81758484783957,-161.4961754471254 -75.81881482369457,-161.49484051201802 -75.81981042910776,-161.49334145953082 -75.82053577283341,-161.49173233000997 -75.82096470647024,-161.49007113204223 -75.82108176710256,-100.22898834625123 -74.30605444452195,-100.22734583448315 -74.30585777708335,-100.22576946346221 -74.30535620216963,-100.22431530761126 -74.30456756172502,-100.22303509393429 -74.30351990914377,-100.22197436199151 -74.30225051135928,-100.22117084397333 -74.30080452319054,-100.22065312249669 -74.299233381102,-100.22043961386883 -74.29759297351377,-100.2205379129852 -74.2959416527474,-100.220944523165 -74.29433815932634,-106.0959583598649 -57.83192845601232,-92.94623645293606 -53.56150642974892,0.5168968571681063 -52.42819495175221,42.552398940491486 -80.15392826171708,42.553823957605765 -80.15468988561345,42.55536450400553 -80.15517718585528,42.55696829838054 -80.15537362500162,42.55858091298275 -80.15527253652432,42.56014762073331 -80.15487735104905,42.56161525248782 -80.15420147993068,42.56293400143029 -80.15326786011391,42.56405911336014 -80.15210817572546,42.564952405509295 -80.15076178281409,42.56558356234557 -80.14927437372997,42.56593116438665 -80.14769642646958,42.56598341511011 -80.14608149161101,42.565738541290365 -80.14448437497535,42.5652048531764 -80.1429592776891,42.56440046246796 -80.14155795676808,22.856549024752262 -52.14358082479128,22.85544171929926 -52.14229333196901,22.854107064023683 -52.14124335176489,22.852595089554377 -52.14047024353326,22.850962473473096 -52.14000298785936,22.849270415709668 -52.13985910019877,0.5220842171561202 -52.41060241052812,-8.41778896463083 -46.51405003506674,2.082503817262605 -45.5265842190059,82.16974873985578 -55.61946094607285,82.17129108418781 -55.61951844683097,82.17281962817947 -55.61930470483393,82.17428704023979 -55.6188263386343,82.17564788173712 -55.61809816091227,82.17686001401307 -55.61714271979877,82.17788590321227 -55.61598960066932,87.42894995498656 -48.54817950299798,90.86025690382013 -48.842320647346625,90.86187779422266 -48.842309257891365,90.86346890919046 -48.841999792907956,90.8649759064788 -48.84140282172809,90.86634731676145 -48.84053873304434,90.86753630149138 -48.839437038563695,90.86850225260417 -48.838135365077605,90.86921217942799 -48.836678169372995,90.86964183543259 -48.83511521987464,90.8697765463347 -48.83349989687612,90.8696117112771 -48.831887369412634,90.86915295996427 -48.83033271104191,90.86841596038786 -48.82888901888599,90.8674258837091 -48.827605600175325,88.83971158165615 -46.64932716144001,92.40269805720794 -41.853630224309256,126.8456757419591 -63.47440298320586,126.84713519537095 -63.47513926788542,126.84870592800237 -63.475591947011644,126.85033338098 -63.4757452969263,126.85196102526822 -63.47559399107129,126.8535323251863 -63.47514328500498,126.85499270215635 -63.47440883385204,126.85629143047208 -63.47341614852797,126.85738339923923 -63.472199709625954,126.85823067928733 -63.47080176974498,126.85880384062692 -63.46927088585993,126.8590829746903 -63.46766023271123,126.85905838584898 -63.466025755798086,126.85873092818818 -63.46442422813017,126.85811197584037 -63.46291127823613,126.85722302790863 -63.461539457925234,126.85609496170247 -63.46035641691782,97.38483049679773 -37.827161184361024,99.87187230030216 -36.330501626203954,171.77091226660818 -29.569125763297997,171.77242885150693 -29.568846999536735,171.7738731802143 -29.568306949932698,171.77520061136264 -29.567522306359965,171.7763701166585 -29.566517320612498,171.777345548987 -29.565323054828713,171.77809675964784 -29.56397642142174,171.77860053019282 -29.562519042189095,171.77884129006245 -29.56099596186458,171.77881159784133 -29.559454255873884,165.32871350322802 30.33706888582541,176.38762884933539 33.794883447557986,176.38920864287232 33.79555326659214,176.3906277904606 33.79651785214075,176.39183197552205 33.79774028557272,176.39277510897307 33.799173779364644,176.39342109324193 33.80076346785056,176.3937452038706 33.80244850715521,176.39373503582075 33.80416440393784,176.3933909782652 33.80584548381587,176.39272619969265 33.80742740499197,176.39176614389606 33.80884962087758,176.39054755613435 33.810057697458305,176.38911707674143 33.811005396706115,176.3875294560099 33.81165644629765,176.38584545867357 33.81198592790426,176.38412953819284 33.81198123091831,176.3824473698573 33.81164253511265,176.38239992262746 33.811606862577534,176.38239393445264 33.81162601425782,176.37937452790632 33.81070321484654),"
+ "(31.940896057402718 -11.516674682385004,31.735090184010808 -11.433768531594366,34.28637780994461 -10.636047228893936,31.940896057402718 -11.516674682385004),"
+ "(30.28283959927952 -10.848748755534567,-3.4172969820295727 2.7269017301769836,-13.569154489871252 9.18584944133385,-12.274858999116972 9.628378040430327,21.92730276845213 2.385649455001494,38.84218041215776 -8.23228345814529,30.28283959927952 -10.848748755534567),"
+ "(-3.506381078742539 2.7627880702187406,-16.750651901766318 8.098065902036172,-13.590409501346059 9.178582205591375,-3.506381078742539 2.7627880702187406),"
+ "(31.709407405831065 -11.423422566994818,30.308715440626955 -10.859172493055892,38.861820878026606 -8.244612297573639,39.53325186684806 -8.666087271928937,34.579078645088416 -10.526151567651766,31.709407405831065 -11.423422566994818),"
+ "(31.96495469130859 -11.526366382128769,34.5846215239078 -10.542808015164859,39.883544951634676 -8.885975497800693,42.787058225913796 -10.708574699971027,37.770908594399415 -13.865217464656103,31.96495469130859 -11.526366382128769),"
+ "(48.77877229519879 -5.194821637047497,38.86437999888012 -8.225507106217272,21.97711163867511 2.3751018026608763,48.385785409894076 -3.2172657509225715,49.85165664674822 -4.7920077720156655,48.77877229519879 -5.194821637047497),"
+ "(52.035281286546805 -3.9721613339210506,48.39482899889053 -3.201249949645277,24.68775090776513 22.266150556743217,27.256969910296846 23.144584341056124,56.359252044298216 -2.1676440520591687,55.64595593834196 -2.6165186152963713,52.035281286546805 -3.9721613339210506),"
+ "(21.0523618078348 -15.604823171775074,20.044774220126357 -15.088996753249816,23.066991360577624 -14.144024584675869,23.763240995171685 -14.58700084866993,21.0523618078348 -15.604823171775074),"
+ "(49.86941225561311 -4.785336300805852,48.41562983381898 -3.2235856816187862,52.00474175020747 -3.9836250990190427,49.86941225561311 -4.785336300805852),"
+ "(56.52330868895917 -2.287118069864981,56.3885724075448 -2.1699191303695926,106.52503218338835 29.380766897799347,127.67871416131852 24.428460971650335,56.52330868895917 -2.287118069864981),"
+ "(23.783784057718577 -14.579279673235199,23.088894501216046 -14.137168734379976,31.708657690867156 -11.442032284077861,31.91659602271336 -11.525797467311321,23.783784057718577 -14.579279673235199),"
+ "(39.55390791690693 -8.65834200124904,38.88402046337834 -8.237835944785246,48.51602741760274 -5.293470218105426,39.55390791690693 -8.65834200124904),(56.50463609360271 -2.2941260112243,55.727564043439656 -2.5858892138401472,56.373071028355454 -2.1796740901332754,56.50463609360271 -2.2941260112243),(21.03014957321752 -15.613158799416311,10.569260752810493 -19.54075189827794,-2.9464639789869125 -22.277697151591028,20.02087042017853 -15.096466397529603,21.03014957321752 -15.613158799416311),"
+ "(52.47436796255111 -4.065143439019163,52.0671665340097 -3.978913434571549,55.572196226218196 -2.6629353253941694,54.16542157313718 -3.5482133364501145,52.47436796255111 -4.065143439019163),"
+ "(18.686422690099135 -14.3935995357972,-39.497151641780675 15.393047282556093,-15.306368432221959 10.270345844048258,-13.609365014952653 9.190640067582622,-16.778642869828406 8.10704200262427,-16.78013527405983 8.106370378455987,-16.78147692731812 8.10543319333665,-16.78262111907359 8.104263075974965,-16.78352801354702 8.10290076476696,-16.784166036618227 8.101393689462272,-16.78451297509954 8.099794319866595,-16.784556750102364 8.098158339071315,-16.784295837571545 8.09654270481052,-16.783739321346324 8.095003666440478,-16.782906576900587 8.093594806581768,-16.78182659677314 8.092365175605535,-16.780536981173654 8.091357583912956,-16.779082628906927 8.090607111463319,-3.4253378182903305 2.711229144049957,21.910296697427533 -13.408098481443034,18.686422690099135 -14.3935995357972),"
+ "(49.92455499029387 -4.844573589537546,49.88232772450034 -4.7992107915072495,52.03662700043225 -3.990377200254404,52.43970998904547 -4.075735073446003,49.92455499029387 -4.844573589537546),"
+ "(56.98298842344176 -2.6869329990186017,56.53834480149721 -2.3001960061283953,127.709423817281 24.421271512588014,132.92279324817048 23.20076594437462,122.22155101611108 17.25548653666155,56.98298842344176 -2.6869329990186017),"
+ "(21.93236247547395 -13.401346106262679,-3.336253671995941 2.6753427840349797,30.256146438987056 -10.856907501734277,21.93236247547395 -13.401346106262679),"
+ "(56.963208077106145 -2.6929774535282007,54.22943361944536 -3.5286570687708547,55.65380423765296 -2.6323059828796573,56.51967220394539 -2.3072039455782374,56.963208077106145 -2.6929774535282007),"
+ "(49.905901657492095 -4.850280677454471,49.047142136266274 -5.112798684502387,49.86457211628575 -4.805882263415661,49.905901657492095 -4.850280677454471),"
+ "(18.66231459031522 -14.40096459040753,-15.242813984693981 -24.76524114901455,-41.871025640976086 15.895732417477603,-39.56283173369286 15.406955864944898,18.66231459031522 -14.40096459040753),"
+ "(54.16010295741377 -4.422118945281966,57.68433962274301 -3.3201949186482835,60.493211425450355 -5.763234012884148,54.16010295741377 -4.422118945281966),"
+ "(50.57482090609503 -5.543124178834603,51.410616916152094 -5.2818015712411075,50.73017482548689 -5.7100012259218005,50.57482090609503 -5.543124178834603),"
+ "(57.7040033134621 -3.3140490007641716,120.5880728282652 16.347976841903872,68.42035360394682 -12.634786014512635,63.952222521971656 -8.748552923366702,69.34888739490755 -7.655727627757562,69.35052190979452 -7.65522664740267,69.35202819378684 -7.654418112452161,69.35334902179036 -7.65333273988165,69.35443421435205 -7.652011763978858,69.3552425440229 -7.650505369815648,69.35574330162603 -7.648870786671658,69.35591746292623 -7.647170113842091,69.35575841137785 -7.645467961429212,69.35527218949336 -7.643828995745994,69.35447726928288 -7.642315482584282,69.35340385048569 -7.640984921680917,69.35209271325485 -7.639887862250621,69.35059366888214 -7.639065982575512,69.348963667422 -7.638550506609389,60.528528122163166 -5.770712765907017,57.7040033134621 -3.3140490007641716),"
+ "(39.90557971777995 -8.879095683641047,50.55626153776256 -5.548932208433719,50.71506487635533 -5.719509860218734,42.803538516251564 -10.698203715094458,39.90557971777995 -8.879095683641047),"
+ "(54.125906762225966 -4.432808367053374,60.520474886872016 -5.78693828698986,63.91384251004383 -8.738419975604259,55.19312990789962 -10.504359876990208,50.74233508921979 -5.723075090472591,51.47603824555935 -5.261358446995118,54.125906762225966 -4.432808367053374),"
+ "(-39.55690832500143 15.42363240349549,-42.57305175099324 16.967718229775315,-54.529804271814804 35.22554209214185,-30.764086064128595 20.105022802970012,-30.710857834915476 18.970448449090075,-30.710636768905257 18.968861050497278,-30.71013054093483 18.96734038034394,-30.709356054150412 18.965937214390088,-30.70833916896296 18.964698404885425,-30.707113839559156 18.963665316154746,-30.70572098015804 18.962872443427244,-30.70420709886957 18.962346261027584,-30.70262274477097 18.962104338388023,-30.70102082005363 18.962154753398345,-29.249644048343924 19.141511936326765,-15.348629077210006 10.297225959678553,-39.55690832500143 15.42363240349549),"
+ "(21.884178079339662 2.412712542801014,-12.242463797063095 9.639454184544832,2.3975468904970114 14.644975309050857,21.884178079339662 2.412712542801014),"
+ "(-15.299650033147174 10.286854033424495,-29.22228439323044 19.144892967884317,-8.792850447899582 21.669506695125158,2.3784269745719975 14.656976960749958,-12.275968322130971 9.646537638677753,-15.299650033147174 10.286854033424495),"
+ "(21.933986962464473 2.402164887728272,2.4189169499386907 14.652281880490598,24.669574614144935 22.25993595597394,48.36498457496562 -3.1949300189490657,21.933986962464473 2.402164887728272),"
+ "(-39.62258841691361 15.437540985884295,-41.88466302451252 15.91655654561091,-42.55362818185854 16.938058662646,-39.62258841691361 15.437540985884295),"
+ "(54.12505697116883 -4.414697518592483,53.149660304654546 -4.208154364528738,54.17278878474252 -3.5643034507215816,56.978802584973195 -2.7065410644301977,57.66879568091532 -3.3066752884918813,54.12505697116883 -4.414697518592483),"
+ "(52.5097940270921 -4.072645352049953,54.108776779744645 -3.583859692404417,53.12503062771869 -4.202927454922124,52.5097940270921 -4.072645352049953),"
+ "(43.28546691270277 -26.986883767640755,42.97679823939298 -26.79048854796605,56.466941170357856 -19.295797633524103,64.08900802970163 -24.08037950217483,45.2669261914462 -28.001268064806617,43.28546691270277 -26.986883767640755),"
+ "(43.11812854048746 -26.90121622441705,42.940870464815944 -26.810470368231712,42.959363702902145 -26.800187467000804,43.11812854048746 -26.90121622441705),"
+ "(20.022491497341747 -15.077589291279075,18.708847193281812 -14.40507958111042,21.92976181239232 -13.420482809530107,23.04762685262098 -14.13170426598196,20.022491497341747 -15.077589291279075),"
+ "(21.073463079609297 -15.61562579933674,23.781749745311217 -14.598776706897553,26.48393818926334 -16.317995334865266,23.590120811873746 -16.904008626322792,21.073463079609297 -15.61562579933674),"
+ "(9.350288473315587 38.74248379268954,-6.585012056625516 55.86103593692023,70.2680521039453 37.868910337863355,40.90146758060325 27.828271548502038,24.262734733742946 25.772111264832496,9.350288473315587 38.74248379268954),"
+ "(73.09089007444824 -29.731095597924465,85.69919539743492 -37.64566996857491,80.88024981899486 -38.09884440280534,73.09089007444824 -29.731095597924465),"
+ "(73.04450471090416 -29.681265947851927,69.3379197794863 -25.699470542214453,79.58321142449617 -22.367138852695543,96.03221445150848 -36.67396648552466,85.72790431968778 -37.64297969856965,73.04450471090416 -29.681265947851927),"
+ "(9.46387079270287 38.62046756176968,24.239338321979417 25.769211949937343,21.716979498625832 25.45751975956489,9.46387079270287 38.62046756176968),"
+ "(50.56156943063165 -5.528888731813538,49.937839204058804 -4.858844205801361,52.475136061040715 -4.083236988055326,53.10370484197959 -4.216347691874761,51.46866317625423 -5.24527327754466,50.56156943063165 -5.528888731813538),"
+ "(9.224408992818482 38.851964794507175,-11.711265479809555 57.06114671556529,-6.615650355906411 55.86820869061986,9.224408992818482 38.851964794507175),"
+ "(60.55579159384646 -5.794417042185758,69.30386052897589 -7.646930246489353,63.93552683381575 -8.734031540594103,60.55579159384646 -5.794417042185758),"
+ "(57.688459366105995 -3.3005293657993064,56.99858293272367 -2.7004966111511806,122.14822367585627 17.214748146233596,120.66377698176358 16.39003571587255,57.688459366105995 -3.3005293657993064),"
+ "(73.03324406984439 -29.694914662490135,80.85821729038376 -38.100921377000205,63.342896321792594 -39.748050882541506,50.75959180753584 -31.74216343806383,67.57943285376581 -26.271427096622276,73.03324406984439 -29.694914662490135),"
+ "(39.86400285729009 -8.873708408777603,34.87732280230907 -10.432912187499966,39.551916707235804 -8.677803685461726,39.86400285729009 -8.873708408777603),"
+ "(43.44410013402389 -27.087801782144677,45.239552804641725 -28.00697030328185,44.975318735147916 -28.06201375436441,43.44410013402389 -27.087801782144677),"
+ "(-15.257389373944136 10.259973914784002,-12.30836353977779 9.635461489231913,-13.588110003575826 9.197907303291592,-15.257389373944136 10.259973914784002),"
+ "(23.069529991534154 -14.124848414588413,21.951827586412705 -13.413730431788267,30.282022284527198 -10.86733124094458,31.682974917738175 -11.431686321512942,23.069529991534154 -14.124848414588413),"
+ "(23.80229280523764 -14.591055529795597,31.94065465827722 -11.53548916772298,37.76851162339057 -13.883163606614682,37.770097848105024 -13.883634342409975,37.771744254525196 -13.883798801928782,37.77339225172808 -13.883651132524463,37.774983192179256 -13.883196589331225,37.77646045883184 -13.882451348248843,42.80353701408153 -10.718930933297813,45.567034652447205 -12.45365217013186,26.508719800762194 -16.312970859703256,23.80229280523764 -14.591055529795597),"
+ "(43.276761579565346 -27.002134145623014,44.95069160862587 -28.067143910504445,38.11630436469161 -29.49083715589638,42.92240688088259 -26.820725087652352,43.276761579565346 -27.002134145623014),"
+ "(126.75959213687518 -63.39967008039708,92.41319098322936 -41.83950698990248,93.78447601919933 -39.99379341951623,97.3690323884615 -37.83666821790139,126.75959213687518 -63.39967008039708),"
+ "(72.98685869023261 -29.645084995156807,67.60116781362723 -26.264357693619786,69.31952721664192 -25.70545281408542,72.98685869023261 -29.645084995156807),"
+ "(39.886037618944634 -8.866828591799006,39.57257275758669 -8.67005841496514,48.78439784949424 -5.211447043733159,49.91918587276122 -4.864551295334174,50.543010064128545 -5.534696763377852,39.886037618944634 -8.866828591799006),"
+ "(9.337991159717035 38.729948727398885,21.695490271536684 25.454859141680437,-8.788846562680476 21.687676810037537,-31.489294946971892 35.93737116944357,-32.81216829744508 64.1347806843964,-11.700243714994912 61.33035113568702,-6.637054435703233 55.89123580798307,-11.741701242558069 57.08628824654891,-11.743347393206076 57.086512042263855,-11.745006213819227 57.08642142961937,-11.746618193091077 57.08601965940509,-11.748125500179835 57.08532114539797,-11.749474059428762 57.084350947258365,-11.75061549036676 57.0831438714978,-11.751508843390358 57.08174322277196,-11.752122068858302 57.08019925029701,-11.752433166894022 57.07856734512509,-11.752430976646009 57.076906052953085,-11.752115576690887 57.07527497375627,-11.751498282214417 57.07373262359911,-11.750601239071592 57.07233433533203,-11.749456629289176 57.07113027348812,9.337991159717035 38.729948727398885),"
+ "(19.998587701357646 -15.085058937588059,-3.1132193245213102 -22.311465244718235,-15.089019545185295 -24.73657453178888,18.684739096779687 -14.412444637400831,19.998587701357646 -15.085058937588059),"
+ "(21.051250846321395 -15.623961427658536,23.562530114275848 -16.909590792795676,10.677531366771717 -19.518827010871995,21.051250846321395 -15.623961427658536),"
+ "(54.09086078489642 -4.42538694225184,51.53408460058219 -5.224830093565444,53.128334513377965 -4.221574604966094,54.09086078489642 -4.42538694225184),"
+ "(173.75757156169772 32.99091541934996,165.3267971738516 30.354864191440612,165.32065635283269 30.411888723916427,173.75757156169772 32.99091541934996),"
+ "(10.465747395220248 -19.57961137948609,-12.894911802992752 -28.350460831776864,-14.505090251111184 -25.891736822767676,-3.10897552967657 -22.328503814897203,10.465747395220248 -19.57961137948609),"
+ "(-27.610965806972345 -33.8756481721416,-38.00614396293315 -37.7785591589894,-43.02265457370873 -37.34856959661485,-29.167463128681774 -32.849015266607424,-27.610965806972345 -33.8756481721416),"
+ "(-38.04432250117674 -37.79289279162382,-43.34682819058996 -39.783739126387225,-48.515464191322366 -39.13238742407438,-43.065536969219835 -37.36249587240486,-38.04432250117674 -37.79289279162382),"
+ "(-43.38210310004821 -39.796974297919405,-78.87353889947534 -53.12237586126752,-78.87504724430607 -53.12311387651708,-78.87638729989119 -53.124125816073466,-78.87750994786981 -53.125374588331766,-78.87837403873353 -53.126814420827664,-78.87894790011936 -53.128392537980105,-78.87921049772773 -53.130051095526014,-78.87915220631305 -53.1317293007423,-78.87877516248726 -53.13336564074071,-78.87809318640446 -53.13490013715957,-78.87713127519739 -53.136276544608954,-78.87592468673323 -53.13744441228774,-78.87451764727265 -53.13836093320586,-78.87296173040167 -53.138992513230576,-78.87131396665488 -53.13931600244487,-78.86963475311974 -53.1393195436839,-8.445695735047487 -46.516657330884335,0.49077562272833575 -52.4109659347568,-92.89011328794561 -53.543280146805785,-48.55468477896229 -39.14512450915579,-43.38210310004821 -39.796974297919405),"
+ "(-27.590643470202913 -33.86803834336524,-29.146094667189693 -32.84209543970167,-19.625029335662298 -29.750071937783378,-19.62345393418427 -29.749383122488545,-19.62204318480157 -29.748400197004802,-19.620851301821823 -29.747160934607262,-19.61992408863952 -29.745712959454867,-19.619297177537277 -29.7441119164207,-19.61899466035717 -29.742419332690684,-19.619028162664783 -29.74070025330835,-19.61939639698522 -29.739020741530297,-19.620085212280053 -29.73744534005227,-19.621068137763796 -29.73603459066957,-19.622307400161336 -29.734842707689822,-19.62375537531373 -29.73391549450752,-19.6253564183479 -29.733288583405276,-19.627049002077914 -29.73298606622517,-19.628768081460247 -29.733019568532782,-19.6304475932383 -29.73338780285322,-29.164834804336436 -32.82973483928127,-31.586344616113706 -31.2325578835804,-14.522499048949383 -25.897172872851705,-12.911746604589299 -28.356773367533684,-27.590643470202913 -33.86803834336524),"
+ "(-15.440268307843084 -24.82560063405746,-33.11063724365916 -30.227166517161177,-35.22563117058885 -28.832160994115174,-15.440268307843084 -24.82560063405746),"
+ "(-110.06713343754421 -53.75156377977681,-133.70536993886762 -54.03818707453698,-134.92982691302475 -49.02232991848598,-110.98866705210969 -44.17423216097226,-107.81630674108442 -53.06352104066732,-110.06713343754421 -53.75156377977681),"
+ "(-33.13242765496227 -30.23380803484376,-53.47598660261661 -36.452516973556065,-67.09295594277563 -35.28529916770173,-35.25002833910638 -28.837083149550402,-33.13242765496227 -30.23380803484376),"
+ "(-53.520970953712265 -36.466267226310144,-58.2354762927896 -37.90741924457058,-71.67669094887043 -36.21351002448205,-67.15404194693704 -35.29766922081722,-53.520970953712265 -36.466267226310144),"
+ "(-58.27645089887022 -37.919936120256196,-107.79952065899286 -53.05836684358259,-110.97130478081613 -44.1706925069293,-71.73052957001556 -36.22440573167339,-58.27645089887022 -37.919936120256196),"
+ "(-110.1268958664014 -53.769831619846144,-132.12902100408343 -60.495532046101545,-133.70109935980145 -54.05568104535152,-110.1268958664014 -53.769831619846144),"
+ "(-15.266747577272781 -24.772564602869423,-35.24640100751268 -28.818461646399513,-76.15530720021192 -1.8358005614142456,-86.14108983925057 19.847703882307872,-83.40496813166878 23.48084268412572,-64.0088883758489 6.425625058377867,-64.00760096344138 6.424685804640387,-64.00616485098435 6.4239950012666585,-64.00462744803231 6.423575453351113,-64.00303950798461 6.423441011187763,-64.00145345259266 6.42359611303842,-63.99992164139084 6.4240356386149005,-63.998494643181274 6.424745078112161,-63.99721956663504 6.4257010112121415,-63.996138505120754 6.42687188024526,-63.995287147100356 6.428219031985601,-63.994693597966496 6.429697993687634,-63.99437745221531 6.431259941239379,-63.99434914658464 6.432853310964729,-65.04832015933097 20.80381197052364,-41.89536979911647 15.900886582972497,-15.260289088462184 -24.770575950704515,-15.266747577272781 -24.772564602869423),"
+ "(-103.34718678997828 -53.67007971050907,-54.4974791531819 -38.39617545176479,-48.5956002477636 -39.13996827390118,-92.94911174811018 -53.54399645486019,-103.34718678997828 -53.67007971050907),"
+ "(-31.60797852622848 -31.239302626156118,-29.186203265828524 -32.836654666187016,-43.067588267658635 -37.344718300390326,-49.39887467327895 -36.801998383222546,-31.60797852622848 -31.239302626156118),"
+ "(-49.44306980595738 -36.81581628610981,-43.11047066152018 -37.358644575644625,-48.55637966222821 -39.12723118950323,-54.45715723826972 -38.38357632163891,-49.44306980595738 -36.81581628610981),"
+ "(-103.40555982520841 -53.68833070320558,-93.00523491310064 -53.562222737803324,-106.10185774557723 -57.815397753737585,-107.15619821197518 -54.861024333167755,-103.40555982520841 -53.68833070320558),"
+ "(23.61518017648848 -16.91683756790308,26.50528396128093 -16.33157619705981,42.94251839317316 -26.78946994271238,42.92206386339187 -26.800842478829786,23.61518017648848 -16.91683756790308),"
+ "(45.291790447718896 -28.01400696853263,64.11042508815196 -24.093836502795284,67.31540237012506 -26.10568053911328,51.48947303426359 -31.186856314772136,45.291790447718896 -28.01400696853263),"
+ "(80.89532917461274 -38.11504345691095,85.72360464810268 -37.66099230023744,91.54967590863684 -41.31818491465435,86.63190829943045 -44.27761401903968,80.89532917461274 -38.11504345691095),"
+ "(55.207151814658104 -10.519422962708234,63.930538194951616 -8.75294135555174,68.40404830643757 -12.643844730861389,61.009133000867436 -16.752229759599903,55.207151814658104 -10.519422962708234),"
+ "(67.23698237538382 -23.44253327219278,78.19510992588658 -21.159810385859345,79.41506647143727 -22.220883708516908,69.16366426579913 -25.51226555715126,67.23698237538382 -23.44253327219278),"
+ "(67.22302522687737 -23.42752227367621,61.02145616510926 -16.765450706696242,68.4181386751373 -12.656083874105,78.17850565684051 -21.14535081755846,67.22302522687737 -23.42752227367621),"
+ "(96.07462679974704 -36.687606632181144,96.22981908999839 -36.67300010138628,96.16231350114971 -36.76386105410172,96.07462679974704 -36.687606632181144),"
+ "(78.21666949675688 -21.155319242128968,91.07942965547718 -18.475847420826167,79.43458494021817 -22.214616982017457,78.21666949675688 -21.155319242128968),"
+ "(78.20006522772039 -21.140859673826085,68.43444397509445 -12.647025156396275,120.67073097659974 16.373831825187075,138.40226861975972 21.917962128038926,139.5590597714433 21.64715021353345,115.5981191196391 -10.603717556458868,91.2383062237693 -18.424837476765795,78.20006522772039 -21.140859673826085),"
+ "(96.05634598878443 -36.67170655960538,79.60266151961639 -22.360812613230724,92.37994996465073 -18.204936463794787,113.16809212086675 -13.874478509513061,96.24389265779745 -36.65405740641633,96.05634598878443 -36.67170655960538),"
+ "(45.58859841303463 -12.467188312478434,56.44996967273963 -19.285159155930536,42.959952931426386 -26.779771024798904,26.53006557073263 -16.326551720595333,45.58859841303463 -12.467188312478434),"
+ "(63.3670170846453 -39.76339728257143,80.8732966434185 -38.11712042833085,86.61655030813772 -44.286856197611016,80.54514164778 -47.94052691203084,75.54588157567393 -47.51198000904026,63.3670170846453 -39.76339728257143),"
+ "(75.57785867637746 -47.53232486223543,80.5195359645405 -47.95593597773675,78.32209776055991 -49.27831700358555,75.57785867637746 -47.53232486223543),"
+ "(44.99652318342139 -28.0755150444964,45.2644170651957 -28.01970920611602,51.48470250967003 -31.204123952853422,51.48629912522756 -31.20475275015989,51.48798761440433 -31.205058644898525,51.489703348260264 -31.20502992858282,51.49138065503266 -31.20466770036407,67.3348255051565 -26.117868279807055,67.56007186320271 -26.259277902547574,50.7404020749334 -31.72995854149191,44.99652318342139 -28.0755150444964),"
+ "(63.338554000982406 -39.76607948751283,75.50811715621062 -47.508744406950505,26.068801349075883 -43.27092792395031,63.338554000982406 -39.76607948751283),"
+ "(75.54009425476244 -47.5290892587767,78.31727689644644 -49.29602159154496,78.31871625003048 -49.29676048598416,78.32026683409454 -49.297222430561355,78.32187588641662 -49.29739170654002,78.32348865525648 -49.29726255391205,78.32505026241076 -49.29683936739541,78.32650757057118 -49.296136546893635,80.54932723087974 -47.95848139128968,87.408400175649 -48.54642481376636,82.1668571223638 -55.601419868886786,2.1628596589493014 -45.519030305358946,10.670127334892323 -44.719016219466,10.478355937853271 -44.825558445303535,10.477022945408265 -44.82646895355328,10.475879396234872 -44.82760833470957,10.474964026699563 -44.82893799359257,10.474307843855296 -44.830412889591,10.473933075114516 -44.83198306235927,10.473852415322028 -44.83359532416468,10.474068596732254 -44.835195061558494,10.474574296457355 -44.83672808534152,10.475352384521349 -44.838142466158686,10.47637650411764 -44.8393902935441,10.47761196441446 -44.84042929883103,10.47901691566548 -44.841224286952674,10.480543766820137 -44.8417483286331,10.482140797613786 -44.84198367258443,10.483753910530092 -44.84192234681058,10.485328463289965 -44.841566428649095,10.940150803529534 -44.693633216985006,25.970875452212482 -43.28014013939624,75.54009425476244 -47.5290892587767),"
+ "(44.97189605739587 -28.080645200533002,50.71876939527397 -31.736994677353735,17.512462576017413 -42.53750991301251,15.017806026020082 -42.32364842620168,38.064721701858005 -29.51950096385712,44.97189605739587 -28.080645200533002),"
+ "(63.31443324277529 -39.750733090438565,25.97083832848871 -43.262530741061205,17.557355750597907 -42.54135463818072,50.737959125026705 -31.74919957485254,63.31443324277529 -39.750733090438565),"
+ "(85.75231357643165 -37.6583020340463,96.05049525434477 -36.68986655103241,96.15182157912969 -36.77798293714598,93.77244835997257 -39.980558168609235,91.56652005301999 -41.308048394369706,85.75231357643165 -37.6583020340463),"
+ "(45.61355673842014 -12.462143693709407,55.186990966922515 -10.523510597075763,60.993339532379515 -16.76100411965765,56.46747536013181 -19.27543354028412,45.61355673842014 -12.462143693709407),"
+ "(64.13520076257863 -24.088675402162217,67.2169128156077 -23.446714026907344,69.14521649458379 -25.51818851852844,67.33723331195878 -26.098671354979363,64.13520076257863 -24.088675402162217),"
+ "(64.11378371141129 -24.075218400024625,56.48444685596549 -19.286072018869127,61.00566269662134 -16.774225066753985,67.20295566340234 -23.431703029161305,64.11378371141129 -24.075218400024625),"
+ "(45.591992977695206 -12.448607551276503,42.82001730414031 -10.708559948596815,50.72722514027072 -5.7325837246547025,55.17296905968835 -10.508447510846764,45.591992977695206 -12.448607551276503),"
+ "(90.83906500907895 -48.82288432501792,87.44124588861607 -48.531629462280534,88.82907600317388 -46.66364240274166,90.83906500907895 -48.82288432501792),"
+ "(23.58758948005409 -16.922419734971612,42.90360027945853 -26.81109719825043,38.05849031533148 -29.502880586949516,-6.114132515913077 -38.70463297488126,-12.88506814740878 -28.365491980870296,10.5740180759243 -19.557686478564662,23.58758948005409 -16.922419734971612),"
+ "(-3.2757307439501204 -22.362271881443974,-14.515075742325166 -25.876489092295138,-15.231034498305647 -24.783228289527237,-3.2757307439501204 -22.362271881443974),"
+ "(-103.408268267121 -53.67082036628739,-107.56298077416507 -53.72117660087794,-107.79361648076426 -53.07491097499442,-58.233960524270685 -37.92529090694332,-54.5393407101279 -38.390899910893495,-103.408268267121 -53.67082036628739),"
+ "(-31.626870337402607 -31.22684198473644,-49.444973181371616 -36.79804691662782,-53.42912203896892 -36.45653410481242,-33.113427002687885 -30.246340465564593,-31.626870337402607 -31.22684198473644),"
+ "(-49.48916830524817 -36.811864820269555,-54.49901880228574 -38.378300779876625,-58.192985934280664 -37.912774029229915,-53.47410637084559 -36.47028435921391,-49.48916830524817 -36.811864820269555),"
+ "(-31.605236430328155 -31.220097240155404,-33.0916365938955 -30.239698946225996,-15.262540010301606 -24.789610509222257,-15.249551258319446 -24.786972494086065,-14.532484538870866 -25.881925144352813,-31.605236430328155 -31.220097240155404),"
+ "(-103.46664127579638 -53.6890713586619,-107.16209180873788 -54.84450985214174,-107.55674612108137 -53.73864675776175,-103.46664127579638 -53.6890713586619),"
+ "(-110.00462741884331 -53.750805850432336,-107.81040256225506 -53.08006517376252,-107.58151701429983 -53.72142667015059,-110.00462741884331 -53.750805850432336),"
+ "(-110.06438982504433 -53.76907369022695,-107.57528236121614 -53.738896827034395,-107.1788402567078 -54.84976950401287,-153.2430747370277 -69.25271687255216,-141.87272856231922 -54.15476717032229,-133.71910155050836 -54.055905624595034,-132.14385744166628 -60.508724794743074,-132.14334419803262 -60.51022379344769,-132.14256964852405 -60.511605997919794,-132.14155906878108 -60.51282630309763,-132.14034543674777 -60.513844887130325,-132.1389683565123 -60.514628510872285,-132.1374727659187 -60.51515160256623,-132.13590747012384 -60.51539709231865,-132.13432354895338 -60.51535696913649,-132.13277269002927 -60.51503254234744,-110.06438982504433 -53.76907369022695),"
+ "(-27.592871920864 -33.887582518965544,-19.25708965943322 -39.38568922534542,-37.965533667372725 -37.78204018761589,-27.592871920864 -33.887582518965544),"
+ "(-38.0037121954104 -37.796373821125144,-19.22641600937537 -39.405920919960636,-12.821155357361697 -43.63069616509796,-43.309481338204634 -39.78844570828592,-38.0037121954104 -37.796373821125144),"
+ "(-43.34475623878629 -39.801680880936765,-12.788017983898143 -43.65255287986782,-8.469056186486533 -46.50124926830628,-78.80591177161446 -53.11570776137347,-43.34475623878629 -39.801680880936765),"
+ "(-27.572549585136507 -33.87997268950195,-12.901902948535914 -28.37180451734392,-6.125539187747014 -38.71923420248274,-6.124615012752566 -38.72041215386896,-6.1235039573952275 -38.72141575980836,-6.12223839702193 -38.72221577595208,-6.120855209143663 -38.72278889041018,-6.119394698851558 -38.7231184030432,-6.11789942435578 -38.723194712092116,-6.116412956870168 -38.72301559396661,38.006907672851085 -29.531544390670412,14.986494714540797 -42.320976703350695,-19.220444896885056 -39.3888453254074,-27.572549585136507 -33.87997268950195),"
+ "(163.85356981584565 38.01045640606598,150.78183751989167 33.1026264373484,160.43346758187292 38.46477202131451,163.85356981584565 38.01045640606598),"
+ "(127.70830325425007 24.439550041637304,106.54590505913245 29.393902120191427,119.4559466211646 37.51814283753344,144.37633145980607 40.59773643801638,160.4042990486444 38.46863420514055,150.67036889056672 33.060765246572494,127.70830325425007 24.439550041637304),"
+ "(137.87665775262624 22.04101325621122,122.3018982810747 17.280057664991475,132.94821653533805 23.194814080812744,137.87665775262624 22.04101325621122),"
+ "(137.91007347628613 22.051206470998714,132.97106197457936 23.207481912287477,150.67791335246926 33.044889401030915,163.89246423334544 38.00632192281352,163.89395437188944 38.00704878327708,163.89528110506717 38.00804307603519,163.89639702613067 38.00926927308045,163.89726226105742 38.01068356001573,163.89784589332643 38.0122354016276,163.8981270686255 38.01386934760742,163.89809574001623 38.01552701389832,163.8977530269305 38.01714916887077,163.8971111751712 38.018677849783465,163.8961931193457 38.020058433904424,163.8950316633681 38.02124159028708,163.89366830831162 38.02218504246065,163.892151769495 38.02285507905031,163.8905362357896 38.02322775835002,160.45914599302486 38.479038148184,164.20988616119448 40.562819558817196,165.3016644430351 30.424412023824377,137.91007347628613 22.051206470998714),"
+ "(138.43525780056368 21.928255201073114,165.3116438348011 30.33174198050335,171.7604175947424 -29.552483202131402,99.90657434057331 -36.30961852717998,149.90557033770168 -6.2210711003068075,149.90688874767233 -6.220099211525472,149.9080034680365 -6.2188991402094,149.90887562498716 -6.217512736621926,149.90947480366685 -6.215988349019058,149.9097801088294 -6.214379137593647,149.90978089352305 -6.212741220612166,149.90947713038307 -6.211131717394169,149.90887941258603 -6.209606756381856,149.9080085844325 -6.20821951776467,149.90689501444066 -6.207018378918731,149.90557753630043 -6.206045227335496,149.90410209462055 -6.205333999873108,149.90252014269552 -6.204909499271364,149.90088684816726 -6.204786529202118,149.89925916915584 -6.204969378018662,113.2096851912215 -13.847909418407404,115.57854716414471 -10.659476291875812,122.98695766373115 -8.24983286863276,122.99248836987037 -8.24805714415804,122.99248165360493 -8.248036225546489,122.99252002096307 -8.24804691580876,122.99409329720051 -8.247358404482963,122.99550225424824 -8.246376525670339,122.99669287690277 -8.24513892167087,122.99761952024896 -8.243693038524139,122.99824665954954 -8.242094307069925,122.99855025215751 -8.240404017895434,122.9985186592394 -8.238686971637309,122.99815309197326 -8.237008994718828,122.99746756511585 -8.235434415761524,122.99648835971863 -8.234023599418036,122.99525301559079 -8.232830632171684,122.99380889213523 -8.231901248822297,122.99221135273041 -8.231271079150648,122.99052164226393 -8.230964281979102,122.98880453918649 -8.230992618994556,122.98712587209964 -8.231355003840502,122.98709746667338 -8.231375211028098,122.98709422100694 -8.23136523218978,122.98445994390397 -8.232210944081352,115.62680134884883 -10.59450865345169,139.5811057192091 21.647409332212078,139.58192836390296 21.648754158529584,139.58249698017912 21.650224525030524,139.58279319818183 21.651772929697092,139.58280744822028 21.653349349391526,139.58253926992927 21.65490285591575,139.58199732714186 21.65638326131015,139.58119912799356 21.65774273923798,139.5801704593002 21.65893737007465,139.5789445534828 21.659928559785786,139.5775610149529 21.660684286755505,139.57606454064265 21.661180136284507,138.43525780056368 21.928255201073114),"
+ "(-11.672901457713799 61.32672411402214,90.98812319335303 47.68960389094599,84.7626026713778 42.82467865599619,70.29932468799596 37.879602651101656,-6.606416144696235 55.884063056220455,-11.672901457713799 61.32672411402214),"
+ "(21.731752401457072 25.441649913510176,24.257151920623585 25.753718243894582,27.241673724801043 23.15789335269138,24.67466474051967 22.280215188935983,21.731752401457072 25.441649913510176),"
+ "(27.27614200608447 23.151139413488384,40.90533858676494 27.81105618886412,88.24260741703002 33.66087553733939,106.50102688198155 29.386386724583776,56.37475342083092 -2.1578890939673077,27.27614200608447 23.151139413488384),"
+ "(24.280548333299286 25.756617557996357,40.820431510930504 27.800564754617064,27.26084581815643 23.16444842429204,24.280548333299286 25.756617557996357),"
+ "(-8.816428652507156 21.684268290604805,-29.245606398615163 19.15968622376516,-30.746990152471433 20.114940195264964,-31.488293120007164 35.91601695199151,-8.816428652507156 21.684268290604805),"
+ "(-29.272966059430175 19.15630519150303,-30.693779343676994 18.980737162403244,-30.745984888163573 20.09351270989812,-29.272966059430175 19.15630519150303),"
+ "(-8.765268372199529 21.672915212812164,21.710263177057982 25.43898929273592,24.6564884472217 22.274000588276877,2.399797039244074 14.664283533978011,-8.765268372199529 21.672915212812164),"
+ "(-11.719020876527594 61.35052257161079,-32.813002816538585 64.15256868853093,-33.794092220123524 85.06475931794377,-11.719020876527594 61.35052257161079),"
+ "(138.36863398834245 21.92583635515323,120.74643517661659 16.41589072499998,122.22857097659741 17.23931929444039,137.91059951928324 22.033067125450867,138.36863398834245 21.92583635515323),"
+ "(138.40162314694612 21.936129433384743,137.94401525032401 22.043260338510414,165.30357425200395 30.40667726763579,165.30972750566778 30.349537283861128,138.40162314694612 21.936129433384743),"
+ "(127.7390129190668 24.432360580502113,150.56644469028546 33.00302819199967,132.94563868010746 23.21343377755938,127.7390129190668 24.432360580502113),"
+ "(-161.35503387993074 -54.37346556730929,-138.5871756703948 -49.76293390065463,-141.88154531641396 -54.13731498386075,-161.35503387993074 -54.37346556730929),"
+ "(-35.27079817688228 -28.823383801272726,-67.15508315200245 -35.279973754753655,-104.45438672212283 -32.08275635744238,-104.45608427388785 -32.08277574513043,-104.45774629244461 -32.083121797430444,-104.45931051252892 -32.08378154996377,-104.46071833276328 -32.084730285999285,-104.46191701107783 -32.08593246243208,-104.46286164062022 -32.08734304135757,-104.46351683212971 -32.088909177355255,-104.46385803974773 -32.09057219727058,-104.46387248059507 -32.0922697983248,-104.46355961366501 -32.09393838220386,-104.46293116009147 -32.09551543768267,-104.46201066403262 -32.096941882523176,-104.46083261062104 -32.09816427690997,-104.4594411340252 -32.0991368255003,-104.45788836402274 -32.099823093084304,-104.45623247302943 -32.10019736958055,-71.78503500133692 -36.217536765212955,-110.97726480920838 -44.153991877456086,-118.48907838644061 -23.105096307062404,-86.1530711337859 19.831784241114434,-76.17018886097277 -1.845422238170359,-76.16937610532348 -1.846827817505229,-76.16831819663724 -1.848059505056384,-76.1670513874113 -1.8490750932589226,-35.27079817688228 -28.823383801272726),"
+ "(-104.01746970265641 -32.1378111596404,-67.21616917021902 -35.29234380666436,-71.7311963690772 -36.20664105942231,-104.01746970265641 -32.1378111596404),"
+ "(-19.189771245865394 -39.40907702065701,14.959045315399937 -42.33622673608511,10.708277693154 -44.69782106654718,2.082853933046394 -45.50894770194591,-12.781743251109447 -43.63567754687929,-19.189771245865394 -39.40907702065701),"
+ "(25.87291249723667 -43.271742962131206,11.016303004296148 -44.66886433771501,17.514523291044114 -42.55528610711852,25.87291249723667 -43.271742962131206),"
+ "(-12.74860587593394 -43.65753426277832,2.0024981350794633 -45.51650162110258,-8.441149421139997 -46.49864196914455,-12.74860587593394 -43.65753426277832),"
+ "(0.5482054515958907 -52.42783142752352,22.844877876175584 -52.15747591132524,42.52338780560707 -80.11376900277862,0.5482054515958907 -52.42783142752352),"
+ "(70.30021875120347 37.86136945403442,88.19316357634735 33.672450869505475,40.98637445712528 27.838762914602786,70.30021875120347 37.86136945403442),"
+ "(70.33149133386337 37.8720617667972,84.7697194975705 42.80859204783613,84.77105909891975 42.80917893165259,84.77228255716334 42.80998025200993,91.0124858249585 47.68637930033897,127.81301147359562 42.79793866689235,119.44990642462011 37.5350680374038,88.24355226977912 33.67867053045407,70.33149133386337 37.8720617667972),"
+ "(144.3073988767456 40.60689326310742,119.4909083116505 37.540144098182196,127.84021527260577 42.79433164264914,144.3073988767456 40.60689326310742),"
+ "(88.29299612070747 33.66709519588936,119.4149447434929 37.5130667826444,106.52189974628405 29.399521939775685,88.29299612070747 33.66709519588936),"
+ "(144.44527145744826 40.60625585489642,163.9457022420348 43.01606879557336,164.20784624646586 40.58176249549163,160.4299774597963 38.482900332010054,144.44527145744826 40.60625585489642),"
+ "(144.37633892649745 40.61541268642703,127.86340960426224 42.808927748536924,161.67658544228874 64.08740831841152,163.94382395897412 43.0335107977197,144.37633892649745 40.61541268642703),"
+ "(-41.90900718265291 15.92171071110581,-65.04965636135107 20.822031166079725,-65.63127790159731 28.752476130223627,-42.58516701826829 16.9541990192793,-41.90900718265291 15.92171071110581),"
+ "(-42.60459058740299 16.983858586408623,-65.63278027468877 28.772961078412454,-66.67261586220584 42.95118235795973,-54.565741638677004 35.24839895429071,-42.60459058740299 16.983858586408623),"
+ "(-54.58907517986818 35.28402900387246,-66.6742146811002 42.97298235051845,-66.98910868886206 47.26628926429717,-62.12011091968531 46.783833855102905,-54.58907517986818 35.28402900387246),"
+ "(-54.55313781876444 35.261172150516714,-62.097702142309025 46.78161343185131,-46.30482922656958 45.2167417013382,-31.506387108397742 35.92737383993618,-30.76509132865387 20.12645029297113,-54.55313781876444 35.261172150516714),"
+ "(-97.83416987317577 45.238498178710174,-65.64955249400556 28.76182418273821,-65.06752232404301 20.825807527637693,-82.6206997737451 24.54292980246981,-82.62234422414674 24.543118386846405,-82.62399482199257 24.54299466157833,-82.62559278256681 24.54256303304157,-82.62708119578785 24.541838873339582,-82.62840705301502 24.540847972838158,-82.62952313490874 24.539625621662307,-83.40757403122092 23.506493075556897,-90.83289438322406 30.035664942125123,-97.83416987317577 45.238498178710174),"
+ "(-82.61888709171882 24.52458915191082,-65.06618612106601 20.80758831903435,-64.01341032562904 6.452926519952804,-83.39437198775232 23.49488435218103,-82.61888709171882 24.52458915191082),"
+ "(-65.65105486819753 28.782309145932423,-97.84873506427972 45.26564377964443,-97.85028505214999 45.266259170730656,-97.8519235011197 45.266570062288324,-97.85359117767403 45.26656521490745,-97.85522779165703 45.26624480383146,-97.85677417589265 45.26562041262175,-97.85817442520765 45.26471461438658,-97.85937791752582 45.263560155713826,-97.86034114396688 45.26219877281023,-97.86102928178767 45.260679682646156,-97.86141745330046 45.259057803654485,-97.86149162525584 45.25739177030908,-97.86124911617533 45.255741813360295,-97.86069869329278 45.254167582361575,-90.86536170723733 30.064229436755205,-122.87031432291771 58.20657846684874,-122.87160397462488 58.20751906037725,-122.87304273757687 58.20821034821862,-122.87458295968815 58.20862943479625,-122.87617362852775 58.20876243988797,-122.87776206086001 58.208604958341404,-122.87929564752282 58.20816220597348,-122.88072359585243 58.20744884682156,-122.88199861194552 58.20648850746798,-122.88307846704171 58.20531299452339,-122.88392739614764 58.203961241186136,-122.88451728257994 58.20247801776782,-122.88482858919475 58.20091244889254,-128.50870223166575 4.921332760433136,-128.50874214078485 4.920024935850124,-128.5085870504444 4.918725726527491,-128.508240412044 4.917464045229747,-118.50876745117507 -23.102116039964123,-135.68859242632564 -45.914092066443295,-166.90162006241783 81.94670439205376,-32.82983975785978 64.13713127225718,-31.507388935807747 35.94872806687944,-46.297243998766895 45.232694686742164,-46.298438120776574 45.23332182175007,-46.29971427817714 45.23375845429706,-46.30104229243783 45.233994258910144,-62.110046067823596 46.80046435131626,-67.56717234515712 55.133453500144235,-67.56820100882734 55.134741527678834,-67.56945250271089 55.1358143403073,-67.5708826237989 55.13663404607767,-67.5724408599347 55.13717169282173,-67.5740721739131 55.13740829075129,-67.57571894740512 55.137335483181175,-67.57732301604885 55.136955841689016,-67.57882772382588 55.13628277528659,-67.5801799241631 55.13534005681094,-67.58133185708003 55.13416098326309,-67.58224283608062 55.13278719975146,-67.58288068520834 55.1312672285785,-67.58322287550715 55.12965475542346,-67.58325732074876 55.12800673315368,-67.00809756718309 47.28579861360277,-74.64384103040652 48.042403137098944,-74.64551355318005 48.04240861420995,-74.64715670691223 48.04209651127949,-74.6487107421129 48.04147817720973,-74.6501191498815 48.04057609629091,-74.65133071672265 48.039423070612024,-74.65230138680663 48.03806102728863,-74.6529958639579 48.03653949388014,-74.65338889511892 48.03491379743455,-74.65346618861936 48.03324305264807,-74.6532249338596 48.0315880122958,-74.65267390351174 48.03000885809735,-74.65183313452161 48.028563012347625,-74.65073319951154 48.02730304988773,-74.64941409507755 48.02627478634224,-66.69106576546662 42.962920784577285,-65.65105486819753 28.782309145932423),"
+ "(-74.60894342391143 48.02131743628841,-67.00680717272054 47.268042957701205,-66.69266458534088 42.98472079049692,-74.60894342391143 48.02131743628841),"
+ "(-138.56127670492663 -49.7577037198288,-134.94703094520807 -49.02582406883465,-133.72337212957453 -54.038411653780486,-141.85939298329575 -54.13705971460783,-138.56127670492663 -49.7577037198288),"
+ "(-134.93399269617888 -49.00526523292734,-135.68321498734667 -45.93611109773349,-118.50171193441933 -23.121886343614484,-110.99462708067594 -44.15753153101153,-134.93399269617888 -49.00526523292734),"
+ "(-138.54536289076012 -49.736572791872405,-135.69686656519858 -45.95423814792149,-134.95119672848287 -49.00875938278158,-138.54536289076012 -49.736572791872405),"
+ "(88.82755353245742 -46.63627739859524,86.64413783102847 -44.29072778657896,91.56634116238342 -41.32862933986829,92.38779164183632 -41.84427969841862,88.82755353245742 -46.63627739859524),"
+ "(96.17559112847069 -36.775403890830276,96.2533145203432 -36.670790012864686,99.8315395547437 -36.33429989598129,97.37090375596762 -37.815068768540016,96.17559112847069 -36.775403890830276),"
+ "(92.39828457197696 -41.83015645846746,91.58318530508117 -41.31849282059788,93.74495703397014 -40.01757527428385,92.39828457197696 -41.83015645846746),"
+ "(96.16509920779882 -36.78952577205994,97.35510564997305 -37.824575800671205,93.81196732309566 -39.95677632714469,96.16509920779882 -36.78952577205994),"
+ "(88.81691795134695 -46.65059264343438,87.42069611419876 -48.52987476642635,80.5749329147718 -47.94307232519108,86.62877983973574 -44.29996996515029,88.81691795134695 -46.65059264343438),"
+ "(69.32473564139825 -25.685312296376537,69.17686596344828 -25.526450792983923,79.43054197209301 -22.234338902371594,79.56777154519035 -22.35371429782551,69.32473564139825 -25.685312296376537),"
+ "(79.58722163711042 -22.347388059401556,79.45006045094098 -22.22807217263994,91.24299727724733 -18.441755195353803,92.22218393874856 -18.237804190782946,79.58722163711042 -22.347388059401556),"
+ "(67.58180682559251 -26.252208498722716,67.35665645137476 -26.110859094265415,69.15841818541341 -25.532373756550623,69.30634307855388 -25.691294568247503,67.58180682559251 -26.252208498722716),"
+ "(10.713631867610786 -44.714913767695485,10.86035670084666 -44.70114019099129,10.566326319189315 -44.7967750242813,10.713631867610786 -44.714913767695485),"
+ "(14.990356626143694 -42.338898459344726,17.469630118109404 -42.551441381415,10.93650885434335 -44.676371327096064,10.75178223878234 -44.69371860760433,14.990356626143694 -42.338898459344726),"
+ "(113.19393813942808 -13.869104583916076,149.85225961536605 -6.232679296303189,99.86624158413852 -36.31341680350249,96.26738808398915 -36.65184732348474,113.19393813942808 -13.869104583916076),"
+ "(113.18383917989723 -13.853283334263445,92.53313651295461 -18.155111782662388,115.54974201699517 -10.668833135736556,113.18383917989723 -13.853283334263445),"
+ "(163.96311491920022 43.01821047323797,169.91789145903348 43.754090361605556,164.22449464723803 40.59100135183526,163.96311491920022 43.01821047323797),"
+ "(92.37537042521268 -18.187979529764235,91.40187377110232 -18.3907452751927,115.58013059889898 -10.627916926612096,115.56781674564326 -10.64450497131272,92.37537042521268 -18.187979529764235),"
+ "(-86.16139825386244 19.849866063211905,-118.49613390319635 -23.085326003412035,-128.4910459077906 4.921493651135869,-122.86916414947727 58.18220258298618,-90.8472856693717 30.0249784474685,-86.16139825386244 19.849866063211905),"
+ "(-86.14941695432584 19.865785693545394,-90.81481832588861 29.996413910560918,-83.41817017513736 23.49245140750158,-86.14941695432584 19.865785693545394),"
+ "(-106.11264211278916 -57.83736939023901,-100.24152662041178 -74.28881727173125,-161.4303237477923 -75.80205692190154,-106.11264211278916 -57.83736939023901),"
+ "(-67.56328532753739 55.095514517777545,-62.132454845199874 46.802684774567844,-66.99039908239888 47.28404492010701,-67.56328532753739 55.095514517777545),"
+ "(115.59662188220229 -10.635148141706566,115.6088128566935 -10.618708014427298,118.58211270640945 -9.664081031738045,115.59662188220229 -10.635148141706566)))";
+ std::string msg;
+ CG mpoly = from_wkt<CG>(wkt);
+ bg::correct(mpoly);
+
+ BOOST_CHECK_MESSAGE(bg::is_valid(mpoly, msg), msg);
+ }
+#endif // BOOST_GEOMETRY_TEST_ENABLE_FAILING
}
BOOST_AUTO_TEST_CASE( test_is_valid_multipolygon )
@@ -892,6 +1115,38 @@ BOOST_AUTO_TEST_CASE( test_is_valid_multipolygon )
test_open_multipolygons<point_type, do_not_allow_duplicates>();
}
+BOOST_AUTO_TEST_CASE( test_geometry_with_NaN_coordinates )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl;
+ std::cout << "************************************" << std::endl;
+ std::cout << " is_valid: geometry with NaN coordinates" << std::endl;
+ std::cout << "************************************" << std::endl;
+#endif
+
+ linestring_type ls1, ls2;
+ bg::read_wkt("LINESTRING(1 1,1.115235e+308 1.738137e+308)", ls1);
+ bg::read_wkt("LINESTRING(-1 1,1.115235e+308 1.738137e+308)", ls2);
+
+ // the intersection of the two linestrings is a new linestring
+ // (multilinestring with a single element) that has NaN coordinates
+ multi_linestring_type mls;
+ bg::intersection(ls1, ls2, mls);
+
+ typedef validity_tester_linear<true> tester_allow_spikes;
+ typedef validity_tester_linear<false> tester_disallow_spikes;
+
+ test_valid
+ <
+ tester_allow_spikes, multi_linestring_type
+ >::apply("mls-NaN", mls, true);
+
+ test_valid
+ <
+ tester_disallow_spikes, multi_linestring_type
+ >::apply("mls-NaN", mls, true);
+}
+
BOOST_AUTO_TEST_CASE( test_is_valid_variant )
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
diff --git a/libs/geometry/test/algorithms/multi_length.cpp b/libs/geometry/test/algorithms/length_multi.cpp
index 5d94be1584..3738665f1b 100644
--- a/libs/geometry/test/algorithms/multi_length.cpp
+++ b/libs/geometry/test/algorithms/length_multi.cpp
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, 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)
@@ -8,15 +8,8 @@
#include <algorithms/test_length.hpp>
-#include <boost/geometry/multi/multi.hpp>
-
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-
-#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
-
template <typename P>
diff --git a/libs/geometry/test/algorithms/maximum_gap.cpp b/libs/geometry/test/algorithms/maximum_gap.cpp
new file mode 100644
index 0000000000..d73e4b04a5
--- /dev/null
+++ b/libs/geometry/test/algorithms/maximum_gap.cpp
@@ -0,0 +1,139 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2015, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
+// Contributed and/or modified by Adam Wulkiewicz, 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_maximum_gap
+#endif
+
+#include <boost/test/included/unit_test.hpp>
+
+#include <cstddef>
+
+#include <iostream>
+#include <sstream>
+#include <vector>
+
+#include <boost/geometry/algorithms/detail/max_interval_gap.hpp>
+
+namespace bg = boost::geometry;
+
+class uint_interval
+{
+public:
+ typedef unsigned value_type;
+ typedef int difference_type;
+
+ uint_interval(unsigned left, unsigned right)
+ : m_left(left)
+ , m_right(right)
+ {}
+
+ template <std::size_t Index>
+ value_type get() const
+ {
+ return (Index == 0) ? m_left : m_right;
+ }
+
+ difference_type length() const
+ {
+ return static_cast<int>(m_right) - static_cast<int>(m_left);
+ }
+
+private:
+ unsigned m_left, m_right;
+};
+
+struct uint_intervals
+ : public std::vector<uint_interval>
+{
+ uint_intervals()
+ {}
+
+ uint_intervals(unsigned left, unsigned right)
+ {
+ this->push_back(uint_interval(left, right));
+ }
+
+ uint_intervals & operator()(unsigned left, unsigned right)
+ {
+ this->push_back(uint_interval(left, right));
+ return *this;
+ }
+};
+
+std::ostream& operator<<(std::ostream& os, uint_interval const& interval)
+{
+ os << "[" << interval.get<0>() << ", " << interval.get<1>() << "]";
+ return os;
+}
+
+
+template <typename RangeOfIntervals>
+inline void test_one(std::string const& case_id,
+ RangeOfIntervals const& intervals,
+ typename boost::range_value
+ <
+ RangeOfIntervals
+ >::type::difference_type expected_gap)
+{
+ typedef typename boost::range_value<RangeOfIntervals>::type interval_type;
+ typedef typename interval_type::difference_type gap_type;
+
+ gap_type gap = bg::maximum_gap(intervals);
+
+ std::ostringstream stream;
+ for (typename boost::range_const_iterator<RangeOfIntervals>::type
+ it = boost::const_begin(intervals);
+ it != boost::const_end(intervals);
+ ++it)
+ {
+ stream << " " << *it;
+ }
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "intervals:" << stream.str() << std::endl;
+ std::cout << "gap found? " << ((gap > 0) ? "yes" : "no") << std::endl;
+ std::cout << "max gap length: " << gap << std::endl;
+ std::cout << std::endl << std::endl;
+#endif
+
+ BOOST_CHECK_MESSAGE(gap == expected_gap,
+ case_id << "; intervals: "
+ << stream.str()
+ << "; expected: " << expected_gap
+ << ", detected: " << gap);
+}
+
+BOOST_AUTO_TEST_CASE( test_maximum_gap )
+{
+ uint_intervals intervals;
+
+ intervals = uint_intervals(3,4)(1,10)(5,11)(20,35)(12,14)(36,40)(39,41)(35,36)(37,37)(50,50)(50,51);
+ test_one("case_01", intervals, 9);
+
+ intervals = uint_intervals(3,4)(1,10)(5,11)(20,35)(52,60)(12,14)(36,40)(39,41)(35,36)(37,37)(55,56);
+ test_one("case_02", intervals, 11);
+
+ intervals = uint_intervals(3,4);
+ test_one("case_03", intervals, 0);
+
+ intervals = uint_intervals(3,4)(15,15);
+ test_one("case_04", intervals, 11);
+
+ intervals = uint_intervals(3,14)(5,5)(5,6);
+ test_one("case_05", intervals, 0);
+
+ intervals = uint_intervals(3,10)(15,15)(15,18)(15,16);
+ test_one("case_06", intervals, 5);
+
+ intervals = uint_intervals(38,41)(3,10)(15,15)(15,18)(15,16)(20,30)(22,30)(23,30);
+ test_one("case_07", intervals, 8);
+}
diff --git a/libs/geometry/test/algorithms/multi_num_geometries.cpp b/libs/geometry/test/algorithms/num_geometries_multi.cpp
index bf7a3cee49..292e06ea93 100644
--- a/libs/geometry/test/algorithms/multi_num_geometries.cpp
+++ b/libs/geometry/test/algorithms/num_geometries_multi.cpp
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
-// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2011-2015 Barend Gehrels, 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)
@@ -8,16 +8,11 @@
#include <geometry_test_common.hpp>
#include <boost/geometry/algorithms/num_geometries.hpp>
-#include <boost/geometry/multi/algorithms/num_geometries.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
template <typename Geometry>
void test_geometry(std::string const& wkt, int expected)
diff --git a/libs/geometry/test/algorithms/multi_num_interior_rings.cpp b/libs/geometry/test/algorithms/num_interior_rings_multi.cpp
index 73fcdc1144..2f9991fe9d 100644
--- a/libs/geometry/test/algorithms/multi_num_interior_rings.cpp
+++ b/libs/geometry/test/algorithms/num_interior_rings_multi.cpp
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
-// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2011-2015 Barend Gehrels, 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)
@@ -8,16 +8,11 @@
#include <geometry_test_common.hpp>
#include <boost/geometry/algorithms/num_interior_rings.hpp>
-#include <boost/geometry/multi/algorithms/num_interior_rings.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
template <typename Geometry>
void test_geometry(std::string const& wkt, int expected)
diff --git a/libs/geometry/test/algorithms/num_points.cpp b/libs/geometry/test/algorithms/num_points.cpp
index 1c266d8aff..6d24f43f05 100644
--- a/libs/geometry/test/algorithms/num_points.cpp
+++ b/libs/geometry/test/algorithms/num_points.cpp
@@ -1,10 +1,10 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
-// Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
-// Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
-// Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
+// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,12 +15,9 @@
#include <geometry_test_common.hpp>
#include <boost/geometry/algorithms/num_points.hpp>
-#include <boost/geometry/multi/algorithms/num_points.hpp>
#include <boost/geometry/geometries/geometries.hpp>
-#include <boost/geometry/multi/geometries/multi_geometries.hpp>
#include <boost/geometry/io/wkt/read.hpp>
-#include <boost/geometry/multi/io/wkt/read.hpp>
template <std::size_t D, typename T = double>
struct box_dD
diff --git a/libs/geometry/test/algorithms/multi_num_points.cpp b/libs/geometry/test/algorithms/num_points_multi.cpp
index d43b71d47b..68b814e321 100644
--- a/libs/geometry/test/algorithms/multi_num_points.cpp
+++ b/libs/geometry/test/algorithms/num_points_multi.cpp
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
-// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2011-2015 Barend Gehrels, 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)
@@ -8,16 +8,14 @@
#include <geometry_test_common.hpp>
#include <boost/geometry/algorithms/num_points.hpp>
-#include <boost/geometry/multi/algorithms/num_points.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/geometries/multi_point.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/variant/variant.hpp>
diff --git a/libs/geometry/test/algorithms/overlay/Jamfile.v2 b/libs/geometry/test/algorithms/overlay/Jamfile.v2
index fc27dbf594..a062f32b43 100644
--- a/libs/geometry/test/algorithms/overlay/Jamfile.v2
+++ b/libs/geometry/test/algorithms/overlay/Jamfile.v2
@@ -1,30 +1,33 @@
# 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.
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
#
-# This file was modified by Oracle on 2014.
-# Modifications copyright (c) 2014 Oracle and/or its affiliates.
+# This file was modified by Oracle on 2014, 2015.
+# Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
+#
+# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
#
# 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
test-suite boost-geometry-algorithms-overlay
:
- [ run assemble.cpp ]
- [ run ccw_traverse.cpp ]
- [ run get_turn_info.cpp ]
- [ run get_turns.cpp ]
- [ run get_turns_areal_areal.cpp ]
- [ run get_turns_linear_linear.cpp ]
- [ run get_turns_linear_areal.cpp ]
- [ run multi_traverse.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE <define>BOOST_GEOMETRY_RESCALE_TO_ROBUST ]
- [ run relative_order.cpp ]
- [ run select_rings.cpp ]
- [ run self_intersection_points.cpp ]
- [ run traverse.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
+ [ run assemble.cpp : : : : algorithms_assemble ]
+ [ run get_turn_info.cpp : : : : algorithms_get_turn_info ]
+ [ run get_turns.cpp : : : : algorithms_get_turns ]
+ [ run get_turns_areal_areal.cpp : : : : algorithms_get_turns_areal_areal ]
+ [ run get_turns_linear_areal.cpp : : : : algorithms_get_turns_linear_areal ]
+ [ run get_turns_linear_linear.cpp : : : : algorithms_get_turns_linear_linear ]
+ [ run relative_order.cpp : : : : algorithms_relative_order ]
+ [ run select_rings.cpp : : : : algorithms_select_rings ]
+ [ run self_intersection_points.cpp : : : : algorithms_self_intersection_points ]
+ [ run traverse.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
+ : algorithms_traverse ]
+ [ run traverse_ccw.cpp : : : : algorithms_traverse_ccw ]
+ [ run traverse_multi.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
+ <define>BOOST_GEOMETRY_RESCALE_TO_ROBUST
+ : algorithms_traverse_multi ]
;
diff --git a/libs/geometry/test/algorithms/overlay/assemble.cpp b/libs/geometry/test/algorithms/overlay/assemble.cpp
index 262f32f982..7be262fd7f 100644
--- a/libs/geometry/test/algorithms/overlay/assemble.cpp
+++ b/libs/geometry/test/algorithms/overlay/assemble.cpp
@@ -83,9 +83,9 @@ inline void test_assemble(std::string const& id, Geometry const& p, Geometry con
type diff_d1 = (area_u - area_q) - area_d1;
type diff_d2 = (area_u - area_p) - area_d2;
- bool ok = abs(diff) < 0.001
- && abs(diff_d1) < 0.001
- && abs(diff_d2) < 0.001;
+ bool ok = bg::math::abs(diff) < 0.001
+ && bg::math::abs(diff_d1) < 0.001
+ && bg::math::abs(diff_d2) < 0.001;
BOOST_CHECK_MESSAGE(ok,
id << " diff: "
diff --git a/libs/geometry/test/algorithms/overlay/dissolver.cpp b/libs/geometry/test/algorithms/overlay/dissolver.cpp
index 28bd3e5600..c928fa7b35 100644
--- a/libs/geometry/test/algorithms/overlay/dissolver.cpp
+++ b/libs/geometry/test/algorithms/overlay/dissolver.cpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2010-2015 Barend Gehrels, 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
@@ -17,9 +17,8 @@
#include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/multi.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
-#include <boost/geometry/multi/io/wkt/read.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
#include <test_common/test_point.hpp>
diff --git a/libs/geometry/test/algorithms/overlay/get_turn_info.cpp b/libs/geometry/test/algorithms/overlay/get_turn_info.cpp
index 4d52b99331..2e94d2a47b 100644
--- a/libs/geometry/test/algorithms/overlay/get_turn_info.cpp
+++ b/libs/geometry/test/algorithms/overlay/get_turn_info.cpp
@@ -183,11 +183,8 @@ void test_both(std::string const& caseid,
//return;
- std::string reverse;
- for (int i = expected.size() - 1; i >= 0; i--)
- {
- reverse += expected[i];
- }
+ std::string reversed(expected.rbegin(), expected.rend());
+
if (ip_x2 >= 0 && ip_y2 >= 0)
{
std::swap(ip_x, ip_x2);
@@ -197,7 +194,7 @@ void test_both(std::string const& caseid,
test_with_point<P, double>(caseid + "_r",
qi_x, qi_y, qj_x, qj_y, qk_x, qk_y, // q
pi_x, pi_y, pj_x, pj_y, pk_x, pk_y, // p
- method, ip_x, ip_y, reverse, ip_x2, ip_y2);
+ method, ip_x, ip_y, reversed, ip_x2, ip_y2);
}
diff --git a/libs/geometry/test/algorithms/overlay/get_turns.cpp b/libs/geometry/test/algorithms/overlay/get_turns.cpp
index 504052df05..90cc082771 100644
--- a/libs/geometry/test/algorithms/overlay/get_turns.cpp
+++ b/libs/geometry/test/algorithms/overlay/get_turns.cpp
@@ -121,7 +121,7 @@ struct test_get_turns
<< ": " << bg::operation_char(turn.operations[0].operation)
<< " " << bg::operation_char(turn.operations[1].operation)
<< " (" << bg::method_char(turn.method) << ")"
- << (turn.is_discarded() ? " (discarded) " : turn.blocked() ? " (blocked)" : "")
+ << (turn.discarded ? " (discarded) " : turn.blocked() ? " (blocked)" : "")
;
offsets[p] += 10;
diff --git a/libs/geometry/test/algorithms/overlay/multi_overlay_common.hpp b/libs/geometry/test/algorithms/overlay/multi_overlay_common.hpp
index 6a49c300d3..4b98944da5 100644
--- a/libs/geometry/test/algorithms/overlay/multi_overlay_common.hpp
+++ b/libs/geometry/test/algorithms/overlay/multi_overlay_common.hpp
@@ -1,8 +1,8 @@
// 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) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// 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)
@@ -12,11 +12,11 @@
#define GEOMETRY_TEST_MULTI_OVERLAY_COMMON_HPP
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
-#include <boost/geometry/multi/io/wkt/read.hpp>
-//#include <boost/geometry/multi/io/svg/write_svg.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
+//#include <boost/geometry/io/svg/write_svg.hpp>
diff --git a/libs/geometry/test/algorithms/overlay/traverse.cpp b/libs/geometry/test/algorithms/overlay/traverse.cpp
index 0ae6bfd0ad..7aef1789be 100644
--- a/libs/geometry/test/algorithms/overlay/traverse.cpp
+++ b/libs/geometry/test/algorithms/overlay/traverse.cpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2010-2015 Barend Gehrels, 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
@@ -57,8 +57,7 @@
#include <boost/geometry/geometries/geometries.hpp>
-#include <boost/geometry/io/wkt/read.hpp>
-#include <boost/geometry/io/wkt/write.hpp>
+#include <boost/geometry/io/wkt/wkt.hpp>
#if defined(TEST_WITH_SVG)
@@ -268,7 +267,7 @@ struct test_traverse
<< std::endl
<< "op: " << bg::operation_char(turn.operations[0].operation)
<< " / " << bg::operation_char(turn.operations[1].operation)
- << (turn.is_discarded() ? " (discarded) " : turn.blocked() ? " (blocked)" : "")
+ //<< (turn.is_discarded() ? " (discarded) " : turn.blocked() ? " (blocked)" : "")
<< std::endl;
out << "r: " << turn.operations[0].fraction
@@ -813,7 +812,7 @@ void test_all(bool test_self_tangencies = true, bool test_mixed = false)
test_traverse<polygon, polygon, operation_intersection>::apply("dz_3",
5, 192.49316937645651, dz_3[0], dz_3[1]);
test_traverse<polygon, polygon, operation_union>::apply("dz_3",
- 6, 1446.496005965641, dz_3[0], dz_3[1]);
+ 5, 1446.496005965641, dz_3[0], dz_3[1]);
test_traverse<polygon, polygon, operation_intersection>::apply("dz_4",
1, 473.59423868207693, dz_4[0], dz_4[1]);
diff --git a/libs/geometry/test/algorithms/overlay/ccw_traverse.cpp b/libs/geometry/test/algorithms/overlay/traverse_ccw.cpp
index 55d2d58945..55d2d58945 100644
--- a/libs/geometry/test/algorithms/overlay/ccw_traverse.cpp
+++ b/libs/geometry/test/algorithms/overlay/traverse_ccw.cpp
diff --git a/libs/geometry/test/algorithms/overlay/multi_traverse.cpp b/libs/geometry/test/algorithms/overlay/traverse_multi.cpp
index 7cab06c96a..d600ce9cbc 100644
--- a/libs/geometry/test/algorithms/overlay/multi_traverse.cpp
+++ b/libs/geometry/test/algorithms/overlay/traverse_multi.cpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, 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
@@ -15,27 +15,19 @@
#define BOOST_GEOMETRY_TEST_MULTI
#include <algorithms/overlay/traverse.cpp>
+#include <boost/geometry/core/closure.hpp>
+#include <boost/geometry/core/geometry_id.hpp>
+#include <boost/geometry/core/point_order.hpp>
+#include <boost/geometry/core/ring_type.hpp>
+#include <boost/geometry/algorithms/envelope.hpp>
+#include <boost/geometry/algorithms/num_points.hpp>
+#include <boost/geometry/algorithms/detail/overlay/copy_segments.hpp>
+#include <boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp>
+#include <boost/geometry/algorithms/detail/sections/range_by_section.hpp>
+#include <boost/geometry/algorithms/detail/sections/sectionalize.hpp>
-#include <boost/geometry/multi/core/closure.hpp>
-#include <boost/geometry/multi/core/geometry_id.hpp>
-#include <boost/geometry/multi/core/point_order.hpp>
-#include <boost/geometry/multi/core/ring_type.hpp>
-
-#include <boost/geometry/multi/algorithms/correct.hpp>
-#include <boost/geometry/multi/algorithms/envelope.hpp>
-#include <boost/geometry/multi/algorithms/num_points.hpp>
-#include <boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp>
-#include <boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp>
-#include <boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp>
-#include <boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp>
-
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
-
-#include <boost/geometry/multi/views/detail/range_type.hpp>
-
-#include <boost/geometry/multi/io/wkt/read.hpp>
+#include <boost/geometry/views/detail/range_type.hpp>
#include "multi_overlay_cases.hpp"
diff --git a/libs/geometry/test/algorithms/multi_perimeter.cpp b/libs/geometry/test/algorithms/perimeter_multi.cpp
index 8268fed62d..3ddd8395c1 100644
--- a/libs/geometry/test/algorithms/multi_perimeter.cpp
+++ b/libs/geometry/test/algorithms/perimeter_multi.cpp
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, 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)
@@ -8,14 +8,12 @@
#include <geometry_test_common.hpp>
#include <boost/geometry/algorithms/perimeter.hpp>
-#include <boost/geometry/multi/algorithms/perimeter.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
#include <algorithms/test_perimeter.hpp>
diff --git a/libs/geometry/test/algorithms/point_on_surface.cpp b/libs/geometry/test/algorithms/point_on_surface.cpp
index 00b6f1236c..0a89d960d3 100644
--- a/libs/geometry/test/algorithms/point_on_surface.cpp
+++ b/libs/geometry/test/algorithms/point_on_surface.cpp
@@ -1,13 +1,13 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2007-2013 Barend Gehrels, Amsterdam, the Netherlands.
-// Copyright (c) 2008-2013 Bruno Lalande, Paris, France.
-// Copyright (c) 2009-2013 Mateusz Loskot, London, UK.
-// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
+// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
-// This file was modified by Oracle on 2014.
-// Modifications copyright (c) 2014 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2014, 2015.
+// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -43,11 +43,7 @@
#include <algorithms/overlay/overlay_cases.hpp>
#if defined(BOOST_GEOMETRY_UNIT_TEST_MULTI)
-# include <boost/geometry/multi/algorithms/correct.hpp>
-# include <boost/geometry/multi/algorithms/within.hpp>
-# include <boost/geometry/multi/algorithms/detail/extreme_points.hpp>
-# include <boost/geometry/multi/geometries/multi_polygon.hpp>
-# include <boost/geometry/multi/io/wkt/wkt.hpp>
+# include <boost/geometry/algorithms/detail/extreme_points.hpp>
#endif
diff --git a/libs/geometry/test/algorithms/relational_operations/Jamfile.v2 b/libs/geometry/test/algorithms/relational_operations/Jamfile.v2
index 2c0c34c9e8..89ce7c88bd 100644
--- a/libs/geometry/test/algorithms/relational_operations/Jamfile.v2
+++ b/libs/geometry/test/algorithms/relational_operations/Jamfile.v2
@@ -1,11 +1,11 @@
# Boost.Geometry (aka GGL, Generic Geometry Library)
#
-# Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
-# Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
-# Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
#
-# This file was modified by Oracle on 2014.
-# Modifications copyright (c) 2014, Oracle and/or its affiliates.
+# This file was modified by Oracle on 2014, 2015.
+# Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
#
# Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -16,18 +16,17 @@
test-suite boost-geometry-algorithms-relational
:
- [ run covered_by.cpp ]
- [ run crosses.cpp ]
- [ run equals.cpp ]
- [ run intersects.cpp ]
- [ run multi_covered_by.cpp ]
- [ run multi_equals.cpp ]
- [ run multi_intersects.cpp ]
- [ run multi_touches.cpp ]
- [ run overlaps.cpp ]
- [ run touches.cpp ]
+ [ run covered_by.cpp : : : : algorithms_covered_by ]
+ [ run covered_by_multi.cpp : : : : algorithms_covered_by_multi ]
+ [ run crosses.cpp : : : : algorithms_crosses ]
+ [ run equals.cpp : : : : algorithms_equals ]
+ [ run equals_multi.cpp : : : : algorithms_equals_multi ]
+ [ run equals_on_spheroid.cpp : : : : algorithms_equals_on_spheroid ]
;
build-project disjoint ;
+build-project intersects ;
+build-project overlaps ;
build-project relate ;
+build-project touches ;
build-project within ;
diff --git a/libs/geometry/test/algorithms/relational_operations/multi_covered_by.cpp b/libs/geometry/test/algorithms/relational_operations/covered_by_multi.cpp
index 7489435b45..720e727168 100644
--- a/libs/geometry/test/algorithms/relational_operations/multi_covered_by.cpp
+++ b/libs/geometry/test/algorithms/relational_operations/covered_by_multi.cpp
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, 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)
@@ -11,16 +11,13 @@
#include <boost/geometry/algorithms/covered_by.hpp>
#include <boost/geometry/geometries/box.hpp>
-#include <boost/geometry/geometries/polygon.hpp>
-#include <boost/geometry/multi/core/point_order.hpp>
-#include <boost/geometry/multi/algorithms/covered_by.hpp>
+#include <boost/geometry/core/point_order.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
#include "test_covered_by.hpp"
diff --git a/libs/geometry/test/algorithms/relational_operations/disjoint/Jamfile.v2 b/libs/geometry/test/algorithms/relational_operations/disjoint/Jamfile.v2
index 8586e9a2c5..ef3122f915 100644
--- a/libs/geometry/test/algorithms/relational_operations/disjoint/Jamfile.v2
+++ b/libs/geometry/test/algorithms/relational_operations/disjoint/Jamfile.v2
@@ -1,11 +1,11 @@
# Boost.Geometry (aka GGL, Generic Geometry Library)
#
-# Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
-# Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
-# Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
#
-# This file was modified by Oracle on 2014.
-# Modifications copyright (c) 2014, Oracle and/or its affiliates.
+# This file was modified by Oracle on 2014, 2015.
+# Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
#
# Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -16,7 +16,13 @@
test-suite boost-geometry-algorithms-disjoint
:
- [ run disjoint.cpp ]
- [ run disjoint_coverage.cpp ]
- [ run multi_disjoint.cpp ]
+ [ run disjoint.cpp : : : : algorithms_disjoint ]
+ [ run disjoint_coverage_a_a.cpp : : : : algorithms_disjoint_coverage_a_a ]
+ [ run disjoint_coverage_l_a.cpp : : : : algorithms_disjoint_coverage_l_a ]
+ [ run disjoint_coverage_l_l.cpp : : : : algorithms_disjoint_coverage_l_l ]
+ [ run disjoint_coverage_p_a.cpp : : : : algorithms_disjoint_coverage_p_a ]
+ [ run disjoint_coverage_p_l.cpp : : : : algorithms_disjoint_coverage_p_l ]
+ [ run disjoint_coverage_p_p.cpp : : : : algorithms_disjoint_coverage_p_p ]
+ [ run disjoint_multi.cpp : : : : algorithms_disjoint_multi ]
+ [ run disjoint_point_box_geometry.cpp : : : : algorithms_disjoint_point_box_geometry ]
;
diff --git a/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint.cpp b/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint.cpp
index 7299af4061..2d0225daff 100644
--- a/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint.cpp
+++ b/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint.cpp
@@ -1,9 +1,14 @@
// 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.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
+
+// This file was modified by Oracle on 2015.
+// Modifications copyright (c) 2015, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@@ -29,33 +34,6 @@
template <typename P>
void test_all()
{
- typedef bg::model::box<P> box;
-
- test_disjoint<P, P>("pp1", "point(1 1)", "point(1 1)", false);
- test_disjoint<P, P>("pp2", "point(1 1)", "point(1.001 1)", true);
-
- // left-right
- test_disjoint<box, box>("bb1", "box(1 1, 2 2)", "box(3 1, 4 2)", true);
- test_disjoint<box, box>("bb2", "box(1 1, 2 2)", "box(2 1, 3 2)", false);
- test_disjoint<box, box>("bb3", "box(1 1, 2 2)", "box(2 2, 3 3)", false);
- test_disjoint<box, box>("bb4", "box(1 1, 2 2)", "box(2.001 2, 3 3)", true);
-
- // up-down
- test_disjoint<box, box>("bb5", "box(1 1, 2 2)", "box(1 3, 2 4)", true);
- test_disjoint<box, box>("bb6", "box(1 1, 2 2)", "box(1 2, 2 3)", false);
- // right-left
- test_disjoint<box, box>("bb7", "box(1 1, 2 2)", "box(0 1, 1 2)", false);
- test_disjoint<box, box>("bb8", "box(1 1, 2 2)", "box(0 1, 1 2)", false);
-
- // point-box
- test_disjoint<P, box>("pb1", "point(1 1)", "box(0 0, 2 2)", false);
- test_disjoint<P, box>("pb2", "point(2 2)", "box(0 0, 2 2)", false);
- test_disjoint<P, box>("pb3", "point(2.0001 2)", "box(1 1, 2 2)", true);
- test_disjoint<P, box>("pb4", "point(0.9999 2)", "box(1 1, 2 2)", true);
-
- // box-point (to test reverse compiling)
- test_disjoint<box, P>("bp1", "box(1 1, 2 2)", "point(2 2)", false);
-
// Test triangles for polygons/rings, boxes
// Note that intersections are tested elsewhere, they don't need
// thorough test at this place
@@ -75,27 +53,10 @@ void test_all()
// Testing touch
test_disjoint<polygon, polygon>("touch_simplex_pp", touch_simplex[0], touch_simplex[1], false);
- // Testing overlap (and test compiling with box)
- test_disjoint<polygon, polygon>("overlaps_box_pp", overlaps_box[0], overlaps_box[1], false);
- test_disjoint<box, polygon>("overlaps_box_bp", overlaps_box[0], overlaps_box[1], false);
- test_disjoint<box, ring>("overlaps_box_br", overlaps_box[0], overlaps_box[1], false);
- test_disjoint<polygon, box>("overlaps_box_pb", overlaps_box[1], overlaps_box[0], false);
- test_disjoint<ring, box>("overlaps_box_rb", overlaps_box[1], overlaps_box[0], false);
-
// Test if within(a,b) returns false for disjoint
test_disjoint<ring, ring>("within_simplex_rr1", within_simplex[0], within_simplex[1], false);
test_disjoint<ring, ring>("within_simplex_rr2", within_simplex[1], within_simplex[0], false);
- test_disjoint<P, ring>("point_ring1", "POINT(0 0)", "POLYGON((0 0,3 3,6 0,0 0))", false);
- test_disjoint<P, ring>("point_ring2", "POINT(3 1)", "POLYGON((0 0,3 3,6 0,0 0))", false);
- test_disjoint<P, ring>("point_ring3", "POINT(0 3)", "POLYGON((0 0,3 3,6 0,0 0))", true);
- test_disjoint<P, polygon>("point_polygon1", "POINT(0 0)", "POLYGON((0 0,3 3,6 0,0 0))", false);
- test_disjoint<P, polygon>("point_polygon2", "POINT(3 1)", "POLYGON((0 0,3 3,6 0,0 0))", false);
- test_disjoint<P, polygon>("point_polygon3", "POINT(0 3)", "POLYGON((0 0,3 3,6 0,0 0))", true);
-
- test_disjoint<ring, P>("point_ring2", "POLYGON((0 0,3 3,6 0,0 0))", "POINT(0 0)", false);
- test_disjoint<polygon, P>("point_polygon2", "POLYGON((0 0,3 3,6 0,0 0))", "POINT(0 0)", false);
-
// Linear
typedef bg::model::linestring<P> ls;
typedef bg::model::segment<P> segment;
@@ -116,15 +77,6 @@ void test_all()
test_disjoint<ls, ls>("ls/ls co-e", "linestring(0 0,1 1)", "linestring(1 1,0 0)", false);
- // Problem described by Volker/Albert 2012-06-01
- test_disjoint<polygon, box>("volker_albert_1",
- "POLYGON((1992 3240,1992 1440,3792 1800,3792 3240,1992 3240))",
- "BOX(1941 2066, 2055 2166)", false);
-
- test_disjoint<polygon, box>("volker_albert_2",
- "POLYGON((1941 2066,2055 2066,2055 2166,1941 2166))",
- "BOX(1941 2066, 2055 2166)", false);
-
// Degenerate linestrings
{
// Submitted by Zachary on the Boost.Geometry Mailing List, on 2012-01-29
@@ -199,21 +151,6 @@ void test_all()
}
-template <typename P>
-void test_3d()
-{
- typedef bg::model::box<P> box;
-
- test_disjoint<P, P>("pp 3d 1", "point(1 1 1)", "point(1 1 1)", false);
- test_disjoint<P, P>("pp 3d 2", "point(1 1 1)", "point(1.001 1 1)", true);
-
- test_disjoint<box, box>("bb1", "box(1 1 1, 2 2 2)", "box(3 1 1, 4 2 1)", true);
- test_disjoint<box, box>("bb2", "box(1 1 1, 2 2 2)", "box(2 1 1, 3 2 1)", false);
- test_disjoint<box, box>("bb3", "box(1 1 1, 2 2 2)", "box(2 2 1, 3 3 1)", false);
- test_disjoint<box, box>("bb4", "box(1 1 1, 2 2 2)", "box(2.001 2 1, 3 3 1)", true);
-
-}
-
int test_main(int, char* [])
{
test_all<bg::model::d2::point_xy<float> >();
@@ -223,8 +160,6 @@ int test_main(int, char* [])
test_all<bg::model::d2::point_xy<ttmath_big> >();
#endif
- test_3d<bg::model::point<double, 3, bg::cs::cartesian> >();
-
return 0;
}
diff --git a/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage.cpp b/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage.cpp
deleted file mode 100644
index 4708fd6dbb..0000000000
--- a/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage.cpp
+++ /dev/null
@@ -1,1723 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-
-// Copyright (c) 2014, 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
-
-#ifndef BOOST_TEST_MODULE
-#define BOOST_TEST_MODULE test_disjoint_coverage
-#endif
-
-// unit test to test disjoint for all geometry combinations
-
-#include <iostream>
-
-#include <boost/test/included/unit_test.hpp>
-
-#include <boost/geometry/core/tag.hpp>
-#include <boost/geometry/core/tags.hpp>
-#include <boost/geometry/multi/core/tags.hpp>
-
-#include <boost/geometry/strategies/strategies.hpp>
-
-#include <boost/geometry/io/wkt/read.hpp>
-#include <boost/geometry/io/wkt/write.hpp>
-#include <boost/geometry/multi/io/wkt/read.hpp>
-#include <boost/geometry/multi/io/wkt/write.hpp>
-#include <boost/geometry/io/dsv/write.hpp>
-
-#include <boost/geometry/geometries/point.hpp>
-#include <boost/geometry/geometries/segment.hpp>
-#include <boost/geometry/geometries/linestring.hpp>
-#include <boost/geometry/geometries/ring.hpp>
-#include <boost/geometry/geometries/polygon.hpp>
-
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
-
-#include <boost/geometry/algorithms/disjoint.hpp>
-
-#include <from_wkt.hpp>
-
-
-#ifdef HAVE_TTMATH
-#include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
-#endif
-
-namespace bg = ::boost::geometry;
-
-//============================================================================
-
-struct test_disjoint
-{
- template <typename Geometry1, typename Geometry2>
- static inline void apply(std::string const& case_id,
- Geometry1 const& geometry1,
- Geometry2 const& geometry2,
- bool expected_result)
- {
- bool result = bg::disjoint(geometry1, geometry2);
- BOOST_CHECK_MESSAGE(result == expected_result,
- "case ID: " << case_id << ", G1: " << bg::wkt(geometry1)
- << ", G2: " << bg::wkt(geometry2) << " -> Expected: "
- << expected_result << ", detected: " << result);
-
- result = bg::disjoint(geometry2, geometry1);
- BOOST_CHECK_MESSAGE(result == expected_result,
- "case ID: " << case_id << ", G1: " << bg::wkt(geometry2)
- << ", G2: " << bg::wkt(geometry1) << " -> Expected: "
- << expected_result << ", detected: " << result);
-
-#ifdef BOOST_GEOMETRY_TEST_DEBUG
- std::cout << "case ID: " << case_id << "; G1 - G2: ";
- std::cout << bg::wkt(geometry1) << " - ";
- std::cout << bg::wkt(geometry2) << std::endl;
- std::cout << std::boolalpha;
- std::cout << "expected/computed result: "
- << expected_result << " / " << result << std::endl;
- std::cout << std::endl;
- std::cout << std::noboolalpha;
-#endif
- }
-};
-
-//============================================================================
-
-// pointlike-pointlike geometries
-template <typename P>
-inline void test_point_point()
-{
- typedef test_disjoint tester;
-
- tester::apply("p-p-01",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<P>("POINT(0 0)"),
- false);
-
- tester::apply("p-p-02",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<P>("POINT(1 1)"),
- true);
-}
-
-template <typename P>
-inline void test_point_multipoint()
-{
- typedef bg::model::multi_point<P> MP;
-
- typedef test_disjoint tester;
-
- tester::apply("p-mp-01",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT(0 0,1 1)"),
- false);
-
- tester::apply("p-mp-02",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT(1 1,2 2)"),
- true);
-
- tester::apply("p-mp-03",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT()"),
- true);
-}
-
-template <typename P>
-inline void test_multipoint_multipoint()
-{
- typedef bg::model::multi_point<P> MP;
-
- typedef test_disjoint tester;
-
- tester::apply("mp-mp-01",
- from_wkt<MP>("MULTIPOINT(0 0,1 0)"),
- from_wkt<MP>("MULTIPOINT(0 0,1 1)"),
- false);
-
- tester::apply("mp-mp-02",
- from_wkt<MP>("MULTIPOINT(0 0,1 0)"),
- from_wkt<MP>("MULTIPOINT(1 1,2 2)"),
- true);
-
- tester::apply("mp-mp-03",
- from_wkt<MP>("MULTIPOINT()"),
- from_wkt<MP>("MULTIPOINT(1 1,2 2)"),
- true);
-
- tester::apply("mp-mp-04",
- from_wkt<MP>("MULTIPOINT(0 0,1 0)"),
- from_wkt<MP>("MULTIPOINT()"),
- true);
-}
-
-//============================================================================
-
-// pointlike-linear geometries
-template <typename P>
-inline void test_point_segment()
-{
- typedef test_disjoint tester;
- typedef bg::model::segment<P> S;
-
- tester::apply("p-s-01",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- false);
-
- tester::apply("p-s-02",
- from_wkt<P>("POINT(1 0)"),
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- false);
-
- tester::apply("p-s-03",
- from_wkt<P>("POINT(1 1)"),
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- true);
-
- tester::apply("p-s-04",
- from_wkt<P>("POINT(3 0)"),
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- true);
-
- tester::apply("p-s-05",
- from_wkt<P>("POINT(-1 0)"),
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- true);
-}
-
-template <typename P>
-inline void test_point_linestring()
-{
- typedef bg::model::linestring<P> L;
-
- typedef test_disjoint tester;
-
- tester::apply("p-l-01",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
- false);
-
- tester::apply("p-l-02",
- from_wkt<P>("POINT(1 1)"),
- from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
- false);
-
- tester::apply("p-l-03",
- from_wkt<P>("POINT(3 3)"),
- from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
- false);
-
- tester::apply("p-l-04",
- from_wkt<P>("POINT(1 0)"),
- from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
- true);
-
- tester::apply("p-l-05",
- from_wkt<P>("POINT(5 5)"),
- from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
- true);
-
- tester::apply("p-l-06",
- from_wkt<P>("POINT(5 5)"),
- from_wkt<L>("LINESTRING(0 0,2 2)"),
- true);
-}
-
-template <typename P>
-inline void test_point_multilinestring()
-{
- typedef bg::model::linestring<P> L;
- typedef bg::model::multi_linestring<L> ML;
-
- typedef test_disjoint tester;
-
- tester::apply("p-ml-01",
- from_wkt<P>("POINT(0 1)"),
- from_wkt<ML>("MULTILINESTRING((0 0,2 2,4 4),(0 0,2 0,4 0))"),
- true);
-
- tester::apply("p-ml-02",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<ML>("MULTILINESTRING((0 0,2 2,4 4),(0 0,2 0,4 0))"),
- false);
-
- tester::apply("p-ml-03",
- from_wkt<P>("POINT(1 1)"),
- from_wkt<ML>("MULTILINESTRING((0 0,2 2,4 4),(0 0,2 0,4 0))"),
- false);
-
- tester::apply("p-ml-04",
- from_wkt<P>("POINT(1 0)"),
- from_wkt<ML>("MULTILINESTRING((0 0,2 2,4 4),(0 0,2 0,4 0))"),
- false);
-
- tester::apply("p-ml-05",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<ML>("MULTILINESTRING((1 1,2 2,4 4),(3 0,4 0))"),
- true);
-
- tester::apply("p-ml-06",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<ML>("MULTILINESTRING((1 1,2 2,4 4),(0 0,4 0))"),
- false);
-
- tester::apply("p-ml-07",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<ML>("MULTILINESTRING((1 1,2 2,4 4),(-1 0,4 0))"),
- false);
-}
-
-template <typename P>
-inline void test_multipoint_segment()
-{
- typedef test_disjoint tester;
- typedef bg::model::multi_point<P> MP;
- typedef bg::model::segment<P> S;
-
- tester::apply("mp-s-01",
- from_wkt<MP>("MULTIPOINT(0 0,1 1)"),
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- false);
-
- tester::apply("mp-s-02",
- from_wkt<MP>("MULTIPOINT(1 0,1 1)"),
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- false);
-
- tester::apply("mp-s-03",
- from_wkt<MP>("MULTIPOINT(1 1,2 2)"),
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- true);
-
- tester::apply("mp-s-04",
- from_wkt<MP>("MULTIPOINT()"),
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- true);
-
- tester::apply("mp-s-05",
- from_wkt<MP>("MULTIPOINT(3 0,4 0)"),
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- true);
-
- tester::apply("mp-s-06",
- from_wkt<MP>("MULTIPOINT(1 0,4 0)"),
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- false);
-
- // segments that degenerate to a point
- tester::apply("mp-s-07",
- from_wkt<MP>("MULTIPOINT(1 1,2 2)"),
- from_wkt<S>("SEGMENT(0 0,0 0)"),
- true);
-
- tester::apply("mp-s-08",
- from_wkt<MP>("MULTIPOINT(1 1,2 2)"),
- from_wkt<S>("SEGMENT(1 1,1 1)"),
- false);
-}
-
-template <typename P>
-inline void test_multipoint_linestring()
-{
- typedef bg::model::multi_point<P> MP;
- typedef bg::model::linestring<P> L;
-
- typedef test_disjoint tester;
-
- tester::apply("mp-l-01",
- from_wkt<MP>("MULTIPOINT(0 0,1 0)"),
- from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
- false);
-
- tester::apply("mp-l-02",
- from_wkt<MP>("MULTIPOINT(1 0,1 1)"),
- from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
- false);
-
- tester::apply("mp-l-03",
- from_wkt<MP>("MULTIPOINT(1 0,3 3)"),
- from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
- false);
-
- tester::apply("mp-l-04",
- from_wkt<MP>("MULTIPOINT(1 0,2 0)"),
- from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
- true);
-
- tester::apply("mp-l-05",
- from_wkt<MP>("MULTIPOINT(-1 -1,2 0)"),
- from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
- true);
-
- tester::apply("mp-l-06",
- from_wkt<MP>("MULTIPOINT(-1 -1,2 0)"),
- from_wkt<L>("LINESTRING(1 0,3 0)"),
- false);
-
- tester::apply("mp-l-07",
- from_wkt<MP>("MULTIPOINT(-1 -1,2 0)"),
- from_wkt<L>("LINESTRING(1 0,3 0)"),
- false);
-}
-
-template <typename P>
-inline void test_multipoint_multilinestring()
-{
- typedef bg::model::multi_point<P> MP;
- typedef bg::model::linestring<P> L;
- typedef bg::model::multi_linestring<L> ML;
-
- typedef test_disjoint tester;
-
- tester::apply("mp-ml-01",
- from_wkt<MP>("MULTIPOINT(0 1,0 2)"),
- from_wkt<ML>("MULTILINESTRING((0 0,2 2,4 4),(0 0,2 0,4 0))"),
- true);
-
- tester::apply("mp-ml-02",
- from_wkt<MP>("MULTIPOINT(0 0,1 0)"),
- from_wkt<ML>("MULTILINESTRING((0 0,2 2,4 4),(0 0,2 0,4 0))"),
- false);
-
- tester::apply("mp-ml-03",
- from_wkt<MP>("MULTIPOINT(0 1,1 1)"),
- from_wkt<ML>("MULTILINESTRING((0 0,2 2,4 4),(0 0,2 0,4 0))"),
- false);
-
- tester::apply("mp-ml-04",
- from_wkt<MP>("MULTIPOINT(0 1,1 0)"),
- from_wkt<ML>("MULTILINESTRING((0 0,2 2,4 4),(0 0,2 0,4 0))"),
- false);
-}
-
-//============================================================================
-
-// pointlike-areal geometries
-template <typename P>
-inline void test_point_box()
-{
- typedef test_disjoint tester;
- typedef bg::model::box<P> B;
-
- tester::apply("p-b-01",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<B>("BOX(0 0,1 1)"),
- false);
-
- tester::apply("p-b-02",
- from_wkt<P>("POINT(2 2)"),
- from_wkt<B>("BOX(0 0,1 0)"),
- true);
-}
-
-template <typename P>
-inline void test_point_ring()
-{
- typedef bg::model::ring<P, false, false> R; // ccw, open
-
- typedef test_disjoint tester;
-
- tester::apply("p-r-01",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<R>("POLYGON((0 0,1 0,0 1))"),
- false);
-
- tester::apply("p-r-02",
- from_wkt<P>("POINT(1 1)"),
- from_wkt<R>("POLYGON((0 0,1 0,0 1))"),
- true);
-}
-
-template <typename P>
-inline void test_point_polygon()
-{
- typedef bg::model::polygon<P, false, false> PL; // ccw, open
-
- typedef test_disjoint tester;
-
- tester::apply("p-pg-01",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<PL>("POLYGON((0 0,1 0,0 1))"),
- false);
-
- tester::apply("p-pg-02",
- from_wkt<P>("POINT(1 1)"),
- from_wkt<PL>("POLYGON((0 0,1 0,0 1))"),
- true);
-}
-
-template <typename P>
-inline void test_point_multipolygon()
-{
- typedef bg::model::polygon<P, false, false> PL; // ccw, open
- typedef bg::model::multi_polygon<PL> MPL;
-
- typedef test_disjoint tester;
-
- tester::apply("p-mpg-01",
- from_wkt<P>("POINT(0 0)"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,1 0,0 1)),((2 0,3 0,2 1)))"),
- false);
-
- tester::apply("p-mpg-02",
- from_wkt<P>("POINT(1 1)"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,1 0,0 1)),((2 0,3 0,2 1)))"),
- true);
-}
-
-template <typename P>
-inline void test_multipoint_box()
-{
- typedef test_disjoint tester;
- typedef bg::model::multi_point<P> MP;
- typedef bg::model::box<P> B;
-
- tester::apply("mp-b-01",
- from_wkt<MP>("MULTIPOINT(0 0,1 1)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- false);
-
- tester::apply("mp-b-02",
- from_wkt<MP>("MULTIPOINT(1 1,3 3)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- false);
-
- tester::apply("mp-b-03",
- from_wkt<MP>("MULTIPOINT(3 3,4 4)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- true);
-
- tester::apply("mp-b-04",
- from_wkt<MP>("MULTIPOINT()"),
- from_wkt<B>("BOX(0 0,2 2)"),
- true);
-}
-
-template <typename P>
-inline void test_multipoint_ring()
-{
- typedef bg::model::multi_point<P> MP;
- typedef bg::model::ring<P, false, false> R; // ccw, open
-
- typedef test_disjoint tester;
-
- tester::apply("mp-r-01",
- from_wkt<MP>("MULTIPOINT(0 0,1 0)"),
- from_wkt<R>("POLYGON((0 0,1 0,0 1))"),
- false);
-
- tester::apply("mp-r-02",
- from_wkt<MP>("MULTIPOINT(1 0,1 1)"),
- from_wkt<R>("POLYGON((0 0,1 0,0 1))"),
- false);
-
- tester::apply("mp-r-03",
- from_wkt<MP>("MULTIPOINT(1 1,2 2)"),
- from_wkt<R>("POLYGON((0 0,1 0,0 1))"),
- true);
-}
-
-template <typename P>
-inline void test_multipoint_polygon()
-{
- typedef bg::model::multi_point<P> MP;
- typedef bg::model::polygon<P, false, false> PL; // ccw, open
-
- typedef test_disjoint tester;
-
- tester::apply("mp-pg-01",
- from_wkt<MP>("MULTIPOINT(0 0,1 0)"),
- from_wkt<PL>("POLYGON(((0 0,1 0,0 1)))"),
- false);
-
- tester::apply("mp-pg-02",
- from_wkt<MP>("MULTIPOINT(0 0,2 0)"),
- from_wkt<PL>("POLYGON(((0 0,1 0,0 1)))"),
- false);
-
- tester::apply("mp-pg-03",
- from_wkt<MP>("MULTIPOINT(1 1,2 0)"),
- from_wkt<PL>("POLYGON(((0 0,1 0,0 1)))"),
- true);
-
- tester::apply("mp-pg-04",
- from_wkt<MP>("MULTIPOINT(1 1,2 3)"),
- from_wkt<PL>("POLYGON(((0 0,1 0,0 1)))"),
- true);
-}
-
-template <typename P>
-inline void test_multipoint_multipolygon()
-{
- typedef bg::model::multi_point<P> MP;
- typedef bg::model::polygon<P, false, false> PL; // ccw, open
- typedef bg::model::multi_polygon<PL> MPL;
-
- typedef test_disjoint tester;
-
- tester::apply("mp-mp-01",
- from_wkt<MP>("MULTIPOINT(0 0,2 0)"),
- from_wkt<MPL>("MULTIPOLYGON((0 0,1 0,0 1)),(2 0,3 0,2 1))"),
- false);
-
- tester::apply("mp-mp-02",
- from_wkt<MP>("MULTIPOINT(0 0,1 0)"),
- from_wkt<MPL>("MULTIPOLYGON((0 0,1 0,0 1)),(2 0,3 0,2 1))"),
- false);
-
- tester::apply("mp-mp-03",
- from_wkt<MP>("MULTIPOINT(1 1,2 0)"),
- from_wkt<MPL>("MULTIPOLYGON((0 0,1 0,0 1)),(2 0,3 0,2 1))"),
- false);
-
- tester::apply("mp-mp-04",
- from_wkt<MP>("MULTIPOINT(1 1,2 3)"),
- from_wkt<MPL>("MULTIPOLYGON((0 0,1 0,0 1)),(2 0,3 0,2 1))"),
- true);
-}
-
-//============================================================================
-
-// linear-linear geometries
-template <typename P>
-inline void test_segment_segment()
-{
- typedef bg::model::segment<P> S;
-
- typedef test_disjoint tester;
-
- tester::apply("s-s-01",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<S>("SEGMENT(0 0,0 2)"),
- false);
-
- tester::apply("s-s-02",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<S>("SEGMENT(2 0,3 0)"),
- false);
-
- tester::apply("s-s-03",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<S>("SEGMENT(1 0,3 0)"),
- false);
-
- tester::apply("s-s-04",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<S>("SEGMENT(1 0,1 1)"),
- false);
-
- tester::apply("s-s-05",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<S>("SEGMENT(1 1,2 2)"),
- true);
-
- tester::apply("s-s-06",
- from_wkt<S>("SEGMENT(0 0,1 1)"),
- from_wkt<S>("SEGMENT(1 1,1 1)"),
- false);
-
- tester::apply("s-s-07",
- from_wkt<S>("SEGMENT(0 0,1 1)"),
- from_wkt<S>("SEGMENT(2 2,2 2)"),
- true);
-
- tester::apply("s-s-08",
- from_wkt<S>("SEGMENT(0 0,1 1)"),
- from_wkt<S>("SEGMENT(2 2,3 3)"),
- true);
-}
-
-template <typename P>
-inline void test_linestring_segment()
-{
- typedef bg::model::segment<P> S;
- typedef bg::model::linestring<P> L;
-
- typedef test_disjoint tester;
-
- tester::apply("l-s-01",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<L>("LINESTRING(0 0,0 2)"),
- false);
-
- tester::apply("l-s-02",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<L>("LINESTRING(2 0,3 0)"),
- false);
-
- tester::apply("l-s-03",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<L>("LINESTRING(1 0,3 0)"),
- false);
-
- tester::apply("l-s-04",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<L>("LINESTRING(1 0,1 1)"),
- false);
-
- tester::apply("l-s-05",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<L>("LINESTRING(1 1,2 2)"),
- true);
-
- tester::apply("l-s-06",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<L>("LINESTRING(1 1,1 1,2 2)"),
- true);
-
- tester::apply("l-s-07",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<L>("LINESTRING(1 0,1 0,1 1,2 2)"),
- false);
-
- tester::apply("l-s-08",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<L>("LINESTRING(1 0,1 0,3 0)"),
- false);
-
- tester::apply("l-s-09",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<L>("LINESTRING(3 0,3 0,4 0)"),
- true);
-
- tester::apply("l-s-10",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<L>("LINESTRING(3 0,3 0)"),
- true);
-
- tester::apply("l-s-11",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<L>("LINESTRING(-1 0,-1 0)"),
- true);
-
- tester::apply("l-s-12",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<L>("LINESTRING(1 0,1 0)"),
- false);
-
- tester::apply("l-s-13",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<L>("LINESTRING(1 1,1 1)"),
- true);
-}
-
-template <typename P>
-inline void test_multilinestring_segment()
-{
- typedef bg::model::segment<P> S;
- typedef bg::model::linestring<P> L;
- typedef bg::model::multi_linestring<L> ML;
-
- typedef test_disjoint tester;
-
- tester::apply("s-ml-01",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<ML>("MULTILINESTRING((0 0,0 2))"),
- false);
-
- tester::apply("s-ml-02",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<ML>("MULTILINESTRING((2 0,3 0))"),
- false);
-
- tester::apply("s-ml-03",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<ML>("MULTILINESTRING((1 0,3 0))"),
- false);
-
- tester::apply("s-ml-04",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<ML>("MULTILINESTRING((1 0,1 1))"),
- false);
-
- tester::apply("s-ml-05",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<ML>("MULTILINESTRING((1 1,2 2))"),
- true);
-
- tester::apply("s-ml-06",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<ML>("MULTILINESTRING((1 1,2 2),(3 3,3 3))"),
- true);
-
- tester::apply("s-ml-07",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<ML>("MULTILINESTRING((1 1,2 2),(1 0,1 0))"),
- false);
-
- tester::apply("s-ml-08",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<ML>("MULTILINESTRING((1 1,2 2),(3 0,3 0))"),
- true);
-}
-
-template <typename P>
-inline void test_linestring_linestring()
-{
- typedef bg::model::linestring<P> L;
-
- typedef test_disjoint tester;
-
- tester::apply("l-l-01",
- from_wkt<L>("LINESTRING(0 0,2 0)"),
- from_wkt<L>("LINESTRING(0 0,0 2)"),
- false);
-
- tester::apply("l-l-02",
- from_wkt<L>("LINESTRING(0 0,2 0)"),
- from_wkt<L>("LINESTRING(2 0,3 0)"),
- false);
-
- tester::apply("l-l-03",
- from_wkt<L>("LINESTRING(0 0,2 0)"),
- from_wkt<L>("LINESTRING(1 0,3 0)"),
- false);
-
- tester::apply("l-l-04",
- from_wkt<L>("LINESTRING(0 0,2 0)"),
- from_wkt<L>("LINESTRING(1 0,1 1)"),
- false);
-
- tester::apply("l-l-05",
- from_wkt<L>("LINESTRING(0 0,2 0)"),
- from_wkt<L>("LINESTRING(1 1,2 2)"),
- true);
-}
-
-template <typename P>
-inline void test_linestring_multilinestring()
-{
- typedef bg::model::linestring<P> L;
- typedef bg::model::multi_linestring<L> ML;
-
- typedef test_disjoint tester;
-
- tester::apply("l-ml-01",
- from_wkt<L>("LINESTRING(0 0,2 0)"),
- from_wkt<ML>("MULTILINESTRING((0 0,0 2))"),
- false);
-
- tester::apply("l-ml-02",
- from_wkt<L>("LINESTRING(0 0,2 0)"),
- from_wkt<ML>("MULTILINESTRING((2 0,3 0))"),
- false);
-
- tester::apply("l-ml-03",
- from_wkt<L>("LINESTRING(0 0,2 0)"),
- from_wkt<ML>("MULTILINESTRING((1 0,3 0))"),
- false);
-
- tester::apply("l-ml-04",
- from_wkt<L>("LINESTRING(0 0,2 0)"),
- from_wkt<ML>("MULTILINESTRING((1 0,1 1))"),
- false);
-
- tester::apply("l-ml-05",
- from_wkt<L>("LINESTRING(0 0,2 0)"),
- from_wkt<ML>("MULTILINESTRING((1 1,2 2))"),
- true);
-}
-
-template <typename P>
-inline void test_multilinestring_multilinestring()
-{
- typedef bg::model::linestring<P> L;
- typedef bg::model::multi_linestring<L> ML;
-
- typedef test_disjoint tester;
-
- tester::apply("ml-ml-01",
- from_wkt<ML>("MULTILINESTRING((0 0,2 0))"),
- from_wkt<ML>("MULTILINESTRING((0 0,0 2))"),
- false);
-
- tester::apply("ml-ml-02",
- from_wkt<ML>("MULTILINESTRING((0 0,2 0))"),
- from_wkt<ML>("MULTILINESTRING((2 0,3 0))"),
- false);
-
- tester::apply("ml-ml-03",
- from_wkt<ML>("MULTILINESTRING((0 0,2 0))"),
- from_wkt<ML>("MULTILINESTRING((1 0,3 0))"),
- false);
-
- tester::apply("ml-ml-04",
- from_wkt<ML>("MULTILINESTRING((0 0,2 0))"),
- from_wkt<ML>("MULTILINESTRING((1 0,1 1))"),
- false);
-
- tester::apply("ml-ml-05",
- from_wkt<ML>("MULTILINESTRING((0 0,2 0))"),
- from_wkt<ML>("MULTILINESTRING((1 1,2 2))"),
- true);
-}
-
-//============================================================================
-
-// linear-areal geometries
-template <typename P>
-inline void test_segment_box()
-{
- typedef bg::model::segment<P> S;
- typedef bg::model::box<P> B;
-
- typedef test_disjoint tester;
-
- tester::apply("s-b-01",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- false);
-
- tester::apply("s-b-02",
- from_wkt<S>("SEGMENT(1 1,3 3)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- false);
-
- tester::apply("s-b-03",
- from_wkt<S>("SEGMENT(2 2,3 3)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- false);
-
- tester::apply("s-b-04",
- from_wkt<S>("SEGMENT(4 4,3 3)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- true);
-
- tester::apply("s-b-05",
- from_wkt<S>("SEGMENT(0 4,4 4)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- true);
-
- tester::apply("s-b-06",
- from_wkt<S>("SEGMENT(4 0,4 4)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- true);
-
- tester::apply("s-b-07",
- from_wkt<S>("SEGMENT(0 -2,0 -1)"),
- from_wkt<B>("BOX(0 0,1 1)"),
- true);
-
- tester::apply("s-b-08",
- from_wkt<S>("SEGMENT(-2 -2,-2 -1)"),
- from_wkt<B>("BOX(0 0,1 1)"),
- true);
-
- tester::apply("s-b-09",
- from_wkt<S>("SEGMENT(-2 -2,-2 -2)"),
- from_wkt<B>("BOX(0 0,1 1)"),
- true);
-
- tester::apply("s-b-10",
- from_wkt<S>("SEGMENT(-2 0,-2 0)"),
- from_wkt<B>("BOX(0 0,1 1)"),
- true);
-
- tester::apply("s-b-11",
- from_wkt<S>("SEGMENT(0 -2,0 -2)"),
- from_wkt<B>("BOX(0 0,1 1)"),
- true);
-
- tester::apply("s-b-12",
- from_wkt<S>("SEGMENT(-2 0,-1 0)"),
- from_wkt<B>("BOX(0 0,1 1)"),
- true);
-
- // segment degenerates to a point
- tester::apply("s-b-13",
- from_wkt<S>("SEGMENT(0 0,0 0)"),
- from_wkt<B>("BOX(0 0,1 1)"),
- false);
-
- tester::apply("s-b-14",
- from_wkt<S>("SEGMENT(1 1,1 1)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- false);
-
- tester::apply("s-b-15",
- from_wkt<S>("SEGMENT(2 2,2 2)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- false);
-
- tester::apply("s-b-16",
- from_wkt<S>("SEGMENT(2 0,2 0)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- false);
-
- tester::apply("s-b-17",
- from_wkt<S>("SEGMENT(0 2,0 2)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- false);
-
- tester::apply("s-b-18",
- from_wkt<S>("SEGMENT(2 2,2 2)"),
- from_wkt<B>("BOX(0 0,1 1)"),
- true);
-}
-
-template <typename P>
-inline void test_segment_ring()
-{
- typedef bg::model::segment<P> S;
- typedef bg::model::ring<P, false, false> R; // ccw, open
-
- typedef test_disjoint tester;
-
- tester::apply("s-r-01",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
- false);
-
- tester::apply("s-r-02",
- from_wkt<S>("SEGMENT(1 0,3 3)"),
- from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
- false);
-
- tester::apply("s-r-03",
- from_wkt<S>("SEGMENT(1 1,3 3)"),
- from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
- false);
-
- tester::apply("s-r-04",
- from_wkt<S>("SEGMENT(2 2,3 3)"),
- from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
- true);
-}
-
-template <typename P>
-inline void test_segment_polygon()
-{
- typedef bg::model::segment<P> S;
- typedef bg::model::polygon<P, false, false> PL; // ccw, open
-
- typedef test_disjoint tester;
-
- tester::apply("s-pg-01",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
- false);
-
- tester::apply("s-pg-02",
- from_wkt<S>("SEGMENT(1 0,3 3)"),
- from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
- false);
-
- tester::apply("s-pg-03",
- from_wkt<S>("SEGMENT(1 1,3 3)"),
- from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
- false);
-
- tester::apply("s-pg-04",
- from_wkt<S>("SEGMENT(2 2,3 3)"),
- from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
- true);
-}
-
-template <typename P>
-inline void test_segment_multipolygon()
-{
- typedef bg::model::segment<P> S;
- typedef bg::model::polygon<P, false, false> PL; // ccw, open
- typedef bg::model::multi_polygon<PL> MPL;
-
- typedef test_disjoint tester;
-
- tester::apply("s-mpg-01",
- from_wkt<S>("SEGMENT(0 0,2 0)"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
- false);
-
- tester::apply("s-mpg-02",
- from_wkt<S>("SEGMENT(1 0,3 3)"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
- false);
-
- tester::apply("s-mpg-03",
- from_wkt<S>("SEGMENT(1 1,3 3)"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
- false);
-
- tester::apply("s-mpg-04",
- from_wkt<S>("SEGMENT(2 2,3 3)"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
- true);
-}
-
-template <typename P>
-inline void test_linestring_box()
-{
- typedef bg::model::linestring<P> L;
- typedef bg::model::box<P> B;
-
- typedef test_disjoint tester;
-
- tester::apply("l-b-01",
- from_wkt<L>("LINESTRING(0 0,2 0)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- false);
-
- tester::apply("l-b-02",
- from_wkt<L>("LINESTRING(1 1,3 3)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- false);
-
- tester::apply("l-b-03",
- from_wkt<L>("LINESTRING(2 2,3 3)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- false);
-
- tester::apply("l-b-04",
- from_wkt<L>("LINESTRING(4 4,3 3)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- true);
-}
-
-template <typename P>
-inline void test_linestring_ring()
-{
- typedef bg::model::linestring<P> L;
- typedef bg::model::ring<P, false, false> R; // ccw, open
-
- typedef test_disjoint tester;
-
- tester::apply("l-r-01",
- from_wkt<L>("LINESTRING(0 0,2 0)"),
- from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
- false);
-
- tester::apply("l-r-02",
- from_wkt<L>("LINESTRING(1 0,3 3)"),
- from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
- false);
-
- tester::apply("l-r-03",
- from_wkt<L>("LINESTRING(1 1,3 3)"),
- from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
- false);
-
- tester::apply("l-r-04",
- from_wkt<L>("LINESTRING(2 2,3 3)"),
- from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
- true);
-}
-
-template <typename P>
-inline void test_linestring_polygon()
-{
- typedef bg::model::linestring<P> L;
- typedef bg::model::polygon<P, false, false> PL; // ccw, open
-
- typedef test_disjoint tester;
-
- tester::apply("l-pg-01",
- from_wkt<L>("LINESTRING(0 0,2 0)"),
- from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
- false);
-
- tester::apply("l-pg-02",
- from_wkt<L>("LINESTRING(1 0,3 3)"),
- from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
- false);
-
- tester::apply("l-pg-03",
- from_wkt<L>("LINESTRING(1 1,3 3)"),
- from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
- false);
-
- tester::apply("l-pg-04",
- from_wkt<L>("LINESTRING(2 2,3 3)"),
- from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
- true);
-}
-
-template <typename P>
-inline void test_linestring_multipolygon()
-{
- typedef bg::model::linestring<P> L;
- typedef bg::model::polygon<P, false, false> PL; // ccw, open
- typedef bg::model::multi_polygon<PL> MPL;
-
- typedef test_disjoint tester;
-
- tester::apply("l-mpg-01",
- from_wkt<L>("LINESTRING(0 0,2 0)"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
- false);
-
- tester::apply("l-mpg-02",
- from_wkt<L>("LINESTRING(1 0,3 3)"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
- false);
-
- tester::apply("l-mpg-03",
- from_wkt<L>("LINESTRING(1 1,3 3)"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
- false);
-
- tester::apply("l-mpg-04",
- from_wkt<L>("LINESTRING(2 2,3 3)"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
- true);
-}
-
-template <typename P>
-inline void test_multilinestring_box()
-{
- typedef bg::model::linestring<P> L;
- typedef bg::model::multi_linestring<L> ML;
- typedef bg::model::box<P> B;
-
- typedef test_disjoint tester;
-
- tester::apply("ml-b-01",
- from_wkt<ML>("MULTILINESTRING((0 0,2 0))"),
- from_wkt<B>("BOX(0 0,2 2)"),
- false);
-
- tester::apply("ml-b-02",
- from_wkt<ML>("MULTILINESTRING((1 1,3 3))"),
- from_wkt<B>("BOX(0 0,2 2)"),
- false);
-
- tester::apply("ml-b-03",
- from_wkt<ML>("MULTILINESTRING((2 2,3 3))"),
- from_wkt<B>("BOX(0 0,2 2)"),
- false);
-
- tester::apply("ml-b-04",
- from_wkt<ML>("MULTILINESTRING((4 4,3 3))"),
- from_wkt<B>("BOX(0 0,2 2)"),
- true);
-}
-
-template <typename P>
-inline void test_multilinestring_ring()
-{
- typedef bg::model::linestring<P> L;
- typedef bg::model::multi_linestring<L> ML;
- typedef bg::model::ring<P, false, false> R; // ccw, open
-
- typedef test_disjoint tester;
-
- tester::apply("ml-r-01",
- from_wkt<ML>("MULTILINESTRING((0 0,2 0))"),
- from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
- false);
-
- tester::apply("ml-r-02",
- from_wkt<ML>("MULTILINESTRING((1 0,3 3))"),
- from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
- false);
-
- tester::apply("ml-r-03",
- from_wkt<ML>("MULTILINESTRING((1 1,3 3))"),
- from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
- false);
-
- tester::apply("ml-r-04",
- from_wkt<ML>("MULTILINESTRING((2 2,3 3))"),
- from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
- true);
-}
-
-template <typename P>
-inline void test_multilinestring_polygon()
-{
- typedef bg::model::linestring<P> L;
- typedef bg::model::multi_linestring<L> ML;
- typedef bg::model::polygon<P, false, false> PL; // ccw, open
-
- typedef test_disjoint tester;
-
- tester::apply("ml-pg-01",
- from_wkt<ML>("MULTILINESTRING((0 0,2 0))"),
- from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
- false);
-
- tester::apply("ml-pg-02",
- from_wkt<ML>("MULTILINESTRING((1 0,3 3))"),
- from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
- false);
-
- tester::apply("ml-pg-03",
- from_wkt<ML>("MULTILINESTRING((1 1,3 3))"),
- from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
- false);
-
- tester::apply("ml-pg-04",
- from_wkt<ML>("MULTILINESTRING((2 2,3 3))"),
- from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
- true);
-}
-
-template <typename P>
-inline void test_multilinestring_multipolygon()
-{
- typedef bg::model::linestring<P> L;
- typedef bg::model::multi_linestring<L> ML;
- typedef bg::model::polygon<P, false, false> PL; // ccw, open
- typedef bg::model::multi_polygon<PL> MPL;
-
- typedef test_disjoint tester;
-
- tester::apply("ml-mpg-01",
- from_wkt<ML>("MULTILINESTRING((0 0,2 0))"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
- false);
-
- tester::apply("ml-mpg-02",
- from_wkt<ML>("MULTILINESTRING((1 0,3 3))"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
- false);
-
- tester::apply("ml-mpg-03",
- from_wkt<ML>("MULTILINESTRING((1 1,3 3))"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
- false);
-
- tester::apply("ml-mpg-04",
- from_wkt<ML>("MULTILINESTRING((2 2,3 3))"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
- true);
-}
-
-//============================================================================
-
-// areal-areal geometries
-template <typename P>
-inline void test_box_box()
-{
- typedef bg::model::box<P> B;
-
- typedef test_disjoint tester;
-
- tester::apply("b-b-01",
- from_wkt<B>("BOX(2 2,3 3)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- false);
-
- tester::apply("b-b-02",
- from_wkt<B>("BOX(1 1,3 3)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- false);
-
- tester::apply("b-b-03",
- from_wkt<B>("BOX(3 3,4 4)"),
- from_wkt<B>("BOX(0 0,2 2)"),
- true);
-}
-
-template <typename P>
-inline void test_ring_box()
-{
- typedef bg::model::box<P> B;
- typedef bg::model::ring<P, false, false> R; // ccw, open
-
- typedef test_disjoint tester;
-
- tester::apply("r-b-01",
- from_wkt<B>("BOX(2 2,3 3)"),
- from_wkt<R>("POLYGON((0 0,2 0,2 2,0 2))"),
- false);
-
- tester::apply("r-b-02",
- from_wkt<B>("BOX(1 1,3 3)"),
- from_wkt<R>("POLYGON((0 0,2 0,2 2,0 2))"),
- false);
-
- tester::apply("r-b-03",
- from_wkt<B>("BOX(3 3,4 4)"),
- from_wkt<R>("POLYGON((0 0,2 0,2 2,0 2))"),
- true);
-}
-
-template <typename P>
-inline void test_polygon_box()
-{
- typedef bg::model::box<P> B;
- typedef bg::model::polygon<P, false, false> PL; // ccw, open
-
- typedef test_disjoint tester;
-
- tester::apply("pg-b-01",
- from_wkt<B>("BOX(2 2,3 3)"),
- from_wkt<PL>("POLYGON((0 0,2 0,2 2,0 2))"),
- false);
-
- tester::apply("pg-b-02",
- from_wkt<B>("BOX(1 1,3 3)"),
- from_wkt<PL>("POLYGON((0 0,2 0,2 2,0 2))"),
- false);
-
- tester::apply("pg-b-03",
- from_wkt<B>("BOX(3 3,4 4)"),
- from_wkt<PL>("POLYGON((0 0,2 0,2 2,0 2))"),
- true);
-}
-
-template <typename P>
-inline void test_multipolygon_box()
-{
- typedef bg::model::box<P> B;
- typedef bg::model::polygon<P, false, false> PL; // ccw, open
- typedef bg::model::multi_polygon<PL> MPL;
-
- typedef test_disjoint tester;
-
- tester::apply("mpg-b-01",
- from_wkt<B>("BOX(2 2,3 3)"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
- false);
-
- tester::apply("mpg-b-02",
- from_wkt<B>("BOX(1 1,3 3)"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
- false);
-
- tester::apply("mpg-b-03",
- from_wkt<B>("BOX(3 3,4 4)"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
- true);
-}
-
-template <typename P>
-inline void test_ring_ring()
-{
- typedef bg::model::ring<P, false, false> R; // ccw, open
-
- typedef test_disjoint tester;
-
- tester::apply("r-r-01",
- from_wkt<R>("POLYGON((2 2,2 3,3 3,3 2))"),
- from_wkt<R>("POLYGON((0 0,2 0,2 2,0 2))"),
- false);
-
- tester::apply("r-r-02",
- from_wkt<R>("POLYGON((1 1,1 3,3 3,3 1))"),
- from_wkt<R>("POLYGON((0 0,2 0,2 2,0 2))"),
- false);
-
- tester::apply("r-r-03",
- from_wkt<R>("POLYGON((3 3,3 4,4 4,4 3))"),
- from_wkt<R>("POLYGON((0 0,2 0,2 2,0 2))"),
- true);
-}
-
-template <typename P>
-inline void test_polygon_ring()
-{
- typedef bg::model::ring<P, false, false> R; // ccw, open
- typedef bg::model::polygon<P, false, false> PL; // ccw, open
-
- typedef test_disjoint tester;
-
- tester::apply("pg-r-01",
- from_wkt<R>("POLYGON((2 2,2 3,3 3,3 2))"),
- from_wkt<PL>("POLYGON((0 0,2 0,2 2,0 2))"),
- false);
-
- tester::apply("pg-r-02",
- from_wkt<R>("POLYGON((1 1,1 3,3 3,3 1))"),
- from_wkt<PL>("POLYGON((0 0,2 0,2 2,0 2))"),
- false);
-
- tester::apply("pg-r-03",
- from_wkt<R>("POLYGON((3 3,3 4,4 4,4 3))"),
- from_wkt<PL>("POLYGON((0 0,2 0,2 2,0 2))"),
- true);
-}
-
-template <typename P>
-inline void test_multipolygon_ring()
-{
- typedef bg::model::ring<P, false, false> R; // ccw, open
- typedef bg::model::polygon<P, false, false> PL; // ccw, open
- typedef bg::model::multi_polygon<PL> MPL;
-
- typedef test_disjoint tester;
-
- tester::apply("mpg-r-01",
- from_wkt<R>("POLYGON((2 2,2 3,3 3,3 2))"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
- false);
-
- tester::apply("mpg-r-02",
- from_wkt<R>("POLYGON((1 1,1 3,3 3,3 1))"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
- false);
-
- tester::apply("mpg-r-03",
- from_wkt<R>("POLYGON((3 3,3 4,4 4,4 3))"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
- true);
-}
-
-template <typename P>
-inline void test_polygon_polygon()
-{
- typedef bg::model::polygon<P, false, false> PL; // ccw, open
-
- typedef test_disjoint tester;
-
- tester::apply("pg-pg-01",
- from_wkt<PL>("POLYGON((2 2,2 3,3 3,3 2))"),
- from_wkt<PL>("POLYGON((0 0,2 0,2 2,0 2))"),
- false);
-
- tester::apply("pg-pg-02",
- from_wkt<PL>("POLYGON((1 1,1 3,3 3,3 1))"),
- from_wkt<PL>("POLYGON((0 0,2 0,2 2,0 2))"),
- false);
-
- tester::apply("pg-pg-03",
- from_wkt<PL>("POLYGON((3 3,3 4,4 4,4 3))"),
- from_wkt<PL>("POLYGON((0 0,2 0,2 2,0 2))"),
- true);
-
- tester::apply("pg-pg-04",
- from_wkt<PL>("POLYGON((0 0,9 0,9 9,0 9))"),
- from_wkt<PL>("POLYGON((3 3,6 3,6 6,3 6))"),
- false);
- // polygon with a hole which entirely contains the other polygon
- tester::apply("pg-pg-05",
- from_wkt<PL>("POLYGON((0 0,9 0,9 9,0 9),(2 2,2 7,7 7,7 2))"),
- from_wkt<PL>("POLYGON((3 3,6 3,6 6,3 6))"),
- true);
- // polygon with a hole, but the inner ring intersects the other polygon
- tester::apply("pg-pg-06",
- from_wkt<PL>("POLYGON((0 0,9 0,9 9,0 9),(3 2,3 7,7 7,7 2))"),
- from_wkt<PL>("POLYGON((2 3,6 3,6 6,2 6))"),
- false);
- // polygon with a hole, but the other polygon is entirely contained
- // between the inner and outer rings.
- tester::apply("pg-pg-07",
- from_wkt<PL>("POLYGON((0 0,9 0,9 9,0 9),(6 2,6 7,7 7,7 2))"),
- from_wkt<PL>("POLYGON((3 3,5 3,5 6,3 6))"),
- false);
- // polygon with a hole and the outer ring of the other polygon lies
- // between the inner and outer, but without touching either.
- tester::apply("pg-pg-08",
- from_wkt<PL>("POLYGON((0 0,9 0,9 9,0 9),(3 3,3 6,6 6,6 3))"),
- from_wkt<PL>("POLYGON((2 2,7 2,7 7,2 7))"),
- false);
-
- {
- typedef bg::model::polygon<P> PL; // cw, closed
-
- // https://svn.boost.org/trac/boost/ticket/10647
- tester::apply("ticket-10647",
- from_wkt<PL>("POLYGON((0 0, 0 5, 5 5, 5 0, 0 0)(1 1, 4 1, 4 4, 1 4, 1 1))"),
- from_wkt<PL>("POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))"),
- true);
- }
-}
-
-template <typename P>
-inline void test_polygon_multipolygon()
-{
- typedef bg::model::polygon<P, false, false> PL; // ccw, open
- typedef bg::model::multi_polygon<PL> MPL;
-
- typedef test_disjoint tester;
-
- tester::apply("pg-mpg-01",
- from_wkt<PL>("POLYGON((2 2,2 3,3 3,3 2))"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
- false);
-
- tester::apply("pg-mpg-02",
- from_wkt<PL>("POLYGON((1 1,1 3,3 3,3 1))"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
- false);
-
- tester::apply("pg-mpg-03",
- from_wkt<PL>("POLYGON((3 3,3 4,4 4,4 3))"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
- true);
-}
-
-template <typename P>
-inline void test_multipolygon_multipolygon()
-{
- typedef bg::model::polygon<P, false, false> PL; // ccw, open
- typedef bg::model::multi_polygon<PL> MPL;
-
- typedef test_disjoint tester;
-
- tester::apply("mpg-mpg-01",
- from_wkt<MPL>("MULTIPOLYGON(((2 2,2 3,3 3,3 2)))"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
- false);
-
- tester::apply("mpg-mpg-02",
- from_wkt<MPL>("MULTIPOLYGON(((1 1,1 3,3 3,3 1)))"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
- false);
-
- tester::apply("mpg-mpg-03",
- from_wkt<MPL>("MULTIPOLYGON(((3 3,3 4,4 4,4 3)))"),
- from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
- true);
-}
-
-//============================================================================
-
-template <typename CoordinateType>
-inline void test_pointlike_pointlike()
-{
- typedef bg::model::point<CoordinateType, 2, bg::cs::cartesian> point_type;
-
- test_point_point<point_type>();
- test_point_multipoint<point_type>();
-
- test_multipoint_multipoint<point_type>();
-}
-
-template <typename CoordinateType>
-inline void test_pointlike_linear()
-{
- typedef bg::model::point<CoordinateType, 2, bg::cs::cartesian> point_type;
-
- test_point_linestring<point_type>();
- test_point_multilinestring<point_type>();
- test_point_segment<point_type>();
-
- // not implemented yet
- // test_multipoint_linestring<point_type>();
- // test_multipoint_multilinestring<point_type>();
- test_multipoint_segment<point_type>();
-}
-
-template <typename CoordinateType>
-inline void test_pointlike_areal()
-{
- typedef bg::model::point<CoordinateType, 2, bg::cs::cartesian> point_type;
-
- test_point_polygon<point_type>();
- test_point_multipolygon<point_type>();
- test_point_ring<point_type>();
- test_point_box<point_type>();
-
- // not implemented yet
- // test_multipoint_polygon<point_type>();
- // test_multipoint_multipolygon<point_type>();
- // test_multipoint_ring<point_type>();
- test_multipoint_box<point_type>();
-}
-
-template <typename CoordinateType>
-inline void test_linear_linear()
-{
- typedef bg::model::point<CoordinateType, 2, bg::cs::cartesian> point_type;
-
- test_linestring_linestring<point_type>();
- test_linestring_multilinestring<point_type>();
- test_linestring_segment<point_type>();
-
- test_multilinestring_multilinestring<point_type>();
- test_multilinestring_segment<point_type>();
-
- test_segment_segment<point_type>();
-}
-
-template <typename CoordinateType>
-inline void test_linear_areal()
-{
- typedef bg::model::point<CoordinateType, 2, bg::cs::cartesian> point_type;
-
- test_segment_polygon<point_type>();
- test_segment_multipolygon<point_type>();
- test_segment_ring<point_type>();
- test_segment_box<point_type>();
-
- test_linestring_polygon<point_type>();
- test_linestring_multipolygon<point_type>();
- test_linestring_ring<point_type>();
- test_linestring_box<point_type>();
-
- test_multilinestring_polygon<point_type>();
- test_multilinestring_multipolygon<point_type>();
- test_multilinestring_ring<point_type>();
- test_multilinestring_box<point_type>();
-}
-
-template <typename CoordinateType>
-inline void test_areal_areal()
-{
- typedef bg::model::point<CoordinateType, 2, bg::cs::cartesian> point_type;
-
- test_polygon_polygon<point_type>();
- test_polygon_multipolygon<point_type>();
- test_polygon_ring<point_type>();
- test_polygon_box<point_type>();
-
- test_multipolygon_multipolygon<point_type>();
- test_multipolygon_ring<point_type>();
- test_multipolygon_box<point_type>();
-
- test_ring_ring<point_type>();
- test_ring_box<point_type>();
-
- test_box_box<point_type>();
-}
-
-//============================================================================
-
-BOOST_AUTO_TEST_CASE( test_pointlike_pointlike_all )
-{
- test_pointlike_pointlike<double>();
- test_pointlike_pointlike<int>();
-#ifdef HAVE_TTMATH
- test_pointlike_pointlike<ttmath_big>();
-#endif
-}
-
-BOOST_AUTO_TEST_CASE( test_pointlike_linear_all )
-{
- test_pointlike_linear<double>();
- test_pointlike_linear<int>();
-#ifdef HAVE_TTMATH
- test_pointlike_linear<ttmath_big>();
-#endif
-}
-
-BOOST_AUTO_TEST_CASE( test_pointlike_areal_all )
-{
- test_pointlike_areal<double>();
- test_pointlike_areal<int>();
-#ifdef HAVE_TTMATH
- test_pointlike_areal<ttmath_big>();
-#endif
-}
-
-BOOST_AUTO_TEST_CASE( test_linear_linear_all )
-{
- test_linear_linear<double>();
- test_linear_linear<int>();
-#ifdef HAVE_TTMATH
- test_linear_linear<ttmath_big>();
-#endif
-}
-
-BOOST_AUTO_TEST_CASE( test_linear_areal_all )
-{
- test_linear_areal<double>();
- test_linear_areal<int>();
-#ifdef HAVE_TTMATH
- test_linear_areal<ttmath_big>();
-#endif
-}
-
-BOOST_AUTO_TEST_CASE( test_areal_areal_all )
-{
- test_areal_areal<double>();
- test_areal_areal<int>();
-#ifdef HAVE_TTMATH
- test_areal_areal<ttmath_big>();
-#endif
-}
diff --git a/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_a_a.cpp b/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_a_a.cpp
new file mode 100644
index 0000000000..25d6c5d774
--- /dev/null
+++ b/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_a_a.cpp
@@ -0,0 +1,387 @@
+// 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
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
+#ifndef BOOST_TEST_MODULE
+#define BOOST_TEST_MODULE test_disjoint_coverage
+#endif
+
+// unit test to test disjoint for all geometry combinations
+
+#include <iostream>
+
+#include <boost/test/included/unit_test.hpp>
+
+#include <boost/geometry/core/tag.hpp>
+#include <boost/geometry/core/tags.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+#include <boost/geometry/io/dsv/write.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/algorithms/disjoint.hpp>
+
+#include <from_wkt.hpp>
+
+
+#ifdef HAVE_TTMATH
+#include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
+#endif
+
+namespace bg = ::boost::geometry;
+
+//============================================================================
+
+struct test_disjoint
+{
+ template <typename Geometry1, typename Geometry2>
+ static inline void apply(std::string const& case_id,
+ Geometry1 const& geometry1,
+ Geometry2 const& geometry2,
+ bool expected_result)
+ {
+ bool result = bg::disjoint(geometry1, geometry2);
+ BOOST_CHECK_MESSAGE(result == expected_result,
+ "case ID: " << case_id << ", G1: " << bg::wkt(geometry1)
+ << ", G2: " << bg::wkt(geometry2) << " -> Expected: "
+ << expected_result << ", detected: " << result);
+
+ result = bg::disjoint(geometry2, geometry1);
+ BOOST_CHECK_MESSAGE(result == expected_result,
+ "case ID: " << case_id << ", G1: " << bg::wkt(geometry2)
+ << ", G2: " << bg::wkt(geometry1) << " -> Expected: "
+ << expected_result << ", detected: " << result);
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "case ID: " << case_id << "; G1 - G2: ";
+ std::cout << bg::wkt(geometry1) << " - ";
+ std::cout << bg::wkt(geometry2) << std::endl;
+ std::cout << std::boolalpha;
+ std::cout << "expected/computed result: "
+ << expected_result << " / " << result << std::endl;
+ std::cout << std::endl;
+ std::cout << std::noboolalpha;
+#endif
+ }
+};
+
+//============================================================================
+
+// areal-areal geometries
+template <typename P>
+inline void test_box_box()
+{
+ typedef bg::model::box<P> B;
+
+ typedef test_disjoint tester;
+
+ tester::apply("b-b-01",
+ from_wkt<B>("BOX(2 2,3 3)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ false);
+
+ tester::apply("b-b-02",
+ from_wkt<B>("BOX(1 1,3 3)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ false);
+
+ tester::apply("b-b-03",
+ from_wkt<B>("BOX(3 3,4 4)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ true);
+}
+
+template <typename P>
+inline void test_ring_box()
+{
+ typedef bg::model::box<P> B;
+ typedef bg::model::ring<P, false, false> R; // ccw, open
+
+ typedef test_disjoint tester;
+
+ tester::apply("r-b-01",
+ from_wkt<B>("BOX(2 2,3 3)"),
+ from_wkt<R>("POLYGON((0 0,2 0,2 2,0 2))"),
+ false);
+
+ tester::apply("r-b-02",
+ from_wkt<B>("BOX(1 1,3 3)"),
+ from_wkt<R>("POLYGON((0 0,2 0,2 2,0 2))"),
+ false);
+
+ tester::apply("r-b-03",
+ from_wkt<B>("BOX(3 3,4 4)"),
+ from_wkt<R>("POLYGON((0 0,2 0,2 2,0 2))"),
+ true);
+}
+
+template <typename P>
+inline void test_polygon_box()
+{
+ typedef bg::model::box<P> B;
+ typedef bg::model::polygon<P, false, false> PL; // ccw, open
+
+ typedef test_disjoint tester;
+
+ tester::apply("pg-b-01",
+ from_wkt<B>("BOX(2 2,3 3)"),
+ from_wkt<PL>("POLYGON((0 0,2 0,2 2,0 2))"),
+ false);
+
+ tester::apply("pg-b-02",
+ from_wkt<B>("BOX(1 1,3 3)"),
+ from_wkt<PL>("POLYGON((0 0,2 0,2 2,0 2))"),
+ false);
+
+ tester::apply("pg-b-03",
+ from_wkt<B>("BOX(3 3,4 4)"),
+ from_wkt<PL>("POLYGON((0 0,2 0,2 2,0 2))"),
+ true);
+}
+
+template <typename P>
+inline void test_multipolygon_box()
+{
+ typedef bg::model::box<P> B;
+ typedef bg::model::polygon<P, false, false> PL; // ccw, open
+ typedef bg::model::multi_polygon<PL> MPL;
+
+ typedef test_disjoint tester;
+
+ tester::apply("mpg-b-01",
+ from_wkt<B>("BOX(2 2,3 3)"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
+ false);
+
+ tester::apply("mpg-b-02",
+ from_wkt<B>("BOX(1 1,3 3)"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
+ false);
+
+ tester::apply("mpg-b-03",
+ from_wkt<B>("BOX(3 3,4 4)"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
+ true);
+}
+
+template <typename P>
+inline void test_ring_ring()
+{
+ typedef bg::model::ring<P, false, false> R; // ccw, open
+
+ typedef test_disjoint tester;
+
+ tester::apply("r-r-01",
+ from_wkt<R>("POLYGON((2 2,2 3,3 3,3 2))"),
+ from_wkt<R>("POLYGON((0 0,2 0,2 2,0 2))"),
+ false);
+
+ tester::apply("r-r-02",
+ from_wkt<R>("POLYGON((1 1,1 3,3 3,3 1))"),
+ from_wkt<R>("POLYGON((0 0,2 0,2 2,0 2))"),
+ false);
+
+ tester::apply("r-r-03",
+ from_wkt<R>("POLYGON((3 3,3 4,4 4,4 3))"),
+ from_wkt<R>("POLYGON((0 0,2 0,2 2,0 2))"),
+ true);
+}
+
+template <typename P>
+inline void test_polygon_ring()
+{
+ typedef bg::model::ring<P, false, false> R; // ccw, open
+ typedef bg::model::polygon<P, false, false> PL; // ccw, open
+
+ typedef test_disjoint tester;
+
+ tester::apply("pg-r-01",
+ from_wkt<R>("POLYGON((2 2,2 3,3 3,3 2))"),
+ from_wkt<PL>("POLYGON((0 0,2 0,2 2,0 2))"),
+ false);
+
+ tester::apply("pg-r-02",
+ from_wkt<R>("POLYGON((1 1,1 3,3 3,3 1))"),
+ from_wkt<PL>("POLYGON((0 0,2 0,2 2,0 2))"),
+ false);
+
+ tester::apply("pg-r-03",
+ from_wkt<R>("POLYGON((3 3,3 4,4 4,4 3))"),
+ from_wkt<PL>("POLYGON((0 0,2 0,2 2,0 2))"),
+ true);
+}
+
+template <typename P>
+inline void test_multipolygon_ring()
+{
+ typedef bg::model::ring<P, false, false> R; // ccw, open
+ typedef bg::model::polygon<P, false, false> PL; // ccw, open
+ typedef bg::model::multi_polygon<PL> MPL;
+
+ typedef test_disjoint tester;
+
+ tester::apply("mpg-r-01",
+ from_wkt<R>("POLYGON((2 2,2 3,3 3,3 2))"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
+ false);
+
+ tester::apply("mpg-r-02",
+ from_wkt<R>("POLYGON((1 1,1 3,3 3,3 1))"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
+ false);
+
+ tester::apply("mpg-r-03",
+ from_wkt<R>("POLYGON((3 3,3 4,4 4,4 3))"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
+ true);
+}
+
+template <typename P>
+inline void test_polygon_polygon()
+{
+ typedef bg::model::polygon<P, false, false> PL; // ccw, open
+
+ typedef test_disjoint tester;
+
+ tester::apply("pg-pg-01",
+ from_wkt<PL>("POLYGON((2 2,2 3,3 3,3 2))"),
+ from_wkt<PL>("POLYGON((0 0,2 0,2 2,0 2))"),
+ false);
+
+ tester::apply("pg-pg-02",
+ from_wkt<PL>("POLYGON((1 1,1 3,3 3,3 1))"),
+ from_wkt<PL>("POLYGON((0 0,2 0,2 2,0 2))"),
+ false);
+
+ tester::apply("pg-pg-03",
+ from_wkt<PL>("POLYGON((3 3,3 4,4 4,4 3))"),
+ from_wkt<PL>("POLYGON((0 0,2 0,2 2,0 2))"),
+ true);
+
+ tester::apply("pg-pg-04",
+ from_wkt<PL>("POLYGON((0 0,9 0,9 9,0 9))"),
+ from_wkt<PL>("POLYGON((3 3,6 3,6 6,3 6))"),
+ false);
+ // polygon with a hole which entirely contains the other polygon
+ tester::apply("pg-pg-05",
+ from_wkt<PL>("POLYGON((0 0,9 0,9 9,0 9),(2 2,2 7,7 7,7 2))"),
+ from_wkt<PL>("POLYGON((3 3,6 3,6 6,3 6))"),
+ true);
+ // polygon with a hole, but the inner ring intersects the other polygon
+ tester::apply("pg-pg-06",
+ from_wkt<PL>("POLYGON((0 0,9 0,9 9,0 9),(3 2,3 7,7 7,7 2))"),
+ from_wkt<PL>("POLYGON((2 3,6 3,6 6,2 6))"),
+ false);
+ // polygon with a hole, but the other polygon is entirely contained
+ // between the inner and outer rings.
+ tester::apply("pg-pg-07",
+ from_wkt<PL>("POLYGON((0 0,9 0,9 9,0 9),(6 2,6 7,7 7,7 2))"),
+ from_wkt<PL>("POLYGON((3 3,5 3,5 6,3 6))"),
+ false);
+ // polygon with a hole and the outer ring of the other polygon lies
+ // between the inner and outer, but without touching either.
+ tester::apply("pg-pg-08",
+ from_wkt<PL>("POLYGON((0 0,9 0,9 9,0 9),(3 3,3 6,6 6,6 3))"),
+ from_wkt<PL>("POLYGON((2 2,7 2,7 7,2 7))"),
+ false);
+
+ {
+ typedef bg::model::polygon<P> PL; // cw, closed
+
+ // https://svn.boost.org/trac/boost/ticket/10647
+ tester::apply("ticket-10647",
+ from_wkt<PL>("POLYGON((0 0, 0 5, 5 5, 5 0, 0 0)(1 1, 4 1, 4 4, 1 4, 1 1))"),
+ from_wkt<PL>("POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))"),
+ true);
+ }
+}
+
+template <typename P>
+inline void test_polygon_multipolygon()
+{
+ typedef bg::model::polygon<P, false, false> PL; // ccw, open
+ typedef bg::model::multi_polygon<PL> MPL;
+
+ typedef test_disjoint tester;
+
+ tester::apply("pg-mpg-01",
+ from_wkt<PL>("POLYGON((2 2,2 3,3 3,3 2))"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
+ false);
+
+ tester::apply("pg-mpg-02",
+ from_wkt<PL>("POLYGON((1 1,1 3,3 3,3 1))"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
+ false);
+
+ tester::apply("pg-mpg-03",
+ from_wkt<PL>("POLYGON((3 3,3 4,4 4,4 3))"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
+ true);
+}
+
+template <typename P>
+inline void test_multipolygon_multipolygon()
+{
+ typedef bg::model::polygon<P, false, false> PL; // ccw, open
+ typedef bg::model::multi_polygon<PL> MPL;
+
+ typedef test_disjoint tester;
+
+ tester::apply("mpg-mpg-01",
+ from_wkt<MPL>("MULTIPOLYGON(((2 2,2 3,3 3,3 2)))"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
+ false);
+
+ tester::apply("mpg-mpg-02",
+ from_wkt<MPL>("MULTIPOLYGON(((1 1,1 3,3 3,3 1)))"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
+ false);
+
+ tester::apply("mpg-mpg-03",
+ from_wkt<MPL>("MULTIPOLYGON(((3 3,3 4,4 4,4 3)))"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,2 2,0 2)))"),
+ true);
+}
+
+//============================================================================
+
+template <typename CoordinateType>
+inline void test_areal_areal()
+{
+ typedef bg::model::point<CoordinateType, 2, bg::cs::cartesian> point_type;
+
+ test_polygon_polygon<point_type>();
+ test_polygon_multipolygon<point_type>();
+ test_polygon_ring<point_type>();
+ test_polygon_box<point_type>();
+
+ test_multipolygon_multipolygon<point_type>();
+ test_multipolygon_ring<point_type>();
+ test_multipolygon_box<point_type>();
+
+ test_ring_ring<point_type>();
+ test_ring_box<point_type>();
+
+ test_box_box<point_type>();
+}
+
+//============================================================================
+
+BOOST_AUTO_TEST_CASE( test_areal_areal_all )
+{
+ test_areal_areal<double>();
+ test_areal_areal<int>();
+#ifdef HAVE_TTMATH
+ test_areal_areal<ttmath_big>();
+#endif
+}
diff --git a/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_l_a.cpp b/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_l_a.cpp
new file mode 100644
index 0000000000..cb55aaa8d4
--- /dev/null
+++ b/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_l_a.cpp
@@ -0,0 +1,538 @@
+// 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
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
+#ifndef BOOST_TEST_MODULE
+#define BOOST_TEST_MODULE test_disjoint_coverage
+#endif
+
+// unit test to test disjoint for all geometry combinations
+
+#include <iostream>
+
+#include <boost/test/included/unit_test.hpp>
+
+#include <boost/geometry/core/tag.hpp>
+#include <boost/geometry/core/tags.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+#include <boost/geometry/io/dsv/write.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/algorithms/disjoint.hpp>
+
+#include <from_wkt.hpp>
+
+
+#ifdef HAVE_TTMATH
+#include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
+#endif
+
+namespace bg = ::boost::geometry;
+
+//============================================================================
+
+struct test_disjoint
+{
+ template <typename Geometry1, typename Geometry2>
+ static inline void apply(std::string const& case_id,
+ Geometry1 const& geometry1,
+ Geometry2 const& geometry2,
+ bool expected_result)
+ {
+ bool result = bg::disjoint(geometry1, geometry2);
+ BOOST_CHECK_MESSAGE(result == expected_result,
+ "case ID: " << case_id << ", G1: " << bg::wkt(geometry1)
+ << ", G2: " << bg::wkt(geometry2) << " -> Expected: "
+ << expected_result << ", detected: " << result);
+
+ result = bg::disjoint(geometry2, geometry1);
+ BOOST_CHECK_MESSAGE(result == expected_result,
+ "case ID: " << case_id << ", G1: " << bg::wkt(geometry2)
+ << ", G2: " << bg::wkt(geometry1) << " -> Expected: "
+ << expected_result << ", detected: " << result);
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "case ID: " << case_id << "; G1 - G2: ";
+ std::cout << bg::wkt(geometry1) << " - ";
+ std::cout << bg::wkt(geometry2) << std::endl;
+ std::cout << std::boolalpha;
+ std::cout << "expected/computed result: "
+ << expected_result << " / " << result << std::endl;
+ std::cout << std::endl;
+ std::cout << std::noboolalpha;
+#endif
+ }
+};
+
+//============================================================================
+
+// linear-areal geometries
+template <typename P>
+inline void test_segment_box()
+{
+ typedef bg::model::segment<P> S;
+ typedef bg::model::box<P> B;
+
+ typedef test_disjoint tester;
+
+ tester::apply("s-b-01",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ false);
+
+ tester::apply("s-b-02",
+ from_wkt<S>("SEGMENT(1 1,3 3)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ false);
+
+ tester::apply("s-b-03",
+ from_wkt<S>("SEGMENT(2 2,3 3)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ false);
+
+ tester::apply("s-b-04",
+ from_wkt<S>("SEGMENT(4 4,3 3)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ true);
+
+ tester::apply("s-b-05",
+ from_wkt<S>("SEGMENT(0 4,4 4)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ true);
+
+ tester::apply("s-b-06",
+ from_wkt<S>("SEGMENT(4 0,4 4)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ true);
+
+ tester::apply("s-b-07",
+ from_wkt<S>("SEGMENT(0 -2,0 -1)"),
+ from_wkt<B>("BOX(0 0,1 1)"),
+ true);
+
+ tester::apply("s-b-08",
+ from_wkt<S>("SEGMENT(-2 -2,-2 -1)"),
+ from_wkt<B>("BOX(0 0,1 1)"),
+ true);
+
+ tester::apply("s-b-09",
+ from_wkt<S>("SEGMENT(-2 -2,-2 -2)"),
+ from_wkt<B>("BOX(0 0,1 1)"),
+ true);
+
+ tester::apply("s-b-10",
+ from_wkt<S>("SEGMENT(-2 0,-2 0)"),
+ from_wkt<B>("BOX(0 0,1 1)"),
+ true);
+
+ tester::apply("s-b-11",
+ from_wkt<S>("SEGMENT(0 -2,0 -2)"),
+ from_wkt<B>("BOX(0 0,1 1)"),
+ true);
+
+ tester::apply("s-b-12",
+ from_wkt<S>("SEGMENT(-2 0,-1 0)"),
+ from_wkt<B>("BOX(0 0,1 1)"),
+ true);
+
+ // segment degenerates to a point
+ tester::apply("s-b-13",
+ from_wkt<S>("SEGMENT(0 0,0 0)"),
+ from_wkt<B>("BOX(0 0,1 1)"),
+ false);
+
+ tester::apply("s-b-14",
+ from_wkt<S>("SEGMENT(1 1,1 1)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ false);
+
+ tester::apply("s-b-15",
+ from_wkt<S>("SEGMENT(2 2,2 2)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ false);
+
+ tester::apply("s-b-16",
+ from_wkt<S>("SEGMENT(2 0,2 0)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ false);
+
+ tester::apply("s-b-17",
+ from_wkt<S>("SEGMENT(0 2,0 2)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ false);
+
+ tester::apply("s-b-18",
+ from_wkt<S>("SEGMENT(2 2,2 2)"),
+ from_wkt<B>("BOX(0 0,1 1)"),
+ true);
+}
+
+template <typename P>
+inline void test_segment_ring()
+{
+ typedef bg::model::segment<P> S;
+ typedef bg::model::ring<P, false, false> R; // ccw, open
+
+ typedef test_disjoint tester;
+
+ tester::apply("s-r-01",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
+ false);
+
+ tester::apply("s-r-02",
+ from_wkt<S>("SEGMENT(1 0,3 3)"),
+ from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
+ false);
+
+ tester::apply("s-r-03",
+ from_wkt<S>("SEGMENT(1 1,3 3)"),
+ from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
+ false);
+
+ tester::apply("s-r-04",
+ from_wkt<S>("SEGMENT(2 2,3 3)"),
+ from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
+ true);
+}
+
+template <typename P>
+inline void test_segment_polygon()
+{
+ typedef bg::model::segment<P> S;
+ typedef bg::model::polygon<P, false, false> PL; // ccw, open
+
+ typedef test_disjoint tester;
+
+ tester::apply("s-pg-01",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
+ false);
+
+ tester::apply("s-pg-02",
+ from_wkt<S>("SEGMENT(1 0,3 3)"),
+ from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
+ false);
+
+ tester::apply("s-pg-03",
+ from_wkt<S>("SEGMENT(1 1,3 3)"),
+ from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
+ false);
+
+ tester::apply("s-pg-04",
+ from_wkt<S>("SEGMENT(2 2,3 3)"),
+ from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
+ true);
+}
+
+template <typename P>
+inline void test_segment_multipolygon()
+{
+ typedef bg::model::segment<P> S;
+ typedef bg::model::polygon<P, false, false> PL; // ccw, open
+ typedef bg::model::multi_polygon<PL> MPL;
+
+ typedef test_disjoint tester;
+
+ tester::apply("s-mpg-01",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
+ false);
+
+ tester::apply("s-mpg-02",
+ from_wkt<S>("SEGMENT(1 0,3 3)"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
+ false);
+
+ tester::apply("s-mpg-03",
+ from_wkt<S>("SEGMENT(1 1,3 3)"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
+ false);
+
+ tester::apply("s-mpg-04",
+ from_wkt<S>("SEGMENT(2 2,3 3)"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
+ true);
+}
+
+template <typename P>
+inline void test_linestring_box()
+{
+ typedef bg::model::linestring<P> L;
+ typedef bg::model::box<P> B;
+
+ typedef test_disjoint tester;
+
+ tester::apply("l-b-01",
+ from_wkt<L>("LINESTRING(0 0,2 0)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ false);
+
+ tester::apply("l-b-02",
+ from_wkt<L>("LINESTRING(1 1,3 3)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ false);
+
+ tester::apply("l-b-03",
+ from_wkt<L>("LINESTRING(2 2,3 3)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ false);
+
+ tester::apply("l-b-04",
+ from_wkt<L>("LINESTRING(4 4,3 3)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ true);
+}
+
+template <typename P>
+inline void test_linestring_ring()
+{
+ typedef bg::model::linestring<P> L;
+ typedef bg::model::ring<P, false, false> R; // ccw, open
+
+ typedef test_disjoint tester;
+
+ tester::apply("l-r-01",
+ from_wkt<L>("LINESTRING(0 0,2 0)"),
+ from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
+ false);
+
+ tester::apply("l-r-02",
+ from_wkt<L>("LINESTRING(1 0,3 3)"),
+ from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
+ false);
+
+ tester::apply("l-r-03",
+ from_wkt<L>("LINESTRING(1 1,3 3)"),
+ from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
+ false);
+
+ tester::apply("l-r-04",
+ from_wkt<L>("LINESTRING(2 2,3 3)"),
+ from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
+ true);
+}
+
+template <typename P>
+inline void test_linestring_polygon()
+{
+ typedef bg::model::linestring<P> L;
+ typedef bg::model::polygon<P, false, false> PL; // ccw, open
+
+ typedef test_disjoint tester;
+
+ tester::apply("l-pg-01",
+ from_wkt<L>("LINESTRING(0 0,2 0)"),
+ from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
+ false);
+
+ tester::apply("l-pg-02",
+ from_wkt<L>("LINESTRING(1 0,3 3)"),
+ from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
+ false);
+
+ tester::apply("l-pg-03",
+ from_wkt<L>("LINESTRING(1 1,3 3)"),
+ from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
+ false);
+
+ tester::apply("l-pg-04",
+ from_wkt<L>("LINESTRING(2 2,3 3)"),
+ from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
+ true);
+}
+
+template <typename P>
+inline void test_linestring_multipolygon()
+{
+ typedef bg::model::linestring<P> L;
+ typedef bg::model::polygon<P, false, false> PL; // ccw, open
+ typedef bg::model::multi_polygon<PL> MPL;
+
+ typedef test_disjoint tester;
+
+ tester::apply("l-mpg-01",
+ from_wkt<L>("LINESTRING(0 0,2 0)"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
+ false);
+
+ tester::apply("l-mpg-02",
+ from_wkt<L>("LINESTRING(1 0,3 3)"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
+ false);
+
+ tester::apply("l-mpg-03",
+ from_wkt<L>("LINESTRING(1 1,3 3)"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
+ false);
+
+ tester::apply("l-mpg-04",
+ from_wkt<L>("LINESTRING(2 2,3 3)"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
+ true);
+}
+
+template <typename P>
+inline void test_multilinestring_box()
+{
+ typedef bg::model::linestring<P> L;
+ typedef bg::model::multi_linestring<L> ML;
+ typedef bg::model::box<P> B;
+
+ typedef test_disjoint tester;
+
+ tester::apply("ml-b-01",
+ from_wkt<ML>("MULTILINESTRING((0 0,2 0))"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ false);
+
+ tester::apply("ml-b-02",
+ from_wkt<ML>("MULTILINESTRING((1 1,3 3))"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ false);
+
+ tester::apply("ml-b-03",
+ from_wkt<ML>("MULTILINESTRING((2 2,3 3))"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ false);
+
+ tester::apply("ml-b-04",
+ from_wkt<ML>("MULTILINESTRING((4 4,3 3))"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ true);
+}
+
+template <typename P>
+inline void test_multilinestring_ring()
+{
+ typedef bg::model::linestring<P> L;
+ typedef bg::model::multi_linestring<L> ML;
+ typedef bg::model::ring<P, false, false> R; // ccw, open
+
+ typedef test_disjoint tester;
+
+ tester::apply("ml-r-01",
+ from_wkt<ML>("MULTILINESTRING((0 0,2 0))"),
+ from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
+ false);
+
+ tester::apply("ml-r-02",
+ from_wkt<ML>("MULTILINESTRING((1 0,3 3))"),
+ from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
+ false);
+
+ tester::apply("ml-r-03",
+ from_wkt<ML>("MULTILINESTRING((1 1,3 3))"),
+ from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
+ false);
+
+ tester::apply("ml-r-04",
+ from_wkt<ML>("MULTILINESTRING((2 2,3 3))"),
+ from_wkt<R>("POLYGON((0 0,2 0,0 2))"),
+ true);
+}
+
+template <typename P>
+inline void test_multilinestring_polygon()
+{
+ typedef bg::model::linestring<P> L;
+ typedef bg::model::multi_linestring<L> ML;
+ typedef bg::model::polygon<P, false, false> PL; // ccw, open
+
+ typedef test_disjoint tester;
+
+ tester::apply("ml-pg-01",
+ from_wkt<ML>("MULTILINESTRING((0 0,2 0))"),
+ from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
+ false);
+
+ tester::apply("ml-pg-02",
+ from_wkt<ML>("MULTILINESTRING((1 0,3 3))"),
+ from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
+ false);
+
+ tester::apply("ml-pg-03",
+ from_wkt<ML>("MULTILINESTRING((1 1,3 3))"),
+ from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
+ false);
+
+ tester::apply("ml-pg-04",
+ from_wkt<ML>("MULTILINESTRING((2 2,3 3))"),
+ from_wkt<PL>("POLYGON((0 0,2 0,0 2))"),
+ true);
+}
+
+template <typename P>
+inline void test_multilinestring_multipolygon()
+{
+ typedef bg::model::linestring<P> L;
+ typedef bg::model::multi_linestring<L> ML;
+ typedef bg::model::polygon<P, false, false> PL; // ccw, open
+ typedef bg::model::multi_polygon<PL> MPL;
+
+ typedef test_disjoint tester;
+
+ tester::apply("ml-mpg-01",
+ from_wkt<ML>("MULTILINESTRING((0 0,2 0))"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
+ false);
+
+ tester::apply("ml-mpg-02",
+ from_wkt<ML>("MULTILINESTRING((1 0,3 3))"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
+ false);
+
+ tester::apply("ml-mpg-03",
+ from_wkt<ML>("MULTILINESTRING((1 1,3 3))"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
+ false);
+
+ tester::apply("ml-mpg-04",
+ from_wkt<ML>("MULTILINESTRING((2 2,3 3))"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,2 0,0 2)))"),
+ true);
+}
+
+//============================================================================
+
+template <typename CoordinateType>
+inline void test_linear_areal()
+{
+ typedef bg::model::point<CoordinateType, 2, bg::cs::cartesian> point_type;
+
+ test_segment_polygon<point_type>();
+ test_segment_multipolygon<point_type>();
+ test_segment_ring<point_type>();
+ test_segment_box<point_type>();
+
+ test_linestring_polygon<point_type>();
+ test_linestring_multipolygon<point_type>();
+ test_linestring_ring<point_type>();
+ test_linestring_box<point_type>();
+
+ test_multilinestring_polygon<point_type>();
+ test_multilinestring_multipolygon<point_type>();
+ test_multilinestring_ring<point_type>();
+ test_multilinestring_box<point_type>();
+}
+
+//============================================================================
+
+BOOST_AUTO_TEST_CASE( test_linear_areal_all )
+{
+ test_linear_areal<double>();
+ test_linear_areal<int>();
+#ifdef HAVE_TTMATH
+ test_linear_areal<ttmath_big>();
+#endif
+}
diff --git a/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_l_l.cpp b/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_l_l.cpp
new file mode 100644
index 0000000000..1d1161e1c4
--- /dev/null
+++ b/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_l_l.cpp
@@ -0,0 +1,379 @@
+// 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
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
+#ifndef BOOST_TEST_MODULE
+#define BOOST_TEST_MODULE test_disjoint_coverage
+#endif
+
+// unit test to test disjoint for all geometry combinations
+
+#include <iostream>
+
+#include <boost/test/included/unit_test.hpp>
+
+#include <boost/geometry/core/tag.hpp>
+#include <boost/geometry/core/tags.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+#include <boost/geometry/io/dsv/write.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/algorithms/disjoint.hpp>
+
+#include <from_wkt.hpp>
+
+
+#ifdef HAVE_TTMATH
+#include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
+#endif
+
+namespace bg = ::boost::geometry;
+
+//============================================================================
+
+struct test_disjoint
+{
+ template <typename Geometry1, typename Geometry2>
+ static inline void apply(std::string const& case_id,
+ Geometry1 const& geometry1,
+ Geometry2 const& geometry2,
+ bool expected_result)
+ {
+ bool result = bg::disjoint(geometry1, geometry2);
+ BOOST_CHECK_MESSAGE(result == expected_result,
+ "case ID: " << case_id << ", G1: " << bg::wkt(geometry1)
+ << ", G2: " << bg::wkt(geometry2) << " -> Expected: "
+ << expected_result << ", detected: " << result);
+
+ result = bg::disjoint(geometry2, geometry1);
+ BOOST_CHECK_MESSAGE(result == expected_result,
+ "case ID: " << case_id << ", G1: " << bg::wkt(geometry2)
+ << ", G2: " << bg::wkt(geometry1) << " -> Expected: "
+ << expected_result << ", detected: " << result);
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "case ID: " << case_id << "; G1 - G2: ";
+ std::cout << bg::wkt(geometry1) << " - ";
+ std::cout << bg::wkt(geometry2) << std::endl;
+ std::cout << std::boolalpha;
+ std::cout << "expected/computed result: "
+ << expected_result << " / " << result << std::endl;
+ std::cout << std::endl;
+ std::cout << std::noboolalpha;
+#endif
+ }
+};
+
+//============================================================================
+
+// linear-linear geometries
+template <typename P>
+inline void test_segment_segment()
+{
+ typedef bg::model::segment<P> S;
+
+ typedef test_disjoint tester;
+
+ tester::apply("s-s-01",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<S>("SEGMENT(0 0,0 2)"),
+ false);
+
+ tester::apply("s-s-02",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<S>("SEGMENT(2 0,3 0)"),
+ false);
+
+ tester::apply("s-s-03",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<S>("SEGMENT(1 0,3 0)"),
+ false);
+
+ tester::apply("s-s-04",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<S>("SEGMENT(1 0,1 1)"),
+ false);
+
+ tester::apply("s-s-05",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<S>("SEGMENT(1 1,2 2)"),
+ true);
+
+ tester::apply("s-s-06",
+ from_wkt<S>("SEGMENT(0 0,1 1)"),
+ from_wkt<S>("SEGMENT(1 1,1 1)"),
+ false);
+
+ tester::apply("s-s-07",
+ from_wkt<S>("SEGMENT(0 0,1 1)"),
+ from_wkt<S>("SEGMENT(2 2,2 2)"),
+ true);
+
+ tester::apply("s-s-08",
+ from_wkt<S>("SEGMENT(0 0,1 1)"),
+ from_wkt<S>("SEGMENT(2 2,3 3)"),
+ true);
+}
+
+template <typename P>
+inline void test_linestring_segment()
+{
+ typedef bg::model::segment<P> S;
+ typedef bg::model::linestring<P> L;
+
+ typedef test_disjoint tester;
+
+ tester::apply("l-s-01",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<L>("LINESTRING(0 0,0 2)"),
+ false);
+
+ tester::apply("l-s-02",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<L>("LINESTRING(2 0,3 0)"),
+ false);
+
+ tester::apply("l-s-03",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<L>("LINESTRING(1 0,3 0)"),
+ false);
+
+ tester::apply("l-s-04",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<L>("LINESTRING(1 0,1 1)"),
+ false);
+
+ tester::apply("l-s-05",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<L>("LINESTRING(1 1,2 2)"),
+ true);
+
+ tester::apply("l-s-06",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<L>("LINESTRING(1 1,1 1,2 2)"),
+ true);
+
+ tester::apply("l-s-07",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<L>("LINESTRING(1 0,1 0,1 1,2 2)"),
+ false);
+
+ tester::apply("l-s-08",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<L>("LINESTRING(1 0,1 0,3 0)"),
+ false);
+
+ tester::apply("l-s-09",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<L>("LINESTRING(3 0,3 0,4 0)"),
+ true);
+
+ tester::apply("l-s-10",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<L>("LINESTRING(3 0,3 0)"),
+ true);
+
+ tester::apply("l-s-11",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<L>("LINESTRING(-1 0,-1 0)"),
+ true);
+
+ tester::apply("l-s-12",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<L>("LINESTRING(1 0,1 0)"),
+ false);
+
+ tester::apply("l-s-13",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<L>("LINESTRING(1 1,1 1)"),
+ true);
+}
+
+template <typename P>
+inline void test_multilinestring_segment()
+{
+ typedef bg::model::segment<P> S;
+ typedef bg::model::linestring<P> L;
+ typedef bg::model::multi_linestring<L> ML;
+
+ typedef test_disjoint tester;
+
+ tester::apply("s-ml-01",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,0 2))"),
+ false);
+
+ tester::apply("s-ml-02",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<ML>("MULTILINESTRING((2 0,3 0))"),
+ false);
+
+ tester::apply("s-ml-03",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 0,3 0))"),
+ false);
+
+ tester::apply("s-ml-04",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 0,1 1))"),
+ false);
+
+ tester::apply("s-ml-05",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 1,2 2))"),
+ true);
+
+ tester::apply("s-ml-06",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 1,2 2),(3 3,3 3))"),
+ true);
+
+ tester::apply("s-ml-07",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 1,2 2),(1 0,1 0))"),
+ false);
+
+ tester::apply("s-ml-08",
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 1,2 2),(3 0,3 0))"),
+ true);
+}
+
+template <typename P>
+inline void test_linestring_linestring()
+{
+ typedef bg::model::linestring<P> L;
+
+ typedef test_disjoint tester;
+
+ tester::apply("l-l-01",
+ from_wkt<L>("LINESTRING(0 0,2 0)"),
+ from_wkt<L>("LINESTRING(0 0,0 2)"),
+ false);
+
+ tester::apply("l-l-02",
+ from_wkt<L>("LINESTRING(0 0,2 0)"),
+ from_wkt<L>("LINESTRING(2 0,3 0)"),
+ false);
+
+ tester::apply("l-l-03",
+ from_wkt<L>("LINESTRING(0 0,2 0)"),
+ from_wkt<L>("LINESTRING(1 0,3 0)"),
+ false);
+
+ tester::apply("l-l-04",
+ from_wkt<L>("LINESTRING(0 0,2 0)"),
+ from_wkt<L>("LINESTRING(1 0,1 1)"),
+ false);
+
+ tester::apply("l-l-05",
+ from_wkt<L>("LINESTRING(0 0,2 0)"),
+ from_wkt<L>("LINESTRING(1 1,2 2)"),
+ true);
+}
+
+template <typename P>
+inline void test_linestring_multilinestring()
+{
+ typedef bg::model::linestring<P> L;
+ typedef bg::model::multi_linestring<L> ML;
+
+ typedef test_disjoint tester;
+
+ tester::apply("l-ml-01",
+ from_wkt<L>("LINESTRING(0 0,2 0)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,0 2))"),
+ false);
+
+ tester::apply("l-ml-02",
+ from_wkt<L>("LINESTRING(0 0,2 0)"),
+ from_wkt<ML>("MULTILINESTRING((2 0,3 0))"),
+ false);
+
+ tester::apply("l-ml-03",
+ from_wkt<L>("LINESTRING(0 0,2 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 0,3 0))"),
+ false);
+
+ tester::apply("l-ml-04",
+ from_wkt<L>("LINESTRING(0 0,2 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 0,1 1))"),
+ false);
+
+ tester::apply("l-ml-05",
+ from_wkt<L>("LINESTRING(0 0,2 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 1,2 2))"),
+ true);
+}
+
+template <typename P>
+inline void test_multilinestring_multilinestring()
+{
+ typedef bg::model::linestring<P> L;
+ typedef bg::model::multi_linestring<L> ML;
+
+ typedef test_disjoint tester;
+
+ tester::apply("ml-ml-01",
+ from_wkt<ML>("MULTILINESTRING((0 0,2 0))"),
+ from_wkt<ML>("MULTILINESTRING((0 0,0 2))"),
+ false);
+
+ tester::apply("ml-ml-02",
+ from_wkt<ML>("MULTILINESTRING((0 0,2 0))"),
+ from_wkt<ML>("MULTILINESTRING((2 0,3 0))"),
+ false);
+
+ tester::apply("ml-ml-03",
+ from_wkt<ML>("MULTILINESTRING((0 0,2 0))"),
+ from_wkt<ML>("MULTILINESTRING((1 0,3 0))"),
+ false);
+
+ tester::apply("ml-ml-04",
+ from_wkt<ML>("MULTILINESTRING((0 0,2 0))"),
+ from_wkt<ML>("MULTILINESTRING((1 0,1 1))"),
+ false);
+
+ tester::apply("ml-ml-05",
+ from_wkt<ML>("MULTILINESTRING((0 0,2 0))"),
+ from_wkt<ML>("MULTILINESTRING((1 1,2 2))"),
+ true);
+}
+
+//============================================================================
+
+template <typename CoordinateType>
+inline void test_linear_linear()
+{
+ typedef bg::model::point<CoordinateType, 2, bg::cs::cartesian> point_type;
+
+ test_linestring_linestring<point_type>();
+ test_linestring_multilinestring<point_type>();
+ test_linestring_segment<point_type>();
+
+ test_multilinestring_multilinestring<point_type>();
+ test_multilinestring_segment<point_type>();
+
+ test_segment_segment<point_type>();
+}
+
+//============================================================================
+
+BOOST_AUTO_TEST_CASE( test_linear_linear_all )
+{
+ test_linear_linear<double>();
+ test_linear_linear<int>();
+#ifdef HAVE_TTMATH
+ test_linear_linear<ttmath_big>();
+#endif
+}
diff --git a/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_p_a.cpp b/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_p_a.cpp
new file mode 100644
index 0000000000..0f42fd7ecb
--- /dev/null
+++ b/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_p_a.cpp
@@ -0,0 +1,291 @@
+// 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
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
+#ifndef BOOST_TEST_MODULE
+#define BOOST_TEST_MODULE test_disjoint_coverage
+#endif
+
+// unit test to test disjoint for all geometry combinations
+
+#include <iostream>
+
+#include <boost/test/included/unit_test.hpp>
+
+#include <boost/geometry/core/tag.hpp>
+#include <boost/geometry/core/tags.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+#include <boost/geometry/io/dsv/write.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/algorithms/disjoint.hpp>
+
+#include <from_wkt.hpp>
+
+
+#ifdef HAVE_TTMATH
+#include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
+#endif
+
+namespace bg = ::boost::geometry;
+
+//============================================================================
+
+struct test_disjoint
+{
+ template <typename Geometry1, typename Geometry2>
+ static inline void apply(std::string const& case_id,
+ Geometry1 const& geometry1,
+ Geometry2 const& geometry2,
+ bool expected_result)
+ {
+ bool result = bg::disjoint(geometry1, geometry2);
+ BOOST_CHECK_MESSAGE(result == expected_result,
+ "case ID: " << case_id << ", G1: " << bg::wkt(geometry1)
+ << ", G2: " << bg::wkt(geometry2) << " -> Expected: "
+ << expected_result << ", detected: " << result);
+
+ result = bg::disjoint(geometry2, geometry1);
+ BOOST_CHECK_MESSAGE(result == expected_result,
+ "case ID: " << case_id << ", G1: " << bg::wkt(geometry2)
+ << ", G2: " << bg::wkt(geometry1) << " -> Expected: "
+ << expected_result << ", detected: " << result);
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "case ID: " << case_id << "; G1 - G2: ";
+ std::cout << bg::wkt(geometry1) << " - ";
+ std::cout << bg::wkt(geometry2) << std::endl;
+ std::cout << std::boolalpha;
+ std::cout << "expected/computed result: "
+ << expected_result << " / " << result << std::endl;
+ std::cout << std::endl;
+ std::cout << std::noboolalpha;
+#endif
+ }
+};
+
+//============================================================================
+
+// pointlike-areal geometries
+template <typename P>
+inline void test_point_box()
+{
+ typedef test_disjoint tester;
+ typedef bg::model::box<P> B;
+
+ tester::apply("p-b-01",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<B>("BOX(0 0,1 1)"),
+ false);
+
+ tester::apply("p-b-02",
+ from_wkt<P>("POINT(2 2)"),
+ from_wkt<B>("BOX(0 0,1 0)"),
+ true);
+}
+
+template <typename P>
+inline void test_point_ring()
+{
+ typedef bg::model::ring<P, false, false> R; // ccw, open
+
+ typedef test_disjoint tester;
+
+ tester::apply("p-r-01",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<R>("POLYGON((0 0,1 0,0 1))"),
+ false);
+
+ tester::apply("p-r-02",
+ from_wkt<P>("POINT(1 1)"),
+ from_wkt<R>("POLYGON((0 0,1 0,0 1))"),
+ true);
+}
+
+template <typename P>
+inline void test_point_polygon()
+{
+ typedef bg::model::polygon<P, false, false> PL; // ccw, open
+
+ typedef test_disjoint tester;
+
+ tester::apply("p-pg-01",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<PL>("POLYGON((0 0,1 0,0 1))"),
+ false);
+
+ tester::apply("p-pg-02",
+ from_wkt<P>("POINT(1 1)"),
+ from_wkt<PL>("POLYGON((0 0,1 0,0 1))"),
+ true);
+}
+
+template <typename P>
+inline void test_point_multipolygon()
+{
+ typedef bg::model::polygon<P, false, false> PL; // ccw, open
+ typedef bg::model::multi_polygon<PL> MPL;
+
+ typedef test_disjoint tester;
+
+ tester::apply("p-mpg-01",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,1 0,0 1)),((2 0,3 0,2 1)))"),
+ false);
+
+ tester::apply("p-mpg-02",
+ from_wkt<P>("POINT(1 1)"),
+ from_wkt<MPL>("MULTIPOLYGON(((0 0,1 0,0 1)),((2 0,3 0,2 1)))"),
+ true);
+}
+
+template <typename P>
+inline void test_multipoint_box()
+{
+ typedef test_disjoint tester;
+ typedef bg::model::multi_point<P> MP;
+ typedef bg::model::box<P> B;
+
+ tester::apply("mp-b-01",
+ from_wkt<MP>("MULTIPOINT(0 0,1 1)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ false);
+
+ tester::apply("mp-b-02",
+ from_wkt<MP>("MULTIPOINT(1 1,3 3)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ false);
+
+ tester::apply("mp-b-03",
+ from_wkt<MP>("MULTIPOINT(3 3,4 4)"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ true);
+
+ tester::apply("mp-b-04",
+ from_wkt<MP>("MULTIPOINT()"),
+ from_wkt<B>("BOX(0 0,2 2)"),
+ true);
+}
+
+template <typename P>
+inline void test_multipoint_ring()
+{
+ typedef bg::model::multi_point<P> MP;
+ typedef bg::model::ring<P, false, false> R; // ccw, open
+
+ typedef test_disjoint tester;
+
+ tester::apply("mp-r-01",
+ from_wkt<MP>("MULTIPOINT(0 0,1 0)"),
+ from_wkt<R>("POLYGON((0 0,1 0,0 1))"),
+ false);
+
+ tester::apply("mp-r-02",
+ from_wkt<MP>("MULTIPOINT(1 0,1 1)"),
+ from_wkt<R>("POLYGON((0 0,1 0,0 1))"),
+ false);
+
+ tester::apply("mp-r-03",
+ from_wkt<MP>("MULTIPOINT(1 1,2 2)"),
+ from_wkt<R>("POLYGON((0 0,1 0,0 1))"),
+ true);
+}
+
+template <typename P>
+inline void test_multipoint_polygon()
+{
+ typedef bg::model::multi_point<P> MP;
+ typedef bg::model::polygon<P, false, false> PL; // ccw, open
+
+ typedef test_disjoint tester;
+
+ tester::apply("mp-pg-01",
+ from_wkt<MP>("MULTIPOINT(0 0,1 0)"),
+ from_wkt<PL>("POLYGON(((0 0,1 0,0 1)))"),
+ false);
+
+ tester::apply("mp-pg-02",
+ from_wkt<MP>("MULTIPOINT(0 0,2 0)"),
+ from_wkt<PL>("POLYGON(((0 0,1 0,0 1)))"),
+ false);
+
+ tester::apply("mp-pg-03",
+ from_wkt<MP>("MULTIPOINT(1 1,2 0)"),
+ from_wkt<PL>("POLYGON(((0 0,1 0,0 1)))"),
+ true);
+
+ tester::apply("mp-pg-04",
+ from_wkt<MP>("MULTIPOINT(1 1,2 3)"),
+ from_wkt<PL>("POLYGON(((0 0,1 0,0 1)))"),
+ true);
+}
+
+template <typename P>
+inline void test_multipoint_multipolygon()
+{
+ typedef bg::model::multi_point<P> MP;
+ typedef bg::model::polygon<P, false, false> PL; // ccw, open
+ typedef bg::model::multi_polygon<PL> MPL;
+
+ typedef test_disjoint tester;
+
+ tester::apply("mp-mp-01",
+ from_wkt<MP>("MULTIPOINT(0 0,2 0)"),
+ from_wkt<MPL>("MULTIPOLYGON((0 0,1 0,0 1)),(2 0,3 0,2 1))"),
+ false);
+
+ tester::apply("mp-mp-02",
+ from_wkt<MP>("MULTIPOINT(0 0,1 0)"),
+ from_wkt<MPL>("MULTIPOLYGON((0 0,1 0,0 1)),(2 0,3 0,2 1))"),
+ false);
+
+ tester::apply("mp-mp-03",
+ from_wkt<MP>("MULTIPOINT(1 1,2 0)"),
+ from_wkt<MPL>("MULTIPOLYGON((0 0,1 0,0 1)),(2 0,3 0,2 1))"),
+ false);
+
+ tester::apply("mp-mp-04",
+ from_wkt<MP>("MULTIPOINT(1 1,2 3)"),
+ from_wkt<MPL>("MULTIPOLYGON((0 0,1 0,0 1)),(2 0,3 0,2 1))"),
+ true);
+}
+
+//============================================================================
+
+template <typename CoordinateType>
+inline void test_pointlike_areal()
+{
+ typedef bg::model::point<CoordinateType, 2, bg::cs::cartesian> point_type;
+
+ test_point_polygon<point_type>();
+ test_point_multipolygon<point_type>();
+ test_point_ring<point_type>();
+ test_point_box<point_type>();
+
+ // not implemented yet
+ // test_multipoint_polygon<point_type>();
+ // test_multipoint_multipolygon<point_type>();
+ // test_multipoint_ring<point_type>();
+ test_multipoint_box<point_type>();
+}
+
+//============================================================================
+
+BOOST_AUTO_TEST_CASE( test_pointlike_areal_all )
+{
+ test_pointlike_areal<double>();
+ test_pointlike_areal<int>();
+#ifdef HAVE_TTMATH
+ test_pointlike_areal<ttmath_big>();
+#endif
+}
diff --git a/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_p_l.cpp b/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_p_l.cpp
new file mode 100644
index 0000000000..ab4b8839ab
--- /dev/null
+++ b/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_p_l.cpp
@@ -0,0 +1,391 @@
+// 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
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
+#ifndef BOOST_TEST_MODULE
+#define BOOST_TEST_MODULE test_disjoint_coverage
+#endif
+
+// unit test to test disjoint for all geometry combinations
+
+#include <iostream>
+
+#include <boost/test/included/unit_test.hpp>
+
+#include <boost/geometry/core/tag.hpp>
+#include <boost/geometry/core/tags.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+#include <boost/geometry/io/dsv/write.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/algorithms/disjoint.hpp>
+
+#include <from_wkt.hpp>
+
+
+#ifdef HAVE_TTMATH
+#include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
+#endif
+
+namespace bg = ::boost::geometry;
+
+//============================================================================
+
+struct test_disjoint
+{
+ template <typename Geometry1, typename Geometry2>
+ static inline void apply(std::string const& case_id,
+ Geometry1 const& geometry1,
+ Geometry2 const& geometry2,
+ bool expected_result)
+ {
+ bool result = bg::disjoint(geometry1, geometry2);
+ BOOST_CHECK_MESSAGE(result == expected_result,
+ "case ID: " << case_id << ", G1: " << bg::wkt(geometry1)
+ << ", G2: " << bg::wkt(geometry2) << " -> Expected: "
+ << expected_result << ", detected: " << result);
+
+ result = bg::disjoint(geometry2, geometry1);
+ BOOST_CHECK_MESSAGE(result == expected_result,
+ "case ID: " << case_id << ", G1: " << bg::wkt(geometry2)
+ << ", G2: " << bg::wkt(geometry1) << " -> Expected: "
+ << expected_result << ", detected: " << result);
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "case ID: " << case_id << "; G1 - G2: ";
+ std::cout << bg::wkt(geometry1) << " - ";
+ std::cout << bg::wkt(geometry2) << std::endl;
+ std::cout << std::boolalpha;
+ std::cout << "expected/computed result: "
+ << expected_result << " / " << result << std::endl;
+ std::cout << std::endl;
+ std::cout << std::noboolalpha;
+#endif
+ }
+};
+
+//============================================================================
+
+// pointlike-linear geometries
+template <typename P>
+inline void test_point_segment()
+{
+ typedef test_disjoint tester;
+ typedef bg::model::segment<P> S;
+
+ tester::apply("p-s-01",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ false);
+
+ tester::apply("p-s-02",
+ from_wkt<P>("POINT(2 0)"),
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ false);
+
+ tester::apply("p-s-03",
+ from_wkt<P>("POINT(1 0)"),
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ false);
+
+ tester::apply("p-s-04",
+ from_wkt<P>("POINT(1 1)"),
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ true);
+
+ tester::apply("p-s-05",
+ from_wkt<P>("POINT(3 0)"),
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ true);
+
+ tester::apply("p-s-06",
+ from_wkt<P>("POINT(-1 0)"),
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ true);
+
+ // degenerate segment
+ tester::apply("p-s-07",
+ from_wkt<P>("POINT(-1 0)"),
+ from_wkt<S>("SEGMENT(2 0,2 0)"),
+ true);
+
+ // degenerate segment
+ tester::apply("p-s-08",
+ from_wkt<P>("POINT(2 0)"),
+ from_wkt<S>("SEGMENT(2 0,2 0)"),
+ false);
+
+ // degenerate segment
+ tester::apply("p-s-09",
+ from_wkt<P>("POINT(3 0)"),
+ from_wkt<S>("SEGMENT(2 0,2 0)"),
+ true);
+
+ // degenerate segment
+ tester::apply("p-s-10",
+ from_wkt<P>("POINT(1 1)"),
+ from_wkt<S>("SEGMENT(2 0,2 0)"),
+ true);
+}
+
+template <typename P>
+inline void test_point_linestring()
+{
+ typedef bg::model::linestring<P> L;
+
+ typedef test_disjoint tester;
+
+ tester::apply("p-l-01",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
+ false);
+
+ tester::apply("p-l-02",
+ from_wkt<P>("POINT(1 1)"),
+ from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
+ false);
+
+ tester::apply("p-l-03",
+ from_wkt<P>("POINT(3 3)"),
+ from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
+ false);
+
+ tester::apply("p-l-04",
+ from_wkt<P>("POINT(1 0)"),
+ from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
+ true);
+
+ tester::apply("p-l-05",
+ from_wkt<P>("POINT(5 5)"),
+ from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
+ true);
+
+ tester::apply("p-l-06",
+ from_wkt<P>("POINT(5 5)"),
+ from_wkt<L>("LINESTRING(0 0,2 2)"),
+ true);
+}
+
+template <typename P>
+inline void test_point_multilinestring()
+{
+ typedef bg::model::linestring<P> L;
+ typedef bg::model::multi_linestring<L> ML;
+
+ typedef test_disjoint tester;
+
+ tester::apply("p-ml-01",
+ from_wkt<P>("POINT(0 1)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,2 2,4 4),(0 0,2 0,4 0))"),
+ true);
+
+ tester::apply("p-ml-02",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,2 2,4 4),(0 0,2 0,4 0))"),
+ false);
+
+ tester::apply("p-ml-03",
+ from_wkt<P>("POINT(1 1)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,2 2,4 4),(0 0,2 0,4 0))"),
+ false);
+
+ tester::apply("p-ml-04",
+ from_wkt<P>("POINT(1 0)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,2 2,4 4),(0 0,2 0,4 0))"),
+ false);
+
+ tester::apply("p-ml-05",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 1,2 2,4 4),(3 0,4 0))"),
+ true);
+
+ tester::apply("p-ml-06",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 1,2 2,4 4),(0 0,4 0))"),
+ false);
+
+ tester::apply("p-ml-07",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 1,2 2,4 4),(-1 0,4 0))"),
+ false);
+}
+
+template <typename P>
+inline void test_multipoint_segment()
+{
+ typedef test_disjoint tester;
+ typedef bg::model::multi_point<P> MP;
+ typedef bg::model::segment<P> S;
+
+ tester::apply("mp-s-01",
+ from_wkt<MP>("MULTIPOINT(0 0,1 1)"),
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ false);
+
+ tester::apply("mp-s-02",
+ from_wkt<MP>("MULTIPOINT(1 0,1 1)"),
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ false);
+
+ tester::apply("mp-s-03",
+ from_wkt<MP>("MULTIPOINT(1 1,2 2)"),
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ true);
+
+ tester::apply("mp-s-04",
+ from_wkt<MP>("MULTIPOINT()"),
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ true);
+
+ tester::apply("mp-s-05",
+ from_wkt<MP>("MULTIPOINT(3 0,4 0)"),
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ true);
+
+ tester::apply("mp-s-06",
+ from_wkt<MP>("MULTIPOINT(1 0,4 0)"),
+ from_wkt<S>("SEGMENT(0 0,2 0)"),
+ false);
+
+ // segments that degenerate to a point
+ tester::apply("mp-s-07",
+ from_wkt<MP>("MULTIPOINT(1 1,2 2)"),
+ from_wkt<S>("SEGMENT(0 0,0 0)"),
+ true);
+
+ tester::apply("mp-s-08",
+ from_wkt<MP>("MULTIPOINT(1 1,2 2)"),
+ from_wkt<S>("SEGMENT(1 1,1 1)"),
+ false);
+}
+
+template <typename P>
+inline void test_multipoint_linestring()
+{
+ typedef bg::model::multi_point<P> MP;
+ typedef bg::model::linestring<P> L;
+
+ typedef test_disjoint tester;
+
+ tester::apply("mp-l-01",
+ from_wkt<MP>("MULTIPOINT(0 0,1 0)"),
+ from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
+ false);
+
+ tester::apply("mp-l-02",
+ from_wkt<MP>("MULTIPOINT(1 0,1 1)"),
+ from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
+ false);
+
+ tester::apply("mp-l-03",
+ from_wkt<MP>("MULTIPOINT(1 0,3 3)"),
+ from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
+ false);
+
+ tester::apply("mp-l-04",
+ from_wkt<MP>("MULTIPOINT(1 0,2 0)"),
+ from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
+ true);
+
+ tester::apply("mp-l-05",
+ from_wkt<MP>("MULTIPOINT(-1 -1,2 0)"),
+ from_wkt<L>("LINESTRING(0 0,2 2,4 4)"),
+ true);
+
+ tester::apply("mp-l-06",
+ from_wkt<MP>("MULTIPOINT(-1 -1,2 0)"),
+ from_wkt<L>("LINESTRING(1 0,3 0)"),
+ false);
+
+ tester::apply("mp-l-07",
+ from_wkt<MP>("MULTIPOINT(-1 -1,2 0,-1 -1,2 0)"),
+ from_wkt<L>("LINESTRING(1 0,3 0)"),
+ false);
+
+ tester::apply("mp-l-08",
+ from_wkt<MP>("MULTIPOINT(2 0)"),
+ from_wkt<L>("LINESTRING(1 0)"),
+ true);
+
+ tester::apply("mp-l-09",
+ from_wkt<MP>("MULTIPOINT(3 0,0 0,3 0)"),
+ from_wkt<L>("LINESTRING(1 0,2 0)"),
+ true);
+}
+
+template <typename P>
+inline void test_multipoint_multilinestring()
+{
+ typedef bg::model::multi_point<P> MP;
+ typedef bg::model::linestring<P> L;
+ typedef bg::model::multi_linestring<L> ML;
+
+ typedef test_disjoint tester;
+
+ tester::apply("mp-ml-01",
+ from_wkt<MP>("MULTIPOINT(0 1,0 2)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,2 2,4 4),(0 0,2 0,4 0))"),
+ true);
+
+ tester::apply("mp-ml-02",
+ from_wkt<MP>("MULTIPOINT(0 0,1 0)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,2 2,4 4),(0 0,2 0,4 0))"),
+ false);
+
+ tester::apply("mp-ml-03",
+ from_wkt<MP>("MULTIPOINT(0 1,1 1)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,2 2,4 4),(0 0,2 0,4 0))"),
+ false);
+
+ tester::apply("mp-ml-04",
+ from_wkt<MP>("MULTIPOINT(0 1,1 0)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,2 2,4 4),(0 0,2 0,4 0))"),
+ false);
+
+ tester::apply("mp-ml-05",
+ from_wkt<MP>("MULTIPOINT(0 0,10 0)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,2 2,4 4),(0 0,2 0,4 0))"),
+ false);
+
+ tester::apply("mp-ml-06",
+ from_wkt<MP>("MULTIPOINT(-1 0,3 0)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,2 2,4 4),(0 0,2 0,4 0))"),
+ false);
+}
+
+//============================================================================
+
+template <typename CoordinateType>
+inline void test_pointlike_linear()
+{
+ typedef bg::model::point<CoordinateType, 2, bg::cs::cartesian> point_type;
+
+ test_point_linestring<point_type>();
+ test_point_multilinestring<point_type>();
+ test_point_segment<point_type>();
+
+ test_multipoint_linestring<point_type>();
+ test_multipoint_multilinestring<point_type>();
+ test_multipoint_segment<point_type>();
+}
+
+//============================================================================
+
+BOOST_AUTO_TEST_CASE( test_pointlike_linear_all )
+{
+ test_pointlike_linear<double>();
+ test_pointlike_linear<int>();
+#ifdef HAVE_TTMATH
+ test_pointlike_linear<ttmath_big>();
+#endif
+}
diff --git a/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_p_p.cpp b/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_p_p.cpp
new file mode 100644
index 0000000000..9121e0f026
--- /dev/null
+++ b/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_coverage_p_p.cpp
@@ -0,0 +1,169 @@
+// 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
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
+#ifndef BOOST_TEST_MODULE
+#define BOOST_TEST_MODULE test_disjoint_coverage
+#endif
+
+// unit test to test disjoint for all geometry combinations
+
+#include <iostream>
+
+#include <boost/test/included/unit_test.hpp>
+
+#include <boost/geometry/core/tag.hpp>
+#include <boost/geometry/core/tags.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+#include <boost/geometry/io/dsv/write.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/algorithms/disjoint.hpp>
+
+#include <from_wkt.hpp>
+
+
+#ifdef HAVE_TTMATH
+#include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
+#endif
+
+namespace bg = ::boost::geometry;
+
+//============================================================================
+
+struct test_disjoint
+{
+ template <typename Geometry1, typename Geometry2>
+ static inline void apply(std::string const& case_id,
+ Geometry1 const& geometry1,
+ Geometry2 const& geometry2,
+ bool expected_result)
+ {
+ bool result = bg::disjoint(geometry1, geometry2);
+ BOOST_CHECK_MESSAGE(result == expected_result,
+ "case ID: " << case_id << ", G1: " << bg::wkt(geometry1)
+ << ", G2: " << bg::wkt(geometry2) << " -> Expected: "
+ << expected_result << ", detected: " << result);
+
+ result = bg::disjoint(geometry2, geometry1);
+ BOOST_CHECK_MESSAGE(result == expected_result,
+ "case ID: " << case_id << ", G1: " << bg::wkt(geometry2)
+ << ", G2: " << bg::wkt(geometry1) << " -> Expected: "
+ << expected_result << ", detected: " << result);
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "case ID: " << case_id << "; G1 - G2: ";
+ std::cout << bg::wkt(geometry1) << " - ";
+ std::cout << bg::wkt(geometry2) << std::endl;
+ std::cout << std::boolalpha;
+ std::cout << "expected/computed result: "
+ << expected_result << " / " << result << std::endl;
+ std::cout << std::endl;
+ std::cout << std::noboolalpha;
+#endif
+ }
+};
+
+//============================================================================
+
+// pointlike-pointlike geometries
+template <typename P>
+inline void test_point_point()
+{
+ typedef test_disjoint tester;
+
+ tester::apply("p-p-01",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<P>("POINT(0 0)"),
+ false);
+
+ tester::apply("p-p-02",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<P>("POINT(1 1)"),
+ true);
+}
+
+template <typename P>
+inline void test_point_multipoint()
+{
+ typedef bg::model::multi_point<P> MP;
+
+ typedef test_disjoint tester;
+
+ tester::apply("p-mp-01",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,1 1)"),
+ false);
+
+ tester::apply("p-mp-02",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<MP>("MULTIPOINT(1 1,2 2)"),
+ true);
+
+ tester::apply("p-mp-03",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<MP>("MULTIPOINT()"),
+ true);
+}
+
+template <typename P>
+inline void test_multipoint_multipoint()
+{
+ typedef bg::model::multi_point<P> MP;
+
+ typedef test_disjoint tester;
+
+ tester::apply("mp-mp-01",
+ from_wkt<MP>("MULTIPOINT(0 0,1 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,1 1)"),
+ false);
+
+ tester::apply("mp-mp-02",
+ from_wkt<MP>("MULTIPOINT(0 0,1 0)"),
+ from_wkt<MP>("MULTIPOINT(1 1,2 2)"),
+ true);
+
+ tester::apply("mp-mp-03",
+ from_wkt<MP>("MULTIPOINT()"),
+ from_wkt<MP>("MULTIPOINT(1 1,2 2)"),
+ true);
+
+ tester::apply("mp-mp-04",
+ from_wkt<MP>("MULTIPOINT(0 0,1 0)"),
+ from_wkt<MP>("MULTIPOINT()"),
+ true);
+}
+
+//============================================================================
+
+template <typename CoordinateType>
+inline void test_pointlike_pointlike()
+{
+ typedef bg::model::point<CoordinateType, 2, bg::cs::cartesian> point_type;
+
+ test_point_point<point_type>();
+ test_point_multipoint<point_type>();
+
+ test_multipoint_multipoint<point_type>();
+}
+
+//============================================================================
+
+BOOST_AUTO_TEST_CASE( test_pointlike_pointlike_all )
+{
+ test_pointlike_pointlike<double>();
+ test_pointlike_pointlike<int>();
+#ifdef HAVE_TTMATH
+ test_pointlike_pointlike<ttmath_big>();
+#endif
+}
diff --git a/libs/geometry/test/algorithms/relational_operations/disjoint/multi_disjoint.cpp b/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_multi.cpp
index 330a66e525..8bc8a6b559 100644
--- a/libs/geometry/test/algorithms/relational_operations/disjoint/multi_disjoint.cpp
+++ b/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_multi.cpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2012-2015 Barend Gehrels, 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
@@ -12,17 +12,6 @@
#include <boost/geometry/strategies/strategies.hpp>
-#include <boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp>
-#include <boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp>
-#include <boost/geometry/multi/algorithms/detail/point_on_border.hpp>
-#include <boost/geometry/multi/algorithms/detail/for_each_range.hpp>
-#include <boost/geometry/multi/algorithms/within.hpp>
-#include <boost/geometry/multi/core/closure.hpp>
-#include <boost/geometry/multi/core/geometry_id.hpp>
-#include <boost/geometry/multi/core/ring_type.hpp>
-#include <boost/geometry/multi/views/detail/range_type.hpp>
-
-
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
diff --git a/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_point_box_geometry.cpp b/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_point_box_geometry.cpp
new file mode 100644
index 0000000000..f1de2de0e3
--- /dev/null
+++ b/libs/geometry/test/algorithms/relational_operations/disjoint/disjoint_point_box_geometry.cpp
@@ -0,0 +1,127 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
+
+// This file was modified by Oracle on 2015.
+// Modifications copyright (c) 2015, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
+// 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)
+
+
+#include "test_disjoint.hpp"
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <test_common/test_point.hpp>
+
+#include <algorithms/overlay/overlay_cases.hpp>
+
+#include <algorithms/predef_relop.hpp>
+
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::box<P> box;
+
+ test_disjoint<P, P>("pp1", "point(1 1)", "point(1 1)", false);
+ test_disjoint<P, P>("pp2", "point(1 1)", "point(1.001 1)", true);
+
+ // left-right
+ test_disjoint<box, box>("bb1", "box(1 1, 2 2)", "box(3 1, 4 2)", true);
+ test_disjoint<box, box>("bb2", "box(1 1, 2 2)", "box(2 1, 3 2)", false);
+ test_disjoint<box, box>("bb3", "box(1 1, 2 2)", "box(2 2, 3 3)", false);
+ test_disjoint<box, box>("bb4", "box(1 1, 2 2)", "box(2.001 2, 3 3)", true);
+
+ // up-down
+ test_disjoint<box, box>("bb5", "box(1 1, 2 2)", "box(1 3, 2 4)", true);
+ test_disjoint<box, box>("bb6", "box(1 1, 2 2)", "box(1 2, 2 3)", false);
+ // right-left
+ test_disjoint<box, box>("bb7", "box(1 1, 2 2)", "box(0 1, 1 2)", false);
+ test_disjoint<box, box>("bb8", "box(1 1, 2 2)", "box(0 1, 1 2)", false);
+
+ // point-box
+ test_disjoint<P, box>("pb1", "point(1 1)", "box(0 0, 2 2)", false);
+ test_disjoint<P, box>("pb2", "point(2 2)", "box(0 0, 2 2)", false);
+ test_disjoint<P, box>("pb3", "point(2.0001 2)", "box(1 1, 2 2)", true);
+ test_disjoint<P, box>("pb4", "point(0.9999 2)", "box(1 1, 2 2)", true);
+
+ // box-point (to test reverse compiling)
+ test_disjoint<box, P>("bp1", "box(1 1, 2 2)", "point(2 2)", false);
+
+ // Test triangles for polygons/rings, boxes
+ // Note that intersections are tested elsewhere, they don't need
+ // thorough test at this place
+ typedef bg::model::polygon<P> polygon;
+ typedef bg::model::ring<P> ring;
+
+ // Testing overlap (and test compiling with box)
+ test_disjoint<polygon, polygon>("overlaps_box_pp", overlaps_box[0], overlaps_box[1], false);
+ test_disjoint<box, polygon>("overlaps_box_bp", overlaps_box[0], overlaps_box[1], false);
+ test_disjoint<box, ring>("overlaps_box_br", overlaps_box[0], overlaps_box[1], false);
+ test_disjoint<polygon, box>("overlaps_box_pb", overlaps_box[1], overlaps_box[0], false);
+ test_disjoint<ring, box>("overlaps_box_rb", overlaps_box[1], overlaps_box[0], false);
+
+ test_disjoint<P, ring>("point_ring1", "POINT(0 0)", "POLYGON((0 0,3 3,6 0,0 0))", false);
+ test_disjoint<P, ring>("point_ring2", "POINT(3 1)", "POLYGON((0 0,3 3,6 0,0 0))", false);
+ test_disjoint<P, ring>("point_ring3", "POINT(0 3)", "POLYGON((0 0,3 3,6 0,0 0))", true);
+ test_disjoint<P, polygon>("point_polygon1", "POINT(0 0)", "POLYGON((0 0,3 3,6 0,0 0))", false);
+ test_disjoint<P, polygon>("point_polygon2", "POINT(3 1)", "POLYGON((0 0,3 3,6 0,0 0))", false);
+ test_disjoint<P, polygon>("point_polygon3", "POINT(0 3)", "POLYGON((0 0,3 3,6 0,0 0))", true);
+
+ test_disjoint<ring, P>("point_ring2", "POLYGON((0 0,3 3,6 0,0 0))", "POINT(0 0)", false);
+ test_disjoint<polygon, P>("point_polygon2", "POLYGON((0 0,3 3,6 0,0 0))", "POINT(0 0)", false);
+
+
+ // Problem described by Volker/Albert 2012-06-01
+ test_disjoint<polygon, box>("volker_albert_1",
+ "POLYGON((1992 3240,1992 1440,3792 1800,3792 3240,1992 3240))",
+ "BOX(1941 2066, 2055 2166)", false);
+
+ test_disjoint<polygon, box>("volker_albert_2",
+ "POLYGON((1941 2066,2055 2066,2055 2166,1941 2166))",
+ "BOX(1941 2066, 2055 2166)", false);
+}
+
+
+template <typename P>
+void test_3d()
+{
+ typedef bg::model::box<P> box;
+
+ test_disjoint<P, P>("pp 3d 1", "point(1 1 1)", "point(1 1 1)", false);
+ test_disjoint<P, P>("pp 3d 2", "point(1 1 1)", "point(1.001 1 1)", true);
+
+ test_disjoint<box, box>("bb1", "box(1 1 1, 2 2 2)", "box(3 1 1, 4 2 1)", true);
+ test_disjoint<box, box>("bb2", "box(1 1 1, 2 2 2)", "box(2 1 1, 3 2 1)", false);
+ test_disjoint<box, box>("bb3", "box(1 1 1, 2 2 2)", "box(2 2 1, 3 3 1)", false);
+ test_disjoint<box, box>("bb4", "box(1 1 1, 2 2 2)", "box(2.001 2 1, 3 3 1)", true);
+
+}
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<float> >();
+ test_all<bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ test_3d<bg::model::point<double, 3, bg::cs::cartesian> >();
+
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/relational_operations/disjoint/test_disjoint.hpp b/libs/geometry/test/algorithms/relational_operations/disjoint/test_disjoint.hpp
index 55a22e9bd6..9e4902421e 100644
--- a/libs/geometry/test/algorithms/relational_operations/disjoint/test_disjoint.hpp
+++ b/libs/geometry/test/algorithms/relational_operations/disjoint/test_disjoint.hpp
@@ -1,9 +1,9 @@
// 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.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@@ -22,8 +22,7 @@
#include <geometry_test_common.hpp>
#include <boost/geometry/algorithms/disjoint.hpp>
-#include <boost/geometry/multi/algorithms/disjoint.hpp>
-#include <boost/geometry/multi/io/wkt/read.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
template <typename G1, typename G2>
diff --git a/libs/geometry/test/algorithms/relational_operations/multi_equals.cpp b/libs/geometry/test/algorithms/relational_operations/equals_multi.cpp
index d1239d38fa..6984f29e52 100644
--- a/libs/geometry/test/algorithms/relational_operations/multi_equals.cpp
+++ b/libs/geometry/test/algorithms/relational_operations/equals_multi.cpp
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
-// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2010-2015 Barend Gehrels, 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)
@@ -8,15 +8,10 @@
#include "test_equals.hpp"
-#include <boost/geometry/multi/algorithms/area.hpp>
-#include <boost/geometry/multi/algorithms/equals.hpp>
+#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
-
-#include <boost/geometry/multi/io/wkt/read.hpp>
-
template <typename P>
diff --git a/libs/geometry/test/algorithms/relational_operations/equals_on_spheroid.cpp b/libs/geometry/test/algorithms/relational_operations/equals_on_spheroid.cpp
new file mode 100644
index 0000000000..5e24fdfabe
--- /dev/null
+++ b/libs/geometry/test/algorithms/relational_operations/equals_on_spheroid.cpp
@@ -0,0 +1,255 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit test
+
+// Copyright (c) 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
+
+#ifndef BOOST_TEST_MODULE
+#define BOOST_TEST_MODULE test_equals_on_spheroid
+#endif
+
+#include <iostream>
+
+#include <boost/test/included/unit_test.hpp>
+
+#include "test_equals.hpp"
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/core/cs.hpp>
+
+namespace bgm = bg::model;
+
+template <typename P1, typename P2 = P1>
+struct test_point_point
+{
+ static inline void apply(std::string const& header)
+ {
+ std::string const str = header + "-";
+
+ test_geometry<P1, P2>(str + "pp_01", "POINT(0 0)", "POINT(0 0)", true);
+ test_geometry<P1, P2>(str + "pp_02", "POINT(0 0)", "POINT(10 0)", false);
+
+ // points whose longitudes differ by 360 degrees
+ test_geometry<P1, P2>(str + "pp_03", "POINT(0 0)", "POINT(360 0)", true);
+ test_geometry<P1, P2>(str + "pp_04", "POINT(10 0)", "POINT(370 0)", true);
+ test_geometry<P1, P2>(str + "pp_05", "POINT(10 0)", "POINT(-350 0)", true);
+ test_geometry<P1, P2>(str + "pp_06", "POINT(180 10)", "POINT(-180 10)", true);
+ test_geometry<P1, P2>(str + "pp_06a", "POINT(540 10)", "POINT(-540 10)", true);
+
+#ifdef BOOST_GEOMETRY_NORMALIZE_LATITUDE
+ test_geometry<P1, P2>(str + "pp_06b", "POINT(540 370)", "POINT(-540 -350)", true);
+ test_geometry<P1, P2>(str + "pp_06c", "POINT(1260 370)", "POINT(-1260 -350)", true);
+ test_geometry<P1, P2>(str + "pp_06d", "POINT(2340 370)", "POINT(-2340 -350)", true);
+#endif
+
+ test_geometry<P1, P2>(str + "pp_06e", "POINT(-180 10)", "POINT(-540 10)", true);
+ test_geometry<P1, P2>(str + "pp_06f", "POINT(180 10)", "POINT(-540 10)", true);
+
+ // north & south pole
+ test_geometry<P1, P2>(str + "pp_07", "POINT(0 90)", "POINT(0 90)", true);
+
+#ifdef BOOST_GEOMETRY_NORMALIZE_LATITUDE
+ test_geometry<P1, P2>(str + "pp_07a", "POINT(0 450)", "POINT(10 -270)", true);
+ test_geometry<P1, P2>(str + "pp_07b", "POINT(0 270)", "POINT(10 90)", false);
+ test_geometry<P1, P2>(str + "pp_07c", "POINT(0 -450)", "POINT(10 90)", false);
+#endif
+
+ test_geometry<P1, P2>(str + "pp_08", "POINT(0 90)", "POINT(10 90)", true);
+ test_geometry<P1, P2>(str + "pp_09", "POINT(0 90)", "POINT(0 -90)", false);
+ test_geometry<P1, P2>(str + "pp_10", "POINT(0 -90)", "POINT(0 -90)", true);
+ test_geometry<P1, P2>(str + "pp_11", "POINT(0 -90)", "POINT(10 -90)", true);
+ test_geometry<P1, P2>(str + "pp_11a", "POINT(0 -90)", "POINT(10 90)", false);
+ test_geometry<P1, P2>(str + "pp_12", "POINT(0 -90)", "POINT(0 -85)", false);
+ test_geometry<P1, P2>(str + "pp_13", "POINT(0 90)", "POINT(0 85)", false);
+ test_geometry<P1, P2>(str + "pp_14", "POINT(0 90)", "POINT(10 85)", false);
+
+ // symmetric wrt prime meridian
+ test_geometry<P1, P2>(str + "pp_15", "POINT(-10 45)", "POINT(10 45)", false);
+ test_geometry<P1, P2>(str + "pp_16", "POINT(-170 45)", "POINT(170 45)", false);
+
+ // other points
+ test_geometry<P1, P2>(str + "pp_17", "POINT(-10 45)", "POINT(10 -45)", false);
+ test_geometry<P1, P2>(str + "pp_18", "POINT(-10 -45)", "POINT(10 45)", false);
+ test_geometry<P1, P2>(str + "pp_19", "POINT(10 -135)", "POINT(10 45)", false);
+
+#ifdef BOOST_GEOMETRY_NORMALIZE_LATITUDE
+ test_geometry<P1, P2>(str + "pp_20", "POINT(190 135)", "POINT(10 45)", true);
+ test_geometry<P1, P2>(str + "pp_21", "POINT(190 150)", "POINT(10 30)", true);
+ test_geometry<P1, P2>(str + "pp_21a", "POINT(-170 150)", "POINT(10 30)", true);
+ test_geometry<P1, P2>(str + "pp_22", "POINT(190 -135)", "POINT(10 -45)", true);
+ test_geometry<P1, P2>(str + "pp_23", "POINT(190 -150)", "POINT(10 -30)", true);
+ test_geometry<P1, P2>(str + "pp_23a", "POINT(-170 -150)", "POINT(10 -30)", true);
+#endif
+ }
+};
+
+
+template <typename P1, typename P2 = P1>
+struct test_point_point_with_height
+{
+ static inline void apply(std::string const& header)
+ {
+ std::string const str = header + "-";
+
+ test_geometry<P1, P2>(str + "pp_01",
+ "POINT(0 0 10)",
+ "POINT(0 0 20)",
+ true);
+
+ test_geometry<P1, P2>(str + "pp_02",
+ "POINT(0 0 10)",
+ "POINT(10 0 10)",
+ false);
+
+ // points whose longitudes differ by 360 degrees
+ test_geometry<P1, P2>(str + "pp_03",
+ "POINT(0 0 10)",
+ "POINT(360 0 10)",
+ true);
+
+ // points whose longitudes differ by 360 degrees
+ test_geometry<P1, P2>(str + "pp_04",
+ "POINT(10 0 10)",
+ "POINT(370 0 10)",
+ true);
+
+ test_geometry<P1, P2>(str + "pp_05",
+ "POINT(10 0 10)",
+ "POINT(10 0 370)",
+ false);
+ }
+};
+
+
+template <typename P>
+void test_segment_segment(std::string const& header)
+{
+ typedef bgm::segment<P> seg;
+
+ std::string const str = header + "-";
+
+ test_geometry<seg, seg>(str + "ss_01",
+ "SEGMENT(10 0,180 0)",
+ "SEGMENT(10 0,-180 0)",
+ true);
+ test_geometry<seg, seg>(str + "ss_02",
+ "SEGMENT(0 90,180 0)",
+ "SEGMENT(10 90,-180 0)",
+ true);
+ test_geometry<seg, seg>(str + "ss_03",
+ "SEGMENT(0 90,0 -90)",
+ "SEGMENT(10 90,20 -90)",
+ true);
+ test_geometry<seg, seg>(str + "ss_04",
+ "SEGMENT(10 80,10 -80)",
+ "SEGMENT(10 80,20 -80)",
+ false);
+ test_geometry<seg, seg>(str + "ss_05",
+ "SEGMENT(170 10,-170 10)",
+ "SEGMENT(170 10,350 10)",
+ false);
+}
+
+
+BOOST_AUTO_TEST_CASE( equals_point_point_se )
+{
+ typedef bg::cs::spherical_equatorial<bg::degree> cs_type;
+
+ test_point_point<bgm::point<int, 2, cs_type> >::apply("se");
+ test_point_point<bgm::point<double, 2, cs_type> >::apply("se");
+ test_point_point<bgm::point<long double, 2, cs_type> >::apply("se");
+
+ // mixed point types
+ test_point_point
+ <
+ bgm::point<double, 2, cs_type>, bgm::point<int, 2, cs_type>
+ >::apply("se");
+
+ test_point_point
+ <
+ bgm::point<double, 2, cs_type>, bgm::point<long double, 2, cs_type>
+ >::apply("se");
+
+#if defined(HAVE_TTMATH)
+ test_point_point<bgm::point<ttmath_big, 2, cs_type> >::apply("se");
+#endif
+}
+
+BOOST_AUTO_TEST_CASE( equals_point_point_with_height_se )
+{
+ typedef bg::cs::spherical_equatorial<bg::degree> cs_type;
+
+ test_point_point<bgm::point<int, 3, cs_type> >::apply("seh");
+ test_point_point<bgm::point<double, 3, cs_type> >::apply("seh");
+ test_point_point<bgm::point<long double, 3, cs_type> >::apply("seh");
+
+ // mixed point types
+ test_point_point
+ <
+ bgm::point<double, 3, cs_type>, bgm::point<int, 3, cs_type>
+ >::apply("seh");
+
+ test_point_point
+ <
+ bgm::point<double, 3, cs_type>, bgm::point<long double, 3, cs_type>
+ >::apply("seh");
+
+#if defined(HAVE_TTMATH)
+ test_point_point<bgm::point<ttmath_big, 3, cs_type> >::apply("seh");
+#endif
+}
+
+BOOST_AUTO_TEST_CASE( equals_point_point_geo )
+{
+ typedef bg::cs::geographic<bg::degree> cs_type;
+
+ test_point_point<bgm::point<int, 2, cs_type> >::apply("geo");
+ test_point_point<bgm::point<double, 2, cs_type> >::apply("geo");
+ test_point_point<bgm::point<long double, 2, cs_type> >::apply("geo");
+
+ // mixed point types
+ test_point_point
+ <
+ bgm::point<double, 2, cs_type>, bgm::point<int, 2, cs_type>
+ >::apply("se");
+
+ test_point_point
+ <
+ bgm::point<double, 2, cs_type>, bgm::point<long double, 2, cs_type>
+ >::apply("se");
+
+#if defined(HAVE_TTMATH)
+ test_point_point<bgm::point<ttmath_big, 2, cs_type> >::apply("geo");
+#endif
+}
+
+BOOST_AUTO_TEST_CASE( equals_segment_segment_se )
+{
+ typedef bg::cs::spherical_equatorial<bg::degree> cs_type;
+
+ test_segment_segment<bgm::point<int, 2, cs_type> >("se");
+ test_segment_segment<bgm::point<double, 2, cs_type> >("se");
+ test_segment_segment<bgm::point<long double, 2, cs_type> >("se");
+
+#if defined(HAVE_TTMATH)
+ test_segment_segment<bgm::point<ttmath_big, 2, cs_type> >("se");
+#endif
+}
+
+BOOST_AUTO_TEST_CASE( equals_segment_segment_geo )
+{
+ typedef bg::cs::geographic<bg::degree> cs_type;
+
+ test_segment_segment<bgm::point<int, 2, cs_type> >("geo");
+ test_segment_segment<bgm::point<double, 2, cs_type> >("geo");
+ test_segment_segment<bgm::point<long double, 2, cs_type> >("geo");
+
+#if defined(HAVE_TTMATH)
+ test_segment_segment<bgm::point<ttmath_big, 2, cs_type> >("geo");
+#endif
+}
diff --git a/libs/geometry/test/algorithms/relational_operations/intersects/Jamfile.v2 b/libs/geometry/test/algorithms/relational_operations/intersects/Jamfile.v2
new file mode 100644
index 0000000000..a8a0d91278
--- /dev/null
+++ b/libs/geometry/test/algorithms/relational_operations/intersects/Jamfile.v2
@@ -0,0 +1,24 @@
+# Boost.Geometry (aka GGL, Generic Geometry Library)
+#
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
+#
+# This file was modified by Oracle on 2014, 2015.
+# Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
+#
+# Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
+# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+#
+# 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)
+
+test-suite boost-geometry-algorithms-relational-intersects
+ :
+ [ run intersects.cpp : : : : algorithms_intersects ]
+ [ run intersects_box_geometry.cpp : : : : algorithms_intersects_box_geometry ]
+ [ run intersects_multi.cpp : : : : algorithms_intersects_multi ]
+ [ run intersects_self.cpp : : : : algorithms_intersects_self ]
+ ;
+
diff --git a/libs/geometry/test/algorithms/relational_operations/intersects.cpp b/libs/geometry/test/algorithms/relational_operations/intersects/intersects.cpp
index 8a2f9cf144..5ef71ba00c 100644
--- a/libs/geometry/test/algorithms/relational_operations/intersects.cpp
+++ b/libs/geometry/test/algorithms/relational_operations/intersects/intersects.cpp
@@ -1,10 +1,10 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
-// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
-// This file was modified by Oracle on 2013.
-// Modifications copyright (c) 2013, Oracle and/or its affiliates.
+// This file was modified by Oracle on 2013, 2015.
+// Modifications copyright (c) 2013-2015, Oracle and/or its affiliates.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -165,23 +165,6 @@ void test_all()
typedef bg::model::polygon<P> polygon;
typedef bg::model::ring<P> ring;
- // intersect <=> ! disjoint (in most cases)
- // so most tests are done in disjoint test.
- // We only test compilation of a few cases.
- test_geometry<P, bg::model::box<P> >("POINT(1 1)", "BOX(0 0,2 2)", true);
-
- test_geometry<polygon, bg::model::box<P> >(
- "POLYGON((1992 3240,1992 1440,3792 1800,3792 3240,1992 3240))",
- "BOX(1941 2066, 2055 2166)", true);
-
- test_geometry<ring, bg::model::box<P> >(
- "POLYGON((1992 3240,1992 1440,3792 1800,3792 3240,1992 3240))",
- "BOX(1941 2066, 2055 2166)", true);
-
- test_geometry<polygon, bg::model::box<P> >(
- "POLYGON((1941 2066,2055 2066,2055 2166,1941 2166))",
- "BOX(1941 2066, 2055 2166)", true);
-
test_intersects_point_segment<P>();
test_intersects_point_linestring<P>();
test_intersects_polygon_polygon<P>();
@@ -193,157 +176,28 @@ void test_all()
test_multi_linestring_polygon<P>();
test_multi_polygon_polygon<P>();
- // self-intersecting is not tested in disjoint, so that is done here.
-
- // Just a normal polygon
- test_self_intersects<polygon>("POLYGON((0 0,0 4,1.5 2.5,2.5 1.5,4 0,0 0))", false);
-
- // Self intersecting
- test_self_intersects<polygon>("POLYGON((1 2,1 1,2 1,2 2.25,3 2.25,3 0,0 0,0 3,3 3,2.75 2,1 2))", true);
-
- // Self intersecting in last segment
- test_self_intersects<polygon>("POLYGON((0 2,2 4,2 0,4 2,0 2))", true);
-
- // Self tangent
- test_self_intersects<polygon>("POLYGON((0 0,0 4,4 4,4 0,2 4,0 0))", true);
-
- // Self tangent in corner
- test_self_intersects<polygon>("POLYGON((0 0,0 4,4 4,4 0,0 4,2 0,0 0))", true);
-
- // With spike
- test_self_intersects<polygon>("POLYGON((0 0,0 4,4 4,4 2,6 2,4 2,4 0,0 0))", true);
-
- // Non intersection, but with duplicate
- test_self_intersects<polygon>("POLYGON((0 0,0 4,4 0,4 0,0 0))", false);
-
- // With many duplicates
- test_self_intersects<polygon>(
- "POLYGON((0 0,0 1,0 1,0 1,0 2,0 2,0 3,0 3,0 3,0 3,0 4,2 4,2 4,4 4,4 0,4 0,3 0,3 0,3 0,3 0,3 0,0 0))",
- false);
-
- // Hole: interior tangent to exterior
- test_self_intersects<polygon>("POLYGON((0 0,0 4,4 4,4 0,0 0),(1 2,2 4,3 2,1 2))", true);
-
- // Hole: interior intersecting exterior
- test_self_intersects<polygon>("POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,1 3,5 4,1 1))", true);
-
- // Hole: two intersecting holes
- test_self_intersects<polygon>(
- "POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,1 3,3 3,3 1,1 1),(2 2,2 3.5,3.5 3.5,3.5 2,2 2))", true);
-
- // Mail Akira T on [Boost-users] at 27-7-2011 3:17
- test_self_intersects<bg::model::linestring<P> >(
- "LINESTRING(0 0,0 4,4 4,2 2,2 5)", true);
-
- test_self_intersects<bg::model::linestring<P> >(
- "LINESTRING(0 4,4 4,2 2,2 5)", true);
-
- // Test self-intersections at last segment in close/open rings:
- test_self_intersects<bg::model::ring<P> >(
- "POLYGON((0 0,3 3,4 1,0 0))", false);
-
- test_self_intersects<bg::model::ring<P, true, false> >(
- "POLYGON((0 0,3 3,4 1))", false);
-
- test_self_intersects<bg::model::ring<P> >(
- "POLYGON((0 0,3 3,4 1,0 1,0 0))", true);
-
- test_self_intersects<bg::model::ring<P, true, false> >(
- "POLYGON((0 0,3 3,4 1,0 1))", true);
-
- // Duplicates in first or last
- test_self_intersects<bg::model::ring<P> >(
- "POLYGON((0 0,3 3,4 1,0 1,0 1,0 0))", true);
- test_self_intersects<bg::model::ring<P> >(
- "POLYGON((0 0,3 3,4 1,0 1,0 0,0 0))", true);
- test_self_intersects<bg::model::ring<P, true, false> >(
- "POLYGON((0 0,3 3,4 1,0 1,0 1))", true);
- test_self_intersects<bg::model::ring<P> >(
- "POLYGON((0 0,0 0,3 3,4 1,0 1,0 1,0 0))", true);
- test_self_intersects<bg::model::ring<P, true, false> >(
- "POLYGON((0 0,0 0,3 3,4 1,0 1,0 1))", true);
- test_self_intersects<bg::model::ring<P> >(
- "POLYGON((0 0,3 3,3 3,4 1,0 1,0 1,0 0))", true);
- test_self_intersects<bg::model::ring<P, true, false> >(
- "POLYGON((0 0,3 3,3 3,4 1,0 1,0 1))", true);
-
- test_self_intersects<bg::model::ring<P> >(
- "POLYGON((0 0,3 3,4 1,0 0,0 0))", false);
- test_self_intersects<bg::model::ring<P> >(
- "POLYGON((0 0,3 3,4 1,4 1,0 0))", false);
- test_self_intersects<bg::model::ring<P, true, false> >(
- "POLYGON((0 0,3 3,4 1,4 1))", false);
- test_self_intersects<bg::model::ring<P> >(
- "POLYGON((0 0,0 0,3 3,4 1,0 0))", false);
- test_self_intersects<bg::model::ring<P, true, false> >(
- "POLYGON((0 0,0 0,3 3,4 1))", false);
- test_self_intersects<bg::model::ring<P> >(
- "POLYGON((0 0,3 3,3 3,4 1,0 0))", false);
- test_self_intersects<bg::model::ring<P, true, false> >(
- "POLYGON((0 0,3 3,3 3,4 1))", false);
-
- test_geometry<P, bg::model::box<P> >(
- "POINT(0 0)",
- "BOX(0 0,4 4)",
- true);
- test_geometry<P, bg::model::ring<P> >(
+ test_geometry<P, ring>(
"POINT(0 0)",
"POLYGON((0 0,3 3,3 3,4 1))",
true);
- test_geometry<P, bg::model::polygon<P> >(
+ test_geometry<P, polygon>(
"POINT(0 0)",
"POLYGON((0 0,3 3,3 3,4 1))",
true);
- test_geometry<bg::model::ring<P>, P>(
+ test_geometry<ring, P>(
"POLYGON((0 0,3 3,3 3,4 1))",
"POINT(0 0)",
true);
- test_geometry<bg::model::polygon<P>, P>(
+ test_geometry<polygon, P>(
"POLYGON((0 0,3 3,3 3,4 1))",
"POINT(0 0)",
true);
}
-// Those tests won't pass for rational<> because numeric_limits<> isn't specialized for this type
-template <typename P>
-void test_additional()
-{
- test_geometry<bg::model::segment<P>, bg::model::box<P> >(
- "SEGMENT(0 0,3 3)",
- "BOX(1 2,3 5)",
- true);
- test_geometry<bg::model::segment<P>, bg::model::box<P> >(
- "SEGMENT(1 1,2 3)",
- "BOX(0 0,4 4)",
- true);
- test_geometry<bg::model::segment<P>, bg::model::box<P> >(
- "SEGMENT(1 1,1 1)",
- "BOX(1 0,3 5)",
- true);
- test_geometry<bg::model::segment<P>, bg::model::box<P> >(
- "SEGMENT(0 1,0 1)",
- "BOX(1 0,3 5)",
- false);
- test_geometry<bg::model::segment<P>, bg::model::box<P> >(
- "SEGMENT(2 1,2 1)",
- "BOX(1 0,3 5)",
- true);
- test_geometry<bg::model::linestring<P>, bg::model::box<P> >(
- "LINESTRING(0 0,1 0,10 10)",
- "BOX(1 2,3 5)",
- true);
- test_geometry<bg::model::linestring<P>, bg::model::box<P> >(
- "LINESTRING(1 2)",
- "BOX(0 0,3 5)",
- true);
-}
-
-
int test_main( int , char* [] )
{
test_all<bg::model::d2::point_xy<double> >();
- test_additional<bg::model::d2::point_xy<double> >();
#if ! defined(BOOST_GEOMETRY_RESCALE_TO_ROBUST)
test_all<bg::model::d2::point_xy<boost::rational<int> > >();
diff --git a/libs/geometry/test/algorithms/relational_operations/intersects/intersects_box_geometry.cpp b/libs/geometry/test/algorithms/relational_operations/intersects/intersects_box_geometry.cpp
new file mode 100644
index 0000000000..50a3324363
--- /dev/null
+++ b/libs/geometry/test/algorithms/relational_operations/intersects/intersects_box_geometry.cpp
@@ -0,0 +1,100 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
+
+// This file was modified by Oracle on 2013, 2015.
+// Modifications copyright (c) 2013-2015, Oracle and/or its affiliates.
+
+// 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 "test_intersects.hpp"
+
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+#include <boost/geometry/util/rational.hpp>
+
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::polygon<P> polygon;
+ typedef bg::model::ring<P> ring;
+
+ // intersect <=> ! disjoint (in most cases)
+ // so most tests are done in disjoint test.
+ // We only test compilation of a few cases.
+ test_geometry<P, bg::model::box<P> >("POINT(1 1)", "BOX(0 0,2 2)", true);
+
+ test_geometry<polygon, bg::model::box<P> >(
+ "POLYGON((1992 3240,1992 1440,3792 1800,3792 3240,1992 3240))",
+ "BOX(1941 2066, 2055 2166)", true);
+
+ test_geometry<ring, bg::model::box<P> >(
+ "POLYGON((1992 3240,1992 1440,3792 1800,3792 3240,1992 3240))",
+ "BOX(1941 2066, 2055 2166)", true);
+
+ test_geometry<polygon, bg::model::box<P> >(
+ "POLYGON((1941 2066,2055 2066,2055 2166,1941 2166))",
+ "BOX(1941 2066, 2055 2166)", true);
+
+ test_geometry<P, bg::model::box<P> >(
+ "POINT(0 0)",
+ "BOX(0 0,4 4)",
+ true);
+}
+
+// Those tests won't pass for rational<> because numeric_limits<> isn't specialized for this type
+template <typename P>
+void test_additional()
+{
+ test_geometry<bg::model::segment<P>, bg::model::box<P> >(
+ "SEGMENT(0 0,3 3)",
+ "BOX(1 2,3 5)",
+ true);
+ test_geometry<bg::model::segment<P>, bg::model::box<P> >(
+ "SEGMENT(1 1,2 3)",
+ "BOX(0 0,4 4)",
+ true);
+ test_geometry<bg::model::segment<P>, bg::model::box<P> >(
+ "SEGMENT(1 1,1 1)",
+ "BOX(1 0,3 5)",
+ true);
+ test_geometry<bg::model::segment<P>, bg::model::box<P> >(
+ "SEGMENT(0 1,0 1)",
+ "BOX(1 0,3 5)",
+ false);
+ test_geometry<bg::model::segment<P>, bg::model::box<P> >(
+ "SEGMENT(2 1,2 1)",
+ "BOX(1 0,3 5)",
+ true);
+ test_geometry<bg::model::linestring<P>, bg::model::box<P> >(
+ "LINESTRING(0 0,1 0,10 10)",
+ "BOX(1 2,3 5)",
+ true);
+ test_geometry<bg::model::linestring<P>, bg::model::box<P> >(
+ "LINESTRING(1 2)",
+ "BOX(0 0,3 5)",
+ true);
+}
+
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+ test_additional<bg::model::d2::point_xy<double> >();
+
+#if ! defined(BOOST_GEOMETRY_RESCALE_TO_ROBUST)
+ test_all<bg::model::d2::point_xy<boost::rational<int> > >();
+#endif
+
+#if defined(HAVE_TTMATH)
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/relational_operations/multi_intersects.cpp b/libs/geometry/test/algorithms/relational_operations/intersects/intersects_multi.cpp
index 1880064f8a..6ed8b358f9 100644
--- a/libs/geometry/test/algorithms/relational_operations/multi_intersects.cpp
+++ b/libs/geometry/test/algorithms/relational_operations/intersects/intersects_multi.cpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2012-2015 Barend Gehrels, 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
@@ -19,7 +19,6 @@
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
template <typename P>
void test_all()
diff --git a/libs/geometry/test/algorithms/relational_operations/intersects/intersects_self.cpp b/libs/geometry/test/algorithms/relational_operations/intersects/intersects_self.cpp
new file mode 100644
index 0000000000..6d6c4172a5
--- /dev/null
+++ b/libs/geometry/test/algorithms/relational_operations/intersects/intersects_self.cpp
@@ -0,0 +1,133 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
+
+// This file was modified by Oracle on 2013, 2015.
+// Modifications copyright (c) 2013-2015, Oracle and/or its affiliates.
+
+// 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 "test_intersects.hpp"
+
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+#include <boost/geometry/util/rational.hpp>
+
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::linestring<P> linestring;
+ typedef bg::model::polygon<P> polygon;
+ typedef bg::model::ring<P> ring;
+ typedef bg::model::ring<P, true, false> ring_open;
+
+ // self-intersecting is not tested in disjoint, so that is done here.
+
+ // Just a normal polygon
+ test_self_intersects<polygon>("POLYGON((0 0,0 4,1.5 2.5,2.5 1.5,4 0,0 0))", false);
+
+ // Self intersecting
+ test_self_intersects<polygon>("POLYGON((1 2,1 1,2 1,2 2.25,3 2.25,3 0,0 0,0 3,3 3,2.75 2,1 2))", true);
+
+ // Self intersecting in last segment
+ test_self_intersects<polygon>("POLYGON((0 2,2 4,2 0,4 2,0 2))", true);
+
+ // Self tangent
+ test_self_intersects<polygon>("POLYGON((0 0,0 4,4 4,4 0,2 4,0 0))", true);
+
+ // Self tangent in corner
+ test_self_intersects<polygon>("POLYGON((0 0,0 4,4 4,4 0,0 4,2 0,0 0))", true);
+
+ // With spike
+ test_self_intersects<polygon>("POLYGON((0 0,0 4,4 4,4 2,6 2,4 2,4 0,0 0))", true);
+
+ // Non intersection, but with duplicate
+ test_self_intersects<polygon>("POLYGON((0 0,0 4,4 0,4 0,0 0))", false);
+
+ // With many duplicates
+ test_self_intersects<polygon>(
+ "POLYGON((0 0,0 1,0 1,0 1,0 2,0 2,0 3,0 3,0 3,0 3,0 4,2 4,2 4,4 4,4 0,4 0,3 0,3 0,3 0,3 0,3 0,0 0))",
+ false);
+
+ // Hole: interior tangent to exterior
+ test_self_intersects<polygon>("POLYGON((0 0,0 4,4 4,4 0,0 0),(1 2,2 4,3 2,1 2))", true);
+
+ // Hole: interior intersecting exterior
+ test_self_intersects<polygon>("POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,1 3,5 4,1 1))", true);
+
+ // Hole: two intersecting holes
+ test_self_intersects<polygon>(
+ "POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,1 3,3 3,3 1,1 1),(2 2,2 3.5,3.5 3.5,3.5 2,2 2))", true);
+
+ // Mail Akira T on [Boost-users] at 27-7-2011 3:17
+ test_self_intersects<linestring>(
+ "LINESTRING(0 0,0 4,4 4,2 2,2 5)", true);
+
+ test_self_intersects<linestring>(
+ "LINESTRING(0 4,4 4,2 2,2 5)", true);
+
+ // Test self-intersections at last segment in close/open rings:
+ test_self_intersects<ring>(
+ "POLYGON((0 0,3 3,4 1,0 0))", false);
+
+ test_self_intersects<ring_open>(
+ "POLYGON((0 0,3 3,4 1))", false);
+
+ test_self_intersects<ring>(
+ "POLYGON((0 0,3 3,4 1,0 1,0 0))", true);
+
+ test_self_intersects<ring_open>(
+ "POLYGON((0 0,3 3,4 1,0 1))", true);
+
+ // Duplicates in first or last
+ test_self_intersects<ring>(
+ "POLYGON((0 0,3 3,4 1,0 1,0 1,0 0))", true);
+ test_self_intersects<ring>(
+ "POLYGON((0 0,3 3,4 1,0 1,0 0,0 0))", true);
+ test_self_intersects<ring_open>(
+ "POLYGON((0 0,3 3,4 1,0 1,0 1))", true);
+ test_self_intersects<ring>(
+ "POLYGON((0 0,0 0,3 3,4 1,0 1,0 1,0 0))", true);
+ test_self_intersects<ring_open>(
+ "POLYGON((0 0,0 0,3 3,4 1,0 1,0 1))", true);
+ test_self_intersects<ring>(
+ "POLYGON((0 0,3 3,3 3,4 1,0 1,0 1,0 0))", true);
+ test_self_intersects<ring_open>(
+ "POLYGON((0 0,3 3,3 3,4 1,0 1,0 1))", true);
+
+ test_self_intersects<ring>(
+ "POLYGON((0 0,3 3,4 1,0 0,0 0))", false);
+ test_self_intersects<ring>(
+ "POLYGON((0 0,3 3,4 1,4 1,0 0))", false);
+ test_self_intersects<ring_open>(
+ "POLYGON((0 0,3 3,4 1,4 1))", false);
+ test_self_intersects<ring>(
+ "POLYGON((0 0,0 0,3 3,4 1,0 0))", false);
+ test_self_intersects<ring_open>(
+ "POLYGON((0 0,0 0,3 3,4 1))", false);
+ test_self_intersects<ring>(
+ "POLYGON((0 0,3 3,3 3,4 1,0 0))", false);
+ test_self_intersects<ring_open>(
+ "POLYGON((0 0,3 3,3 3,4 1))", false);
+}
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+#if ! defined(BOOST_GEOMETRY_RESCALE_TO_ROBUST)
+ test_all<bg::model::d2::point_xy<boost::rational<int> > >();
+#endif
+
+#if defined(HAVE_TTMATH)
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/relational_operations/test_intersects.hpp b/libs/geometry/test/algorithms/relational_operations/intersects/test_intersects.hpp
index 7a8af71615..9c4c7914b0 100644
--- a/libs/geometry/test/algorithms/relational_operations/test_intersects.hpp
+++ b/libs/geometry/test/algorithms/relational_operations/intersects/test_intersects.hpp
@@ -1,8 +1,8 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
-// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -14,27 +14,20 @@
#include <geometry_test_common.hpp>
+
+#include <boost/geometry/core/geometry_id.hpp>
+#include <boost/geometry/core/point_order.hpp>
#include <boost/geometry/core/ring_type.hpp>
+#include <boost/geometry/algorithms/covered_by.hpp>
#include <boost/geometry/algorithms/intersects.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/geometries/ring.hpp>
#include <boost/geometry/geometries/polygon.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/io/wkt/read.hpp>
-#include <boost/geometry/multi/core/geometry_id.hpp>
-#include <boost/geometry/multi/core/point_order.hpp>
-#include <boost/geometry/multi/core/ring_type.hpp>
-#include <boost/geometry/multi/algorithms/covered_by.hpp>
-#include <boost/geometry/multi/algorithms/detail/point_on_border.hpp>
-#include <boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp>
-#include <boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp>
-#include <boost/geometry/multi/views/detail/range_type.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
-
-#include <boost/geometry/multi/io/wkt/read.hpp>
-
template <typename Geometry1, typename Geometry2>
void test_geometry(std::string const& wkt1,
std::string const& wkt2, bool expected)
diff --git a/libs/geometry/test/algorithms/relational_operations/overlaps/Jamfile.v2 b/libs/geometry/test/algorithms/relational_operations/overlaps/Jamfile.v2
new file mode 100644
index 0000000000..2f9410b62c
--- /dev/null
+++ b/libs/geometry/test/algorithms/relational_operations/overlaps/Jamfile.v2
@@ -0,0 +1,23 @@
+# Boost.Geometry (aka GGL, Generic Geometry Library)
+#
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
+#
+# This file was modified by Oracle on 2014, 2015.
+# Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
+#
+# Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
+# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+#
+# 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)
+
+test-suite boost-geometry-algorithms-relational-overlaps
+ :
+ [ run overlaps.cpp : : : : algorithms_overlaps ]
+ [ run overlaps_areal.cpp : : : : algorithms_overlaps_areal ]
+ [ run overlaps_box.cpp : : : : algorithms_overlaps_box ]
+ ;
+
diff --git a/libs/geometry/test/algorithms/relational_operations/overlaps/overlaps.cpp b/libs/geometry/test/algorithms/relational_operations/overlaps/overlaps.cpp
new file mode 100644
index 0000000000..c6407f756f
--- /dev/null
+++ b/libs/geometry/test/algorithms/relational_operations/overlaps/overlaps.cpp
@@ -0,0 +1,56 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+
+// This file was modified by Oracle on 2014, 2015.
+// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
+
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
+// 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 "test_overlaps.hpp"
+
+template <typename P>
+void test_pp()
+{
+ typedef bg::model::multi_point<P> mpt;
+
+ test_geometry<mpt, mpt>("MULTIPOINT(0 0,1 1,2 2)", "MULTIPOINT(1 1,3 3,4 4)", true);
+ test_geometry<mpt, mpt>("MULTIPOINT(0 0,1 1,2 2)", "MULTIPOINT(1 1,2 2)", false);
+}
+
+template <typename P>
+void test_ll()
+{
+ typedef bg::model::linestring<P> ls;
+ typedef bg::model::multi_linestring<ls> mls;
+
+ test_geometry<ls, ls>("LINESTRING(0 0,2 2,3 1)", "LINESTRING(1 1,2 2,4 4)", true);
+ test_geometry<ls, ls>("LINESTRING(0 0,2 2,4 0)", "LINESTRING(0 1,2 1,3 2)", false);
+
+ test_geometry<ls, mls>("LINESTRING(0 0,2 2,3 1)", "MULTILINESTRING((1 1,2 2),(2 2,4 4))", true);
+ test_geometry<ls, mls>("LINESTRING(0 0,2 2,3 1)", "MULTILINESTRING((1 1,2 2),(3 3,4 4))", true);
+ test_geometry<ls, mls>("LINESTRING(0 0,3 3,3 1)", "MULTILINESTRING((3 3,2 2),(0 0,1 1))", false);
+}
+
+template <typename P>
+void test_2d()
+{
+ test_pp<P>();
+ test_ll<P>();
+}
+
+int test_main( int , char* [] )
+{
+ test_2d<bg::model::d2::point_xy<int> >();
+ test_2d<bg::model::d2::point_xy<double> >();
+
+#if defined(HAVE_TTMATH)
+ test_2d<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/relational_operations/overlaps.cpp b/libs/geometry/test/algorithms/relational_operations/overlaps/overlaps_areal.cpp
index 3d627af436..c41da0639e 100644
--- a/libs/geometry/test/algorithms/relational_operations/overlaps.cpp
+++ b/libs/geometry/test/algorithms/relational_operations/overlaps/overlaps_areal.cpp
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2014, 2015.
// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
@@ -14,59 +14,6 @@
#include "test_overlaps.hpp"
template <typename P>
-void test_box_box_2d()
-{
-#if defined(BOOST_GEOMETRY_COMPILE_FAIL)
- test_geometry<P, P>("POINT(1 1)", "POINT(1 1)", true);
-#endif
-
- test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 3 3)", "BOX(0 0,2 2)", true);
-
- // touch -> false
- test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 3 3)", "BOX(3 3,5 5)", false);
-
- // disjoint -> false
- test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 3 3)", "BOX(4 4,6 6)", false);
-
- // within -> false
- test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 5 5)", "BOX(2 2,3 3)", false);
-
- // within+touch -> false
- test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 5 5)", "BOX(2 2,5 5)", false);
-}
-
-template <typename P>
-void test_3d()
-{
- test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1 1, 3 3 3)", "BOX(0 0 0,2 2 2)", true);
- test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1 1, 3 3 3)", "BOX(3 3 3,5 5 5)", false);
- test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1 1, 3 3 3)", "BOX(4 4 4,6 6 6)", false);
-}
-
-template <typename P>
-void test_pp()
-{
- typedef bg::model::multi_point<P> mpt;
-
- test_geometry<mpt, mpt>("MULTIPOINT(0 0,1 1,2 2)", "MULTIPOINT(1 1,3 3,4 4)", true);
- test_geometry<mpt, mpt>("MULTIPOINT(0 0,1 1,2 2)", "MULTIPOINT(1 1,2 2)", false);
-}
-
-template <typename P>
-void test_ll()
-{
- typedef bg::model::linestring<P> ls;
- typedef bg::model::multi_linestring<ls> mls;
-
- test_geometry<ls, ls>("LINESTRING(0 0,2 2,3 1)", "LINESTRING(1 1,2 2,4 4)", true);
- test_geometry<ls, ls>("LINESTRING(0 0,2 2,4 0)", "LINESTRING(0 1,2 1,3 2)", false);
-
- test_geometry<ls, mls>("LINESTRING(0 0,2 2,3 1)", "MULTILINESTRING((1 1,2 2),(2 2,4 4))", true);
- test_geometry<ls, mls>("LINESTRING(0 0,2 2,3 1)", "MULTILINESTRING((1 1,2 2),(3 3,4 4))", true);
- test_geometry<ls, mls>("LINESTRING(0 0,3 3,3 1)", "MULTILINESTRING((3 3,2 2),(0 0,1 1))", false);
-}
-
-template <typename P>
void test_aa()
{
typedef bg::model::polygon<P> poly;
@@ -102,11 +49,7 @@ void test_aa()
template <typename P>
void test_2d()
{
- test_pp<P>();
- test_ll<P>();
test_aa<P>();
-
- test_box_box_2d<P>();
}
int test_main( int , char* [] )
@@ -118,7 +61,5 @@ int test_main( int , char* [] )
test_2d<bg::model::d2::point_xy<ttmath_big> >();
#endif
- //test_3d<bg::model::point<double, 3, bg::cs::cartesian> >();
-
return 0;
}
diff --git a/libs/geometry/test/algorithms/relational_operations/overlaps/overlaps_box.cpp b/libs/geometry/test/algorithms/relational_operations/overlaps/overlaps_box.cpp
new file mode 100644
index 0000000000..c80ff6de4c
--- /dev/null
+++ b/libs/geometry/test/algorithms/relational_operations/overlaps/overlaps_box.cpp
@@ -0,0 +1,64 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+
+// This file was modified by Oracle on 2014, 2015.
+// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
+
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
+// 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 "test_overlaps.hpp"
+
+template <typename P>
+void test_box_box_2d()
+{
+#if defined(BOOST_GEOMETRY_COMPILE_FAIL)
+ test_geometry<P, P>("POINT(1 1)", "POINT(1 1)", true);
+#endif
+
+ test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 3 3)", "BOX(0 0,2 2)", true);
+
+ // touch -> false
+ test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 3 3)", "BOX(3 3,5 5)", false);
+
+ // disjoint -> false
+ test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 3 3)", "BOX(4 4,6 6)", false);
+
+ // within -> false
+ test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 5 5)", "BOX(2 2,3 3)", false);
+
+ // within+touch -> false
+ test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 5 5)", "BOX(2 2,5 5)", false);
+}
+
+template <typename P>
+void test_3d()
+{
+ test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1 1, 3 3 3)", "BOX(0 0 0,2 2 2)", true);
+ test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1 1, 3 3 3)", "BOX(3 3 3,5 5 5)", false);
+ test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1 1, 3 3 3)", "BOX(4 4 4,6 6 6)", false);
+}
+
+template <typename P>
+void test_2d()
+{
+ test_box_box_2d<P>();
+}
+
+int test_main( int , char* [] )
+{
+ test_2d<bg::model::d2::point_xy<int> >();
+ test_2d<bg::model::d2::point_xy<double> >();
+
+#if defined(HAVE_TTMATH)
+ test_2d<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ //test_3d<bg::model::point<double, 3, bg::cs::cartesian> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/relational_operations/test_overlaps.hpp b/libs/geometry/test/algorithms/relational_operations/overlaps/test_overlaps.hpp
index 862fe73891..862fe73891 100644
--- a/libs/geometry/test/algorithms/relational_operations/test_overlaps.hpp
+++ b/libs/geometry/test/algorithms/relational_operations/overlaps/test_overlaps.hpp
diff --git a/libs/geometry/test/algorithms/relational_operations/relate/Jamfile.v2 b/libs/geometry/test/algorithms/relational_operations/relate/Jamfile.v2
index 7e6bb61c9d..d0e63a93dd 100644
--- a/libs/geometry/test/algorithms/relational_operations/relate/Jamfile.v2
+++ b/libs/geometry/test/algorithms/relational_operations/relate/Jamfile.v2
@@ -1,11 +1,11 @@
# Boost.Geometry (aka GGL, Generic Geometry Library)
#
-# Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
-# Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
-# Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
#
-# This file was modified by Oracle on 2014.
-# Modifications copyright (c) 2014, Oracle and/or its affiliates.
+# This file was modified by Oracle on 2014, 2015.
+# Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
#
# Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -16,8 +16,8 @@
test-suite boost-geometry-algorithms-relate
:
- [ run relate_areal_areal.cpp ]
- [ run relate_linear_areal.cpp ]
- [ run relate_linear_linear.cpp ]
- [ run relate_pointlike_xxx.cpp ]
+ [ run relate_areal_areal.cpp : : : : algorithms_relate_areal_areal ]
+ [ run relate_linear_areal.cpp : : : : algorithms_relate_linear_areal ]
+ [ run relate_linear_linear.cpp : : : : algorithms_relate_linear_linear ]
+ [ run relate_pointlike_geometry.cpp : : : : algorithms_relate_pointlike_geometry ]
;
diff --git a/libs/geometry/test/algorithms/relational_operations/relate/relate_areal_areal.cpp b/libs/geometry/test/algorithms/relational_operations/relate/relate_areal_areal.cpp
index bae133d076..9a2b41aafc 100644
--- a/libs/geometry/test/algorithms/relational_operations/relate/relate_areal_areal.cpp
+++ b/libs/geometry/test/algorithms/relational_operations/relate/relate_areal_areal.cpp
@@ -233,11 +233,15 @@ void test_polygon_polygon()
bg::read_wkt("POLYGON((0 0,0 10,10 10,10 0,0 0))", p1);
bg::read_wkt("POLYGON((10 0,10 10,20 10,20 0,10 0))", p2);
bg::read_wkt("POLYGON((5 5,5 10,6 10,6 5,5 5))", p3);
- BOOST_CHECK(bgdr::relate(p1, p2, bgdr::mask9("FT*******")
- || bgdr::mask9("F**T*****")
- || bgdr::mask9("F***T****"))); // touches()
- BOOST_CHECK(bgdr::relate(p1, p3, bgdr::mask9("T*****FF*"))); // contains()
- BOOST_CHECK(bgdr::relate(p2, p3, bgdr::mask9("FF*FF****"))); // disjoint()
+ BOOST_CHECK(bg::relate(p1, p2, bg::de9im::mask("FT*******")
+ || bg::de9im::mask("F**T*****")
+ || bg::de9im::mask("F***T****"))); // touches()
+ BOOST_CHECK(bg::relate(p1, p3, bg::de9im::mask("T*****FF*"))); // contains()
+ BOOST_CHECK(bg::relate(p2, p3, bg::de9im::mask("FF*FF****"))); // disjoint()
+
+ BOOST_CHECK(bg::relate(p1, p2, bg::de9im::static_mask<'F','T'>()
+ || bg::de9im::static_mask<'F','*','*','T'>()
+ || bg::de9im::static_mask<'F','*','*','*','T'>()));
}
// CCW
diff --git a/libs/geometry/test/algorithms/relational_operations/relate/relate_linear_linear.cpp b/libs/geometry/test/algorithms/relational_operations/relate/relate_linear_linear.cpp
index 2794e89d42..a246e9c7b9 100644
--- a/libs/geometry/test/algorithms/relational_operations/relate/relate_linear_linear.cpp
+++ b/libs/geometry/test/algorithms/relational_operations/relate/relate_linear_linear.cpp
@@ -1,16 +1,16 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2013, 2014, 2015.
// Modifications copyright (c) 2013-2015 Oracle and/or its affiliates.
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
// 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_relate.hpp"
//TEST
@@ -211,16 +211,25 @@ void test_linestring_linestring()
bg::read_wkt("LINESTRING(2 0,4 0)", ls2);
bg::read_wkt("LINESTRING(1 0,1 1)", ls3);
bg::read_wkt("LINESTRING(1 0,4 0)", ls4);
- BOOST_CHECK(bgdr::relate(ls1, ls2, bgdr::mask9("FT*******")
- || bgdr::mask9("F**T*****")
- || bgdr::mask9("F***T****")));
- BOOST_CHECK(bgdr::relate(ls1, ls3, bgdr::mask9("FT*******")
- || bgdr::mask9("F**T*****")
- || bgdr::mask9("F***T****")));
- BOOST_CHECK(bgdr::relate(ls3, ls1, bgdr::mask9("FT*******")
- || bgdr::mask9("F**T*****")
- || bgdr::mask9("F***T****")));
- BOOST_CHECK(bgdr::relate(ls2, ls4, bgdr::mask9("T*F**F***"))); // within
+ BOOST_CHECK(bg::relate(ls1, ls2, bg::de9im::mask("FT*******")
+ || bg::de9im::mask("F**T*****")
+ || bg::de9im::mask("F***T****")));
+ BOOST_CHECK(bg::relate(ls1, ls3, bg::de9im::mask("FT*******")
+ || bg::de9im::mask("F**T*****")
+ || bg::de9im::mask("F***T****")));
+ BOOST_CHECK(bg::relate(ls3, ls1, bg::de9im::mask("FT*******")
+ || bg::de9im::mask("F**T*****")
+ || bg::de9im::mask("F***T****")));
+ BOOST_CHECK(bg::relate(ls2, ls4, bg::de9im::mask("T*F**F***"))); // within
+
+ BOOST_CHECK(bg::relate(ls1, ls2, bg::de9im::static_mask<'F','T'>()
+ || bg::de9im::static_mask<'F','*','*','T'>()
+ || bg::de9im::static_mask<'F','*','*','*','T'>()));
+ BOOST_CHECK(bg::relate(ls1, ls2, bg::de9im::mask("FT")
+ || bg::de9im::mask("F**T")
+ || bg::de9im::mask("F***T**************")));
+
+ BOOST_CHECK_THROW(bg::relate(ls1, ls2, bg::de9im::mask("A")), bg::invalid_input_exception);
}
// spike - boundary and interior on the same point
diff --git a/libs/geometry/test/algorithms/relational_operations/relate/relate_pointlike_xxx.cpp b/libs/geometry/test/algorithms/relational_operations/relate/relate_pointlike_geometry.cpp
index f9314454f7..95a4158651 100644
--- a/libs/geometry/test/algorithms/relational_operations/relate/relate_pointlike_xxx.cpp
+++ b/libs/geometry/test/algorithms/relational_operations/relate/relate_pointlike_geometry.cpp
@@ -1,9 +1,9 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
-// This file was modified by Oracle on 2013, 2014.
-// Modifications copyright (c) 2013-2014 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2013, 2014, 2015.
+// Modifications copyright (c) 2013-2015 Oracle and/or its affiliates.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -92,6 +92,8 @@ void test_all()
int test_main( int , char* [] )
{
+ check_mask();
+
test_all<bg::model::d2::point_xy<int> >();
test_all<bg::model::d2::point_xy<double> >();
diff --git a/libs/geometry/test/algorithms/relational_operations/relate/test_relate.hpp b/libs/geometry/test/algorithms/relational_operations/relate/test_relate.hpp
index 3cdd3e6a96..77359d9eab 100644
--- a/libs/geometry/test/algorithms/relational_operations/relate/test_relate.hpp
+++ b/libs/geometry/test/algorithms/relational_operations/relate/test_relate.hpp
@@ -2,22 +2,25 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
-// This file was modified by Oracle on 2013, 2014.
-// Modifications copyright (c) 2013-2014 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2013, 2014, 2015.
+// Modifications copyright (c) 2013-2015 Oracle and/or its affiliates.
+
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// 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_RELATE_HPP
#define BOOST_GEOMETRY_TEST_RELATE_HPP
#include <geometry_test_common.hpp>
+#include <boost/variant.hpp>
+
#include <boost/geometry/core/ring_type.hpp>
-#include <boost/geometry/algorithms/detail/relate/relate.hpp>
+#include <boost/geometry/algorithms/relate.hpp>
+#include <boost/geometry/algorithms/relation.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
@@ -67,6 +70,44 @@ std::string matrix_format(std::string const& matrix1, std::string const& matrix2
+ ( !matrix2.empty() ? " || " : "" ) + matrix2;
}
+template <typename M>
+char get_ii(M const& m)
+{
+ using bg::detail::relate::interior;
+ return m.template get<interior, interior>();
+}
+
+template <typename M>
+char get_ee(M const& m)
+{
+ using bg::detail::relate::exterior;
+ return m.template get<exterior, exterior>();
+}
+
+void check_mask()
+{
+ bg::de9im::mask m1("");
+ bg::de9im::mask m2("TTT");
+ bg::de9im::mask m3("000111222");
+ bg::de9im::mask m4("000111222FFFF");
+ bg::de9im::mask m5(std::string(""));
+ bg::de9im::mask m6(std::string("TTT"));
+ bg::de9im::mask m7(std::string("000111222"));
+ bg::de9im::mask m8(std::string("000111222FFFF"));
+
+ using bg::detail::relate::interior;
+ using bg::detail::relate::exterior;
+
+ BOOST_CHECK(get_ii(m1) == '*' && get_ee(m1) == '*');
+ BOOST_CHECK(get_ii(m2) == 'T' && get_ee(m2) == '*');
+ BOOST_CHECK(get_ii(m3) == '0' && get_ee(m3) == '2');
+ BOOST_CHECK(get_ii(m4) == '0' && get_ee(m4) == '2');
+ BOOST_CHECK(get_ii(m5) == '*' && get_ee(m5) == '*');
+ BOOST_CHECK(get_ii(m6) == 'T' && get_ee(m6) == '*');
+ BOOST_CHECK(get_ii(m7) == '0' && get_ee(m7) == '2');
+ BOOST_CHECK(get_ii(m8) == '0' && get_ee(m8) == '2');
+}
+
template <typename Geometry1, typename Geometry2>
void check_geometry(Geometry1 const& geometry1,
Geometry2 const& geometry2,
@@ -75,19 +116,32 @@ void check_geometry(Geometry1 const& geometry1,
std::string const& expected1,
std::string const& expected2 = std::string())
{
+ boost::variant<Geometry1> variant1 = geometry1;
+ boost::variant<Geometry2> variant2 = geometry2;
+
{
- std::string res_str = bgdr::relate<bgdr::matrix9>(geometry1, geometry2);
+ std::string res_str = bg::relation(geometry1, geometry2).str();
bool ok = matrix_compare(res_str, expected1, expected2);
BOOST_CHECK_MESSAGE(ok,
"relate: " << wkt1
<< " and " << wkt2
<< " -> Expected: " << matrix_format(expected1, expected2)
<< " detected: " << res_str);
+
+ // test variants
+ boost::variant<Geometry1> v1 = geometry1;
+ boost::variant<Geometry2> v2 = geometry2;
+ std::string res_str1 = bg::relation(geometry1, variant2).str();
+ std::string res_str2 = bg::relation(variant1, geometry2).str();
+ std::string res_str3 = bg::relation(variant1, variant2).str();
+ BOOST_CHECK(res_str == res_str1);
+ BOOST_CHECK(res_str == res_str2);
+ BOOST_CHECK(res_str == res_str3);
}
// changed sequence of geometries - transposed result
{
- std::string res_str = bgdr::relate(geometry2, geometry1, bgdr::matrix9());
+ std::string res_str = bg::relation(geometry2, geometry1).str();
std::string expected1_tr = transposed(expected1);
std::string expected2_tr = transposed(expected2);
bool ok = matrix_compare(res_str, expected1_tr, expected2_tr);
@@ -101,12 +155,20 @@ void check_geometry(Geometry1 const& geometry1,
if ( expected2.empty() )
{
{
- bool result = bgdr::relate(geometry1, geometry2, bgdr::mask9(expected1));
+ bool result = bg::relate(geometry1, geometry2, bg::de9im::mask(expected1));
// TODO: SHOULD BE !interrupted - CHECK THIS!
BOOST_CHECK_MESSAGE(result,
"relate: " << wkt1
<< " and " << wkt2
<< " -> Expected: " << expected1);
+
+ // test variants
+ bool result1 = bg::relate(geometry1, variant2, bg::de9im::mask(expected1));
+ bool result2 = bg::relate(variant1, geometry2, bg::de9im::mask(expected1));
+ bool result3 = bg::relate(variant1, variant2, bg::de9im::mask(expected1));
+ BOOST_CHECK(result == result1);
+ BOOST_CHECK(result == result2);
+ BOOST_CHECK(result == result3);
}
if ( BOOST_GEOMETRY_CONDITION((
@@ -130,7 +192,7 @@ void check_geometry(Geometry1 const& geometry1,
if ( changed )
{
- bool result = bgdr::relate(geometry1, geometry2, bgdr::mask9(expected_interrupt));
+ bool result = bg::relate(geometry1, geometry2, bg::de9im::mask(expected_interrupt));
// TODO: SHOULD BE interrupted - CHECK THIS!
BOOST_CHECK_MESSAGE(!result,
"relate: " << wkt1
diff --git a/libs/geometry/test/algorithms/relational_operations/test_covered_by.hpp b/libs/geometry/test/algorithms/relational_operations/test_covered_by.hpp
index b9d8f5853f..5403e8edb8 100644
--- a/libs/geometry/test/algorithms/relational_operations/test_covered_by.hpp
+++ b/libs/geometry/test/algorithms/relational_operations/test_covered_by.hpp
@@ -1,8 +1,8 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
-// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -22,13 +22,10 @@
#include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/geometries/ring.hpp>
#include <boost/geometry/geometries/polygon.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/io/wkt/read.hpp>
-#include <boost/geometry/multi/algorithms/covered_by.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/io/wkt/read.hpp>
-
template <typename Geometry1, typename Geometry2>
void check_geometry(Geometry1 const& geometry1,
Geometry2 const& geometry2,
diff --git a/libs/geometry/test/algorithms/relational_operations/touches/Jamfile.v2 b/libs/geometry/test/algorithms/relational_operations/touches/Jamfile.v2
new file mode 100644
index 0000000000..b2d6afef84
--- /dev/null
+++ b/libs/geometry/test/algorithms/relational_operations/touches/Jamfile.v2
@@ -0,0 +1,23 @@
+# Boost.Geometry (aka GGL, Generic Geometry Library)
+#
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
+#
+# This file was modified by Oracle on 2014, 2015.
+# Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
+#
+# Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
+# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+#
+# 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)
+
+test-suite boost-geometry-algorithms-relational-touches
+ :
+ [ run touches.cpp : : : : algorithms_touches ]
+ [ run touches_box.cpp : : : : algorithms_touches_box ]
+ [ run touches_multi.cpp : : : : algorithms_touches_multi ]
+ [ run touches_self.cpp : : : : algorithms_touches_self ]
+ ;
diff --git a/libs/geometry/test/algorithms/relational_operations/test_touches.hpp b/libs/geometry/test/algorithms/relational_operations/touches/test_touches.hpp
index 60df672c5a..60df672c5a 100644
--- a/libs/geometry/test/algorithms/relational_operations/test_touches.hpp
+++ b/libs/geometry/test/algorithms/relational_operations/touches/test_touches.hpp
diff --git a/libs/geometry/test/algorithms/relational_operations/touches.cpp b/libs/geometry/test/algorithms/relational_operations/touches/touches.cpp
index d7a92c8e0e..88a0cc2695 100644
--- a/libs/geometry/test/algorithms/relational_operations/touches.cpp
+++ b/libs/geometry/test/algorithms/relational_operations/touches/touches.cpp
@@ -1,40 +1,27 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
-// Copyright (c) 2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands.
-// This file was modified by Oracle on 2013, 2014.
-// Modifications copyright (c) 2013, 2014, Oracle and/or its affiliates.
+// This file was modified by Oracle on 2013, 2014. 2015.
+// Modifications copyright (c) 2013-2015, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// 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_touches.hpp"
template <typename P>
void test_all()
{
- typedef bg::model::box<P> box;
typedef bg::model::ring<P> ring;
typedef bg::model::polygon<P> polygon;
typedef bg::model::linestring<P> linestring;
typedef bg::model::multi_polygon<polygon> mpolygon;
typedef bg::model::multi_linestring<linestring> mlinestring;
- // Just a normal polygon
- test_self_touches<polygon>("POLYGON((0 0,0 4,1.5 2.5,2.5 1.5,4 0,0 0))", false);
-
- // Self intersecting
- test_self_touches<polygon>("POLYGON((1 2,1 1,2 1,2 2.25,3 2.25,3 0,0 0,0 3,3 3,2.75 2,1 2))", false);
-
- // Self touching at a point
- test_self_touches<polygon>("POLYGON((0 0,0 3,2 3,2 2,1 2,1 1,2 1,2 2,3 2,3 0,0 0))", true);
-
- // Self touching at a segment
- test_self_touches<polygon>("POLYGON((0 0,0 3,2 3,2 2,1 2,1 1,2 1,2 2.5,3 2.5,3 0,0 0))", true);
-
// Touching at corner
test_touches<polygon, polygon>
(
@@ -196,35 +183,11 @@ void test_all()
test_touches<linestring, mpolygon>("LINESTRING(-1 -1,3 3)", "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(0 0,9 1,9 9,1 9,0 0)))", true);
test_touches<mlinestring, mpolygon>("MULTILINESTRING((0 0,11 11))", "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(0 0,9 1,9 9,1 9,0 0)))", false);
-
- test_touches<box, box>("POLYGON((0 0,0 5,5 5,5 0,0 0))", "POLYGON((5 1,5 2,6 2,6 1,5 1))", true);
- test_touches<box, box>("POLYGON((0 0,0 5,5 5,5 0,0 0))", "POLYGON((4 1,4 2,5 2,5 1,4 1))", false);
- test_touches<box, box>("POLYGON((0 0,0 5,5 5,5 0,0 0))", "POLYGON((4 1,4 2,6 2,6 1,4 1))", false);
-
- // Point-size
- test_touches<box, box>("POLYGON((0 0,0 5,5 5,5 0,0 0))", "POLYGON((5 5,5 5,5 5,5 5,5 5))", true);
- // TODO: should it be TRUE?
- test_touches<box, box>("POLYGON((5 5,5 5,5 5,5 5,5 5))", "POLYGON((5 5,5 5,5 5,5 5,5 5))", true);
-}
-
-template <typename P>
-void test_box_3d()
-{
- typedef bg::model::box<P> box;
-
- check_touches<box, box>(box(P(0,0,0),P(5,5,5)), box(P(5,1,2),P(6,6,6)),
- "box(P(0,0,0),P(5,5,5))", "box(P(5,1,2),P(6,6,6))",
- true);
-
- check_touches<box, box>(box(P(0,0,0),P(5,5,5)), box(P(5,5,5),P(6,6,6)),
- "box(P(0,0,0),P(5,5,5))", "box(P(5,5,5),P(6,6,6))",
- true);
}
int test_main( int , char* [] )
{
test_all<bg::model::d2::point_xy<double> >();
- test_box_3d<bg::model::point<double, 3, bg::cs::cartesian> >();
#if defined(HAVE_TTMATH)
test_all<bg::model::d2::point_xy<ttmath_big> >();
diff --git a/libs/geometry/test/algorithms/relational_operations/touches/touches_box.cpp b/libs/geometry/test/algorithms/relational_operations/touches/touches_box.cpp
new file mode 100644
index 0000000000..4e8b932f11
--- /dev/null
+++ b/libs/geometry/test/algorithms/relational_operations/touches/touches_box.cpp
@@ -0,0 +1,65 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands.
+
+// This file was modified by Oracle on 2013, 2014. 2015.
+// Modifications copyright (c) 2013-2015, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
+// 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 "test_touches.hpp"
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::box<P> box;
+
+ test_touches<box, box>("POLYGON((0 0,0 5,5 5,5 0,0 0))", "POLYGON((5 1,5 2,6 2,6 1,5 1))", true);
+ test_touches<box, box>("POLYGON((0 0,0 5,5 5,5 0,0 0))", "POLYGON((4 1,4 2,5 2,5 1,4 1))", false);
+ test_touches<box, box>("POLYGON((0 0,0 5,5 5,5 0,0 0))", "POLYGON((4 1,4 2,6 2,6 1,4 1))", false);
+
+ // Point-size
+ test_touches<box, box>("POLYGON((0 0,0 5,5 5,5 0,0 0))", "POLYGON((5 5,5 5,5 5,5 5,5 5))", true);
+ // TODO: should it be TRUE?
+ test_touches<box, box>("POLYGON((5 5,5 5,5 5,5 5,5 5))", "POLYGON((5 5,5 5,5 5,5 5,5 5))", true);
+}
+
+template <typename P>
+void test_box_3d()
+{
+ typedef bg::model::box<P> box;
+
+ check_touches<box, box>(box(P(0,0,0),P(5,5,5)), box(P(5,1,2),P(6,6,6)),
+ "box(P(0,0,0),P(5,5,5))", "box(P(5,1,2),P(6,6,6))",
+ true);
+
+ check_touches<box, box>(box(P(0,0,0),P(5,5,5)), box(P(5,5,5),P(6,6,6)),
+ "box(P(0,0,0),P(5,5,5))", "box(P(5,5,5),P(6,6,6))",
+ true);
+}
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+ test_box_3d<bg::model::point<double, 3, bg::cs::cartesian> >();
+
+#if defined(HAVE_TTMATH)
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
+
+/*
+with viewy as
+(
+select geometry::STGeomFromText('POLYGON((0 0,0 100,100 100,100 0,0 0))',0) as p
+ , geometry::STGeomFromText('POLYGON((200 0,100 50,200 100,200 0))',0) as q
+)
+-- select p from viewy union all select q from viewy
+select p.STTouches(q) from viewy
+*/
diff --git a/libs/geometry/test/algorithms/relational_operations/multi_touches.cpp b/libs/geometry/test/algorithms/relational_operations/touches/touches_multi.cpp
index 86456b04ac..65de6b52c7 100644
--- a/libs/geometry/test/algorithms/relational_operations/multi_touches.cpp
+++ b/libs/geometry/test/algorithms/relational_operations/touches/touches_multi.cpp
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
-// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2010-2015 Barend Gehrels, 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)
@@ -8,24 +8,9 @@
#include "test_touches.hpp"
-#include <boost/geometry/multi/algorithms/area.hpp>
-#include <boost/geometry/multi/algorithms/num_geometries.hpp>
-#include <boost/geometry/multi/algorithms/within.hpp>
-#include <boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp>
-#include <boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp>
-#include <boost/geometry/multi/algorithms/detail/for_each_range.hpp>
-#include <boost/geometry/multi/core/closure.hpp>
-#include <boost/geometry/multi/core/geometry_id.hpp>
-#include <boost/geometry/multi/core/topological_dimension.hpp>
-#include <boost/geometry/multi/core/ring_type.hpp>
-#include <boost/geometry/multi/views/detail/range_type.hpp>
-
-#include <boost/geometry/geometries/geometries.hpp>
-#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
-
-#include <boost/geometry/multi/io/wkt/read.hpp>
-
+#include <boost/geometry/algorithms/area.hpp>
+#include <boost/geometry/algorithms/num_geometries.hpp>
+#include <boost/geometry/algorithms/within.hpp>
template <typename P>
diff --git a/libs/geometry/test/algorithms/relational_operations/touches/touches_self.cpp b/libs/geometry/test/algorithms/relational_operations/touches/touches_self.cpp
new file mode 100644
index 0000000000..00ea47daaa
--- /dev/null
+++ b/libs/geometry/test/algorithms/relational_operations/touches/touches_self.cpp
@@ -0,0 +1,43 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands.
+
+// This file was modified by Oracle on 2013, 2014. 2015.
+// Modifications copyright (c) 2013-2015, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
+// 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 "test_touches.hpp"
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::polygon<P> polygon;
+
+ // Just a normal polygon
+ test_self_touches<polygon>("POLYGON((0 0,0 4,1.5 2.5,2.5 1.5,4 0,0 0))", false);
+
+ // Self intersecting
+ test_self_touches<polygon>("POLYGON((1 2,1 1,2 1,2 2.25,3 2.25,3 0,0 0,0 3,3 3,2.75 2,1 2))", false);
+
+ // Self touching at a point
+ test_self_touches<polygon>("POLYGON((0 0,0 3,2 3,2 2,1 2,1 1,2 1,2 2,3 2,3 0,0 0))", true);
+
+ // Self touching at a segment
+ test_self_touches<polygon>("POLYGON((0 0,0 3,2 3,2 2,1 2,1 1,2 1,2 2.5,3 2.5,3 0,0 0))", true);
+}
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+#if defined(HAVE_TTMATH)
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/relational_operations/within/Jamfile.v2 b/libs/geometry/test/algorithms/relational_operations/within/Jamfile.v2
index dc33b40cc3..b714702152 100644
--- a/libs/geometry/test/algorithms/relational_operations/within/Jamfile.v2
+++ b/libs/geometry/test/algorithms/relational_operations/within/Jamfile.v2
@@ -1,11 +1,11 @@
# Boost.Geometry (aka GGL, Generic Geometry Library)
#
-# Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
-# Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
-# Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
#
-# This file was modified by Oracle on 2014.
-# Modifications copyright (c) 2014, Oracle and/or its affiliates.
+# This file was modified by Oracle on 2014, 2015.
+# Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
#
# Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -16,10 +16,10 @@
test-suite boost-geometry-algorithms-within
:
- [ run multi_within.cpp ]
- [ run within.cpp ]
- [ run within_areal_areal.cpp ]
- [ run within_linear_areal.cpp ]
- [ run within_linear_linear.cpp ]
- [ run within_pointlike_xxx.cpp ]
+ [ run within.cpp : : : : algorithms_within ]
+ [ run within_areal_areal.cpp : : : : algorithms_within_areal_areal ]
+ [ run within_linear_areal.cpp : : : : algorithms_within_linear_areal ]
+ [ run within_linear_linear.cpp : : : : algorithms_within_linear_linear ]
+ [ run within_multi.cpp : : : : algorithms_within_multi ]
+ [ run within_pointlike_geometry.cpp : : : : algorithms_within_pointlike_geometry ]
;
diff --git a/libs/geometry/test/algorithms/relational_operations/within/test_within.hpp b/libs/geometry/test/algorithms/relational_operations/within/test_within.hpp
index c82bdaf7e1..b92b029dd7 100644
--- a/libs/geometry/test/algorithms/relational_operations/within/test_within.hpp
+++ b/libs/geometry/test/algorithms/relational_operations/within/test_within.hpp
@@ -1,11 +1,11 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
-// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
-// This file was modified by Oracle on 2014.
-// Modifications copyright (c) 2014 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2014, 2015.
+// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -26,6 +26,7 @@
#include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/geometries/ring.hpp>
#include <boost/geometry/geometries/polygon.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/io/wkt/read.hpp>
@@ -38,10 +39,6 @@
#include <boost/geometry/algorithms/within.hpp>
-#include <boost/geometry/multi/algorithms/covered_by.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/io/wkt/read.hpp>
-
template <typename Geometry1, typename Geometry2>
void check_geometry(Geometry1 const& geometry1,
Geometry2 const& geometry2,
diff --git a/libs/geometry/test/algorithms/relational_operations/within/within.cpp b/libs/geometry/test/algorithms/relational_operations/within/within.cpp
index 2300a4ec53..c8999e4db5 100644
--- a/libs/geometry/test/algorithms/relational_operations/within/within.cpp
+++ b/libs/geometry/test/algorithms/relational_operations/within/within.cpp
@@ -1,10 +1,10 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
-// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
-// This file was modified by Oracle on 2014.
-// Modifications copyright (c) 2014 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2014, 2015.
+// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -17,10 +17,9 @@
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/multi.hpp>
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/geometries/multi_point.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
template <typename P>
void test_all()
diff --git a/libs/geometry/test/algorithms/relational_operations/within/within_areal_areal.cpp b/libs/geometry/test/algorithms/relational_operations/within/within_areal_areal.cpp
index a2901ba4b5..5595439452 100644
--- a/libs/geometry/test/algorithms/relational_operations/within/within_areal_areal.cpp
+++ b/libs/geometry/test/algorithms/relational_operations/within/within_areal_areal.cpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
-// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2014, 2015.
// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
@@ -18,8 +18,7 @@
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/multi.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
template <typename P>
void test_a_a()
diff --git a/libs/geometry/test/algorithms/relational_operations/within/within_linear_areal.cpp b/libs/geometry/test/algorithms/relational_operations/within/within_linear_areal.cpp
index 889ff3692f..14e541d363 100644
--- a/libs/geometry/test/algorithms/relational_operations/within/within_linear_areal.cpp
+++ b/libs/geometry/test/algorithms/relational_operations/within/within_linear_areal.cpp
@@ -1,10 +1,10 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
-// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
-// This file was modified by Oracle on 2014.
-// Modifications copyright (c) 2014 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2014, 2015.
+// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -17,9 +17,8 @@
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/multi.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
template <typename P>
void test_l_a()
diff --git a/libs/geometry/test/algorithms/relational_operations/within/within_linear_linear.cpp b/libs/geometry/test/algorithms/relational_operations/within/within_linear_linear.cpp
index 6467e01104..f2e2876bff 100644
--- a/libs/geometry/test/algorithms/relational_operations/within/within_linear_linear.cpp
+++ b/libs/geometry/test/algorithms/relational_operations/within/within_linear_linear.cpp
@@ -1,10 +1,10 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
-// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
-// This file was modified by Oracle on 2014.
-// Modifications copyright (c) 2014 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2014, 2015.
+// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -17,8 +17,7 @@
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/multi.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
template <typename P>
void test_l_l()
diff --git a/libs/geometry/test/algorithms/relational_operations/within/multi_within.cpp b/libs/geometry/test/algorithms/relational_operations/within/within_multi.cpp
index cf5573aa68..b41529cc08 100644
--- a/libs/geometry/test/algorithms/relational_operations/within/multi_within.cpp
+++ b/libs/geometry/test/algorithms/relational_operations/within/within_multi.cpp
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, 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)
@@ -8,19 +8,14 @@
#include <geometry_test_common.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
#include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/algorithms/within.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/polygon.hpp>
-
-#include <boost/geometry/multi/core/point_order.hpp>
-#include <boost/geometry/multi/algorithms/within.hpp>
-
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
#include "test_within.hpp"
diff --git a/libs/geometry/test/algorithms/relational_operations/within/within_pointlike_xxx.cpp b/libs/geometry/test/algorithms/relational_operations/within/within_pointlike_geometry.cpp
index 5ea4f09f2e..ff9e67f122 100644
--- a/libs/geometry/test/algorithms/relational_operations/within/within_pointlike_xxx.cpp
+++ b/libs/geometry/test/algorithms/relational_operations/within/within_pointlike_geometry.cpp
@@ -1,10 +1,10 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
-// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
-// This file was modified by Oracle on 2014.
-// Modifications copyright (c) 2014 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2014, 2015.
+// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -17,10 +17,9 @@
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/multi.hpp>
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/geometries/multi_point.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
template <typename P>
void test_p_p()
diff --git a/libs/geometry/test/algorithms/remove_spikes.cpp b/libs/geometry/test/algorithms/remove_spikes.cpp
index 8f7fd75bb3..f4e2521033 100644
--- a/libs/geometry/test/algorithms/remove_spikes.cpp
+++ b/libs/geometry/test/algorithms/remove_spikes.cpp
@@ -1,10 +1,10 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2007-2013 Barend Gehrels, Amsterdam, the Netherlands.
-// Copyright (c) 2008-2013 Bruno Lalande, Paris, France.
-// Copyright (c) 2009-2013 Mateusz Loskot, London, UK.
-// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
+// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -36,14 +36,7 @@
#include <boost/geometry/strategies/strategies.hpp>
#if defined(BOOST_GEOMETRY_UNIT_TEST_MULTI)
-
-# include <boost/geometry/multi/algorithms/remove_spikes.hpp>
-
-# include <boost/geometry/multi/algorithms/area.hpp>
-# include <boost/geometry/multi/algorithms/correct.hpp>
-# include <boost/geometry/multi/algorithms/perimeter.hpp>
-# include <boost/geometry/multi/geometries/multi_polygon.hpp>
-# include <boost/geometry/multi/io/wkt/wkt.hpp>
+# include <boost/geometry/geometries/multi_polygon.hpp>
#endif
diff --git a/libs/geometry/test/algorithms/multi_reverse.cpp b/libs/geometry/test/algorithms/reverse_multi.cpp
index 78334928df..f3a7f574db 100644
--- a/libs/geometry/test/algorithms/multi_reverse.cpp
+++ b/libs/geometry/test/algorithms/reverse_multi.cpp
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, 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)
@@ -8,18 +8,12 @@
#include <geometry_test_common.hpp>
#include <boost/geometry/algorithms/reverse.hpp>
-#include <boost/geometry/multi/algorithms/reverse.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
-
#include <algorithms/test_reverse.hpp>
diff --git a/libs/geometry/test/algorithms/set_operations/check_turn_less.hpp b/libs/geometry/test/algorithms/set_operations/check_turn_less.hpp
new file mode 100644
index 0000000000..c786c34f06
--- /dev/null
+++ b/libs/geometry/test/algorithms/set_operations/check_turn_less.hpp
@@ -0,0 +1,106 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 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
+
+#ifndef BOOST_GEOMETRY_TEST_CHECK_TURN_LESS_HPP
+#define BOOST_GEOMETRY_TEST_CHECK_TURN_LESS_HPP
+
+#include <boost/range.hpp>
+
+#include "test_set_ops_linear_linear.hpp"
+
+
+// check less functor for turns
+template <typename Turns, typename Less>
+inline void verify_less_for_turns(Turns turns, Less const& less)
+{
+ typedef typename boost::range_iterator<Turns const>::type iterator_type;
+
+ if (boost::size(turns) < 2)
+ {
+ return;
+ }
+
+ iterator_type last = --boost::end(turns);
+ for (iterator_type it1 = boost::begin(turns); it1 != last; ++it1)
+ {
+ iterator_type it2 = it1;
+ ++it2;
+ for (; it2 != boost::end(turns); ++it2)
+ {
+ if (less(*it1, *it2))
+ {
+ BOOST_CHECK(! less(*it2, *it1));
+ }
+ if (less(*it2, *it1))
+ {
+ BOOST_CHECK(! less(*it1, *it2));
+ }
+ }
+ }
+}
+
+
+struct check_turn_less
+{
+ template <bool EnableDegenerateTurns = true>
+ struct assign_policy
+ {
+ static bool const include_no_turn = false;
+ static bool const include_degenerate = EnableDegenerateTurns;
+ static bool const include_opposite = false;
+
+ template
+ <
+ typename Info,
+ typename Point1,
+ typename Point2,
+ typename IntersectionInfo
+ >
+ static inline void apply(Info& , Point1 const& , Point2 const& ,
+ IntersectionInfo const& )
+ {
+ }
+ };
+
+ template <typename Geometry1, typename Geometry2>
+ static inline void apply(Geometry1 const& geometry1,
+ Geometry2 const& geometry2)
+ {
+ typedef bg::detail::no_rescale_policy robust_policy_type;
+
+ typedef bg::detail::relate::turns::get_turns
+ <
+ Geometry1,
+ Geometry2,
+ bg::detail::get_turns::get_turn_info_type
+ <
+ Geometry1, Geometry2, assign_policy<>
+ >,
+ robust_policy_type
+ > get_turns_type;
+
+ typedef typename get_turns_type::turn_info turn_info;
+
+ typedef std::vector<turn_info> turns_container;
+
+ turns_container turns;
+
+ bg::detail::get_turns::no_interrupt_policy interrupt_policy;
+
+ get_turns_type::apply(turns, geometry1, geometry2,
+ interrupt_policy, robust_policy_type());
+
+
+ typedef bg::detail::turns::less_seg_fraction_other_op<> turn_less_type;
+
+ verify_less_for_turns(turns, turn_less_type());
+ }
+};
+
+#endif // BOOST_GEOMETRY_TEST_CHECK_TURN_LESS_HPP
diff --git a/libs/geometry/test/algorithms/set_operations/difference/Jamfile.v2 b/libs/geometry/test/algorithms/set_operations/difference/Jamfile.v2
index 8bbbbbdc65..b00e397d00 100644
--- a/libs/geometry/test/algorithms/set_operations/difference/Jamfile.v2
+++ b/libs/geometry/test/algorithms/set_operations/difference/Jamfile.v2
@@ -1,11 +1,11 @@
# Boost.Geometry (aka GGL, Generic Geometry Library)
#
-# Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
-# Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
-# Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
#
-# This file was modified by Oracle on 2014.
-# Modifications copyright (c) 2014, Oracle and/or its affiliates.
+# This file was modified by Oracle on 2014, 2015.
+# Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
#
# Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -16,9 +16,13 @@
test-suite boost-geometry-algorithms-difference
:
- [ run difference.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
- [ run difference_linear_linear.cpp ]
- [ run difference_pl_pl.cpp ]
- [ run multi_difference.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
- [ run multi_difference_spike.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
+ [ run difference.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
+ : algorithms_difference ]
+ [ run difference_linear_linear.cpp : : : : algorithms_difference_linear_linear ]
+ [ run difference_pl_l.cpp : : : : algorithms_difference_pl_l ]
+ [ run difference_pl_pl.cpp : : : : algorithms_difference_pl_pl ]
+ [ run difference_multi.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
+ : algorithms_difference_multi ]
+ [ run difference_multi_spike.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
+ : algorithms_difference_multi_spike ]
;
diff --git a/libs/geometry/test/algorithms/set_operations/difference/difference.cpp b/libs/geometry/test/algorithms/set_operations/difference/difference.cpp
index c6456a009b..1e6a23c2ab 100644
--- a/libs/geometry/test/algorithms/set_operations/difference/difference.cpp
+++ b/libs/geometry/test/algorithms/set_operations/difference/difference.cpp
@@ -23,12 +23,8 @@
#include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/algorithms/is_valid.hpp>
-#include <boost/geometry/algorithms/perimeter.hpp>
-#include <boost/geometry/multi/algorithms/correct.hpp>
-#include <boost/geometry/multi/algorithms/intersection.hpp>
-#include <boost/geometry/multi/algorithms/within.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
+#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
@@ -36,7 +32,6 @@
#include <algorithms/test_overlay.hpp>
#include <algorithms/overlay/overlay_cases.hpp>
#include <algorithms/overlay/multi_overlay_cases.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
#ifdef HAVE_TTMATH
@@ -175,6 +170,33 @@ void test_ticket_11121()
BOOST_CHECK(bg::is_valid(sym_diff));
}
+template <typename CoordinateType>
+void test_bug21155501()
+{
+ typedef bg::model::point<CoordinateType,2,bg::cs::cartesian> point_type;
+ typedef bg::model::polygon
+ <
+ point_type, /*ClockWise*/false, /*Closed*/false
+ > polygon_type;
+ typedef bg::model::multi_polygon<polygon_type> multipolygon_type;
+
+ polygon_type g1;
+ bg::read_wkt("POLYGON((-8.3935546875 27.449790329784214,4.9658203125 18.729501999072138,11.8212890625 23.563987128451217,9.7119140625 25.48295117535531,9.8876953125 31.728167146023935,8.3056640625 32.99023555965106,8.5693359375 37.16031654673677,-1.8896484375 35.60371874069731,-0.5712890625 32.02670629333614,-8.9208984375 29.458731185355344,-8.3935546875 27.449790329784214))", g1);
+ multipolygon_type g2;
+ bg::read_wkt("MULTIPOLYGON(((4.9658203125 18.729501999072138,-3.4868710311820115 24.246968623627644,8.3589904332912 33.833614418115445,8.3056640625 32.99023555965106,9.8876953125 31.728167146023935,9.7119140625 25.48295117535531,11.8212890625 23.563987128451217,4.9658203125 18.729501999072138)),((-3.88714525609152 24.508246314579743,-8.3935546875 27.449790329784214,-8.9208984375 29.458731185355344,-0.5712890625 32.02670629333614,-1.8896484375 35.60371874069731,8.5693359375 37.16031654673677,8.362166569827938 33.883846345901595,-3.88714525609152 24.508246314579743)))", g2);
+ bg::correct(g1);
+ bg::correct(g2);
+
+ multipolygon_type diff12, diff21, sym_diff;
+ bg::difference(g1, g2, diff12);
+ bg::difference(g2, g1, diff21);
+ bg::sym_difference(g1, g2, sym_diff);
+
+ BOOST_CHECK(bg::is_valid(diff12));
+ BOOST_CHECK(bg::is_valid(diff21));
+ BOOST_CHECK(bg::is_valid(sym_diff));
+}
+
template <typename P>
void test_all()
{
@@ -207,10 +229,12 @@ void test_all()
1, 5, 8.0,
1, 5, 8.0);
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<polygon, polygon, polygon>("star_comb_15",
star_comb_15[0], star_comb_15[1],
30, 160, 227.658275102812,
30, 198, 480.485775259312);
+#endif
test_one<polygon, polygon, polygon>("new_hole",
new_hole[0], new_hole[1],
@@ -259,7 +283,8 @@ void test_all()
test_one<polygon, polygon, polygon>("fitting",
fitting[0], fitting[1],
1, 9, 21.0,
- 1, 4, 4.0);
+ 1, 4, 4.0,
+ 1, 5, 25.0);
test_one<polygon, polygon, polygon>("identical",
identical[0], identical[1],
@@ -324,14 +349,14 @@ void test_all()
test_one<polygon, polygon, polygon>("side_side",
side_side[0], side_side[1],
1, 5, 1,
- 1, 5, 1);
+ 1, 5, 1,
+ 1, 7, 2);
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<polygon, polygon, polygon>("buffer_mp1",
buffer_mp1[0], buffer_mp1[1],
1, 61, 10.2717,
1, 61, 10.2717);
-#endif
if ( BOOST_GEOMETRY_CONDITION((boost::is_same<ct, double>::value)) )
{
@@ -340,6 +365,7 @@ void test_all()
1, 91, 12.09857,
1, 155, 24.19714);
}
+#endif
/*** TODO: self-tangencies for difference
test_one<polygon, polygon, polygon>("wrapped_a",
@@ -357,11 +383,16 @@ void test_all()
// rings might be discarded. We check area only
test_one<polygon, polygon, polygon>("isovist",
isovist1[0], isovist1[1],
- -1, -1, 0.279121,
+ -1, -1, 0.279132,
-1, -1, 224.8892,
+#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
+ 0.1);
+#else
0.001);
- // SQL Server gives: 0.279121891701124 and 224.889211358929
- // PostGIS gives: 0.279121991127244 and 224.889205853156
+#endif
+ // SQL Server gives: 0.279121891701124 and 224.889211358929
+ // PostGIS gives: 0.279121991127244 and 224.889205853156
+ // No robustness gives: 0.279121991127106 and 224.825363749290
#ifdef GEOMETRY_TEST_INCLUDE_FAILING_TESTS
test_one<polygon, polygon, polygon>("geos_1",
@@ -378,6 +409,7 @@ void test_all()
// PostGIS gives: 0.30859375 and 0.033203125 with 35/35 rings
#endif
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<polygon, polygon, polygon>("geos_2",
geos_2[0], geos_2[1],
1, -1, 138.6923828,
@@ -387,7 +419,9 @@ void test_all()
test_one<polygon, polygon, polygon>("geos_3",
geos_3[0], geos_3[1],
1, -1, 16211128.5,
- 1, -1, 13180420.0);
+ 1, -1, 13180420.0,
+ 1, -1, 16211128.5 + 13180420.0);
+#endif
test_one<polygon, polygon, polygon>("geos_4",
geos_4[0], geos_4[1],
@@ -397,7 +431,8 @@ void test_all()
test_one<polygon, polygon, polygon>("ggl_list_20110306_javier",
ggl_list_20110306_javier[0], ggl_list_20110306_javier[1],
1, -1, 71495.3331,
- 2, -1, 8960.49049);
+ 2, -1, 8960.49049,
+ 2, -1, 71495.3331 + 8960.49049);
test_one<polygon, polygon, polygon>("ggl_list_20110307_javier",
ggl_list_20110307_javier[0], ggl_list_20110307_javier[1],
@@ -410,20 +445,23 @@ void test_all()
test_one<polygon, polygon, polygon>("ggl_list_20110716_enrico",
ggl_list_20110716_enrico[0], ggl_list_20110716_enrico[1],
3, -1, 35723.8506317139,
- 1, -1, 58456.4964294434
- );
+ 1, -1, 58456.4964294434,
+ 1, -1, 35723.8506317139 + 58456.4964294434);
}
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<polygon, polygon, polygon>("ggl_list_20110820_christophe",
ggl_list_20110820_christophe[0], ggl_list_20110820_christophe[1],
1, -1, 2.8570121719168924,
1, -1, 64.498061986388564);
+#endif
test_one<polygon, polygon, polygon>("ggl_list_20120717_volker",
ggl_list_20120717_volker[0], ggl_list_20120717_volker[1],
1, 11, 3370866.2295081965,
1, 5, 384.2295081964694, 0.01);
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
// 2011-07-02 / 2014-06-19
// Interesting FP-precision case.
// sql server gives: 6.62295817619452E-05
@@ -433,11 +471,12 @@ void test_all()
// however, some long spikes are still generated in the resulting difference
test_one<polygon, polygon, polygon>("ggl_list_20110627_phillip",
ggl_list_20110627_phillip[0], ggl_list_20110627_phillip[1],
- 1, -1,
- if_typed_tt<ct>(0.0000000000001105367, 0.00021401892),
+ if_typed_tt<ct>(1, 1), -1,
+ if_typed_tt<ct>(0.0000000000001105367, 0.000125137888971949),
1, -1, 3577.40960816756,
0.01
);
+#endif
// Ticket 8310, one should be completely subtracted from the other.
test_one<polygon, polygon, polygon>("ticket_8310a",
@@ -456,8 +495,8 @@ void test_all()
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<polygon, polygon, polygon>("ticket_9081_15",
ticket_9081_15[0], ticket_9081_15[1],
- 1, 10, 0.0334529710902111,
- 0, 0, 0);
+ 2, 10, 0.0334529710902111,
+ 1, 4, 5.3469555172380723e-010);
#endif
test_one<polygon, polygon, polygon>("ticket_9081_314",
@@ -470,7 +509,6 @@ void test_all()
ticket_9563[0], ticket_9563[1],
0, 0, 0,
6, 24, 20.096189);
-#endif
test_one<polygon, polygon, polygon>("ticket_10108_a",
ticket_10108_a[0], ticket_10108_a[1],
@@ -480,6 +518,7 @@ void test_all()
ticket_10108_b[0], ticket_10108_b[1],
1, 5, 1081.68697,
1, 5, 1342.65795);
+#endif
// From assemble-test, with a u/u case
test_one<polygon, polygon, polygon>("assemble_0210",
@@ -642,7 +681,9 @@ void test_specific()
test_one<polygon, polygon, polygon>("ggl_list_20120717_volker",
ggl_list_20120717_volker[0], ggl_list_20120717_volker[1],
1, 11, 3371540,
- 1, 4, 384, 0.001);
+ 1, 4, 385,
+ 1, 16, 3371540 + 385,
+ 0.001);
test_one<polygon, polygon, polygon>("ticket_10658",
ticket_10658[0], ticket_10658[1],
@@ -652,7 +693,7 @@ void test_specific()
test_one<polygon, polygon, polygon>("ticket_11121",
ticket_11121[0], ticket_11121[1],
2, 8, 489763.5,
- 1, 4, 6743503.5);
+ 1, 4, 6731652.0);
}
@@ -672,8 +713,8 @@ int test_main(int, char* [])
("MULTIPOLYGON(((516 2484,516 1608,1308 1932,2094 2466,2094 3150,1308 3066,516 2484)))");
test_ticket_10835<int>
- ("MULTILINESTRING((5239 2113,5233 2114),(4795 2205,1020 2986))",
- "MULTILINESTRING((5239 2113,5233 2114),(4795 2205,1460 2895))");
+ ("MULTILINESTRING((5239 2113,5233 2114),(4794 2205,1020 2986))",
+ "MULTILINESTRING((5239 2113,5233 2114),(4794 2205,1460 2895))");
test_ticket_10835<double>
("MULTILINESTRING((5239 2113,5232.52 2114.34),(4794.39 2205,1020 2986))",
@@ -681,6 +722,10 @@ int test_main(int, char* [])
test_ticket_11121<int>();
+#ifdef BOOST_GEOMETRY_TEST_ENABLE_FAILING
+ test_bug21155501<double>();
+#endif
+
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
test_all<bg::model::d2::point_xy<float> >();
diff --git a/libs/geometry/test/algorithms/set_operations/difference/difference_linear_linear.cpp b/libs/geometry/test/algorithms/set_operations/difference/difference_linear_linear.cpp
index 9f79baa08b..e081666582 100644
--- a/libs/geometry/test/algorithms/set_operations/difference/difference_linear_linear.cpp
+++ b/libs/geometry/test/algorithms/set_operations/difference/difference_linear_linear.cpp
@@ -23,7 +23,7 @@
#include "test_difference_linear_linear.hpp"
#include <boost/geometry/geometries/linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/algorithms/difference.hpp>
typedef bg::model::point<double,2,bg::cs::cartesian> point_type;
@@ -552,14 +552,16 @@ BOOST_AUTO_TEST_CASE( test_difference_linestring_linestring )
(from_wkt<L>("LINESTRING(8 1, 4 .4,2 8)"),
from_wkt<L>("LINESTRING(0 -.2, 8 1)"),
from_wkt<ML>("MULTILINESTRING((4 .4,2 8))"),
- "lldf31x"
+ "lldf31x",
+ 4.0 * std::numeric_limits<double>::epsilon()
);
tester::apply
(from_wkt<L>("LINESTRING(2 8,4 .4,8 1)"),
from_wkt<L>("LINESTRING(0 -.2, 8 1)"),
from_wkt<ML>("MULTILINESTRING((2 8,4 .4))"),
- "lldf31x-r"
+ "lldf31x-r",
+ 4.0 * std::numeric_limits<double>::epsilon()
);
tester::apply
@@ -1184,6 +1186,34 @@ BOOST_AUTO_TEST_CASE( test_difference_multilinestring_multilinestring )
"mlmldf25-r",
1e-10
);
+
+ {
+ std::string wkt1 = "MULTILINESTRING((0 -18,17 -9,8.422018348623853 -6.477064220183486),(4.0893470790378 -5.202749140893471,0 -4,6.049382716049383 -7.4567901234567895),(9.21951219512195 -9.26829268292683,14 -12),(-7 3,-5.903614457831325 6.289156626506024),(-5.277777777777778 8.166666666666668,-5 9,-5.445859872611465 8.26751592356688),(-6.342710997442455 6.794117647058823,-19 -14,-6.2338779019776425 6.668959587274291),(-5.3004291845493565 8.180257510729614,-3.579710144927536 10.966183574879228),(-3.390625 11.272321428571429,2 20),(20 -19,14 -3,3.258064516129032 1.774193548387096),(-5.275590551181104 5.5669291338582685,-13 9,-8.678414096916299 9.480176211453745),(-7.65625 9.59375,-4 10),(-2 -4,-0.15873015873015883 -0.31746031746031766),(1.875 3.75,9 18,6 8,13 17),(12 -11,6 4))";
+
+ std::string wkt2 = "MULTILINESTRING((1 16,-16 18),(17 10,15 4),(0 -14,-7 3),(-16 3,-6.471885336273427 6.942668136714442),(-4.557823129251701 7.73469387755102,-2.220994475138122 8.701657458563536),(-1.7326203208556137 8.90374331550802,13 15,15 -16,11 -11),(-6 11,-4.285714285714287 7.571428571428573),(-0.5882352941176467 0.1764705882352935,4 -9,-4 -8,-4 4.1),(-4 7.4,-4 11.666666666666666),(-4 12.142857142857142,-4 19),(-17 -1,-3.5989717223650377 3.638817480719794),(0.8699690402476783 5.185758513931889,9 8),(18 10,2.814814814814815 2.4074074074074057),(-0.9090909090909101 0.545454545454545,-4 -1,-3 -16,1.272141706924316 -1.9629629629629637),(2.666666666666667 2.6190476190476204,4 7),(-1 18,11 -6))";
+
+ std::string wkt_out = "MULTILINESTRING((0 -18,17 -9,8.4220183486238529 -6.47706422018348604),(4.08934707903780037 -5.20274914089347096,0 -4,6.04938271604938294 -7.45679012345678949),(9.21951219512195053 -9.26829268292683039,14 -12),(-7 3,-5.90361445783132499 6.28915662650602414),(-5.27777777777777768 8.16666666666666785,-5 9,-5.44585987261146531 8.26751592356687937),(-6.34271099744245515 6.79411764705882337,-19 -14,-6.23387790197764247 6.66895958727429061),(-5.30042918454935652 8.18025751072961427,-3.57971014492753614 10.9661835748792278),(-3.390625 11.2723214285714288,2 20),(20 -19,14 -3,3.25806451612903203 1.77419354838709609),(-5.27559055118110365 5.56692913385826849,-13 9,-8.67841409691629906 9.48017621145374534),(-7.65625 9.59375,-4 10),(-2 -4,-0.158730158730158832 -0.317460317460317665),(1.875 3.75,9 18,6 8,13 17),(12 -11,6 4))";
+
+ ML mls1, mls2, mls_out;
+ bg::read_wkt(wkt1, mls1);
+ bg::read_wkt(wkt2, mls2);
+ bg::read_wkt(wkt_out, mls_out);
+
+ tester::apply(mls1, mls2, mls_out, "mlmldf26", 1e-10);
+ }
+ {
+ std::string wkt1 = "MULTILINESTRING((12 -11,6 4))";
+ std::string wkt2 = "MULTILINESTRING((18 10,2.814814814814815 2.4074074074074057),(-1 18,11 -6))";
+
+ std::string wkt_out = "MULTILINESTRING((12 -11,6 4))";
+
+ ML mls1, mls2, mls_out;
+ bg::read_wkt(wkt1, mls1);
+ bg::read_wkt(wkt2, mls2);
+ bg::read_wkt(wkt_out, mls_out);
+
+ tester::apply(mls1, mls2, mls_out, "mlmldf27");
+ }
}
diff --git a/libs/geometry/test/algorithms/set_operations/difference/multi_difference.cpp b/libs/geometry/test/algorithms/set_operations/difference/difference_multi.cpp
index cad1b9bffe..eb5ae6f79a 100644
--- a/libs/geometry/test/algorithms/set_operations/difference/multi_difference.cpp
+++ b/libs/geometry/test/algorithms/set_operations/difference/difference_multi.cpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2010-2015 Barend Gehrels, 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
@@ -27,16 +27,16 @@
#include <algorithms/test_overlay.hpp>
#include <algorithms/overlay/multi_overlay_cases.hpp>
-#include <boost/geometry/multi/algorithms/correct.hpp>
-#include <boost/geometry/multi/algorithms/intersection.hpp>
-#include <boost/geometry/multi/algorithms/within.hpp> // only for testing #77
+#include <boost/geometry/algorithms/correct.hpp>
+#include <boost/geometry/algorithms/intersection.hpp>
+#include <boost/geometry/algorithms/within.hpp> // only for testing #77
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/geometries/multi_point.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
-#include <boost/geometry/multi/io/wkt/read.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
template <typename Ring, typename Polygon, typename MultiPolygon>
void test_areal()
@@ -58,14 +58,14 @@ void test_areal()
test_one<Polygon, Ring, MultiPolygon>("simplex_multi_r_mp",
case_single_simplex, case_multi_simplex[0],
4, 17, 2.58, 5, 21, 5.58);
- test_one<Ring, MultiPolygon, Polygon>("simplex_multi_mp_r",
+ test_one<Polygon, MultiPolygon, Ring>("simplex_multi_mp_r",
case_multi_simplex[0], case_single_simplex,
5, 21, 5.58, 4, 17, 2.58);
// Constructed cases for multi/touch/equal/etc
test_one<Polygon, MultiPolygon, MultiPolygon>("case_61_multi",
case_61_multi[0], case_61_multi[1],
- 2, 10, 2, 2, 10, 2);
+ 2, 10, 2, 2, 10, 2, 1, 10, 4);
test_one<Polygon, MultiPolygon, MultiPolygon>("case_62_multi",
case_62_multi[0], case_62_multi[1],
0, 0, 0, 1, 5, 1);
@@ -74,7 +74,7 @@ void test_areal()
0, 0, 0, 1, 5, 1);
test_one<Polygon, MultiPolygon, MultiPolygon>("case_64_multi",
case_64_multi[0], case_64_multi[1],
- 1, 5, 1, 1, 5, 1);
+ 1, 5, 1, 1, 5, 1, 1, 7, 2);
test_one<Polygon, MultiPolygon, MultiPolygon>("case_65_multi",
case_65_multi[0], case_65_multi[1],
0, 0, 0, 2, 10, 3);
@@ -139,10 +139,13 @@ void test_areal()
2, 12, 7962.66, 1, 18, 2775258.93,
0.001);
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<Polygon, MultiPolygon, MultiPolygon>("ticket_9081",
ticket_9081[0], ticket_9081[1],
2, 28, 0.0907392476356186, 4, 25, 0.126018011439877,
+ 4, 42, 0.0907392476356186 + 0.126018011439877,
0.001);
+#endif
/* TODO: fix
test_one<Polygon, MultiPolygon, MultiPolygon>("case_101_multi",
diff --git a/libs/geometry/test/algorithms/set_operations/difference/multi_difference_spike.cpp b/libs/geometry/test/algorithms/set_operations/difference/difference_multi_spike.cpp
index 56a909262f..7ec3d2ce0a 100644
--- a/libs/geometry/test/algorithms/set_operations/difference/multi_difference_spike.cpp
+++ b/libs/geometry/test/algorithms/set_operations/difference/difference_multi_spike.cpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2013 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2013-2015 Barend Gehrels, 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
@@ -11,7 +11,6 @@
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_geometries.hpp>
#include "test_difference.hpp"
@@ -44,17 +43,23 @@ void test_spikes_in_ticket_8364()
if_typed<ct, int>(2775595.5, 2775256.487954), // SQL Server: 2775256.47588724
3,
-1, // don't check point-count
- if_typed<ct, int>(7907.0, 7810.487954)); // SQL Server: 7810.48711165739
+ if_typed<ct, int>(7893.0, 7810.487954), // SQL Server: 7810.48711165739
+ if_typed<ct, int>(1, 5),
+ -1,
+ if_typed<ct, int>(2783349.5, 2775256.487954 + 7810.487954));
test_one<polygon, multi_polygon, multi_polygon>("ticket_8364_step4",
"MULTIPOLYGON(((2567 2688,2136 2790,2052 2712,1032 2130,1032 1764,1032 1458,1032 1212,2136 2328,3232 2220,3232 1056,1031 1056,1031 2856,3232 2856,3232 2580,2567 2688)))",
"MULTIPOLYGON(((1032 2556,1778 2556,1032 2130,1032 2556)),((3234 2580,3234 2556,1778 2556,2136 2760,3234 2580)))",
1,
if_typed<ct, int>(17, 20),
- if_typed<ct, int>(2616125.0, 2616029.559567), // SQL Server: 2616029.55616044
+ if_typed<ct, int>(2615783.5, 2616029.559567), // SQL Server: 2616029.55616044
1,
if_typed<ct, int>(9, 11),
- if_typed<ct, int>(161211.5, 161054.559567)); // SQL Server: 161054.560110092
+ if_typed<ct, int>(161133.5, 161054.559567), // SQL Server: 161054.560110092
+ if_typed<ct, int>(1, 2),
+ if_typed<ct, int>(25, 31),
+ if_typed<ct, int>(2776875.5, 2616029.559567 + 161054.559567));
}
template <typename P, bool ClockWise, bool Closed>
@@ -70,12 +75,15 @@ void test_spikes_in_ticket_8365()
test_one<polygon, multi_polygon, multi_polygon>("ticket_8365_step2",
"MULTIPOLYGON(((971 2704,971 1402,4640 1402,3912 1722,3180 2376,3912 1884,4643 1402,5395 1402,5395 3353,971 3353,971 2865,1704 3348)))",
"MULTIPOLYGON(((5388 1560,4650 1722,3912 1884,4650 1398)),((2442 3186,1704 3348,966 2700,1704 3024)))",
- if_typed<ct, int>(1, 2),
- if_typed<ct, int>(17, 21),
- if_typed<ct, int>(7974930.5, 7975207.6047877), // SQL Server:
+ if_typed<ct, int>(2, 2),
+ if_typed<ct, int>(21, 21),
+ if_typed<ct, int>(7975092.5, 7975207.6047877), // SQL Server:
2,
-1,
- if_typed<ct, int>(196.5, 197.1047877)); // SQL Server:
+ if_typed<ct, int>(196.5, 197.1047877), // SQL Server:
+ if_typed<ct, int>(3, 4),
+ -1,
+ if_typed<ct, int>(7975092.5 + 196.5, 7975207.6047877 + 197.1047877));
}
diff --git a/libs/geometry/test/algorithms/set_operations/difference/difference_pl_l.cpp b/libs/geometry/test/algorithms/set_operations/difference/difference_pl_l.cpp
new file mode 100644
index 0000000000..9592ec56dd
--- /dev/null
+++ b/libs/geometry/test/algorithms/set_operations/difference/difference_pl_l.cpp
@@ -0,0 +1,674 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 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
+
+#ifndef BOOST_TEST_MODULE
+#define BOOST_TEST_MODULE test_difference_pointlike_linear
+#endif
+
+#include <iostream>
+#include <algorithm>
+
+#include <boost/test/included/unit_test.hpp>
+
+#include "../test_set_ops_pointlike.hpp"
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/linestring.hpp>
+#include <boost/geometry/geometries/segment.hpp>
+#include <boost/geometry/geometries/multi_point.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
+
+typedef bg::model::point<double, 2, bg::cs::cartesian> point_type;
+typedef bg::model::segment<point_type> segment_type;
+typedef bg::model::linestring<point_type> linestring_type;
+typedef bg::model::multi_point<point_type> multi_point_type;
+typedef bg::model::multi_linestring<linestring_type> multi_linestring_type;
+
+
+//===========================================================================
+//===========================================================================
+//===========================================================================
+
+
+BOOST_AUTO_TEST_CASE( test_difference_point_segment )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "size of std::size_t: " << sizeof(std::size_t) << std::endl;
+ std::cout << "size of range_iterator<multipoint>: "
+ << sizeof(boost::range_iterator<multi_point_type>::type)
+ << std::endl;
+ std::cout << "size of range_iterator<multilinestring>: "
+ << sizeof(boost::range_iterator<multi_linestring_type>::type)
+ << std::endl;
+ std::cout << "size of point_iterator<multipoint>: "
+ << sizeof(bg::point_iterator<multi_point_type>) << std::endl;
+ std::cout << "size of point_iterator<linestring>: "
+ << sizeof(bg::point_iterator<linestring_type>) << std::endl;
+ std::cout << "size of point_iterator<multilinestring>: "
+ << sizeof(bg::point_iterator<multi_linestring_type>) << std::endl;
+ std::cout << "size of segment_iterator<linestring>: "
+ << sizeof(bg::segment_iterator<linestring_type>) << std::endl;
+ std::cout << "size of segment_iterator<multilinestring>: "
+ << sizeof(bg::segment_iterator<multi_linestring_type>) << std::endl;
+
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** POINT / SEGMENT DIFFERENCE ***" << std::endl;
+ std::cout << std::endl;
+#endif
+
+ typedef point_type P;
+ typedef segment_type S;
+ typedef multi_point_type MP;
+
+ typedef test_set_op_of_pointlike_geometries
+ <
+ P, S, MP, bg::overlay_difference
+ > tester;
+
+ tester::apply
+ ("psdf01",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<S>("SEGMENT(1 1,2 2)"),
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
+
+ tester::apply
+ ("psdf02",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<S>("SEGMENT(0 0,1 1)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("psdf03",
+ from_wkt<P>("POINT(1 1)"),
+ from_wkt<S>("SEGMENT(0 0,2 2)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("psdf04",
+ from_wkt<P>("POINT(3 3)"),
+ from_wkt<S>("SEGMENT(0 0,2 2)"),
+ from_wkt<MP>("MULTIPOINT(3 3)")
+ );
+}
+
+
+BOOST_AUTO_TEST_CASE( test_difference_point_linestring )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** POINT / LINESTRING DIFFERENCE ***" << std::endl;
+ std::cout << std::endl;
+#endif
+
+ typedef point_type P;
+ typedef linestring_type L;
+ typedef multi_point_type MP;
+
+ typedef test_set_op_of_pointlike_geometries
+ <
+ P, L, MP, bg::overlay_difference
+ > tester;
+
+ tester::apply
+ ("pldf01",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<L>("LINESTRING(1 1,2 2)"),
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
+
+ tester::apply
+ ("pldf02",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<L>("LINESTRING(0 0,1 1)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pldf03",
+ from_wkt<P>("POINT(1 1)"),
+ from_wkt<L>("LINESTRING(0 0,2 2)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pldf04",
+ from_wkt<P>("POINT(3 3)"),
+ from_wkt<L>("LINESTRING(0 0,2 2)"),
+ from_wkt<MP>("MULTIPOINT(3 3)")
+ );
+
+ // linestrings with more than two points
+ tester::apply
+ ("pldf05",
+ from_wkt<P>("POINT(1 1)"),
+ from_wkt<L>("LINESTRING(0 0,1 1,2 2)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pldf06",
+ from_wkt<P>("POINT(2 2)"),
+ from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pldf07",
+ from_wkt<P>("POINT(10 10)"),
+ from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
+ from_wkt<MP>("MULTIPOINT(10 10)")
+ );
+
+ tester::apply
+ ("pldf08",
+ from_wkt<P>("POINT(0 1)"),
+ from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
+ from_wkt<MP>("MULTIPOINT(0 1)")
+ );
+
+ tester::apply
+ ("pldf09",
+ from_wkt<P>("POINT(4 4)"),
+ from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pldf10",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+}
+
+
+BOOST_AUTO_TEST_CASE( test_difference_point_multilinestring )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** POINT / MULTILINESTRING DIFFERENCE ***" << std::endl;
+ std::cout << std::endl;
+#endif
+
+ typedef point_type P;
+ typedef multi_linestring_type ML;
+ typedef multi_point_type MP;
+
+ typedef test_set_op_of_pointlike_geometries
+ <
+ P, ML, MP, bg::overlay_difference
+ > tester;
+
+ tester::apply
+ ("pmldf01",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 1,2 2))"),
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
+
+ tester::apply
+ ("pmldf02",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,1 1))"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pmldf03",
+ from_wkt<P>("POINT(1 1)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,2 2))"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pmldf04",
+ from_wkt<P>("POINT(3 3)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,2 2))"),
+ from_wkt<MP>("MULTIPOINT(3 3)")
+ );
+
+ // linestrings with more than two points
+ tester::apply
+ ("pmldf05",
+ from_wkt<P>("POINT(1 1)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,1 1,2 2))"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pmldf06",
+ from_wkt<P>("POINT(2 2)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pmldf07",
+ from_wkt<P>("POINT(10 10)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT(10 10)")
+ );
+
+ tester::apply
+ ("pmldf08",
+ from_wkt<P>("POINT(0 1)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT(0 1)")
+ );
+
+ tester::apply
+ ("pmldf09",
+ from_wkt<P>("POINT(4 4)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pmldf10",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ // multilinestrings with more than one linestring
+ tester::apply
+ ("pmldf11",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<ML>("MULTILINESTRING((-10,-10),(0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pmldf12",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<ML>("MULTILINESTRING((-10 0,0 0,10 0),(0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pmldf13",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pmldf14",
+ from_wkt<P>("POINT(-20 0)"),
+ from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT(-20 0)")
+ );
+
+ tester::apply
+ ("pmldf15",
+ from_wkt<P>("POINT(0 1)"),
+ from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT(0 1)")
+ );
+}
+
+
+BOOST_AUTO_TEST_CASE( test_difference_multipoint_segment )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** MULTIPOINT / SEGMENT DIFFERENCE ***" << std::endl;
+ std::cout << std::endl;
+#endif
+
+ typedef multi_point_type MP;
+ typedef segment_type S;
+
+ typedef test_set_op_of_pointlike_geometries
+ <
+ MP, S, MP, bg::overlay_difference
+ > tester;
+
+ tester::apply
+ ("mpsdf01",
+ from_wkt<MP>("MULTIPOINT(0 0)"),
+ from_wkt<S>("SEGMENT(1 1,2 2)"),
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
+
+ tester::apply
+ ("mpsdf02",
+ from_wkt<MP>("MULTIPOINT(0 0)"),
+ from_wkt<S>("SEGMENT(0 0,1 1)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpsdf03",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
+ from_wkt<S>("SEGMENT(1 1,2 2)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpsdf04",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
+ from_wkt<S>("SEGMENT(0 0,1 1)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpsdf05",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
+ from_wkt<S>("SEGMENT(1 1,2 2)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)")
+ );
+
+ tester::apply
+ ("mpsf06",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
+ from_wkt<S>("SEGMENT(1 0,2 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpsdf07",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<S>("SEGMENT(0 0,1 0)"),
+ from_wkt<MP>("MULTIPOINT(2 0)")
+ );
+
+ tester::apply
+ ("mpsdf08",
+ from_wkt<MP>("MULTIPOINT()"),
+ from_wkt<S>("SEGMENT(0 0,1 1)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpsdf09",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<S>("SEGMENT(-1 0,1 0)"),
+ from_wkt<MP>("MULTIPOINT(2 0)")
+ );
+
+ tester::apply
+ ("mpsdf10",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<S>("SEGMENT(1 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpsdf11",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<S>("SEGMENT(-1 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpsdf12",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<S>("SEGMENT(3 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)")
+ );
+
+ tester::apply
+ ("mpsdf12a",
+ from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0)"),
+ from_wkt<S>("SEGMENT(3 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)")
+ );
+
+ tester::apply
+ ("mpsdf12b",
+ from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0,2 0)"),
+ from_wkt<S>("SEGMENT(3 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0,2 0)")
+ );
+
+ tester::apply
+ ("mpsdf12c",
+ from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0,2 0,0 0)"),
+ from_wkt<S>("SEGMENT(3 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,0 0,2 0,2 0)")
+ );
+
+ tester::apply
+ ("mpsdf13",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<S>("SEGMENT(2 0,2 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpsdf14",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<S>("SEGMENT(0 0,0 0)"),
+ from_wkt<MP>("MULTIPOINT(2 0)")
+ );
+
+ tester::apply
+ ("mpsdf15",
+ from_wkt<MP>("MULTIPOINT()"),
+ from_wkt<S>("SEGMENT(0 0,1 0)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+}
+
+
+BOOST_AUTO_TEST_CASE( test_difference_multipoint_linestring )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** MULTIPOINT / LINESTRING DIFFERENCE ***" << std::endl;
+ std::cout << std::endl;
+#endif
+
+ typedef multi_point_type MP;
+ typedef linestring_type L;
+
+ typedef test_set_op_of_pointlike_geometries
+ <
+ MP, L, MP, bg::overlay_difference
+ > tester;
+
+ tester::apply
+ ("mpldf01",
+ from_wkt<MP>("MULTIPOINT(0 0)"),
+ from_wkt<L>("LINESTRING(1 1,2 2,3 3,4 4,5 5)"),
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
+
+ tester::apply
+ ("mpldf02",
+ from_wkt<MP>("MULTIPOINT(0 0)"),
+ from_wkt<L>("LINESTRING(0 0,1 1)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpldf03",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
+ from_wkt<L>("LINESTRING(1 1,2 2)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpldf04",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
+ from_wkt<L>("LINESTRING(0 0,1 1)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpldf05",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
+ from_wkt<L>("LINESTRING(1 1,2 2)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)")
+ );
+
+ tester::apply
+ ("mplf06",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
+ from_wkt<L>("LINESTRING(1 0,2 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpldf07",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<L>("LINESTRING(0 0,1 0)"),
+ from_wkt<MP>("MULTIPOINT(2 0)")
+ );
+
+ tester::apply
+ ("mpldf08",
+ from_wkt<MP>("MULTIPOINT()"),
+ from_wkt<L>("LINESTRING(0 0,1 1)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpldf09",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<L>("LINESTRING(-1 0,1 0)"),
+ from_wkt<MP>("MULTIPOINT(2 0)")
+ );
+
+ tester::apply
+ ("mpldf10",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<L>("LINESTRING(1 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpldf11",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<L>("LINESTRING(-1 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpldf12",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<L>("LINESTRING(3 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)")
+ );
+
+ tester::apply
+ ("mpldf13",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<L>("LINESTRING(2 0,2 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpldf14",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<L>("LINESTRING(0 0,0 0)"),
+ from_wkt<MP>("MULTIPOINT(2 0)")
+ );
+
+ tester::apply
+ ("mpldf15",
+ from_wkt<MP>("MULTIPOINT()"),
+ from_wkt<L>("LINESTRING(0 0,1 0,2 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpldf16",
+ from_wkt<MP>("MULTIPOINT()"),
+ from_wkt<L>("LINESTRING()"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+}
+
+
+BOOST_AUTO_TEST_CASE( test_difference_multipoint_multilinestring )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** MULTIPOINT / MULTILINESTRING DIFFERENCE ***" << std::endl;
+ std::cout << std::endl;
+#endif
+
+ typedef multi_point_type MP;
+ typedef multi_linestring_type ML;
+
+ typedef test_set_op_of_pointlike_geometries
+ <
+ MP, ML, MP, bg::overlay_difference
+ > tester;
+
+ tester::apply
+ ("mpmldf01",
+ from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 0,1 1,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT(0 0,2 0)")
+ );
+
+ tester::apply
+ ("mpmldf02",
+ from_wkt<MP>("MULTIPOINT(2 2,3 3,0 0,0 0,2 2,1 1,1 1,1 0,1 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 0,1 1,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpmldf03",
+ from_wkt<MP>("MULTIPOINT(5 5,3 3,0 0,0 0,5 5,1 1,1 1,1 0,1 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 0,1 1,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT(5 5,5 5,0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpmldf04",
+ from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
+ from_wkt<ML>("MULTILINESTRING((1 0,0 0,1 1,0 0))"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpmldf05",
+ from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0,5 0)"),
+ from_wkt<ML>("MULTILINESTRING((0 1,0 0,1 2,1 0),\
+ (0 1,2 0,0 10,2 0,2 10,5 10,5 0,5 10))"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpmldf05a",
+ from_wkt<MP>("MULTIPOINT(0 0,1 0,6 0,7 0,2 0,5 0,7 0,8 0)"),
+ from_wkt<ML>("MULTILINESTRING((0 1,0 0,1 2,1 0),\
+ (0 1,2 0,0 10,2 0,2 10,5 10,5 0,5 10))"),
+ from_wkt<MP>("MULTIPOINT(7 0,7 0,8 0,6 0)")
+ );
+
+ tester::apply
+ ("mpmldf06",
+ from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
+ from_wkt<ML>("MULTILINESTRING(())"),
+ from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)")
+ );
+
+ tester::apply
+ ("mpmldf07",
+ from_wkt<MP>("MULTIPOINT()"),
+ from_wkt<ML>("MULTILINESTRING(())"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpmldf08",
+ from_wkt<MP>("MULTIPOINT()"),
+ from_wkt<ML>("MULTILINESTRING((0 0,1 0),(9 0,10 0))"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+}
diff --git a/libs/geometry/test/algorithms/set_operations/difference/difference_pl_pl.cpp b/libs/geometry/test/algorithms/set_operations/difference/difference_pl_pl.cpp
index 1e33264514..eaf58b2160 100644
--- a/libs/geometry/test/algorithms/set_operations/difference/difference_pl_pl.cpp
+++ b/libs/geometry/test/algorithms/set_operations/difference/difference_pl_pl.cpp
@@ -20,7 +20,7 @@
#include <boost/test/included/unit_test.hpp>
-#include "../test_set_ops_pl_pl.hpp"
+#include "../test_set_ops_pointlike.hpp"
#include <boost/geometry/geometries/multi_point.hpp>
@@ -51,17 +51,19 @@ BOOST_AUTO_TEST_CASE( test_difference_point_point )
> tester;
tester::apply
- (from_wkt<P>("POINT(0 0)"),
+ ("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)"),
- "ppdf01");
+ from_wkt<MP>("MULTIPOINT(1 1)")
+ );
tester::apply
- (from_wkt<P>("POINT(0 0)"),
+ ("ppdf02",
from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT()"),
- "ppdf02");
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
}
@@ -82,58 +84,66 @@ BOOST_AUTO_TEST_CASE( test_difference_multipoint_point )
> tester;
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0)"),
+ ("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)"),
- "mppdf01");
+ from_wkt<MP>("MULTIPOINT(1 1)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0)"),
+ ("mppdf02",
+ from_wkt<MP>("MULTIPOINT(0 0)"),
from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT()"),
- "mppdf02");
+ from_wkt<MP>("MULTIPOINT()")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
+ ("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)"),
- "mppdf03");
+ from_wkt<MP>("MULTIPOINT(1 1)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
+ ("mppdf04",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT()"),
- "mppdf04");
+ from_wkt<MP>("MULTIPOINT()")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
+ ("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)"),
- "mppdf05");
+ from_wkt<MP>("MULTIPOINT(1 1)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
+ ("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()"),
- "mppdf06");
+ from_wkt<MP>("MULTIPOINT()")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
+ ("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()"),
- "mppdf07");
+ from_wkt<MP>("MULTIPOINT()")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT()"),
+ ("mppdf08",
+ from_wkt<MP>("MULTIPOINT()"),
from_wkt<P>("POINT(0 0)"),
from_wkt<MP>("MULTIPOINT()"),
- from_wkt<MP>("MULTIPOINT(0 0)"),
- "mppdf08");
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
}
@@ -154,25 +164,28 @@ BOOST_AUTO_TEST_CASE( test_difference_point_multipoint )
> tester;
tester::apply
- (from_wkt<P>("POINT(0 0)"),
+ ("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)"),
- "pmpdf01");
+ from_wkt<MP>("MULTIPOINT(1 0,1 1,1 1)")
+ );
tester::apply
- (from_wkt<P>("POINT(0 0)"),
+ ("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)"),
- "pmpdf02");
+ from_wkt<MP>("MULTIPOINT(1 0,1 1)")
+ );
tester::apply
- (from_wkt<P>("POINT(0 0)"),
+ ("pmpdf03",
+ from_wkt<P>("POINT(0 0)"),
from_wkt<MP>("MULTIPOINT()"),
from_wkt<MP>("MULTIPOINT(0 0)"),
- from_wkt<MP>("MULTIPOINT()"),
- "pmpdf03");
+ from_wkt<MP>("MULTIPOINT()")
+ );
}
@@ -192,35 +205,40 @@ BOOST_AUTO_TEST_CASE( test_difference_multipoint_multipoint )
> tester;
tester::apply
- (from_wkt<MP>("MULTIPOINT(2 2,3 3,0 0,0 0,2 2,1 1,1 1,1 0,1 0)"),
+ ("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)"),
- "mpmpdf01");
+ from_wkt<MP>("MULTIPOINT(4 4)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
+ ("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()"),
- "mpmpdf02");
+ from_wkt<MP>("MULTIPOINT()")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT()"),
- from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
+ ("mpmpdf03",
from_wkt<MP>("MULTIPOINT()"),
from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
- "mpmpdf03");
+ from_wkt<MP>("MULTIPOINT()"),
+ from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
- from_wkt<MP>("MULTIPOINT()"),
+ ("mpmpdf04",
from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
from_wkt<MP>("MULTIPOINT()"),
- "mpmpdf04");
+ from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT()"),
+ ("mpmpdf05",
from_wkt<MP>("MULTIPOINT()"),
from_wkt<MP>("MULTIPOINT()"),
- "mpmpdf05");
+ from_wkt<MP>("MULTIPOINT()")
+ );
}
diff --git a/libs/geometry/test/algorithms/set_operations/difference/test_difference.hpp b/libs/geometry/test/algorithms/set_operations/difference/test_difference.hpp
index e3cda5d950..72eb218a63 100644
--- a/libs/geometry/test/algorithms/set_operations/difference/test_difference.hpp
+++ b/libs/geometry/test/algorithms/set_operations/difference/test_difference.hpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, 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)
@@ -30,9 +30,9 @@
#include <boost/geometry/geometries/geometries.hpp>
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/geometries/multi_point.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/strategies/strategies.hpp>
@@ -195,11 +195,12 @@ void test_one(std::string const& caseid,
int expected_count1,
int expected_point_count1,
double expected_area1,
-
int expected_count2,
int expected_point_count2,
double expected_area2,
-
+ int expected_count_s,
+ int expected_point_count_s,
+ double expected_area_s,
double percentage = 0.0001)
{
#ifdef BOOST_GEOMETRY_CHECK_WITH_SQLSERVER
@@ -234,10 +235,9 @@ void test_one(std::string const& caseid,
expected_count2, expected_point_count2,
expected_area2, percentage);
test_difference<OutputType>(caseid + "_s", g1, g2,
- expected_count1 + expected_count2,
- expected_point_count1 >= 0 && expected_point_count2 >= 0
- ? (expected_point_count1 + expected_point_count2) : -1,
- expected_area1 + expected_area2,
+ expected_count_s,
+ expected_point_count_s,
+ expected_area_s,
percentage, true);
@@ -276,6 +276,27 @@ void test_one(std::string const& caseid,
}
template <typename OutputType, typename G1, typename G2>
+void test_one(std::string const& caseid,
+ std::string const& wkt1, std::string const& wkt2,
+ int expected_count1,
+ int expected_point_count1,
+ double expected_area1,
+ int expected_count2,
+ int expected_point_count2,
+ double expected_area2,
+ double percentage = 0.0001)
+{
+ test_one<OutputType, G1, G2>(caseid, wkt1, wkt2,
+ expected_count1, expected_point_count1, expected_area1,
+ expected_count2, expected_point_count2, expected_area2,
+ expected_count1 + expected_count2,
+ expected_point_count1 >= 0 && expected_point_count2 >= 0
+ ? (expected_point_count1 + expected_point_count2) : -1,
+ expected_area1 + expected_area2,
+ percentage);
+}
+
+template <typename OutputType, typename G1, typename G2>
void test_one_lp(std::string const& caseid,
std::string const& wkt1, std::string const& wkt2,
std::size_t expected_count,
diff --git a/libs/geometry/test/algorithms/set_operations/difference/test_difference_linear_linear.hpp b/libs/geometry/test/algorithms/set_operations/difference/test_difference_linear_linear.hpp
index cbfd9fa5df..4245f83068 100644
--- a/libs/geometry/test/algorithms/set_operations/difference/test_difference_linear_linear.hpp
+++ b/libs/geometry/test/algorithms/set_operations/difference/test_difference_linear_linear.hpp
@@ -14,6 +14,7 @@
#include <boost/geometry/geometry.hpp>
#include "../test_set_ops_linear_linear.hpp"
+#include "../check_turn_less.hpp"
#include <from_wkt.hpp>
#include <to_svg.hpp>
@@ -104,6 +105,8 @@ private:
std::cout << std::endl;
std::cout << std::endl;
#endif
+
+ check_turn_less::apply(geometry1, geometry2);
}
diff --git a/libs/geometry/test/algorithms/set_operations/intersection/Jamfile.v2 b/libs/geometry/test/algorithms/set_operations/intersection/Jamfile.v2
index b21302819b..8e50c07804 100644
--- a/libs/geometry/test/algorithms/set_operations/intersection/Jamfile.v2
+++ b/libs/geometry/test/algorithms/set_operations/intersection/Jamfile.v2
@@ -1,11 +1,11 @@
# Boost.Geometry (aka GGL, Generic Geometry Library)
#
-# Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
-# Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
-# Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
#
-# This file was modified by Oracle on 2014.
-# Modifications copyright (c) 2014, Oracle and/or its affiliates.
+# This file was modified by Oracle on 2014, 2015.
+# Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
#
# Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -16,8 +16,12 @@
test-suite boost-geometry-algorithms-intersection
:
- [ run intersection.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
- [ run intersection_linear_linear.cpp ]
- [ run intersection_pl_pl.cpp ]
- [ run multi_intersection.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
+ [ run intersection.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
+ : algorithms_intersection ]
+ [ run intersection_areal_areal_linear.cpp : : : : algorithms_intersection_areal_areal_linear ]
+ [ run intersection_linear_linear.cpp : : : : algorithms_intersection_linear_linear ]
+ [ run intersection_multi.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
+ : algorithms_intersection_multi ]
+ [ run intersection_pl_l.cpp : : : : algorithms_intersection_pl_l ]
+ [ run intersection_pl_pl.cpp : : : : algorithms_intersection_pl_pl ]
;
diff --git a/libs/geometry/test/algorithms/set_operations/intersection/intersection.cpp b/libs/geometry/test/algorithms/set_operations/intersection/intersection.cpp
index e15c3ee546..95b0f69733 100644
--- a/libs/geometry/test/algorithms/set_operations/intersection/intersection.cpp
+++ b/libs/geometry/test/algorithms/set_operations/intersection/intersection.cpp
@@ -179,12 +179,19 @@ void test_areal()
geos_1[0], geos_1[1],
1, -1, 3461.0214843, 0.005); // MSVC 14 reports 3461.025390625
+ // Expectations:
+ // In most cases: 0 (no intersection)
+ // In some cases: 1.430511474609375e-05 (clang/gcc on Xubuntu using b2)
+ // In some cases: 5.6022983000000002e-05 (powerpc64le-gcc-6-0)
test_one<Polygon, Polygon, Polygon>("geos_2",
geos_2[0], geos_2[1],
- 0, 0, 0.0);
+ 0, 0, 6.0e-5, -1.0); // -1 denotes: compare with <=
+
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<Polygon, Polygon, Polygon>("geos_3",
geos_3[0], geos_3[1],
- 0, -0, 0.0);
+ 0, 0, 0.0);
+#endif
test_one<Polygon, Polygon, Polygon>("geos_4",
geos_4[0], geos_4[1],
1, -1, 0.08368849);
@@ -203,13 +210,25 @@ void test_areal()
if_typed<ct, float>(1.0, 0.01));
}
+ // SQL Server reports: 0.400390625
+ // PostGIS reports 0.4
+ // BG did report 0.4 but is changed to 0.397
+ // when selecting other IP closer at endpoint or if segment B is smaller than A
test_one<Polygon, Polygon, Polygon>("ggl_list_20110307_javier",
ggl_list_20110307_javier[0], ggl_list_20110307_javier[1],
- 1, 4, 0.4, 0.01);
+ 1, 4,
+ #if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
+ 0.40
+ #else
+ 0.397162651, 0.01
+ #endif
+ );
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<Polygon, Polygon, Polygon>("ggl_list_20110627_phillip",
ggl_list_20110627_phillip[0], ggl_list_20110627_phillip[1],
1, if_typed_tt<ct>(6, 5), 11151.6618);
+#endif
test_one<Polygon, Polygon, Polygon>("ggl_list_20110716_enrico",
ggl_list_20110716_enrico[0], ggl_list_20110716_enrico[1],
@@ -221,7 +240,7 @@ void test_areal()
test_one<Polygon, Polygon, Polygon>("ggl_list_20140223_shalabuda",
ggl_list_20140223_shalabuda[0], ggl_list_20140223_shalabuda[1],
- 1, 4, 3.77106);
+ 1, 4, 3.77106, 0.001);
#if 0
// TODO: fix this testcase, it should give 0 but instead it gives one of the input polygons
@@ -241,7 +260,7 @@ void test_areal()
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<Polygon, Polygon, Polygon>("ticket_8254", ticket_8254[0], ticket_8254[1],
- 1, 4, 3.6334e-08, 0.01);
+ 1, 4, 3.635930e-08, 0.01);
#endif
test_one<Polygon, Polygon, Polygon>("ticket_6958", ticket_6958[0], ticket_6958[1],
@@ -266,9 +285,14 @@ void test_areal()
test_one<Polygon, Polygon, Polygon>("ticket_10108_a",
ticket_10108_a[0], ticket_10108_a[1],
0, 0, 0.0);
+
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
+ // msvc 5.6023011e-5
+ // mingw 5.6022954e-5
test_one<Polygon, Polygon, Polygon>("ticket_10108_b",
ticket_10108_b[0], ticket_10108_b[1],
- 0, 0, 0.0);
+ 0, 0, 5.6022983e-5);
+#endif
test_one<Polygon, Polygon, Polygon>("ticket_10747_a",
ticket_10747_a[0], ticket_10747_a[1],
@@ -358,6 +382,7 @@ void test_boxes(std::string const& wkt1, std::string const& wkt2, double expecte
bg::read_wkt(wkt2, box2);
Box box_out;
+ bg::assign_zero(box_out);
bool detected = bg::intersection(box1, box2, box_out);
typename bg::default_area_result<Box>::type area = bg::area(box_out);
@@ -433,6 +458,38 @@ void test_areal_linear()
}
+
+template <typename Linestring, typename Box>
+void test_linear_box()
+{
+ typedef bg::model::multi_linestring<Linestring> multi_linestring_type;
+
+ test_one_lp<Linestring, Box, Linestring>
+ ("case-l-b-01",
+ "BOX(-10 -10,10 10)",
+ "LINESTRING(-20 -20, 0 0,20 20)",
+ 1, 3, 20 * sqrt(2.0));
+
+ test_one_lp<Linestring, Box, Linestring>
+ ("case-l-b-02",
+ "BOX(-10 -10,10 10)",
+ "LINESTRING(-20 -20, 20 20)",
+ 1, 2, 20.0 * sqrt(2.0));
+
+ test_one_lp<Linestring, Box, Linestring>
+ ("case-l-b-02",
+ "BOX(-10 -10,10 10)",
+ "LINESTRING(-20 -20, 20 20,15 0,0 -15)",
+ 2, 4, 25.0 * sqrt(2.0));
+
+ test_one_lp<Linestring, Box, multi_linestring_type>
+ ("case-ml-b-01",
+ "BOX(-10 -10,10 10)",
+ "MULTILINESTRING((-20 -20, 20 20),(0 -15,15 0))",
+ 2, 4, 25.0 * sqrt(2.0));
+}
+
+
template <typename P>
void test_all()
{
@@ -455,6 +512,8 @@ void test_all()
test_areal_linear<polygon_ccw_open, linestring>();
#endif
+ test_linear_box<linestring, box>();
+
// Test polygons clockwise and counter clockwise
test_areal<polygon>();
@@ -545,7 +604,7 @@ void test_pointer_version()
bg::detail::intersection::intersection_insert<output_type>(box, ln, std::back_inserter(clip));
double length = 0;
- int n = 0;
+ std::size_t n = 0;
for (std::vector<output_type>::const_iterator it = clip.begin();
it != clip.end(); ++it)
{
@@ -554,10 +613,10 @@ void test_pointer_version()
}
BOOST_CHECK_EQUAL(clip.size(), 1u);
- BOOST_CHECK_EQUAL(n, 2);
+ BOOST_CHECK_EQUAL(n, 2u);
BOOST_CHECK_CLOSE(length, sqrt(2.0 * 6.0 * 6.0), 0.001);
- for (unsigned int i = 0; i < ln.size(); i++)
+ for (std::size_t i = 0; i < ln.size(); i++)
{
delete ln[i];
}
diff --git a/libs/geometry/test/algorithms/set_operations/intersection/intersection_areal_areal_linear.cpp b/libs/geometry/test/algorithms/set_operations/intersection/intersection_areal_areal_linear.cpp
new file mode 100644
index 0000000000..c83c794c06
--- /dev/null
+++ b/libs/geometry/test/algorithms/set_operations/intersection/intersection_areal_areal_linear.cpp
@@ -0,0 +1,391 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit test
+
+// Copyright (c) 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
+
+#ifndef BOOST_TEST_MODULE
+#define BOOST_TEST_MODULE test_intersection_linear_linear_areal
+#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 <boost/range.hpp>
+
+#include <boost/geometry/geometries/linestring.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/ring.hpp>
+#include <boost/geometry/geometries/polygon.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
+
+#include "test_intersection_linear_linear.hpp"
+
+typedef bg::model::point<double,2,bg::cs::cartesian> point_type;
+typedef bg::model::multi_linestring
+ <
+ bg::model::linestring<point_type>
+ > multi_linestring_type;
+
+typedef bg::model::ring<point_type, true, false> open_ring_type;
+typedef bg::model::polygon<point_type, true, false> open_polygon_type;
+typedef bg::model::multi_polygon<open_polygon_type> open_multipolygon_type;
+
+typedef bg::model::ring<point_type> closed_ring_type;
+typedef bg::model::polygon<point_type> closed_polygon_type;
+typedef bg::model::multi_polygon<closed_polygon_type> closed_multipolygon_type;
+
+
+template
+<
+ typename OpenAreal1,
+ typename OpenAreal2,
+ typename ClosedAreal1,
+ typename ClosedAreal2,
+ typename MultiLinestring
+>
+struct test_intersection_aal
+{
+ static inline void apply(std::string const& case_id,
+ OpenAreal1 const& open_areal1,
+ OpenAreal2 const& open_areal2,
+ MultiLinestring const& expected1,
+ MultiLinestring const& expected2)
+ {
+ typedef test_intersection_of_geometries
+ <
+ OpenAreal1, OpenAreal2, MultiLinestring
+ > tester;
+
+ tester::apply(open_areal1, open_areal2, expected1, expected2, case_id);
+
+ ClosedAreal1 closed_areal1;
+ ClosedAreal2 closed_areal2;
+ bg::convert(open_areal1, closed_areal1);
+ bg::convert(open_areal2, closed_areal2);
+
+ typedef test_intersection_of_geometries
+ <
+ ClosedAreal1, ClosedAreal2, MultiLinestring
+ > tester_of_closed;
+
+ std::string case_id_closed = case_id + "-closed";
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "testing closed areal geometries..." << std::endl;
+#endif
+ tester_of_closed::apply(closed_areal1, closed_areal2,
+ expected1, expected2, case_id_closed);
+ }
+
+ static inline void apply(std::string const& case_id,
+ OpenAreal1 const& open_areal1,
+ OpenAreal2 const& open_areal2,
+ MultiLinestring const& expected)
+ {
+ apply(case_id, open_areal1, open_areal2, expected, expected);
+ }
+};
+
+
+BOOST_AUTO_TEST_CASE( test_intersection_ring_ring_linestring )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** RING / RING / LINEAR INTERSECTION ***" << std::endl;
+ std::cout << std::endl;
+#endif
+ typedef open_ring_type OG;
+ typedef closed_ring_type CG;
+ typedef multi_linestring_type ML;
+
+ typedef test_intersection_aal<OG, OG, CG, CG, ML> tester;
+
+ tester::apply
+ ("r-r-01",
+ from_wkt<OG>("POLYGON((0 0,0 2,2 2,2 0))"),
+ from_wkt<OG>("POLYGON((2 1,2 4,4 4,4 0,1 0))"),
+ from_wkt<ML>("MULTILINESTRING((2 1,2 2),(2 0,1 0),(2 1,2 1))"),
+ from_wkt<ML>("MULTILINESTRING((2 2,2 1),(2 0,1 0),(2 1,2 1))")
+ );
+
+ tester::apply
+ ("r-r-02",
+ from_wkt<OG>("POLYGON(())"),
+ from_wkt<OG>("POLYGON((2 1,2 4,4 4,4 0,1 0))"),
+ from_wkt<ML>("MULTILINESTRING()")
+ );
+
+ tester::apply
+ ("r-r-03",
+ from_wkt<OG>("POLYGON((2 1,2 4,4 4,4 0,1 0))"),
+ from_wkt<OG>("POLYGON(())"),
+ from_wkt<ML>("MULTILINESTRING()")
+ );
+
+ tester::apply
+ ("r-r-04",
+ from_wkt<OG>("POLYGON(())"),
+ from_wkt<OG>("POLYGON(())"),
+ from_wkt<ML>("MULTILINESTRING()")
+ );
+}
+
+
+BOOST_AUTO_TEST_CASE( test_intersection_ring_polygon_linestring )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** RING / POLYGON / LINEAR INTERSECTION ***" << std::endl;
+ std::cout << std::endl;
+#endif
+ typedef open_ring_type OG1;
+ typedef open_polygon_type OG2;
+ typedef closed_ring_type CG1;
+ typedef closed_polygon_type CG2;
+ typedef multi_linestring_type ML;
+
+ typedef test_intersection_aal<OG1, OG2, CG1, CG2, ML> tester;
+
+ tester::apply
+ ("r-pg-01",
+ from_wkt<OG1>("POLYGON((0 0,0 2,2 2,2 0))"),
+ from_wkt<OG2>("POLYGON((2 1,2 4,4 4,4 0,1 0))"),
+ from_wkt<ML>("MULTILINESTRING((2 1,2 2),(2 0,1 0),(2 1,2 1))"),
+ from_wkt<ML>("MULTILINESTRING((2 2,2 1),(2 0,1 0),(2 1,2 1))")
+ );
+}
+
+
+BOOST_AUTO_TEST_CASE( test_intersection_ring_multipolygon_linestring )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** RING / MULTIPOLYGON / LINEAR INTERSECTION ***"
+ << std::endl;
+ std::cout << std::endl;
+#endif
+ typedef open_ring_type OG1;
+ typedef open_multipolygon_type OG2;
+ typedef closed_ring_type CG1;
+ typedef closed_multipolygon_type CG2;
+ typedef multi_linestring_type ML;
+
+ typedef test_intersection_aal<OG1, OG2, CG1, CG2, ML> tester;
+
+ tester::apply
+ ("r-mpg-01",
+ from_wkt<OG1>("POLYGON((0 0,0 2,2 2,2 0))"),
+ from_wkt<OG2>("MULTIPOLYGON(((2 1,2 4,4 4,4 0,1 0)))"),
+ from_wkt<ML>("MULTILINESTRING((2 1,2 2),(2 0,1 0),(2 1,2 1))"),
+ from_wkt<ML>("MULTILINESTRING((2 2,2 1),(2 0,1 0),(2 1,2 1))")
+ );
+}
+
+
+BOOST_AUTO_TEST_CASE( test_intersection_polygon_polygon_linestring )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** POLYGON / POLYGON / LINEAR INTERSECTION ***" << std::endl;
+ std::cout << std::endl;
+#endif
+ typedef open_polygon_type OG;
+ typedef closed_polygon_type CG;
+ typedef multi_linestring_type ML;
+
+ typedef test_intersection_aal<OG, OG, CG, CG, ML> tester;
+
+ tester::apply
+ ("pg-pg-01",
+ from_wkt<OG>("POLYGON((0 0,0 2,2 2,2 0))"),
+ from_wkt<OG>("POLYGON((2 1,2 4,4 4,4 0,1 0))"),
+ from_wkt<ML>("MULTILINESTRING((2 1,2 2),(2 0,1 0),(2 1,2 1))"),
+ from_wkt<ML>("MULTILINESTRING((2 2,2 1),(2 0,1 0),(2 1,2 1))")
+ );
+
+ tester::apply
+ ("pg-pg-02",
+ from_wkt<OG>("POLYGON((0 0,0 10,10 10,10 0),(2 2,7 2,7 7,2 7))"),
+ from_wkt<OG>("POLYGON((2 2,2 7,7 7,7 2))"),
+ from_wkt<ML>("MULTILINESTRING((2 2,2 2),(2 2,2 7,7 7,7 2,2 2),(2 2,2 2))"),
+ from_wkt<ML>("MULTILINESTRING((2 2,2 2),(2 2,7 2,7 7,2 7,2 2),(2 2,2 2))")
+ );
+
+ tester::apply
+ ("pg-pg-03",
+ from_wkt<OG>("POLYGON((0 0,0 10,10 10,10 0),(2 2,7 2,7 7,2 7))"),
+ from_wkt<OG>("POLYGON((2 3,2 6,6 6,6 3))"),
+ from_wkt<ML>("MULTILINESTRING((2 3,2 6),(2 3,2 3))")
+ );
+
+ tester::apply
+ ("pg-pg-04",
+ from_wkt<OG>("POLYGON((0 0,0 10,10 10,10 0),(2 2,7 2,7 7,2 7))"),
+ from_wkt<OG>("POLYGON((2 3,2 7,6 7,6 3))"),
+ from_wkt<ML>("MULTILINESTRING((2 3,2 7,6 7),(2 3,2 3))")
+ );
+
+ tester::apply
+ ("pg-pg-05",
+ from_wkt<OG>("POLYGON((0 0,0 10,10 10,10 0),(2 2,7 2,7 7,2 7))"),
+ from_wkt<OG>("POLYGON((2 3,2 7,7 7,7 3))"),
+ from_wkt<ML>("MULTILINESTRING((2 3,2 7,7 7,7 3),(2 3,2 3))")
+ );
+
+ tester::apply
+ ("pg-pg-06",
+ from_wkt<OG>("POLYGON((0 0,0 10,10 10,10 0),(2 2,7 2,7 7,2 7))"),
+ from_wkt<OG>("POLYGON((2 3,2 7,7 7,7 3))"),
+ from_wkt<ML>("MULTILINESTRING((2 3,2 7,7 7,7 3),(2 3,2 3))")
+ );
+
+ tester::apply
+ ("pg-pg-07",
+ from_wkt<OG>("POLYGON((0 0,0 10,10 10,10 0),(2 2,7 2,7 7,2 7))"),
+ from_wkt<OG>("POLYGON((2 5,5 7,7 5,5 2))"),
+ from_wkt<ML>("MULTILINESTRING((2 5,2 5),(5 7,5 7),(7 5,7 5),(5 2,5 2))")
+ );
+
+ tester::apply
+ ("pg-pg-08",
+ from_wkt<OG>("POLYGON((0 0,0 10,10 10,10 0),(2 2,7 2,7 7,2 7))"),
+ from_wkt<OG>("POLYGON((2 5,4 7,6 7,7 5,5 2))"),
+ from_wkt<ML>("MULTILINESTRING((2 5,2 5),(4 7,6 7),(7 5,7 5),(5 2,5 2))")
+ );
+
+ tester::apply
+ ("pg-pg-09",
+ from_wkt<OG>("POLYGON(())"),
+ from_wkt<OG>("POLYGON((2 1,2 4,4 4,4 0,1 0))"),
+ from_wkt<ML>("MULTILINESTRING()")
+ );
+
+ tester::apply
+ ("pg-pg-10",
+ from_wkt<OG>("POLYGON((2 1,2 4,4 4,4 0,1 0))"),
+ from_wkt<OG>("POLYGON(())"),
+ from_wkt<ML>("MULTILINESTRING()")
+ );
+
+ tester::apply
+ ("pg-pg-11",
+ from_wkt<OG>("POLYGON(())"),
+ from_wkt<OG>("POLYGON(())"),
+ from_wkt<ML>("MULTILINESTRING()")
+ );
+
+ tester::apply
+ ("pg-pg-12",
+ from_wkt<OG>("POLYGON((),())"),
+ from_wkt<OG>("POLYGON((),(),())"),
+ from_wkt<ML>("MULTILINESTRING()")
+ );
+
+ tester::apply
+ ("pg-pg-13",
+ from_wkt<OG>("POLYGON((2 1,2 4,4 4,4 0,1 0),())"),
+ from_wkt<OG>("POLYGON(())"),
+ from_wkt<ML>("MULTILINESTRING()")
+ );
+}
+
+
+BOOST_AUTO_TEST_CASE( test_intersection_polygon_multipolygon_linestring )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** POLYGON / MULTIPOLYGON / LINEAR INTERSECTION ***"
+ << std::endl;
+ std::cout << std::endl;
+#endif
+ typedef open_polygon_type OG1;
+ typedef open_multipolygon_type OG2;
+ typedef closed_polygon_type CG1;
+ typedef closed_multipolygon_type CG2;
+ typedef multi_linestring_type ML;
+
+ typedef test_intersection_aal<OG1, OG2, CG1, CG2, ML> tester;
+
+ tester::apply
+ ("pg-mpg-01",
+ from_wkt<OG1>("POLYGON((0 0,0 2,2 2,2 0))"),
+ from_wkt<OG2>("MULTIPOLYGON(((2 1,2 4,4 4,4 0,1 0)))"),
+ from_wkt<ML>("MULTILINESTRING((2 1,2 2),(2 0,1 0),(2 1,2 1))"),
+ from_wkt<ML>("MULTILINESTRING((2 2,2 1),(2 0,1 0),(2 1,2 1))")
+ );
+}
+
+
+BOOST_AUTO_TEST_CASE( test_intersection_multipolygon_multipolygon_linestring )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** MULTIPOLYGON / MULTIPOLYGON / LINEAR INTERSECTION ***"
+ << std::endl;
+ std::cout << std::endl;
+#endif
+ typedef open_multipolygon_type OG;
+ typedef closed_multipolygon_type CG;
+ typedef multi_linestring_type ML;
+
+ typedef test_intersection_aal<OG, OG, CG, CG, ML> tester;
+
+ tester::apply
+ ("mpg-mpg-01",
+ from_wkt<OG>("MULTIPOLYGON(((0 0,0 2,2 2,2 0)))"),
+ from_wkt<OG>("MULTIPOLYGON(((2 1,2 4,4 4,4 0,1 0)))"),
+ from_wkt<ML>("MULTILINESTRING((2 1,2 2),(2 0,1 0),(2 1,2 1))"),
+ from_wkt<ML>("MULTILINESTRING((2 2,2 1),(2 0,1 0),(2 1,2 1))")
+ );
+
+ tester::apply
+ ("mpg-mpg-02",
+ from_wkt<OG>("MULTIPOLYGON(((0 0,0 10,10 10,10 0),(2 2,8 2,8 8,2 8)))"),
+ from_wkt<OG>("MULTIPOLYGON(((2 4,2 6,8 6,8 4)))"),
+ from_wkt<ML>("MULTILINESTRING((2 4,2 4),(2 4,2 6),(8 6,8 4))")
+ );
+
+ tester::apply
+ ("mpg-mpg-03",
+ from_wkt<OG>("MULTIPOLYGON()"),
+ from_wkt<OG>("MULTIPOLYGON(((2 1,2 4,4 4,4 0,1 0)))"),
+ from_wkt<ML>("MULTILINESTRING()")
+ );
+
+ tester::apply
+ ("mpg-mpg-04",
+ from_wkt<OG>("MULTIPOLYGON(((2 1,2 4,4 4,4 0,1 0)))"),
+ from_wkt<OG>("MULTIPOLYGON()"),
+ from_wkt<ML>("MULTILINESTRING()")
+ );
+
+ tester::apply
+ ("mpg-mpg-05",
+ from_wkt<OG>("MULTIPOLYGON()"),
+ from_wkt<OG>("MULTIPOLYGON()"),
+ from_wkt<ML>("MULTILINESTRING()")
+ );
+
+ tester::apply
+ ("mpg-mpg-06",
+ from_wkt<OG>("MULTIPOLYGON((()),((),()))"),
+ from_wkt<OG>("MULTIPOLYGON()"),
+ from_wkt<ML>("MULTILINESTRING()")
+ );
+
+ tester::apply
+ ("mpg-mpg-07",
+ from_wkt<OG>("MULTIPOLYGON(((2 1,2 4,4 4,4 0,1 0),(),()))"),
+ from_wkt<OG>("MULTIPOLYGON()"),
+ from_wkt<ML>("MULTILINESTRING()")
+ );
+}
diff --git a/libs/geometry/test/algorithms/set_operations/intersection/intersection_linear_linear.cpp b/libs/geometry/test/algorithms/set_operations/intersection/intersection_linear_linear.cpp
index 0102edc5c3..5224f10f4c 100644
--- a/libs/geometry/test/algorithms/set_operations/intersection/intersection_linear_linear.cpp
+++ b/libs/geometry/test/algorithms/set_operations/intersection/intersection_linear_linear.cpp
@@ -23,7 +23,7 @@
#include "test_intersection_linear_linear.hpp"
#include <boost/geometry/geometries/linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
typedef bg::model::point<double,2,bg::cs::cartesian> point_type;
diff --git a/libs/geometry/test/algorithms/set_operations/intersection/multi_intersection.cpp b/libs/geometry/test/algorithms/set_operations/intersection/intersection_multi.cpp
index 46106022d5..2399935cb3 100644
--- a/libs/geometry/test/algorithms/set_operations/intersection/multi_intersection.cpp
+++ b/libs/geometry/test/algorithms/set_operations/intersection/intersection_multi.cpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2010-2015 Barend Gehrels, 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
@@ -20,16 +20,16 @@
#include <algorithms/test_overlay.hpp>
#include <algorithms/overlay/multi_overlay_cases.hpp>
-#include <boost/geometry/multi/algorithms/correct.hpp>
-#include <boost/geometry/multi/algorithms/intersection.hpp>
-#include <boost/geometry/multi/algorithms/within.hpp> // only for testing #77
+#include <boost/geometry/algorithms/correct.hpp>
+#include <boost/geometry/algorithms/intersection.hpp>
+#include <boost/geometry/algorithms/within.hpp> // only for testing #77
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/geometries/multi_point.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
-#include <boost/geometry/multi/io/wkt/read.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
template <typename Ring, typename Polygon, typename MultiPolygon>
void test_areal()
diff --git a/libs/geometry/test/algorithms/set_operations/intersection/intersection_pl_l.cpp b/libs/geometry/test/algorithms/set_operations/intersection/intersection_pl_l.cpp
new file mode 100644
index 0000000000..fd4575f0b7
--- /dev/null
+++ b/libs/geometry/test/algorithms/set_operations/intersection/intersection_pl_l.cpp
@@ -0,0 +1,702 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 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
+
+#ifndef BOOST_TEST_MODULE
+#define BOOST_TEST_MODULE test_intersection_pointlike_linear
+#endif
+
+#include <iostream>
+#include <algorithm>
+
+#include <boost/test/included/unit_test.hpp>
+
+#include "../test_set_ops_pointlike.hpp"
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/linestring.hpp>
+#include <boost/geometry/geometries/segment.hpp>
+#include <boost/geometry/geometries/multi_point.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
+
+typedef bg::model::point<double, 2, bg::cs::cartesian> point_type;
+typedef bg::model::segment<point_type> segment_type;
+typedef bg::model::linestring<point_type> linestring_type;
+typedef bg::model::multi_point<point_type> multi_point_type;
+typedef bg::model::multi_linestring<linestring_type> multi_linestring_type;
+
+
+//===========================================================================
+//===========================================================================
+//===========================================================================
+
+
+BOOST_AUTO_TEST_CASE( test_intersection_point_segment )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** POINT / SEGMENT INTERSECTION ***" << std::endl;
+ std::cout << std::endl;
+#endif
+
+ typedef point_type P;
+ typedef segment_type S;
+ typedef multi_point_type MP;
+
+ typedef test_set_op_of_pointlike_geometries
+ <
+ P, S, MP, bg::overlay_intersection
+ > tester;
+
+ tester::apply
+ ("psi01",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<S>("SEGMENT(1 1,2 2)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("psi02",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<S>("SEGMENT(0 0,1 1)"),
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
+
+ tester::apply
+ ("psi03",
+ from_wkt<P>("POINT(1 1)"),
+ from_wkt<S>("SEGMENT(0 0,2 2)"),
+ from_wkt<MP>("MULTIPOINT(1 1)")
+ );
+
+ tester::apply
+ ("psi04",
+ from_wkt<P>("POINT(3 3)"),
+ from_wkt<S>("SEGMENT(0 0,2 2)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+}
+
+
+BOOST_AUTO_TEST_CASE( test_intersection_point_linestring )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** POINT / LINESTRING INTERSECTION ***" << std::endl;
+ std::cout << std::endl;
+#endif
+
+ typedef point_type P;
+ typedef linestring_type L;
+ typedef multi_point_type MP;
+
+ typedef test_set_op_of_pointlike_geometries
+ <
+ P, L, MP, bg::overlay_intersection
+ > tester;
+
+ tester::apply
+ ("pli01",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<L>("LINESTRING(1 1,2 2)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pli02",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<L>("LINESTRING(0 0,1 1)"),
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
+
+ tester::apply
+ ("pli03",
+ from_wkt<P>("POINT(1 1)"),
+ from_wkt<L>("LINESTRING(0 0,2 2)"),
+ from_wkt<MP>("MULTIPOINT(1 1)")
+ );
+
+ tester::apply
+ ("pli04",
+ from_wkt<P>("POINT(3 3)"),
+ from_wkt<L>("LINESTRING(0 0,2 2)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ // linestrings with more than two points
+ tester::apply
+ ("pli05",
+ from_wkt<P>("POINT(1 1)"),
+ from_wkt<L>("LINESTRING(0 0,1 1,2 2)"),
+ from_wkt<MP>("MULTIPOINT(1 1)")
+ );
+
+ tester::apply
+ ("pli06",
+ from_wkt<P>("POINT(2 2)"),
+ from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
+ from_wkt<MP>("MULTIPOINT(2 2)")
+ );
+
+ tester::apply
+ ("pli07",
+ from_wkt<P>("POINT(10 10)"),
+ from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pli08",
+ from_wkt<P>("POINT(0 1)"),
+ from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pli09",
+ from_wkt<P>("POINT(4 4)"),
+ from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
+ from_wkt<MP>("MULTIPOINT(4 4)")
+ );
+
+ tester::apply
+ ("pli10",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
+}
+
+
+BOOST_AUTO_TEST_CASE( test_intersection_point_multilinestring )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** POINT / MULTILINESTRING INTERSECTION ***" << std::endl;
+ std::cout << std::endl;
+#endif
+
+ typedef point_type P;
+ typedef multi_linestring_type ML;
+ typedef multi_point_type MP;
+
+ typedef test_set_op_of_pointlike_geometries
+ <
+ P, ML, MP, bg::overlay_intersection
+ > tester;
+
+ tester::apply
+ ("pmli01",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 1,2 2))"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pmli02",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,1 1))"),
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
+
+ tester::apply
+ ("pmli03",
+ from_wkt<P>("POINT(1 1)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,2 2))"),
+ from_wkt<MP>("MULTIPOINT(1 1)")
+ );
+
+ tester::apply
+ ("pmli04",
+ from_wkt<P>("POINT(3 3)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,2 2))"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ // linestrings with more than two points
+ tester::apply
+ ("pmli05",
+ from_wkt<P>("POINT(1 1)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,1 1,2 2))"),
+ from_wkt<MP>("MULTIPOINT(1 1)")
+ );
+
+ tester::apply
+ ("pmli06",
+ from_wkt<P>("POINT(2 2)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT(2 2)")
+ );
+
+ tester::apply
+ ("pmli07",
+ from_wkt<P>("POINT(10 10)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pmli08",
+ from_wkt<P>("POINT(0 1)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pmli09",
+ from_wkt<P>("POINT(4 4)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT(4 4)")
+ );
+
+ tester::apply
+ ("pmli10",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
+
+ // multilinestrings with more than one linestring
+ tester::apply
+ ("pmli11",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<ML>("MULTILINESTRING((-10,-10),(0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
+
+ tester::apply
+ ("pmli12",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<ML>("MULTILINESTRING((-10 0,0 0,10 0),(0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
+
+ tester::apply
+ ("pmli13",
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
+
+ tester::apply
+ ("pmli14",
+ from_wkt<P>("POINT(-20 0)"),
+ from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pmli15",
+ from_wkt<P>("POINT(0 1)"),
+ from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 0,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("pmli16",
+ from_wkt<P>("POINT(1 0)"),
+ from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(-1 0,2 0,20 0))"),
+ from_wkt<MP>("MULTIPOINT(1 0)")
+ );
+
+ tester::apply
+ ("pmli17",
+ from_wkt<P>("POINT(1 0)"),
+ from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 -1,0 2,0 4))"),
+ from_wkt<MP>("MULTIPOINT(1 0)")
+ );
+}
+
+
+BOOST_AUTO_TEST_CASE( test_intersection_multipoint_segment )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** MULTIPOINT / SEGMENT INTERSECTION ***" << std::endl;
+ std::cout << std::endl;
+#endif
+
+ typedef multi_point_type MP;
+ typedef segment_type S;
+
+ typedef test_set_op_of_pointlike_geometries
+ <
+ MP, S, MP, bg::overlay_intersection
+ > tester;
+
+ tester::apply
+ ("mpsi01",
+ from_wkt<MP>("MULTIPOINT(0 0)"),
+ from_wkt<S>("SEGMENT(1 1,2 2)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpsi02",
+ from_wkt<MP>("MULTIPOINT(0 0)"),
+ from_wkt<S>("SEGMENT(0 0,1 1)"),
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
+
+ tester::apply
+ ("mpsi03",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
+ from_wkt<S>("SEGMENT(1 1,2 2)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpsi04",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
+ from_wkt<S>("SEGMENT(0 0,1 1)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpsi05",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
+ from_wkt<S>("SEGMENT(1 1,2 2)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpsf06",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
+ from_wkt<S>("SEGMENT(1 0,2 0)"),
+ from_wkt<MP>("MULTIPOINT(1 0)")
+ );
+
+ tester::apply
+ ("mpsi07",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<S>("SEGMENT(0 0,1 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpsi07a",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<S>("SEGMENT(0 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)")
+ );
+
+ tester::apply
+ ("mpsi08",
+ from_wkt<MP>("MULTIPOINT()"),
+ from_wkt<S>("SEGMENT(0 0,1 1)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpsi09",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<S>("SEGMENT(-1 0,1 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpsi10",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<S>("SEGMENT(1 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT(2 0)")
+ );
+
+ tester::apply
+ ("mpsi11",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<S>("SEGMENT(-1 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)")
+ );
+
+ tester::apply
+ ("mpsi12",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<S>("SEGMENT(3 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpsi12a",
+ from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0)"),
+ from_wkt<S>("SEGMENT(3 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpsi12b",
+ from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0,2 0)"),
+ from_wkt<S>("SEGMENT(3 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpsi12c",
+ from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0,2 0,0 0)"),
+ from_wkt<S>("SEGMENT(3 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpsi13",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<S>("SEGMENT(2 0,2 0)"),
+ from_wkt<MP>("MULTIPOINT(2 0)")
+ );
+
+ tester::apply
+ ("mpsi14",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<S>("SEGMENT(0 0,0 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpsi15",
+ from_wkt<MP>("MULTIPOINT()"),
+ from_wkt<S>("SEGMENT(0 0,1 0)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpsi16",
+ from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0,2 0,0 0)"),
+ from_wkt<S>("SEGMENT(-1 0,10 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,0 0,2 0,2 0)")
+ );
+}
+
+
+BOOST_AUTO_TEST_CASE( test_intersection_multipoint_linestring )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** MULTIPOINT / LINESTRING INTERSECTION ***" << std::endl;
+ std::cout << std::endl;
+#endif
+
+ typedef multi_point_type MP;
+ typedef linestring_type L;
+
+ typedef test_set_op_of_pointlike_geometries
+ <
+ MP, L, MP, bg::overlay_intersection
+ > tester;
+
+ tester::apply
+ ("mpli01",
+ from_wkt<MP>("MULTIPOINT(0 0)"),
+ from_wkt<L>("LINESTRING(1 1,2 2,3 3,4 4,5 5)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpli02",
+ from_wkt<MP>("MULTIPOINT(0 0)"),
+ from_wkt<L>("LINESTRING(0 0,1 1)"),
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
+
+ tester::apply
+ ("mpli03",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
+ from_wkt<L>("LINESTRING(1 1,2 2)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpli04",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
+ from_wkt<L>("LINESTRING(0 0,1 1)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpli05",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
+ from_wkt<L>("LINESTRING(1 1,2 2)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpli06",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
+ from_wkt<L>("LINESTRING(1 0,2 0)"),
+ from_wkt<MP>("MULTIPOINT(1 0)")
+ );
+
+ tester::apply
+ ("mpli07",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<L>("LINESTRING(0 0,1 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpli08",
+ from_wkt<MP>("MULTIPOINT()"),
+ from_wkt<L>("LINESTRING(0 0,1 1)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpli09",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<L>("LINESTRING(-1 0,1 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpli10",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<L>("LINESTRING(1 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT(2 0)")
+ );
+
+ tester::apply
+ ("mpli10a",
+ from_wkt<MP>("MULTIPOINT(2 0,0 0,2 0,0 0,2 0)"),
+ from_wkt<L>("LINESTRING(1 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT(2 0,2 0,2 0)")
+ );
+
+ tester::apply
+ ("mpli11",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<L>("LINESTRING(-1 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT(2 0,0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpli12",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<L>("LINESTRING(3 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpli13",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<L>("LINESTRING(2 0,2 0)"),
+ from_wkt<MP>("MULTIPOINT(2 0)")
+ );
+
+ tester::apply
+ ("mpli14",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
+ from_wkt<L>("LINESTRING(0 0,0 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpli15",
+ from_wkt<MP>("MULTIPOINT()"),
+ from_wkt<L>("LINESTRING(0 0,1 0,2 0,3 0)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpli16",
+ from_wkt<MP>("MULTIPOINT()"),
+ from_wkt<L>("LINESTRING()"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+}
+
+
+BOOST_AUTO_TEST_CASE( test_intersection_multipoint_multilinestring )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** MULTIPOINT / MULTILINESTRING INTERSECTION ***"
+ << std::endl;
+ std::cout << std::endl;
+#endif
+
+ typedef multi_point_type MP;
+ typedef multi_linestring_type ML;
+
+ typedef test_set_op_of_pointlike_geometries
+ <
+ MP, ML, MP, bg::overlay_intersection
+ > tester;
+
+ tester::apply
+ ("mpmli01",
+ from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 0,1 1,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT(1 0)")
+ );
+
+ tester::apply
+ ("mpmli02",
+ from_wkt<MP>("MULTIPOINT(2 2,3 3,0 0,0 0,2 2,1 1,1 1,1 0,1 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 0,1 1,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT(2 2,2 2,3 3,1 1,1 1,1 0,1 0)")
+ );
+
+ tester::apply
+ ("mpmli03",
+ from_wkt<MP>("MULTIPOINT(5 5,3 3,0 0,0 0,5 5,1 1,1 1,1 0,1 0)"),
+ from_wkt<ML>("MULTILINESTRING((1 0,1 1,1 1,4 4))"),
+ from_wkt<MP>("MULTIPOINT(1 0,1 0,3 3,1 1,1 1)")
+ );
+
+ tester::apply
+ ("mpmli04",
+ from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
+ from_wkt<ML>("MULTILINESTRING((1 0,0 0,1 1,0 0))"),
+ from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,1 1)")
+ );
+
+ tester::apply
+ ("mpmli05",
+ from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0,5 0)"),
+ from_wkt<ML>("MULTILINESTRING((0 1,0 0,1 2,1 0),\
+ (0 1,2 0,0 10,2 0,2 10,5 10,5 0,5 10))"),
+ from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0,5 0)")
+ );
+
+ tester::apply
+ ("mpmli06",
+ from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
+ from_wkt<ML>("MULTILINESTRING(())"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpmli07",
+ from_wkt<MP>("MULTIPOINT()"),
+ from_wkt<ML>("MULTILINESTRING(())"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpmli08",
+ from_wkt<MP>("MULTIPOINT()"),
+ from_wkt<ML>("MULTILINESTRING((0 0,1 0),(9 0,10 0))"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
+
+ tester::apply
+ ("mpmli09",
+ from_wkt<MP>("MULTIPOINT(0 0,1 1,0 0,0 0,0 0,0 0,0 0,0 0,\
+ 0 0,0 0,0 0,0 0,0 0)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,0 1),(0 0,2 0),(0 0,0 3),\
+ (0 0,4 0),(0 0,0 5),(0 0,6 0),(0 0,7 0),(0 0,8 0))"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,0 0,0 0,0 0,0 0,0 0,\
+ 0 0,0 0,0 0,0 0,0 0)")
+ );
+
+ tester::apply
+ ("mpmli09a",
+ from_wkt<MP>("MULTIPOINT(0 0,1 1,0 0)"),
+ from_wkt<ML>("MULTILINESTRING((0 0,0 1),(0 0,2 0),(0 0,0 3),\
+ (0 0,4 0),(0 0,0 5),(0 0,6 0),(0 0,7 0),(0 0,8 0))"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)")
+ );
+}
diff --git a/libs/geometry/test/algorithms/set_operations/intersection/intersection_pl_pl.cpp b/libs/geometry/test/algorithms/set_operations/intersection/intersection_pl_pl.cpp
index 212f914afb..e564040e43 100644
--- a/libs/geometry/test/algorithms/set_operations/intersection/intersection_pl_pl.cpp
+++ b/libs/geometry/test/algorithms/set_operations/intersection/intersection_pl_pl.cpp
@@ -20,7 +20,7 @@
#include <boost/test/included/unit_test.hpp>
-#include "../test_set_ops_pl_pl.hpp"
+#include "../test_set_ops_pointlike.hpp"
#include <boost/geometry/geometries/multi_point.hpp>
@@ -51,16 +51,18 @@ BOOST_AUTO_TEST_CASE( test_intersection_point_point )
> tester;
tester::apply
- (from_wkt<P>("POINT(0 0)"),
+ ("ppi01",
+ from_wkt<P>("POINT(0 0)"),
from_wkt<P>("POINT(1 1)"),
- from_wkt<MP>("MULTIPOINT()"),
- "ppi01");
+ from_wkt<MP>("MULTIPOINT()")
+ );
tester::apply
- (from_wkt<P>("POINT(0 0)"),
+ ("ppi02",
from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT(0 0)"),
- "ppi02");
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
}
@@ -81,52 +83,60 @@ BOOST_AUTO_TEST_CASE( test_intersection_multipoint_point )
> tester;
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0)"),
+ ("mppi01",
+ from_wkt<MP>("MULTIPOINT(0 0)"),
from_wkt<P>("POINT(1 1)"),
- from_wkt<MP>("MULTIPOINT()"),
- "mppi01");
+ from_wkt<MP>("MULTIPOINT()")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0)"),
- from_wkt<P>("POINT(0 0)"),
+ ("mppi02",
from_wkt<MP>("MULTIPOINT(0 0)"),
- "mppi02");
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
+ ("mppi03",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
from_wkt<P>("POINT(1 1)"),
- from_wkt<MP>("MULTIPOINT()"),
- "mppi03");
+ from_wkt<MP>("MULTIPOINT()")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
+ ("mppi04",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT(0 0)"),
- "mppi04");
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
+ ("mppi05",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
from_wkt<P>("POINT(1 1)"),
- from_wkt<MP>("MULTIPOINT()"),
- "mppi05");
+ from_wkt<MP>("MULTIPOINT()")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
+ ("mppi06",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
from_wkt<P>("POINT(1 0)"),
- from_wkt<MP>("MULTIPOINT(1 0)"),
- "mppi06");
+ from_wkt<MP>("MULTIPOINT(1 0)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
+ ("mppi07",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT(0 0)"),
- "mppi07");
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT()"),
- from_wkt<P>("POINT(0 0)"),
+ ("mppi08",
from_wkt<MP>("MULTIPOINT()"),
- "mppi08");
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
}
@@ -146,40 +156,46 @@ BOOST_AUTO_TEST_CASE( test_intersection_multipoint_multipoint )
> tester;
tester::apply
- (from_wkt<MP>("MULTIPOINT(2 2,3 3,0 0,0 0,2 2,1 1,1 1,1 0,1 0)"),
+ ("mpmpi01",
+ 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,1 1)"),
- from_wkt<MP>("MULTIPOINT(1 0,1 1,1 1,1 1)"),
- "mpmpi01");
+ from_wkt<MP>("MULTIPOINT(1 0,1 1,1 1,1 1)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
- from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
+ ("mpmp02",
from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
- "mpmpi02");
+ from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
+ from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT()"),
- from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
+ ("mpmpi03",
from_wkt<MP>("MULTIPOINT()"),
- "mpmpi03");
+ from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
+ from_wkt<MP>("MULTIPOINT()")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
- from_wkt<MP>("MULTIPOINT()"),
+ ("mpmpi04",
+ from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
from_wkt<MP>("MULTIPOINT()"),
- "mpmpi04");
+ from_wkt<MP>("MULTIPOINT()")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT()"),
+ ("mpmpi05",
from_wkt<MP>("MULTIPOINT()"),
from_wkt<MP>("MULTIPOINT()"),
- "mpmpi05");
+ from_wkt<MP>("MULTIPOINT()")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0,3 0,0 0,1 0,2 0)"),
+ ("mpmpi06",
+ from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0,3 0,0 0,1 0,2 0)"),
from_wkt<MP>("MULTIPOINT(0 1,0 2,1 0,0 0,2 0)"),
- from_wkt<MP>("MULTIPOINT(1 0,0 0,2 0)"),
- "mpmpi06");
+ from_wkt<MP>("MULTIPOINT(1 0,0 0,2 0)")
+ );
}
diff --git a/libs/geometry/test/algorithms/set_operations/intersection/test_intersection.hpp b/libs/geometry/test/algorithms/set_operations/intersection/test_intersection.hpp
index 4a7cc645c5..1c45032a98 100644
--- a/libs/geometry/test/algorithms/set_operations/intersection/test_intersection.hpp
+++ b/libs/geometry/test/algorithms/set_operations/intersection/test_intersection.hpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, 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)
@@ -54,7 +54,9 @@ check_result(
{
if (expected_point_count > 0)
{
- n += bg::num_points(*it, true);
+ // here n should rather be of type std::size_t, but expected_point_count
+ // is set to -1 in some test cases so type int was left for now
+ n += static_cast<int>(bg::num_points(*it, true));
}
// instead of specialization we check it run-time here
@@ -92,7 +94,16 @@ check_result(
}
double const detected_length_or_area = boost::numeric_cast<double>(length_or_area);
- BOOST_CHECK_CLOSE(detected_length_or_area, expected_length_or_area, percentage);
+ if (percentage > 0.0)
+ {
+ BOOST_CHECK_CLOSE(detected_length_or_area, expected_length_or_area, percentage);
+ }
+ else
+ {
+ // In some cases (geos_2) the intersection is either 0, or a tiny rectangle,
+ // depending on compiler/settings. That cannot be tested by CLOSE
+ BOOST_CHECK_LE(detected_length_or_area, expected_length_or_area);
+ }
#endif
return length_or_area;
diff --git a/libs/geometry/test/algorithms/set_operations/intersection/test_intersection_linear_linear.hpp b/libs/geometry/test/algorithms/set_operations/intersection/test_intersection_linear_linear.hpp
index 8e92540404..b4ade8310b 100644
--- a/libs/geometry/test/algorithms/set_operations/intersection/test_intersection_linear_linear.hpp
+++ b/libs/geometry/test/algorithms/set_operations/intersection/test_intersection_linear_linear.hpp
@@ -12,7 +12,8 @@
#include <limits>
-#include <boost/geometry/multi/geometries/multi_point.hpp>
+#include <boost/type_traits/is_same.hpp>
+
#include <boost/geometry/geometry.hpp>
#include "../test_set_ops_linear_linear.hpp"
#include <from_wkt.hpp>
@@ -70,7 +71,7 @@ private:
std::cout << "Geometry #2: " << bg::wkt(geometry2) << std::endl;
std::cout << "intersection : " << bg::wkt(mls_output) << std::endl;
std::cout << "expected intersection : " << bg::wkt(mls_int1)
- << std::endl;
+ << " or: " << bg::wkt(mls_int2) << std::endl;
std::cout << std::endl;
std::cout << "************************************" << std::endl;
std::cout << std::endl;
@@ -121,8 +122,8 @@ private:
std::cout << "Geometry #1: " << bg::wkt(geometry2) << std::endl;
std::cout << "Geometry #2: " << bg::wkt(geometry1) << std::endl;
std::cout << "intersection : " << bg::wkt(mls_output) << std::endl;
- std::cout << "expected intersection : " << bg::wkt(mls_int2)
- << std::endl;
+ std::cout << "expected intersection : " << bg::wkt(mls_int1)
+ << " or: " << bg::wkt(mls_int2) << std::endl;
std::cout << std::endl;
std::cout << "************************************" << std::endl;
std::cout << std::endl;
@@ -193,14 +194,27 @@ public:
Geometry2 rg2(geometry2);
bg::reverse<Geometry2>(rg2);
- test_get_turns_ll_invariance<>::apply(geometry1, geometry2);
+ typedef typename bg::tag_cast
+ <
+ Geometry1, bg::linear_tag
+ >::type tag1_type;
+
+ typedef typename bg::tag_cast
+ <
+ Geometry2, bg::linear_tag
+ >::type tag2_type;
+
+ bool const are_linear
+ = boost::is_same<tag1_type, bg::linear_tag>::value
+ && boost::is_same<tag2_type, bg::linear_tag>::value;
+
+ test_get_turns_ll_invariance<are_linear>::apply(geometry1, geometry2);
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << std::endl
<< "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
<< std::endl << std::endl;
#endif
- test_get_turns_ll_invariance<>::apply(rg1, geometry2);
-
+ test_get_turns_ll_invariance<are_linear>::apply(rg1, geometry2);
base_test(geometry1, geometry2, mls_int1, mls_int2, case_id, tolerance);
// base_test(rg1, rg2, mls_int1, mls_int2);
diff --git a/libs/geometry/test/algorithms/set_operations/sym_difference/Jamfile.v2 b/libs/geometry/test/algorithms/set_operations/sym_difference/Jamfile.v2
index f64bb92ba1..72bbeeab2b 100644
--- a/libs/geometry/test/algorithms/set_operations/sym_difference/Jamfile.v2
+++ b/libs/geometry/test/algorithms/set_operations/sym_difference/Jamfile.v2
@@ -1,11 +1,11 @@
# Boost.Geometry (aka GGL, Generic Geometry Library)
#
-# Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
-# Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
-# Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
#
-# This file was modified by Oracle on 2014.
-# Modifications copyright (c) 2014, Oracle and/or its affiliates.
+# This file was modified by Oracle on 2014, 2015.
+# Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
#
# Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -16,5 +16,6 @@
test-suite boost-geometry-algorithms-sym_difference
:
- [ run sym_difference_linear_linear.cpp ]
+ [ run sym_difference_areal_areal.cpp : : : : algorithms_sym_difference_areal_areal ]
+ [ run sym_difference_linear_linear.cpp : : : : algorithms_sym_difference_linear_linear ]
;
diff --git a/libs/geometry/test/algorithms/set_operations/sym_difference/sym_difference_areal_areal.cpp b/libs/geometry/test/algorithms/set_operations/sym_difference/sym_difference_areal_areal.cpp
new file mode 100644
index 0000000000..1a163aa22c
--- /dev/null
+++ b/libs/geometry/test/algorithms/set_operations/sym_difference/sym_difference_areal_areal.cpp
@@ -0,0 +1,137 @@
+// 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_sym_difference_areal_areal
+#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 <boost/geometry/geometries/linestring.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
+#include <boost/geometry/algorithms/sym_difference.hpp>
+
+#include "../difference/test_difference.hpp"
+#include <from_wkt.hpp>
+
+typedef bg::model::point<double,2,bg::cs::cartesian> point_type;
+typedef bg::model::ring<point_type> ring_type; // ccw, closed
+typedef bg::model::polygon<point_type> polygon_type; // ccw, closed
+typedef bg::model::multi_polygon<polygon_type> multi_polygon_type;
+
+double const default_tolerance = 0.0001;
+
+template
+<
+ typename Areal1, typename Areal2, typename PolygonOut
+>
+struct test_sym_difference_of_areal_geometries
+{
+ static inline void apply(std::string const& case_id,
+ Areal1 const& areal1,
+ Areal2 const& areal2,
+ int expected_polygon_count,
+ int expected_point_count,
+ double expected_area,
+ double tolerance = default_tolerance)
+ {
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ bg::model::multi_polygon<PolygonOut> sdf;
+
+ bg::sym_difference(areal1, areal2, sdf);
+
+ std::cout << "Case ID: " << case_id << std::endl;
+ std::cout << "Geometry #1: " << bg::wkt(areal1) << std::endl;
+ std::cout << "Geometry #2: " << bg::wkt(areal2) << std::endl;
+ std::cout << "Sym diff: " << bg::wkt(sdf) << std::endl;
+ std::cout << "Polygon count: expected: "
+ << expected_polygon_count
+ << "; detected: " << sdf.size() << std::endl;
+ std::cout << "Point count: expected: "
+ << expected_point_count
+ << "; detected: " << bg::num_points(sdf) << std::endl;
+ std::cout << "Area: expected: "
+ << expected_area
+ << "; detected: " << bg::area(sdf) << std::endl;
+#endif
+ test_difference
+ <
+ PolygonOut
+ >(case_id, areal1, areal2,
+ expected_polygon_count, expected_point_count, expected_area,
+ tolerance, true);
+ }
+};
+
+
+//===========================================================================
+//===========================================================================
+//===========================================================================
+
+
+BOOST_AUTO_TEST_CASE( test_sym_difference_ring_ring )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** RING / RING SYMMETRIC DIFFERENCE ***" << std::endl;
+ std::cout << std::endl;
+#endif
+
+ typedef ring_type R;
+ typedef polygon_type PG;
+
+ typedef test_sym_difference_of_areal_geometries<R, R, PG> tester;
+
+ tester::apply("r-r-sdf00",
+ from_wkt<R>("POLYGON((0 0,0 10,10 10,10 0,0 0))"),
+ from_wkt<R>("POLYGON((10 0,10 20,20 20,20 0,10 0))"),
+ 1,
+ 8,
+ 300);
+
+ tester::apply("r-r-sdf01",
+ from_wkt<R>("POLYGON((0 0,0 10,10 10,10 0,0 0))"),
+ from_wkt<R>("POLYGON((9 0,9 20,20 20,20 0,9 0))"),
+ 2,
+ 12,
+ 300);
+}
+
+
+BOOST_AUTO_TEST_CASE( test_sym_difference_polygon_multipolygon )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << std::endl << std::endl << std::endl;
+ std::cout << "*** POLYGON / MULTIPOLYGON SYMMETRIC DIFFERENCE ***"
+ << std::endl;
+ std::cout << std::endl;
+#endif
+
+ typedef polygon_type PG;
+ typedef multi_polygon_type MPG;
+
+ typedef test_sym_difference_of_areal_geometries<PG, MPG, PG> tester;
+
+ tester::apply
+ ("pg-mpg-sdf00",
+ from_wkt<PG>("POLYGON((10 0,10 10,20 10,20 0,10 0))"),
+ from_wkt<MPG>("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),\
+ ((20 0,20 10,30 10,30 0,20 0)))"),
+ 1,
+ 9,
+ 300);
+}
+
diff --git a/libs/geometry/test/algorithms/set_operations/sym_difference/sym_difference_linear_linear.cpp b/libs/geometry/test/algorithms/set_operations/sym_difference/sym_difference_linear_linear.cpp
index bcd0398ad0..3ae7f840fd 100644
--- a/libs/geometry/test/algorithms/set_operations/sym_difference/sym_difference_linear_linear.cpp
+++ b/libs/geometry/test/algorithms/set_operations/sym_difference/sym_difference_linear_linear.cpp
@@ -23,7 +23,7 @@
#include "test_sym_difference_linear_linear.hpp"
#include <boost/geometry/geometries/linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/algorithms/sym_difference.hpp>
typedef bg::model::point<double,2,bg::cs::cartesian> point_type;
@@ -791,7 +791,8 @@ BOOST_AUTO_TEST_CASE( test_sym_difference_multilinestring_multilinestring )
(10 10,11 10),(12 10,15 10),(20 10,30 20),\
(1 1,2 0),(-1 -1,0 0),(9 0,11 10),(12 10,13 0.3),\
(10 20,15 10),(20 10,25 10,30 15))"),
- "mlmlsdf06"
+ "mlmlsdf06",
+ 4.0 * std::numeric_limits<double>::epsilon()
);
tester::apply
diff --git a/libs/geometry/test/algorithms/set_operations/test_get_turns_ll_invariance.hpp b/libs/geometry/test/algorithms/set_operations/test_get_turns_ll_invariance.hpp
index b2a962ada0..42a3a729dc 100644
--- a/libs/geometry/test/algorithms/set_operations/test_get_turns_ll_invariance.hpp
+++ b/libs/geometry/test/algorithms/set_operations/test_get_turns_ll_invariance.hpp
@@ -14,7 +14,7 @@
#include <boost/geometry/algorithms/reverse.hpp>
-#include <boost/geometry/algorithms/detail/signed_index_type.hpp>
+#include <boost/geometry/algorithms/detail/signed_size_type.hpp>
#include <boost/geometry/algorithms/detail/relate/turns.hpp>
@@ -32,6 +32,7 @@ namespace bg_turns = bg_detail::turns;
template
<
+ bool Enable = true,
bool EnableRemoveDuplicateTurns = true,
bool EnableDegenerateTurns = true
>
@@ -132,10 +133,10 @@ public:
bg_turns::less_seg_fraction_other_op<>());
std::sort(boost::begin(rturns_all), boost::end(rturns_all),
- bg_turns::less_seg_fraction_other_op<std::greater<boost::geometry::signed_index_type> >());
+ bg_turns::less_seg_fraction_other_op<std::greater<boost::geometry::signed_size_type> >());
std::sort(boost::begin(rturns_wo_cont), boost::end(rturns_wo_cont),
- bg_turns::less_seg_fraction_other_op<std::greater<boost::geometry::signed_index_type> >());
+ bg_turns::less_seg_fraction_other_op<std::greater<boost::geometry::signed_size_type> >());
remove_duplicate_turns::apply(turns_all);
remove_duplicate_turns::apply(turns_wo_cont);
@@ -166,6 +167,17 @@ public:
}
};
-
+template <bool EnableRemoveDuplicateTurns, bool EnableDegenerateTurns>
+class test_get_turns_ll_invariance
+<
+ false, EnableRemoveDuplicateTurns, EnableDegenerateTurns
+>
+{
+public:
+ template <typename Linear1, typename Linear2>
+ static inline void apply(Linear1 const&, Linear2 const&)
+ {
+ }
+};
#endif // BOOST_GEOMETRY_TEST_GET_TURNS_LL_INVARIANCE_HPP
diff --git a/libs/geometry/test/algorithms/set_operations/test_set_ops_linear_linear.hpp b/libs/geometry/test/algorithms/set_operations/test_set_ops_linear_linear.hpp
index 884b5028ab..d08c95d506 100644
--- a/libs/geometry/test/algorithms/set_operations/test_set_ops_linear_linear.hpp
+++ b/libs/geometry/test/algorithms/set_operations/test_set_ops_linear_linear.hpp
@@ -21,7 +21,6 @@
#include <boost/geometry/policies/compare.hpp>
#include <boost/geometry/algorithms/equals.hpp>
#include <boost/geometry/algorithms/reverse.hpp>
-#include <boost/geometry/multi/algorithms/reverse.hpp>
#include "test_get_turns_ll_invariance.hpp"
@@ -40,18 +39,24 @@ struct ls_less
bool operator()(Linestring1 const& linestring1,
Linestring2 const& linestring2) const
{
- if ( boost::size(linestring1) != boost::size(linestring2) )
+ if (boost::size(linestring1) != boost::size(linestring2))
+ {
return boost::size(linestring1) < boost::size(linestring2);
+ }
Iterator1 it1 = boost::begin(linestring1);
Iterator2 it2 = boost::begin(linestring2);
point_less less;
for (; it1 != boost::end(linestring1); ++it1, ++it2)
{
- if ( less(*it1, *it2) )
+ if (less(*it1, *it2))
+ {
return true;
- if ( less(*it2, *it1) )
+ }
+ if (less(*it2, *it1))
+ {
return false;
+ }
}
return false;
}
@@ -66,8 +71,8 @@ struct ls_equal
{
ls_less<Linestring1, Linestring2> less;
- return !less(linestring1, linestring2)
- && !less(linestring2, linestring1);
+ return ! less(linestring1, linestring2)
+ && ! less(linestring2, linestring1);
}
};
@@ -195,7 +200,7 @@ struct multilinestring_equals
unique<MultiLinestring1, EnableUnique>()(mls1, tolerance);
unique<MultiLinestring2, EnableUnique>()(mls2, tolerance);
- if ( boost::size(mls1) != boost::size(mls2) )
+ if (boost::size(mls1) != boost::size(mls2))
{
return false;
}
@@ -204,7 +209,7 @@ struct multilinestring_equals
ls2_iterator it2 = boost::begin(mls2);
for (; it1 != boost::end(mls1); ++it1, ++it2)
{
- if ( boost::size(*it1) != boost::size(*it2) )
+ if (boost::size(*it1) != boost::size(*it2))
{
return false;
}
@@ -249,7 +254,7 @@ private:
for (; it != boost::end(multilinestring); ++it)
{
- if ( boost::size(*it) == 1 )
+ if (boost::size(*it) == 1)
{
typename boost::range_value<MultiLinestring>::type linestring;
isolated_point_to_segment(*it, std::back_inserter(linestring));
@@ -271,25 +276,25 @@ private:
{
typedef multilinestring_equals<true> mls_equals;
- if ( mls_equals::apply(multilinestring1, multilinestring2, tolerance) )
+ if (mls_equals::apply(multilinestring1, multilinestring2, tolerance))
{
return true;
}
MultiLinestring1 reverse_multilinestring1 = multilinestring1;
bg::reverse(reverse_multilinestring1);
- if ( mls_equals::apply(reverse_multilinestring1,
- multilinestring2,
- tolerance) )
+ if (mls_equals::apply(reverse_multilinestring1,
+ multilinestring2,
+ tolerance))
{
return true;
}
MultiLinestring2 reverse_multilinestring2 = multilinestring2;
bg::reverse(reverse_multilinestring2);
- if ( mls_equals::apply(multilinestring1,
- reverse_multilinestring2,
- tolerance) )
+ if (mls_equals::apply(multilinestring1,
+ reverse_multilinestring2,
+ tolerance))
{
return true;
}
diff --git a/libs/geometry/test/algorithms/set_operations/test_set_ops_pl_pl.hpp b/libs/geometry/test/algorithms/set_operations/test_set_ops_pointlike.hpp
index fd825d003f..cb14ebe450 100644
--- a/libs/geometry/test/algorithms/set_operations/test_set_ops_pl_pl.hpp
+++ b/libs/geometry/test/algorithms/set_operations/test_set_ops_pointlike.hpp
@@ -1,14 +1,14 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
-// Copyright (c) 2014, Oracle and/or its affiliates.
+// 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
-#ifndef BOOST_GEOMETRY_TEST_SET_OPS_PL_PL_HPP
-#define BOOST_GEOMETRY_TEST_SET_OPS_PL_PL_HPP
+#ifndef BOOST_GEOMETRY_TEST_SET_OPS_POINTLIKE_HPP
+#define BOOST_GEOMETRY_TEST_SET_OPS_POINTLIKE_HPP
#include <boost/geometry/geometry.hpp>
@@ -170,6 +170,54 @@ struct set_op<bg::overlay_intersection>
};
+template
+<
+ typename Geometry,
+ typename Tag = typename bg::tag<Geometry>::type
+> struct geometry_info
+{};
+
+template <typename Point>
+struct geometry_info<Point, bg::point_tag>
+{
+ static std::size_t const topological_dimension = 0;
+
+ static inline char const* name() { return "P"; }
+};
+
+template <typename MultiPoint>
+struct geometry_info<MultiPoint, bg::multi_point_tag>
+{
+ static std::size_t const topological_dimension = 0;
+
+ static inline char const* name() { return "MP"; }
+};
+
+template <typename Linestring>
+struct geometry_info<Linestring, bg::linestring_tag>
+{
+ static std::size_t const topological_dimension = 1;
+
+ static inline char const* name() { return "L"; }
+};
+
+template <typename MultiLinestring>
+struct geometry_info<MultiLinestring, bg::multi_linestring_tag>
+{
+ static std::size_t const topological_dimension = 1;
+
+ static inline char const* name() { return "ML"; }
+};
+
+template <typename Segment>
+struct geometry_info<Segment, bg::segment_tag>
+{
+ static std::size_t const topological_dimension = 1;
+
+ static inline char const* name() { return "S"; }
+};
+
+
//==================================================================
//==================================================================
@@ -188,54 +236,78 @@ template
class test_set_op_of_pointlike_geometries
{
private:
- template <typename G1, typename G2, typename MP>
- static inline void base_test(G1 const& geometry1,
- G2 const& geometry2,
- MP const& mp_expected,
- std::string const& case_id)
+ template <bool Enable, typename Dummy = void>
+ struct base_test
{
- MultiPoint mp_output;
+ template <typename G1, typename G2, typename MP>
+ static inline void apply(std::string const& case_id,
+ G1 const& geometry1,
+ G2 const& geometry2,
+ MP const& mp_expected)
+ {
+ MultiPoint mp_output;
- set_op<OverlayType>::apply(geometry1, geometry2, mp_output);
+ set_op<OverlayType>::apply(geometry1, geometry2, mp_output);
- std::string op_name = set_op<OverlayType>::name();
+ std::string op_name = set_op<OverlayType>::name();
- BOOST_CHECK_MESSAGE( equals::apply(mp_expected, mp_output),
- op_name << " P/P: " << bg::wkt(geometry1)
- << " " << bg::wkt(geometry2)
- << " -> Expected: " << bg::wkt(mp_expected)
- << " computed: " << bg::wkt(mp_output) );
+ BOOST_CHECK_MESSAGE(equals::apply(mp_expected, mp_output),
+ "case ID: " << case_id << ", "
+ << op_name << " "
+ << geometry_info<G1>::name() << "/"
+ << geometry_info<G2>::name() << ": "
+ << bg::wkt(geometry1)
+ << " " << bg::wkt(geometry2)
+ << " -> Expected: " << bg::wkt(mp_expected)
+ << " computed: " << bg::wkt(mp_output) );
- set_operation_output(op_name, case_id,
- geometry1, geometry2, mp_output);
+ set_operation_output(op_name, case_id,
+ geometry1, geometry2, mp_output);
#ifdef BOOST_GEOMETRY_TEST_DEBUG
- std::cout << "Geometry #1: " << bg::wkt(geometry1) << std::endl;
- std::cout << "Geometry #2: " << bg::wkt(geometry2) << std::endl;
- std::cout << "expected " << op_name << " : "
- << bg::wkt(mp_expected) << std::endl;
- std::cout << op_name << " : " << bg::wkt(mp_output) << std::endl;
- std::cout << std::endl;
- std::cout << "************************************" << std::endl;
- std::cout << std::endl;
- std::cout << std::endl;
+ std::cout << "Geometry #1: " << bg::wkt(geometry1) << std::endl;
+ std::cout << "Geometry #2: " << bg::wkt(geometry2) << std::endl;
+ std::cout << "expected " << op_name << " : "
+ << bg::wkt(mp_expected) << std::endl;
+ std::cout << op_name << " : " << bg::wkt(mp_output) << std::endl;
+ std::cout << std::endl;
+ std::cout << "************************************" << std::endl;
+ std::cout << std::endl;
+ std::cout << std::endl;
#endif
- }
+ }
+ };
+ template <typename Dummy>
+ struct base_test<false, Dummy>
+ {
+ template <typename G1, typename G2, typename MP>
+ static inline void apply(std::string const&, G1 const&, G2 const&,
+ MP const&)
+ {
+ }
+ };
public:
- static inline void apply(Geometry1 const& geometry1,
+ static inline void apply(std::string const& case_id,
+ Geometry1 const& geometry1,
Geometry2 const& geometry2,
MultiPoint const& mp_expected12,
- MultiPoint const& mp_expected21,
- std::string const& case_id)
+ MultiPoint const& mp_expected21)
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << "test case: " << case_id << std::endl;
#endif
- base_test(geometry1, geometry2, mp_expected12, case_id);
- base_test(geometry2, geometry1, mp_expected21, case_id);
+ base_test<true>::apply(case_id, geometry1, geometry2, mp_expected12);
+ // try the same set operation with the arguments' order
+ // reversed only if the two geometries are of the same
+ // topological dimension
+ base_test
+ <
+ (geometry_info<Geometry1>::topological_dimension
+ == geometry_info<Geometry2>::topological_dimension)
+ >::apply(case_id, geometry2, geometry1, mp_expected21);
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << std::endl;
@@ -243,15 +315,14 @@ public:
#endif
}
-
- static inline void apply(Geometry1 const& geometry1,
+ static inline void apply(std::string const& case_id,
+ Geometry1 const& geometry1,
Geometry2 const& geometry2,
- MultiPoint const& mp_expected,
- std::string const& case_id)
+ MultiPoint const& mp_expected)
{
- apply(geometry1, geometry2, mp_expected, mp_expected, case_id);
+ apply(case_id, geometry1, geometry2, mp_expected, mp_expected);
}
};
-#endif // BOOST_GEOMETRY_TEST_SET_OPS_PL_PL_HPP
+#endif // BOOST_GEOMETRY_TEST_SET_OPS_POINTLIKE_HPP
diff --git a/libs/geometry/test/algorithms/set_operations/union/Jamfile.v2 b/libs/geometry/test/algorithms/set_operations/union/Jamfile.v2
index 1f6b4f17e6..ea558953c9 100644
--- a/libs/geometry/test/algorithms/set_operations/union/Jamfile.v2
+++ b/libs/geometry/test/algorithms/set_operations/union/Jamfile.v2
@@ -1,11 +1,11 @@
# Boost.Geometry (aka GGL, Generic Geometry Library)
#
-# Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
-# Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
-# Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
#
-# This file was modified by Oracle on 2014.
-# Modifications copyright (c) 2014, Oracle and/or its affiliates.
+# This file was modified by Oracle on 2014, 2015.
+# Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
#
# Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -16,8 +16,10 @@
test-suite boost-geometry-algorithms-union
:
- [ run multi_union.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
- [ run union.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE ]
- [ run union_linear_linear.cpp ]
- [ run union_pl_pl.cpp ]
+ [ run union.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
+ : algorithms_union ]
+ [ run union_linear_linear.cpp : : : : algorithms_union_linear_linear ]
+ [ run union_multi.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
+ : algorithms_union_multi ]
+ [ run union_pl_pl.cpp : : : : algorithms_union_pl_pl ]
;
diff --git a/libs/geometry/test/algorithms/set_operations/union/test_union.hpp b/libs/geometry/test/algorithms/set_operations/union/test_union.hpp
index 2c1868ef2f..6a769827c8 100644
--- a/libs/geometry/test/algorithms/set_operations/union/test_union.hpp
+++ b/libs/geometry/test/algorithms/set_operations/union/test_union.hpp
@@ -1,7 +1,13 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+
+// This file was modified by Oracle on 2015.
+// Modifications copyright (c) 2015 Oracle and/or its affiliates.
+
+// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
+
// 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)
@@ -20,6 +26,7 @@
#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/correct.hpp>
+#include <boost/geometry/algorithms/is_empty.hpp>
#include <boost/geometry/algorithms/length.hpp>
#include <boost/geometry/algorithms/num_points.hpp>
@@ -79,7 +86,7 @@ void test_union(std::string const& caseid, G1 const& g1, G2 const& g2,
++it, ++index)
{
// Skip the empty polygon created above to avoid the empty_input_exception
- if (bg::num_points(*it) > 0)
+ if (! bg::is_empty(*it))
{
area_inserted += bg::area(*it);
}
diff --git a/libs/geometry/test/algorithms/set_operations/union/union.cpp b/libs/geometry/test/algorithms/set_operations/union/union.cpp
index 20820a2d29..a2bfa9b988 100644
--- a/libs/geometry/test/algorithms/set_operations/union/union.cpp
+++ b/libs/geometry/test/algorithms/set_operations/union/union.cpp
@@ -223,20 +223,24 @@ void test_areal()
ggl_list_20110307_javier[0], ggl_list_20110307_javier[1],
1, 1, 13, 20016.4);
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<Polygon, Polygon, Polygon>("ggl_list_20110627_phillip",
ggl_list_20110627_phillip[0], ggl_list_20110627_phillip[1],
1, 0, 8, 14729.07145);
+#endif
test_one<Polygon, Polygon, Polygon>("ggl_list_20110716_enrico",
ggl_list_20110716_enrico[0], ggl_list_20110716_enrico[1],
1, 1, 15, 129904.197692871);
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<Polygon, Polygon, Polygon>("ggl_list_20110820_christophe",
ggl_list_20110820_christophe[0], ggl_list_20110820_christophe[1],
-1, // Either 1 or 2, depending if the intersection/turn point (eps.region) is missed
0,
if_typed_tt<ct>(9, 8),
67.3550722317627);
+#endif
test_one<Polygon, Polygon, Polygon>("isovist",
@@ -272,7 +276,7 @@ void test_areal()
test_one<Polygon, Polygon, Polygon>("ticket_9081_15",
ticket_9081_15[0], ticket_9081_15[1],
- 1, 0, 7, 0.0403425433);
+ 1, 0, 10, 0.0403425433);
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<Polygon, Polygon, Polygon>("ticket_9563", ticket_9563[0], ticket_9563[1],
@@ -282,10 +286,18 @@ void test_areal()
test_one<Polygon, Polygon, Polygon>("ticket_9756", ticket_9756[0], ticket_9756[1],
1, 0, 10, 1289.08374);
+#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
+ // The number of clips is reversed here
test_one<Polygon, Polygon, Polygon>("ticket_10108_a", ticket_10108_a[0], ticket_10108_a[1],
- 2, 0, 8, 0.0435229);
+ 1, 0, 8, 0.0435229);
test_one<Polygon, Polygon, Polygon>("ticket_10108_b", ticket_10108_b[0], ticket_10108_b[1],
2, 0, 10, 2424.3449);
+#else
+ test_one<Polygon, Polygon, Polygon>("ticket_10108_a", ticket_10108_a[0], ticket_10108_a[1],
+ 2, 0, 8, 0.0435229);
+ test_one<Polygon, Polygon, Polygon>("ticket_10108_b", ticket_10108_b[0], ticket_10108_b[1],
+ 1, 0, 10, 2424.3449);
+#endif
test_one<Polygon, Polygon, Polygon>("geos_1", geos_1[0], geos_1[1],
1, 0, -1, 3461.3203125);
@@ -302,18 +314,22 @@ void test_areal()
// Robustness issues, followed out buffer-robustness-tests, test them also reverse
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<Polygon, Polygon, Polygon>("buffer_rt_f", buffer_rt_f[0], buffer_rt_f[1],
- 1, 0, if_typed<ct, double>(21, 23), 4.60853);
+ 1, 0, if_typed<ct, double>(18, 23), 4.60853);
test_one<Polygon, Polygon, Polygon>("buffer_rt_f_rev", buffer_rt_f[1], buffer_rt_f[0],
- 1, 0, if_typed<ct, double>(21, 23), 4.60853);
+ 1, 0, if_typed<ct, double>(18, 23), 4.60853);
#endif
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<Polygon, Polygon, Polygon>("buffer_rt_g", buffer_rt_g[0], buffer_rt_g[1],
1, 0, if_typed<ct, float>(18, 17), 16.571);
+#endif
test_one<Polygon, Polygon, Polygon>("buffer_rt_g_rev", buffer_rt_g[1], buffer_rt_g[0],
1, 0, if_typed<ct, float>(18, 17), 16.571);
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<Polygon, Polygon, Polygon>("buffer_rt_i", buffer_rt_i[0], buffer_rt_i[1],
1, 0, if_typed<ct, float>(14, 13), 13.6569);
+#endif
test_one<Polygon, Polygon, Polygon>("buffer_rt_i_rev", buffer_rt_i[1], buffer_rt_i[0],
1, 0, 13, 13.6569);
@@ -339,8 +355,10 @@ void test_areal()
test_one<Polygon, Polygon, Polygon>("buffer_rt_m2_rev", buffer_rt_m2[1], buffer_rt_m2[0],
1, 0, if_typed_tt<ct>(20, 19), 21.4853);
+#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<Polygon, Polygon, Polygon>("buffer_rt_q", buffer_rt_q[0], buffer_rt_q[1],
1, 0, 18, 18.5710);
+#endif
test_one<Polygon, Polygon, Polygon>("buffer_rt_q_rev", buffer_rt_q[1], buffer_rt_q[0],
1, 0, 18, 18.5710);
@@ -354,9 +372,9 @@ void test_areal()
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<Polygon, Polygon, Polygon>("buffer_rt_t", buffer_rt_t[0], buffer_rt_t[1],
1, 0, if_typed_tt<ct>(16, 14), 15.6569);
-#endif
- test_one<Polygon, Polygon, Polygon>("buffer_rt_t_ref", buffer_rt_t[1], buffer_rt_t[0],
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_t_rev", buffer_rt_t[1], buffer_rt_t[0],
1, 0, if_typed_tt<ct>(16, if_typed<ct, float>(15, 14)), 15.6569);
+#endif
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<Polygon, Polygon, Polygon>("buffer_mp1", buffer_mp1[0], buffer_mp1[1],
diff --git a/libs/geometry/test/algorithms/set_operations/union/union_linear_linear.cpp b/libs/geometry/test/algorithms/set_operations/union/union_linear_linear.cpp
index 925c8363bc..4ef79e6cc4 100644
--- a/libs/geometry/test/algorithms/set_operations/union/union_linear_linear.cpp
+++ b/libs/geometry/test/algorithms/set_operations/union/union_linear_linear.cpp
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
-// Copyright (c) 2014, Oracle and/or its affiliates.
+// 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
@@ -23,7 +23,7 @@
#include "test_union_linear_linear.hpp"
#include <boost/geometry/geometries/linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/algorithms/union.hpp>
typedef bg::model::point<double,2,bg::cs::cartesian> point_type;
diff --git a/libs/geometry/test/algorithms/set_operations/union/multi_union.cpp b/libs/geometry/test/algorithms/set_operations/union/union_multi.cpp
index 74c9d060d7..a80a249cae 100644
--- a/libs/geometry/test/algorithms/set_operations/union/multi_union.cpp
+++ b/libs/geometry/test/algorithms/set_operations/union/union_multi.cpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2010-2015 Barend Gehrels, 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
@@ -18,15 +18,15 @@
#include <algorithms/test_overlay.hpp>
#include <algorithms/overlay/multi_overlay_cases.hpp>
-#include <boost/geometry/multi/algorithms/correct.hpp>
-#include <boost/geometry/multi/algorithms/intersection.hpp>
-#include <boost/geometry/multi/algorithms/within.hpp>
+#include <boost/geometry/algorithms/correct.hpp>
+#include <boost/geometry/algorithms/intersection.hpp>
+#include <boost/geometry/algorithms/within.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
-#include <boost/geometry/multi/io/wkt/read.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
template <typename Ring, typename Polygon, typename MultiPolygon>
@@ -126,7 +126,12 @@ void test_areal()
test_one<Polygon, MultiPolygon, MultiPolygon>("ticket_9081",
ticket_9081[0], ticket_9081[1],
- 3, 0, 31, 0.2187385);
+#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
+ 3,
+#else
+ 4,
+#endif
+ 0, 31, 0.2187385);
}
template <typename P>
diff --git a/libs/geometry/test/algorithms/set_operations/union/union_pl_pl.cpp b/libs/geometry/test/algorithms/set_operations/union/union_pl_pl.cpp
index 59798be23c..030a627843 100644
--- a/libs/geometry/test/algorithms/set_operations/union/union_pl_pl.cpp
+++ b/libs/geometry/test/algorithms/set_operations/union/union_pl_pl.cpp
@@ -20,7 +20,7 @@
#include <boost/test/included/unit_test.hpp>
-#include "../test_set_ops_pl_pl.hpp"
+#include "../test_set_ops_pointlike.hpp"
#include <boost/geometry/geometries/multi_point.hpp>
@@ -51,16 +51,18 @@ BOOST_AUTO_TEST_CASE( test_union_point_point )
> tester;
tester::apply
- (from_wkt<P>("POINT(0 0)"),
+ ("ppu01",
+ from_wkt<P>("POINT(0 0)"),
from_wkt<P>("POINT(1 1)"),
- from_wkt<MP>("MULTIPOINT(0 0,1 1)"),
- "ppu01");
+ from_wkt<MP>("MULTIPOINT(0 0,1 1)")
+ );
tester::apply
- (from_wkt<P>("POINT(0 0)"),
+ ("ppu02",
from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT(0 0)"),
- "ppu02");
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
}
@@ -81,52 +83,60 @@ BOOST_AUTO_TEST_CASE( test_union_multipoint_point )
> tester;
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0)"),
+ ("mppu01",
+ from_wkt<MP>("MULTIPOINT(0 0)"),
from_wkt<P>("POINT(1 1)"),
- from_wkt<MP>("MULTIPOINT(0 0,1 1)"),
- "mppu01");
+ from_wkt<MP>("MULTIPOINT(0 0,1 1)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0)"),
- from_wkt<P>("POINT(0 0)"),
+ ("mppu02",
from_wkt<MP>("MULTIPOINT(0 0)"),
- "mppu02");
+ from_wkt<P>("POINT(0 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
+ ("mppu03",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
from_wkt<P>("POINT(1 1)"),
- from_wkt<MP>("MULTIPOINT(0 0,0 0,1 1)"),
- "mppu03");
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,1 1)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
+ ("mppu04",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT(0 0)"),
- "mppu04");
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
+ ("mppu05",
+ 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,1 1)"),
- "mppu05");
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0,1 1)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
- from_wkt<P>("POINT(1 0)"),
+ ("mppu06",
from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
- "mppu06");
+ from_wkt<P>("POINT(1 0)"),
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
+ ("mppu07",
+ from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT(0 0,1 0)"),
- "mppu07");
+ from_wkt<MP>("MULTIPOINT(0 0,1 0)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT()"),
+ ("mppu08",
+ from_wkt<MP>("MULTIPOINT()"),
from_wkt<P>("POINT(0 0)"),
- from_wkt<MP>("MULTIPOINT(0 0)"),
- "mppu08");
+ from_wkt<MP>("MULTIPOINT(0 0)")
+ );
}
@@ -146,42 +156,47 @@ BOOST_AUTO_TEST_CASE( test_union_multipoint_multipoint )
> tester;
tester::apply
- (from_wkt<MP>("MULTIPOINT(2 2,3 3,0 0,0 0,2 2,1 1,1 1,1 0,1 0)"),
+ ("mpmpu01",
+ 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,1 1)"),
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,1 1,2 2,3 3,0 0,0 0,2 2)"),
- "mpmpu01");
+ from_wkt<MP>("MULTIPOINT(1 0,1 1,1 1,1 1,2 2,3 3,0 0,0 0,2 2)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
- from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
+ ("mpmpu02",
from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
- "mpmpu02");
+ from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
+ from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT()"),
- from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
+ ("mpmpu03",
+ from_wkt<MP>("MULTIPOINT()"),
from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
- "mpmpu03");
+ from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
- from_wkt<MP>("MULTIPOINT()"),
+ ("mpmpu04",
from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
- "mpmpu04");
+ from_wkt<MP>("MULTIPOINT()"),
+ from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT()"),
+ ("mpmpu05",
from_wkt<MP>("MULTIPOINT()"),
from_wkt<MP>("MULTIPOINT()"),
- "mpmpu05");
+ from_wkt<MP>("MULTIPOINT()")
+ );
tester::apply
- (from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0,3 0,0 0,1 0,2 0)"),
+ ("mpmpu06",
+ from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0,3 0,0 0,1 0,2 0)"),
from_wkt<MP>("MULTIPOINT(0 1,0 2,1 0,0 0,2 0)"),
from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0,3 0,0 0,1 0,2 0,0 1,0 2)"),
- from_wkt<MP>("MULTIPOINT(0 1,0 2,1 0,0 0,2 0,3 0)"),
- "mpmpu06");
+ from_wkt<MP>("MULTIPOINT(0 1,0 2,1 0,0 0,2 0,3 0)")
+ );
}
-
diff --git a/libs/geometry/test/algorithms/multi_simplify.cpp b/libs/geometry/test/algorithms/simplify_multi.cpp
index 8b9d922659..f142f91d88 100644
--- a/libs/geometry/test/algorithms/multi_simplify.cpp
+++ b/libs/geometry/test/algorithms/simplify_multi.cpp
@@ -1,17 +1,12 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, 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 <boost/geometry/multi/algorithms/simplify.hpp>
-
-#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
-
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/ring.hpp>
#include <boost/geometry/geometries/linestring.hpp>
@@ -20,9 +15,9 @@
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/geometries/multi_point.hpp>
+#include <boost/geometry/geometries/multi_linestring.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
#include <algorithms/test_simplify.hpp>
diff --git a/libs/geometry/test/algorithms/test_centroid.hpp b/libs/geometry/test/algorithms/test_centroid.hpp
index 14e0ceff18..cfbe017832 100644
--- a/libs/geometry/test/algorithms/test_centroid.hpp
+++ b/libs/geometry/test/algorithms/test_centroid.hpp
@@ -1,7 +1,13 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+
+// This file was modified by Oracle on 2015.
+// Modifications copyright (c) 2015, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
// 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)
@@ -30,6 +36,7 @@ struct check_result
static void apply(Point1 const& actual, Point2 const& expected)
{
check_result<D-1>::apply(actual, expected);
+
BOOST_CHECK_CLOSE(bg::get<D-1>(actual), bg::get<D-1>(expected), 0.001);
}
};
@@ -48,9 +55,9 @@ void test_with_other_calculation_type(Geometry const& geometry, Point& c1)
{
typedef typename bg::point_type<Geometry>::type point_type;
// Calculate it with user defined strategy
- point_type c2;
+ Point c2;
bg::centroid(geometry, c2,
- bg::strategy::centroid::bashein_detmer<point_type, point_type, CalculationType>());
+ bg::strategy::centroid::bashein_detmer<Point, point_type, CalculationType>());
std::cout << typeid(CalculationType).name() << ": " << std::setprecision(20)
<< bg::get<0>(c2) << " " << bg::get<1>(c2)
@@ -58,13 +65,10 @@ void test_with_other_calculation_type(Geometry const& geometry, Point& c1)
<< std::endl;
}
-template <typename Geometry, typename T>
-void test_centroid(std::string const& wkt, T const& d1, T const& d2, T const& d3 = T(), T const& d4 = T(), T const& d5 = T())
+template <typename Geometry, typename Point, typename T>
+void test_centroid(Geometry const& geometry, T const& d1, T const& d2, T const& d3 = T(), T const& d4 = T(), T const& d5 = T())
{
- Geometry geometry;
- bg::read_wkt(wkt, geometry);
- typedef typename bg::point_type<Geometry>::type point_type;
- point_type c1;
+ Point c1;
bg::centroid(geometry, c1);
check_result<bg::dimension<Geometry>::type::value>::apply(c1, boost::make_tuple(d1, d2, d3, d4, d5));
@@ -85,6 +89,27 @@ void test_centroid(std::string const& wkt, T const& d1, T const& d2, T const& d3
#endif
}
+template <typename Geometry, typename Point, typename T>
+void test_centroid(std::string const& wkt, T const& d1, T const& d2, T const& d3 = T(), T const& d4 = T(), T const& d5 = T())
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+
+ test_centroid<Geometry, Point>(geometry, d1, d2, d3, d4, d5);
+}
+
+template <typename Geometry, typename T>
+void test_centroid(Geometry const& geometry, T const& d1, T const& d2, T const& d3 = T(), T const& d4 = T(), T const& d5 = T())
+{
+ test_centroid<Geometry, typename bg::point_type<Geometry>::type>(geometry, d1, d2, d3, d4, d5);
+}
+
+template <typename Geometry, typename T>
+void test_centroid(std::string const& wkt, T const& d1, T const& d2, T const& d3 = T(), T const& d4 = T(), T const& d5 = T())
+{
+ test_centroid<Geometry, typename bg::point_type<Geometry>::type>(wkt, d1, d2, d3, d4, d5);
+}
+
template <typename Geometry>
void test_centroid_exception()
{
diff --git a/libs/geometry/test/algorithms/test_convex_hull.hpp b/libs/geometry/test/algorithms/test_convex_hull.hpp
index 1570dec2ad..a3ab82df40 100644
--- a/libs/geometry/test/algorithms/test_convex_hull.hpp
+++ b/libs/geometry/test/algorithms/test_convex_hull.hpp
@@ -1,12 +1,13 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2014, 2015.
// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -21,13 +22,13 @@
#include <boost/geometry/algorithms/convex_hull.hpp>
#include <boost/geometry/algorithms/area.hpp>
+#include <boost/geometry/algorithms/is_empty.hpp>
#include <boost/geometry/algorithms/num_points.hpp>
#include <boost/geometry/algorithms/perimeter.hpp>
#include <boost/geometry/strategies/strategies.hpp>
-#include <boost/geometry/io/wkt/read.hpp>
-#include <boost/geometry/io/wkt/write.hpp>
+#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/geometries/polygon.hpp>
@@ -182,7 +183,7 @@ void test_empty_input()
> hull;
bg::convex_hull(geometry, hull);
- BOOST_CHECK_MESSAGE(bg::num_points(hull) == 0, "Output convex hull should be empty" );
+ BOOST_CHECK_MESSAGE(bg::is_empty(hull), "Output convex hull should be empty" );
}
diff --git a/libs/geometry/test/algorithms/test_envelope_expand_on_spheroid.hpp b/libs/geometry/test/algorithms/test_envelope_expand_on_spheroid.hpp
new file mode 100644
index 0000000000..316b9cae2c
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_envelope_expand_on_spheroid.hpp
@@ -0,0 +1,192 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2015, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
+
+// Licensed under the Boost Software License version 1.0.
+// http://www.boost.org/users/license.html
+
+#ifndef BOOST_GEOMETRY_TEST_ENVELOPE_EXPAND_ON_SPHEROID_HPP
+#define BOOST_GEOMETRY_TEST_ENVELOPE_EXPAND_ON_SPHEROID_HPP
+
+#include <cmath>
+#include <cstddef>
+#include <algorithm>
+
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/geometry/core/access.hpp>
+#include <boost/geometry/core/coordinate_dimension.hpp>
+#include <boost/geometry/core/cs.hpp>
+
+#include <boost/geometry/util/condition.hpp>
+#include <boost/geometry/util/math.hpp>
+
+#include <boost/geometry/views/detail/indexed_point_view.hpp>
+
+#include <boost/geometry/algorithms/assign.hpp>
+
+
+template <typename Units>
+char const* units2string()
+{
+ if (BOOST_GEOMETRY_CONDITION((boost::is_same<Units, bg::degree>::value)))
+ {
+ return "degrees";
+ }
+ return "radians";
+}
+
+template <typename CoordinateSystem>
+struct other_system_info
+{};
+
+template <>
+struct other_system_info<bg::cs::spherical_equatorial<bg::radian> >
+{
+ typedef bg::degree units;
+ typedef bg::cs::spherical_equatorial<units> type;
+
+ template <typename T>
+ static inline T convert(T const& value)
+ {
+ return value * bg::math::r2d<T>();
+ }
+};
+
+template <>
+struct other_system_info<bg::cs::spherical_equatorial<bg::degree> >
+{
+ typedef bg::radian units;
+ typedef bg::cs::spherical_equatorial<units> type;
+
+ template <typename T>
+ static inline T convert(T const& value)
+ {
+ return value * bg::math::d2r<T>();
+ }
+};
+
+template <>
+struct other_system_info<bg::cs::geographic<bg::radian> >
+{
+ typedef bg::degree units;
+ typedef bg::cs::geographic<units> type;
+
+ template <typename T>
+ static inline T convert(T const& value)
+ {
+ return value * bg::math::r2d<T>();
+ }
+};
+
+template <>
+struct other_system_info<bg::cs::geographic<bg::degree> >
+{
+ typedef bg::radian units;
+ typedef bg::cs::geographic<units> type;
+
+ template <typename T>
+ static inline T convert(T const& value)
+ {
+ return value * bg::math::d2r<T>();
+ }
+};
+
+
+
+class equals_with_tolerance
+{
+private:
+ double m_tolerence;
+
+ template <typename T>
+ static inline T const& get_max(T const& a, T const& b, T const& c)
+ {
+ return (std::max)((std::max)(a, b), c);
+ }
+
+ template <typename T>
+ static inline bool check_close(T const& a, T const& b, double tol)
+ {
+ return (a == b)
+ || (std::abs(a - b) <= tol * get_max(std::abs(a), std::abs(b), 1.0));
+ }
+
+public:
+ equals_with_tolerance(double tolerence) : m_tolerence(tolerence) {}
+
+ template <typename T>
+ inline bool operator()(T const& value1, T const& value2) const
+ {
+ return check_close(value1, value2, m_tolerence);
+ }
+};
+
+
+template
+<
+ typename Box1,
+ typename Box2 = Box1,
+ std::size_t DimensionCount = bg::dimension<Box1>::value
+>
+struct box_equals
+{
+ static inline bool apply(Box1 const& box1, Box2 const& box2, double tol)
+ {
+ equals_with_tolerance equals(tol);
+
+ return equals(bg::get<0, 0>(box1), bg::get<0, 0>(box2))
+ && equals(bg::get<0, 1>(box1), bg::get<0, 1>(box2))
+ && equals(bg::get<1, 0>(box1), bg::get<1, 0>(box2))
+ && equals(bg::get<1, 1>(box1), bg::get<1, 1>(box2));
+ }
+};
+
+template <typename Box1, typename Box2>
+struct box_equals<Box1, Box2, 3>
+{
+ static inline bool apply(Box1 const& box1, Box2 const& box2, double tol)
+ {
+ equals_with_tolerance equals(tol);
+
+ return box_equals<Box1, Box2, 2>::apply(box1, box2, tol)
+ && equals(bg::get<0, 2>(box1), bg::get<0, 2>(box2))
+ && equals(bg::get<1, 2>(box1), bg::get<1, 2>(box2));
+ }
+};
+
+
+template <typename Box, std::size_t Dimension = bg::dimension<Box>::value>
+struct initialize_box
+{
+ static inline void apply(Box& box,
+ double lon_min, double lat_min, double,
+ double lon_max, double lat_max, double)
+ {
+ bg::detail::indexed_point_view<Box, bg::min_corner> p_min(box);
+ bg::detail::indexed_point_view<Box, bg::max_corner> p_max(box);
+
+ bg::assign_values(p_min, lon_min, lat_min);
+ bg::assign_values(p_max, lon_max, lat_max);
+ }
+};
+
+template <typename Box>
+struct initialize_box<Box, 3>
+{
+ static inline void apply(Box& box,
+ double lon_min, double lat_min, double height_min,
+ double lon_max, double lat_max, double height_max)
+ {
+ bg::detail::indexed_point_view<Box, bg::min_corner> p_min(box);
+ bg::detail::indexed_point_view<Box, bg::max_corner> p_max(box);
+
+ bg::assign_values(p_min, lon_min, lat_min, height_min);
+ bg::assign_values(p_max, lon_max, lat_max, height_max);
+ }
+};
+
+#endif // BOOST_GEOMETRY_TEST_ENVELOPE_EXPAND_ON_SPHEROID_HPP
diff --git a/libs/geometry/test/algorithms/test_length.hpp b/libs/geometry/test/algorithms/test_length.hpp
index 9543a30350..107bdae21f 100644
--- a/libs/geometry/test/algorithms/test_length.hpp
+++ b/libs/geometry/test/algorithms/test_length.hpp
@@ -12,7 +12,7 @@
#include <geometry_test_common.hpp>
#include <boost/geometry/algorithms/length.hpp>
-#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include <boost/variant/variant.hpp>
diff --git a/libs/geometry/test/algorithms/transform.cpp b/libs/geometry/test/algorithms/transform.cpp
index 1746c7d236..f0414ff516 100644
--- a/libs/geometry/test/algorithms/transform.cpp
+++ b/libs/geometry/test/algorithms/transform.cpp
@@ -130,24 +130,34 @@ int test_main(int, char* [])
test_all<bg::model::d2::point_xy<int>, bg::model::d2::point_xy<float> >(1.0);
test_all<bg::model::point<double, 2, bg::cs::spherical<bg::degree> >,
- bg::model::point<double, 2, bg::cs::spherical<bg::radian> > >(bg::math::d2r);
+ bg::model::point<double, 2, bg::cs::spherical<bg::radian> > >(bg::math::d2r<double>());
test_all<bg::model::point<double, 2, bg::cs::spherical<bg::radian> >,
- bg::model::point<double, 2, bg::cs::spherical<bg::degree> > >(bg::math::r2d);
+ bg::model::point<double, 2, bg::cs::spherical<bg::degree> > >(bg::math::r2d<double>());
test_all<bg::model::point<int, 2, bg::cs::spherical<bg::degree> >,
- bg::model::point<float, 2, bg::cs::spherical<bg::radian> > >(bg::math::d2r);
+ bg::model::point<float, 2, bg::cs::spherical<bg::radian> > >(bg::math::d2r<float>());
test_transformations<float, bg::degree>(4, 52, 1);
test_transformations<double, bg::degree>(4, 52, 1);
- test_transformations<float, bg::radian>(3 * bg::math::d2r, 51 * bg::math::d2r, 1);
- test_transformations<double, bg::radian>(3 * bg::math::d2r, 51 * bg::math::d2r, 1);
+ test_transformations
+ <
+ float, bg::radian
+ >(3 * bg::math::d2r<float>(), 51 * bg::math::d2r<float>(), 1);
+
+ test_transformations
+ <
+ double, bg::radian
+ >(3 * bg::math::d2r<double>(), 51 * bg::math::d2r<double>(), 1);
#if defined(HAVE_TTMATH)
typedef bg::model::d2::point_xy<ttmath_big > PT;
test_all<PT, PT>();
test_transformations<ttmath_big, bg::degree>(4, 52, 1);
- test_transformations<ttmath_big, bg::radian>(3 * bg::math::d2r, 51 * bg::math::d2r, 1);
+ test_transformations
+ <
+ ttmath_big, bg::radian
+ >(3 * bg::math::d2r<ttmath_big>(), 51 * bg::math::d2r<ttmath_big>(), 1);
#endif
return 0;
diff --git a/libs/geometry/test/algorithms/multi_transform.cpp b/libs/geometry/test/algorithms/transform_multi.cpp
index 9c00025836..66cb8ba6ec 100644
--- a/libs/geometry/test/algorithms/multi_transform.cpp
+++ b/libs/geometry/test/algorithms/transform_multi.cpp
@@ -1,9 +1,9 @@
// 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.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@@ -22,14 +22,7 @@
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/algorithms/transform.hpp>
-
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
-
#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
// This test is a little different from transform.cpp test.
diff --git a/libs/geometry/test/algorithms/multi_unique.cpp b/libs/geometry/test/algorithms/unique_multi.cpp
index 397e462655..9061d7ef33 100644
--- a/libs/geometry/test/algorithms/multi_unique.cpp
+++ b/libs/geometry/test/algorithms/unique_multi.cpp
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, 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)
@@ -8,18 +8,10 @@
#include <geometry_test_common.hpp>
#include <boost/geometry/algorithms/unique.hpp>
-#include <boost/geometry/multi/algorithms/unique.hpp>
-
-#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
-
#include <algorithms/test_unique.hpp>
diff --git a/libs/geometry/test/arithmetic/Jamfile.v2 b/libs/geometry/test/arithmetic/Jamfile.v2
index a1a9db0f35..ac1ad55b5c 100644
--- a/libs/geometry/test/arithmetic/Jamfile.v2
+++ b/libs/geometry/test/arithmetic/Jamfile.v2
@@ -1,8 +1,9 @@
# 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.
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
+# Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
#
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -10,6 +11,6 @@
test-suite boost-geometry-arithmetic
:
- [ run arithmetic.cpp ]
- [ run dot_product.cpp ]
+ [ run arithmetic.cpp : : : : arithmetic ]
+ [ run dot_product.cpp : : : : arithmetic_dot_product ]
;
diff --git a/libs/geometry/test/concepts/Jamfile.v2 b/libs/geometry/test/concepts/Jamfile.v2
index 476e0be116..dd1ad4eb7a 100644
--- a/libs/geometry/test/concepts/Jamfile.v2
+++ b/libs/geometry/test/concepts/Jamfile.v2
@@ -1,8 +1,9 @@
# 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.
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
+# Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
#
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -10,6 +11,20 @@
test-suite boost-geometry-concepts
:
- [ run linestring_concept.cpp ]
- [ run polygon_concept.cpp ]
+ [ run linestring_concept.cpp : : : : concepts_linestring_concept ]
+ [ compile point_array.cpp : : concepts_point_array ]
+ [ compile point_concept_checker.cpp : : concepts_point_concept_checker ]
+ [ compile point_well_formed.cpp : : concepts_point_well_formed ]
+ [ compile point_well_formed_non_cartesian.cpp : : concepts_point_well_formed_non_cartesian ]
+ [ compile point_well_formed_traits.cpp : : concepts_point_well_formed_traits ]
+ [ compile-fail point_geographic_custom_with_wrong_units.cpp : : concepts_point_geographic_custom_with_wrong_units ]
+ [ compile-fail point_geographic_with_wrong_units.cpp : : concepts_point_geographic_with_wrong_units ]
+ [ compile-fail point_spherical_custom_with_wrong_units.cpp : : concepts_point_spherical_custom_with_wrong_units ]
+ [ compile-fail point_spherical_with_wrong_units.cpp : : concepts_point_spherical_with_wrong_units ]
+ [ compile-fail point_with_incorrect_dimension.cpp : : concepts_point_with_incorrect_dimension ]
+ [ compile-fail point_without_coordinate_type.cpp : : concepts_point_without_coordinate_type ]
+ [ compile-fail point_without_dimension.cpp : : concepts_point_without_dimension ]
+ [ compile-fail point_without_getter.cpp : : concepts_point_without_getter ]
+ [ compile-fail point_without_setter.cpp : : concepts_point_without_setter ]
+# [ run polygon_concept.cpp : : : : concepts_polygon_concept ]
;
diff --git a/libs/geometry/test/point_concept/function_asserting_a_point.hpp b/libs/geometry/test/concepts/function_asserting_a_point.hpp
index 8ff84d4498..8ff84d4498 100644
--- a/libs/geometry/test/point_concept/function_asserting_a_point.hpp
+++ b/libs/geometry/test/concepts/function_asserting_a_point.hpp
diff --git a/libs/geometry/test/point_concept/function_requiring_a_point.hpp b/libs/geometry/test/concepts/function_requiring_a_point.hpp
index 39dc382944..39dc382944 100644
--- a/libs/geometry/test/point_concept/function_requiring_a_point.hpp
+++ b/libs/geometry/test/concepts/function_requiring_a_point.hpp
diff --git a/libs/geometry/test/concepts/linestring_concept.cpp b/libs/geometry/test/concepts/linestring_concept.cpp
index befce07bbb..9b202f1e2e 100644
--- a/libs/geometry/test/concepts/linestring_concept.cpp
+++ b/libs/geometry/test/concepts/linestring_concept.cpp
@@ -38,16 +38,16 @@ void test_linestring()
typedef typename bg::point_type<Geometry>::type P;
bg::clear(geometry);
- BOOST_CHECK_EQUAL(boost::size(geometry), 0);
+ BOOST_CHECK_EQUAL(boost::size(geometry), 0u);
bg::append(geometry, bg::make<P>(1, 2));
- BOOST_CHECK_EQUAL(boost::size(geometry), 1);
+ BOOST_CHECK_EQUAL(boost::size(geometry), 1u);
bg::append(geometry, bg::make<P>(3, 4));
- BOOST_CHECK_EQUAL(boost::size(geometry), 2);
+ BOOST_CHECK_EQUAL(boost::size(geometry), 2u);
bg::traits::resize<Geometry>::apply(geometry, 1);
- BOOST_CHECK_EQUAL(boost::size(geometry), 1);
+ BOOST_CHECK_EQUAL(boost::size(geometry), 1u);
//std::cout << bg::dsv(geometry) << std::endl;
P p = *boost::begin(geometry);
@@ -56,7 +56,7 @@ void test_linestring()
BOOST_CHECK_EQUAL(bg::get<1>(p), 2);
bg::clear(geometry);
- BOOST_CHECK_EQUAL(boost::size(geometry), 0);
+ BOOST_CHECK_EQUAL(boost::size(geometry), 0u);
}
template <typename Point>
diff --git a/libs/geometry/test/point_concept/array_point.cpp b/libs/geometry/test/concepts/point_array.cpp
index 000deadc03..000deadc03 100644
--- a/libs/geometry/test/point_concept/array_point.cpp
+++ b/libs/geometry/test/concepts/point_array.cpp
diff --git a/libs/geometry/test/point_concept/concept_checker.cpp b/libs/geometry/test/concepts/point_concept_checker.cpp
index 0750972f47..0750972f47 100644
--- a/libs/geometry/test/point_concept/concept_checker.cpp
+++ b/libs/geometry/test/concepts/point_concept_checker.cpp
diff --git a/libs/geometry/test/point_concept/geographic_custom_point_with_wrong_units.cpp b/libs/geometry/test/concepts/point_geographic_custom_with_wrong_units.cpp
index f2985b841f..f2985b841f 100644
--- a/libs/geometry/test/point_concept/geographic_custom_point_with_wrong_units.cpp
+++ b/libs/geometry/test/concepts/point_geographic_custom_with_wrong_units.cpp
diff --git a/libs/geometry/test/point_concept/geographic_point_with_wrong_units.cpp b/libs/geometry/test/concepts/point_geographic_with_wrong_units.cpp
index ab5fdc7043..ab5fdc7043 100644
--- a/libs/geometry/test/point_concept/geographic_point_with_wrong_units.cpp
+++ b/libs/geometry/test/concepts/point_geographic_with_wrong_units.cpp
diff --git a/libs/geometry/test/point_concept/spherical_equatorial_custom_point_with_wrong_units.cpp b/libs/geometry/test/concepts/point_spherical_custom_with_wrong_units.cpp
index f5c5bb573f..f5c5bb573f 100644
--- a/libs/geometry/test/point_concept/spherical_equatorial_custom_point_with_wrong_units.cpp
+++ b/libs/geometry/test/concepts/point_spherical_custom_with_wrong_units.cpp
diff --git a/libs/geometry/test/point_concept/spherical_equatorial_point_with_wrong_units.cpp b/libs/geometry/test/concepts/point_spherical_with_wrong_units.cpp
index 960db4a4d2..960db4a4d2 100644
--- a/libs/geometry/test/point_concept/spherical_equatorial_point_with_wrong_units.cpp
+++ b/libs/geometry/test/concepts/point_spherical_with_wrong_units.cpp
diff --git a/libs/geometry/test/point_concept/well_formed_point.cpp b/libs/geometry/test/concepts/point_well_formed.cpp
index 20ae39c622..20ae39c622 100644
--- a/libs/geometry/test/point_concept/well_formed_point.cpp
+++ b/libs/geometry/test/concepts/point_well_formed.cpp
diff --git a/libs/geometry/test/point_concept/well_formed_non_cartesian_point.cpp b/libs/geometry/test/concepts/point_well_formed_non_cartesian.cpp
index e6817adb30..e6817adb30 100644
--- a/libs/geometry/test/point_concept/well_formed_non_cartesian_point.cpp
+++ b/libs/geometry/test/concepts/point_well_formed_non_cartesian.cpp
diff --git a/libs/geometry/test/point_concept/well_formed_point_traits.cpp b/libs/geometry/test/concepts/point_well_formed_traits.cpp
index fc4ab82f2d..fc4ab82f2d 100644
--- a/libs/geometry/test/point_concept/well_formed_point_traits.cpp
+++ b/libs/geometry/test/concepts/point_well_formed_traits.cpp
diff --git a/libs/geometry/test/point_concept/point_with_incorrect_dimension.cpp b/libs/geometry/test/concepts/point_with_incorrect_dimension.cpp
index baf653a0f0..79ffc8bee4 100644
--- a/libs/geometry/test/point_concept/point_with_incorrect_dimension.cpp
+++ b/libs/geometry/test/concepts/point_with_incorrect_dimension.cpp
@@ -22,6 +22,7 @@
struct point
{
+ point() : x(0), y(0) {} // initialize to suppress warnings
float x, y;
};
diff --git a/libs/geometry/test/point_concept/point_without_coordinate_type.cpp b/libs/geometry/test/concepts/point_without_coordinate_type.cpp
index a9cb2b9b1f..3896e46903 100644
--- a/libs/geometry/test/point_concept/point_without_coordinate_type.cpp
+++ b/libs/geometry/test/concepts/point_without_coordinate_type.cpp
@@ -19,6 +19,7 @@
struct point
{
+ point() : x(0), y(0) {} // initialize to suppress warnings
float x, y;
};
diff --git a/libs/geometry/test/point_concept/point_without_dimension.cpp b/libs/geometry/test/concepts/point_without_dimension.cpp
index 61b7769cfa..11182ed2b8 100644
--- a/libs/geometry/test/point_concept/point_without_dimension.cpp
+++ b/libs/geometry/test/concepts/point_without_dimension.cpp
@@ -19,6 +19,7 @@
struct point
{
+ point() : x(0), y(0) {} // initialize to suppress warnings
float x, y;
};
diff --git a/libs/geometry/test/point_concept/point_without_getter.cpp b/libs/geometry/test/concepts/point_without_getter.cpp
index c7650dd395..5d19924e2a 100644
--- a/libs/geometry/test/point_concept/point_without_getter.cpp
+++ b/libs/geometry/test/concepts/point_without_getter.cpp
@@ -19,6 +19,7 @@
struct point
{
+ point() : x(0), y(0) {} // initialize to suppress warnings
float x, y;
};
diff --git a/libs/geometry/test/point_concept/point_without_setter.cpp b/libs/geometry/test/concepts/point_without_setter.cpp
index 882111889a..78be839945 100644
--- a/libs/geometry/test/point_concept/point_without_setter.cpp
+++ b/libs/geometry/test/concepts/point_without_setter.cpp
@@ -19,6 +19,7 @@
struct point
{
+ point() : x(0), y(0) {} // initialize to suppress warnings
float x, y;
};
diff --git a/libs/geometry/test/core/Jamfile.v2 b/libs/geometry/test/core/Jamfile.v2
index 613174f158..1564d034f0 100644
--- a/libs/geometry/test/core/Jamfile.v2
+++ b/libs/geometry/test/core/Jamfile.v2
@@ -1,8 +1,9 @@
# 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.
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
+# Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
#
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -10,18 +11,19 @@
test-suite boost-geometry-core
:
- [ run access.cpp ]
- [ run coordinate_dimension.cpp ]
- [ run coordinate_system.cpp ]
- [ run coordinate_type.cpp ]
- [ run geometry_id.cpp ]
- [ run point_type.cpp ]
- [ run radian_access.cpp ]
- [ run radius.cpp ]
-# [ run reverse_dispatch.cpp ]
- [ run ring.cpp ]
- [ run tag.cpp ]
- [ run topological_dimension.cpp ]
+ [ run access.cpp : : : : core_access ]
+ [ run assert.cpp : : : : core_assert ]
+ [ run coordinate_dimension.cpp : : : : core_coordinate_dimension ]
+ [ run coordinate_system.cpp : : : : core_coordinate_system ]
+ [ run coordinate_type.cpp : : : : core_coordinate_type ]
+ [ run geometry_id.cpp : : : : core_geometry_id ]
+ [ run point_type.cpp : : : : core_point_type ]
+ [ run radian_access.cpp : : : : core_radian_access ]
+ [ run radius.cpp : : : : core_radius ]
+# [ run reverse_dispatch.cpp : : : : core_reverse_dispatch ]
+ [ run ring.cpp : : : : core_ring ]
+ [ run tag.cpp : : : : core_tag ]
+ [ run topological_dimension.cpp : : : : core_topological_dimension ]
;
# The reverse_dispatch somehow asks for UAC-control on MinGW...
diff --git a/libs/geometry/test/core/assert.cpp b/libs/geometry/test/core/assert.cpp
new file mode 100644
index 0000000000..3a36efd302
--- /dev/null
+++ b/libs/geometry/test/core/assert.cpp
@@ -0,0 +1,63 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2015 Oracle and/or its affiliates.
+
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
+// 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>
+
+#define BOOST_GEOMETRY_ENABLE_ASSERT_HANDLER
+#include <boost/geometry/core/assert.hpp>
+
+struct assert_failure_exception
+ : std::exception
+{
+ const char * what() const throw()
+ {
+ return "assertion failure";
+ }
+};
+
+namespace boost { namespace geometry {
+
+inline void assertion_failed(char const * expr, char const * function, char const * file, long line)
+{
+ throw assert_failure_exception();
+}
+
+inline void assertion_failed_msg(char const * expr, char const * msg, char const * function, char const * file, long line)
+{
+ throw assert_failure_exception();
+}
+
+}}
+
+void fun1(bool condition)
+{
+ BOOST_GEOMETRY_ASSERT(condition);
+}
+
+void fun2(bool condition, const char* msg = "")
+{
+ BOOST_GEOMETRY_ASSERT_MSG(condition, msg);
+}
+
+bool is_ok(assert_failure_exception const& ) { return true; }
+
+int test_main(int, char* [])
+{
+ int a = 1;
+
+ fun1(a == 1);
+ BOOST_CHECK_EXCEPTION(fun1(a == 2), assert_failure_exception, is_ok);
+ fun2(a == 1);
+ BOOST_CHECK_EXCEPTION(fun2(a == 2), assert_failure_exception, is_ok);
+
+ return 0;
+}
diff --git a/libs/geometry/test/from_wkt.hpp b/libs/geometry/test/from_wkt.hpp
index a12dc051d9..2d5f7bac6d 100644
--- a/libs/geometry/test/from_wkt.hpp
+++ b/libs/geometry/test/from_wkt.hpp
@@ -1,10 +1,10 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Tests
-// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
-// Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
-// Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
-// Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
+// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -16,7 +16,6 @@
#include <string>
#include <boost/geometry/io/wkt/read.hpp>
-#include <boost/geometry/multi/io/wkt/read.hpp>
template <typename Geometry>
inline Geometry from_wkt(std::string const& wkt)
diff --git a/libs/geometry/test/geometries/Jamfile.v2 b/libs/geometry/test/geometries/Jamfile.v2
index c09ff95ad2..cde618d06e 100644
--- a/libs/geometry/test/geometries/Jamfile.v2
+++ b/libs/geometry/test/geometries/Jamfile.v2
@@ -1,9 +1,9 @@
# 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.
-# Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
+# Copyright (c) 2014-2015 Adam Wulkiewicz, Lodz, Poland.
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -11,20 +11,20 @@
test-suite boost-geometry-geometries
:
- [ run adapted.cpp ]
- [ run boost_array_as_point.cpp ]
- [ run boost_fusion.cpp ]
- [ run boost_polygon.cpp ]
- [ run boost_range.cpp ]
- [ run boost_tuple.cpp ]
- [ run box.cpp ]
+ [ run adapted.cpp : : : : geometries_adapted ]
+ [ run boost_array_as_point.cpp : : : : geometries_boost_array_as_point ]
+ [ run boost_fusion.cpp : : : : geometries_boost_fusion ]
+ [ run boost_polygon.cpp : : : : geometries_boost_polygon ]
+ [ run boost_range.cpp : : : : geometries_boost_range ]
+ [ run boost_tuple.cpp : : : : geometries_boost_tuple ]
+ [ run box.cpp : : : : geometries_box ]
#[ compile-fail custom_linestring.cpp
# : # requirements
# <define>TEST_FAIL_CLEAR
# : # target name
- # custom_linestring_test_fail_clear
+ # geometries_custom_linestring_test_fail_clear
#]
- [ run custom_linestring.cpp ]
- [ run geometries.cpp : : : <define>BOOST_GEOMETRY_EXPERIMENTAL_ENABLE_INITIALIZER_LIST ]
- [ run segment.cpp ]
+ [ run custom_linestring.cpp : : : : geometries_custom_linestring ]
+ [ run geometries.cpp : : : : geometries ]
+ [ run segment.cpp : : : : geometries_segment ]
;
diff --git a/libs/geometry/test/geometries/adapted.cpp b/libs/geometry/test/geometries/adapted.cpp
index fd3bb64196..4dd8c89235 100644
--- a/libs/geometry/test/geometries/adapted.cpp
+++ b/libs/geometry/test/geometries/adapted.cpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2007-2015 Barend Gehrels, 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
@@ -14,7 +14,6 @@
#include <boost/core/ignore_unused.hpp>
#include <boost/geometry/geometries/geometries.hpp>
-#include <boost/geometry/multi/multi.hpp>
#include <boost/geometry/geometries/adapted/c_array.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
@@ -35,8 +34,8 @@
#elif defined(BOOST_GEOMETRY_TEST_MULTI_POINT)
- #include <boost/geometry/multi/geometries/register/multi_point.hpp>
- #include <boost/geometry/multi/geometries/concepts/multi_point_concept.hpp>
+ #include <boost/geometry/geometries/register/multi_point.hpp>
+ #include <boost/geometry/geometries/concepts/multi_point_concept.hpp>
BOOST_GEOMETRY_REGISTER_MULTI_POINT_TEMPLATED(std::vector)
BOOST_GEOMETRY_REGISTER_MULTI_POINT_TEMPLATED(std::deque)
diff --git a/libs/geometry/test/geometries/geometries.cpp b/libs/geometry/test/geometries/geometries.cpp
index 8510df1da3..23dd11f522 100644
--- a/libs/geometry/test/geometries/geometries.cpp
+++ b/libs/geometry/test/geometries/geometries.cpp
@@ -1,7 +1,7 @@
// Boost.Geometry
// Unit Test
-// Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2014-2015 Adam Wulkiewicz, Lodz, Poland.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -18,7 +18,6 @@
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/algorithms/num_points.hpp>
-#include <boost/geometry/multi/algorithms/num_points.hpp>
#include <boost/geometry/algorithms/num_geometries.hpp>
typedef std::pair<float, float> pt_pair_t;
diff --git a/libs/geometry/test/geometry_test_common.hpp b/libs/geometry/test/geometry_test_common.hpp
index f4fbd65b76..68978061a2 100644
--- a/libs/geometry/test/geometry_test_common.hpp
+++ b/libs/geometry/test/geometry_test_common.hpp
@@ -15,10 +15,12 @@
#ifndef GEOMETRY_TEST_GEOMETRY_TEST_COMMON_HPP
#define GEOMETRY_TEST_GEOMETRY_TEST_COMMON_HPP
+#include <boost/config.hpp>
+
// Determine debug/release mode
// (it would be convenient if Boost.Config or Boost.Test would define this)
// Note that they might be combined (e.g. for optimize+no inline)
-#if defined (__clang__) || defined(__gcc__)
+#if defined (BOOST_CLANG) || defined(BOOST_GCC)
#if defined(__OPTIMIZE__)
#define BOOST_GEOMETRY_COMPILER_MODE_RELEASE
#endif
@@ -27,7 +29,7 @@
#endif
#endif
-#if defined(_MSC_VER)
+#if defined(BOOST_MSVC)
#if defined(_DEBUG)
#define BOOST_GEOMETRY_COMPILER_MODE_DEBUG
#else
@@ -36,14 +38,14 @@
#endif
-#if defined(_MSC_VER)
+#if defined(BOOST_MSVC)
// We deliberately mix float/double's so turn off warnings
#pragma warning( disable : 4244 )
// For (new since Boost 1.40) warning in Boost.Test on putenv/posix
#pragma warning( disable : 4996 )
//#pragma warning( disable : 4305 )
-#endif // defined(_MSC_VER)
+#endif // defined(BOOST_MSVC)
#include <boost/config.hpp>
#include <boost/concept_check.hpp>
diff --git a/libs/geometry/test/io/dsv/Jamfile.v2 b/libs/geometry/test/io/dsv/Jamfile.v2
index 73d818db71..eaebe1c723 100644
--- a/libs/geometry/test/io/dsv/Jamfile.v2
+++ b/libs/geometry/test/io/dsv/Jamfile.v2
@@ -1,8 +1,9 @@
# 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.
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
+# Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
#
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -10,6 +11,6 @@
test-suite boost-geometry-io-dsv
:
- [ run multi_dsv.cpp ]
+ [ run dsv_multi.cpp : : : : dsv_multi ]
;
diff --git a/libs/geometry/test/io/dsv/multi_dsv.cpp b/libs/geometry/test/io/dsv/dsv_multi.cpp
index 0af8f10e9b..0b4bd8f282 100644
--- a/libs/geometry/test/io/dsv/multi_dsv.cpp
+++ b/libs/geometry/test/io/dsv/dsv_multi.cpp
@@ -1,9 +1,9 @@
// 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.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,9 +15,8 @@
#include <geometry_test_common.hpp>
#include <boost/geometry/geometries/geometries.hpp>
-#include <boost/geometry/multi/io/dsv/write.hpp>
-#include <boost/geometry/multi/geometries/multi_geometries.hpp>
-#include <boost/geometry/multi/io/wkt/read.hpp>
+#include <boost/geometry/io/dsv/write.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
template <typename Geometry>
void test_dsv(std::string const& wkt, std::string const& expected, bool json = false)
diff --git a/libs/geometry/test/io/wkt/Jamfile.v2 b/libs/geometry/test/io/wkt/Jamfile.v2
index 27813bbf68..898e8e94d9 100644
--- a/libs/geometry/test/io/wkt/Jamfile.v2
+++ b/libs/geometry/test/io/wkt/Jamfile.v2
@@ -1,8 +1,9 @@
# 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.
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
+# Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
#
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -10,7 +11,7 @@
test-suite boost-geometry-io-wkt
:
- [ run multi_wkt.cpp ]
- [ run wkt.cpp ]
+ [ run wkt.cpp : : : : io_wkt ]
+ [ run wkt_multi.cpp : : : : io_wkt_multi ]
;
diff --git a/libs/geometry/test/io/wkt/multi_wkt.cpp b/libs/geometry/test/io/wkt/wkt_multi.cpp
index 35265feeed..809f69fadb 100644
--- a/libs/geometry/test/io/wkt/multi_wkt.cpp
+++ b/libs/geometry/test/io/wkt/wkt_multi.cpp
@@ -1,12 +1,12 @@
// 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.
+// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
-// This file was modified by Oracle on 2014.
-// Modifications copyright (c) 2014 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2014, 2015.
+// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -29,18 +29,7 @@
#include <boost/geometry/geometries/geometries.hpp>
-#include <boost/geometry/multi/algorithms/area.hpp>
-#include <boost/geometry/multi/algorithms/length.hpp>
-#include <boost/geometry/multi/algorithms/num_points.hpp>
-#include <boost/geometry/multi/algorithms/perimeter.hpp>
-#include <boost/geometry/multi/core/point_type.hpp>
-#include <boost/geometry/multi/core/topological_dimension.hpp>
-#include <boost/geometry/multi/geometries/multi_point.hpp>
-#include <boost/geometry/multi/geometries/multi_linestring.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
-
-#include <boost/geometry/multi/io/wkt/read.hpp>
-#include <boost/geometry/multi/io/wkt/write.hpp>
+#include <boost/geometry/io/wkt/wkt.hpp>
template <typename T>
void test_all();
diff --git a/libs/geometry/test/iterators/Jamfile.v2 b/libs/geometry/test/iterators/Jamfile.v2
index 1f760858cd..c9b54e9614 100644
--- a/libs/geometry/test/iterators/Jamfile.v2
+++ b/libs/geometry/test/iterators/Jamfile.v2
@@ -1,13 +1,14 @@
# Boost.Geometry (aka GGL, Generic Geometry Library)
#
-# Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
-# Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
-# Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
#
-# This file was modified by Oracle on 2014.
-# Modifications copyright (c) 2014, Oracle and/or its affiliates.
+# This file was modified by Oracle on 2014, 2015.
+# Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
#
# Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
+# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
#
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,10 +16,10 @@
test-suite boost-geometry-iterators
:
- [ run closing_iterator.cpp ]
- [ run concatenate_iterator.cpp ]
- [ run ever_circling_iterator.cpp ]
- [ run flatten_iterator.cpp ]
- [ run point_iterator.cpp ]
- [ run segment_iterator.cpp ]
+ [ run closing_iterator.cpp : : : : iterators_closing_iterator ]
+ [ run concatenate_iterator.cpp : : : : iterators_concatenate_iterator ]
+ [ run ever_circling_iterator.cpp : : : : iterators_ever_circling_iterator ]
+ [ run flatten_iterator.cpp : : : : iterators_flatten_iterator ]
+ [ run point_iterator.cpp : : : : iterators_point_iterator ]
+ [ run segment_iterator.cpp : : : : iterators_segment_iterator ]
;
diff --git a/libs/geometry/test/iterators/point_iterator.cpp b/libs/geometry/test/iterators/point_iterator.cpp
index b07d64ea2e..7eaee6af09 100644
--- a/libs/geometry/test/iterators/point_iterator.cpp
+++ b/libs/geometry/test/iterators/point_iterator.cpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2014, Oracle and/or its affiliates.
+// Copyright (c) 2014-2015, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
@@ -27,27 +27,32 @@
#include <boost/iterator/iterator_concepts.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/type_traits/is_const.hpp>
+#include <boost/type_traits/is_reference.hpp>
#include <boost/geometry/core/point_type.hpp>
-#include <boost/geometry/multi/core/point_type.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
-#include <boost/geometry/multi/geometries/multi_geometries.hpp>
-#include <boost/geometry/multi/geometries/register/multi_point.hpp>
+#include <boost/geometry/geometries/register/linestring.hpp>
+#include <boost/geometry/geometries/register/multi_point.hpp>
#include <boost/geometry/algorithms/equals.hpp>
+#include <boost/geometry/algorithms/make.hpp>
#include <boost/geometry/algorithms/num_points.hpp>
-#include <boost/geometry/multi/algorithms/num_points.hpp>
#include <boost/geometry/policies/compare.hpp>
+#include <boost/geometry/util/condition.hpp>
+
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/io/dsv/write.hpp>
#include <boost/geometry/iterators/point_iterator.hpp>
#include <boost/geometry/iterators/point_reverse_iterator.hpp>
+#include <test_common/with_pointer.hpp>
+#include <test_geometries/copy_on_dereference_geometries.hpp>
+
namespace bg = ::boost::geometry;
namespace ba = ::boost::assign;
@@ -67,10 +72,20 @@ typedef boost::tuple<double, double, double> tuple_point_type_3d;
typedef std::vector<tuple_point_type> tuple_multi_point_type;
typedef std::vector<tuple_point_type_3d> tuple_multi_point_type_3d;
+template <typename T>
+struct vector_as_multipoint : std::vector<T> {};
+
+template <typename T>
+struct vector_as_linestring : std::vector<T> {};
+
BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
BOOST_GEOMETRY_REGISTER_MULTI_POINT(tuple_multi_point_type)
BOOST_GEOMETRY_REGISTER_MULTI_POINT(tuple_multi_point_type_3d)
+BOOST_GEOMETRY_REGISTER_MULTI_POINT_TEMPLATED(vector_as_multipoint)
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(vector_as_linestring)
+
+
template <typename Geometry>
inline Geometry from_wkt(std::string const& wkt)
@@ -100,31 +115,37 @@ inline std::ostream& print_point_range(std::ostream& os,
template
<
typename Geometry,
+ bool Enable = true,
bool IsConst = boost::is_const<Geometry>::value
>
struct test_iterator_concepts
{
typedef bg::point_iterator<Geometry> iterator;
- BOOST_CONCEPT_ASSERT(( boost::BidirectionalIteratorConcept<iterator> ));
- BOOST_CONCEPT_ASSERT(( boost_concepts::ReadableIteratorConcept<iterator> ));
- BOOST_CONCEPT_ASSERT(( boost_concepts::LvalueIteratorConcept<iterator> ));
+ BOOST_CONCEPT_ASSERT((boost::BidirectionalIteratorConcept<iterator>));
+ BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIteratorConcept<iterator>));
+ BOOST_CONCEPT_ASSERT((boost_concepts::LvalueIteratorConcept<iterator>));
BOOST_CONCEPT_ASSERT
- (( boost_concepts::BidirectionalTraversalConcept<iterator> ));
+ ((boost_concepts::BidirectionalTraversalConcept<iterator>));
};
template <typename Geometry>
-struct test_iterator_concepts<Geometry, false>
- : test_iterator_concepts<Geometry, true>
+struct test_iterator_concepts<Geometry, true, false>
+ : test_iterator_concepts<Geometry, true, true>
{
typedef bg::point_iterator<Geometry> iterator;
BOOST_CONCEPT_ASSERT
- (( boost::Mutable_BidirectionalIteratorConcept<iterator> ));
+ ((boost::Mutable_BidirectionalIteratorConcept<iterator>));
BOOST_CONCEPT_ASSERT
- (( boost_concepts::WritableIteratorConcept<iterator> ));
+ ((boost_concepts::WritableIteratorConcept<iterator>));
BOOST_CONCEPT_ASSERT
- (( boost_concepts::SwappableIteratorConcept<iterator> ));
+ ((boost_concepts::SwappableIteratorConcept<iterator>));
};
+template <typename Geometry, bool IsConst>
+struct test_iterator_concepts<Geometry, false, IsConst>
+{};
+
+
struct equals
{
@@ -139,14 +160,14 @@ struct equals
{
++num_elems;
}
- BOOST_CHECK( size == num_elems );
+ BOOST_CHECK(size == num_elems);
num_elems = 0;
for (Iterator it = end; it != begin; --it)
{
++num_elems;
}
- BOOST_CHECK( size == num_elems );
+ BOOST_CHECK(size == num_elems);
return num_elems;
}
@@ -158,7 +179,7 @@ struct equals
std::size_t num_points1 = number_of_elements(begin1, end1);
std::size_t num_points2 = number_of_elements(begin2, end2);
- if ( num_points1 != num_points2 )
+ if (num_points1 != num_points2)
{
return false;
}
@@ -167,7 +188,7 @@ struct equals
Iterator2 it2 = begin2;
for (; it1 != end1; ++it1, ++it2)
{
- if ( !bg::equals(*it1, *it2) )
+ if (! bg::equals(*it1, *it2))
{
return false;
}
@@ -177,6 +198,7 @@ struct equals
};
+template <bool Enable = true>
struct test_assignment
{
template <typename Iterator, typename ConstIterator, typename Value>
@@ -191,16 +213,16 @@ struct test_assignment
std::cout << "*cit : " << bg::wkt(*cit) << std::endl;
#endif
- BOOST_CHECK( bg::equals(*it, value1) );
- BOOST_CHECK( !bg::equals(*it, value2) );
- BOOST_CHECK( bg::equals(*cit, value1) );
- BOOST_CHECK( !bg::equals(*cit, value2) );
+ BOOST_CHECK(bg::equals(*it, value1));
+ BOOST_CHECK(! bg::equals(*it, value2));
+ BOOST_CHECK(bg::equals(*cit, value1));
+ BOOST_CHECK(! bg::equals(*cit, value2));
*it = value2;
- BOOST_CHECK( bg::equals(*it, value2) );
- BOOST_CHECK( !bg::equals(*it, value1) );
- BOOST_CHECK( bg::equals(*cit, value2) );
- BOOST_CHECK( !bg::equals(*cit, value1) );
+ BOOST_CHECK(bg::equals(*it, value2));
+ BOOST_CHECK(! bg::equals(*it, value1));
+ BOOST_CHECK(bg::equals(*cit, value2));
+ BOOST_CHECK(! bg::equals(*cit, value1));
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << "== after 1st assignment ==" << std::endl;
@@ -211,10 +233,10 @@ struct test_assignment
#endif
*it = value1;
- BOOST_CHECK( bg::equals(*it, value1) );
- BOOST_CHECK( !bg::equals(*it, value2) );
- BOOST_CHECK( bg::equals(*cit, value1) );
- BOOST_CHECK( !bg::equals(*cit, value2) );
+ BOOST_CHECK(bg::equals(*it, value1));
+ BOOST_CHECK(! bg::equals(*it, value2));
+ BOOST_CHECK(bg::equals(*cit, value1));
+ BOOST_CHECK(! bg::equals(*cit, value2));
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << "== after 2nd assignment ==" << std::endl;
@@ -227,10 +249,27 @@ struct test_assignment
}
};
+template <>
+struct test_assignment<false>
+{
+ template <typename Iterator, typename ConstIterator, typename Value>
+ static inline void apply(Iterator, ConstIterator,
+ Value const&, Value const&)
+ {
+ }
+};
-template <typename Geometry, typename PointRange>
+
+template
+<
+ typename Geometry,
+ typename PointRange,
+ bool EnableConceptChecks = true
+>
struct test_point_iterator_of_geometry
{
+ typedef typename bg::point_type<Geometry>::type point_type;
+
template <typename G>
static inline void base_test(G& geometry,
PointRange const& point_range,
@@ -238,19 +277,19 @@ struct test_point_iterator_of_geometry
{
typedef bg::point_iterator<G> point_iterator;
- test_iterator_concepts<G>();
+ test_iterator_concepts<G, EnableConceptChecks>();
point_iterator begin = bg::points_begin(geometry);
point_iterator end = bg::points_end(geometry);
- BOOST_CHECK( std::size_t(std::distance(begin, end))
- ==
- bg::num_points(geometry) );
+ BOOST_CHECK(std::size_t(std::distance(begin, end))
+ ==
+ bg::num_points(geometry));
- BOOST_CHECK( equals::apply(begin, end,
- bg::points_begin(point_range),
- bg::points_end(point_range))
- );
+ BOOST_CHECK(equals::apply(begin, end,
+ bg::points_begin(point_range),
+ bg::points_end(point_range))
+ );
boost::ignore_unused(header);
@@ -269,7 +308,44 @@ struct test_point_iterator_of_geometry
#endif
}
- static inline void apply(Geometry geometry, PointRange const& point_range)
+ template <typename G, bool Enable>
+ struct test_reverse
+ {
+ template <typename Iterator>
+ static inline void apply(Iterator first, Iterator last,
+ G const& geometry)
+ {
+ std::reverse(first, last);
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ print_point_range(std::cout, first, last, "reversed:\n")
+ << std::endl;
+ std::cout << bg::wkt(geometry) << std::endl;
+ std::cout << std::endl;
+#endif
+
+ std::reverse(first, last);
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ print_point_range(std::cout, first, last, "re-reversed:\n")
+ << std::endl;
+ std::cout << bg::wkt(geometry) << std::endl;
+ std::cout << std::endl;
+ std::cout << std::endl;
+#endif
+ }
+ };
+
+ template <typename G>
+ struct test_reverse<G, false>
+ {
+ template <typename Iterator>
+ static inline void apply(Iterator, Iterator, G const&)
+ {
+ }
+ };
+
+ static inline void apply(Geometry geometry,
+ PointRange const& point_range,
+ point_type const& zero_point)
{
base_test<Geometry>(geometry, point_range, "non-const");
@@ -315,50 +391,57 @@ struct test_point_iterator_of_geometry
const_rend = rend;
// testing equality/inequality comparison
- BOOST_CHECK ( begin == const_begin );
- BOOST_CHECK ( end == const_end );
- if ( begin != end )
+ BOOST_CHECK(begin == const_begin);
+ BOOST_CHECK(end == const_end);
+ if (begin != end)
{
- BOOST_CHECK ( begin != const_end );
- BOOST_CHECK ( const_begin != end );
+ BOOST_CHECK(begin != const_end);
+ BOOST_CHECK(const_begin != end);
}
// testing equality/inequality comparison for reverse_iterator
- BOOST_CHECK ( rbegin == const_rbegin );
- BOOST_CHECK ( rend == const_rend );
- if ( rbegin != rend )
+ BOOST_CHECK(rbegin == const_rbegin);
+ BOOST_CHECK(rend == const_rend);
+ if (rbegin != rend)
{
- BOOST_CHECK ( rbegin != const_rend );
- BOOST_CHECK ( const_rbegin != rend );
+ BOOST_CHECK(rbegin != const_rend);
+ BOOST_CHECK(const_rbegin != rend);
}
- if ( begin != end )
+ if (begin != end)
{
- BOOST_CHECK( rbegin != rend );
+ BOOST_CHECK(rbegin != rend);
point_reverse_iterator rlast(rend);
--rlast;
- BOOST_CHECK( bg::equals(*begin, *rlast) );
+ BOOST_CHECK(bg::equals(*begin, *rlast));
point_iterator last(end);
--last;
- BOOST_CHECK( bg::equals(*rbegin, *last) );
+ BOOST_CHECK(bg::equals(*rbegin, *last));
}
// testing dereferencing/assignment
- if ( begin != end )
- {
- typedef typename bg::point_type<Geometry>::type point;
- point p = *begin;
- point q = bg::make_zero<point>();
+ bool const is_reference = boost::is_reference
+ <
+ typename std::iterator_traits<point_iterator>::reference
+ >::value;
+
+ if (begin != end)
+ {
+ if (BOOST_GEOMETRY_CONDITION(is_reference))
+ {
+ point_type p = *begin;
+ point_type q = zero_point;
- test_assignment::apply(begin, const_begin, p, q);
+ test_assignment<is_reference>::apply(begin, const_begin, p, q);
- *begin = q;
- test_assignment::apply(begin, const_begin, q, p);
+ *begin = q;
+ test_assignment<is_reference>::apply(begin, const_begin, q, p);
- *begin = p;
+ *begin = p;
+ }
}
// test with algorithms
@@ -369,33 +452,19 @@ struct test_point_iterator_of_geometry
std::cout << bg::wkt(geometry) << std::endl;
std::cout << std::endl;
#endif
-
- std::reverse(begin, end);
-#ifdef BOOST_GEOMETRY_TEST_DEBUG
- print_point_range(std::cout, begin, end, "reversed:\n") << std::endl;
- std::cout << bg::wkt(geometry) << std::endl;
- std::cout << std::endl;
-#endif
-
- std::reverse(begin, end);
-#ifdef BOOST_GEOMETRY_TEST_DEBUG
- print_point_range(std::cout, begin, end, "re-reversed:\n") << std::endl;
- std::cout << bg::wkt(geometry) << std::endl;
- std::cout << std::endl;
- std::cout << std::endl;
-#endif
+ test_reverse<Geometry, is_reference>::apply(begin, end, geometry);
typedef typename std::iterator_traits
<
point_iterator
>::value_type point;
- if ( const_begin != const_end )
+ if (const_begin != const_end)
{
const_point_iterator pit_max = std::max_element(const_begin,
const_end,
bg::less<point>());
- BOOST_CHECK( pit_max != const_end ); // to avoid warnings
+ BOOST_CHECK(pit_max != const_end); // to avoid warnings
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << "max point: " << bg::dsv(*pit_max) << std::endl;
#endif
@@ -406,6 +475,11 @@ struct test_point_iterator_of_geometry
std::cout << std::endl;
#endif
}
+
+ static inline void apply(Geometry geometry, PointRange const& point_range)
+ {
+ apply(geometry, point_range, bg::make_zero<point_type>());
+ }
};
@@ -628,3 +702,148 @@ BOOST_AUTO_TEST_CASE( test_multipolygon_point_iterator )
std::cout << std::endl << std::endl;
#endif
}
+
+
+//======================================================================
+//======================================================================
+
+
+BOOST_AUTO_TEST_CASE( test_multipoint_of_point_pointers )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "*** MULTIPOINT OF POINT POINTERS ***" << std::endl;
+#endif
+
+ typedef tuple_multi_point_type TMP;
+ typedef vector_as_multipoint<test::test_point_xy*> MP;
+
+ MP multipoint;
+ for (int i = 1; i < 10; i++)
+ {
+ test::test_point_xy* p = new test::test_point_xy;
+ p->x = i;
+ p->y = -i;
+ multipoint.push_back(p);
+ }
+
+ test::test_point_xy* zero = new test::test_point_xy;
+ zero->x = 0;
+ zero->y = 0;
+
+ typedef test_point_iterator_of_geometry<MP, TMP> tester;
+
+ tester::apply(multipoint,
+ ba::tuple_list_of(1,-1)(2,-2)(3,-3)(4,-4)(5,-5)(6,-6)\
+ (7,-7)(8,-8)(9,-9),
+ zero
+ );
+
+ for (unsigned int i = 0; i < multipoint.size(); i++)
+ {
+ delete multipoint[i];
+ }
+ delete zero;
+}
+
+
+//======================================================================
+//======================================================================
+
+
+BOOST_AUTO_TEST_CASE( test_linestring_of_point_pointers )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "*** LINESTRING OF POINT POINTERS ***" << std::endl;
+#endif
+
+ typedef tuple_multi_point_type TMP;
+ typedef vector_as_linestring<test::test_point_xy*> L;
+
+ L linestring;
+ for (int i = 1; i < 10; i++)
+ {
+ test::test_point_xy* p = new test::test_point_xy;
+ p->x = i;
+ p->y = -i;
+ linestring.push_back(p);
+ }
+
+ test::test_point_xy* zero = new test::test_point_xy;
+ zero->x = 0;
+ zero->y = 0;
+
+ typedef test_point_iterator_of_geometry<L, TMP> tester;
+
+ tester::apply(linestring,
+ ba::tuple_list_of(1,-1)(2,-2)(3,-3)(4,-4)(5,-5)(6,-6)\
+ (7,-7)(8,-8)(9,-9),
+ zero
+ );
+
+ for (unsigned int i = 0; i < linestring.size(); i++)
+ {
+ delete linestring[i];
+ }
+ delete zero;
+}
+
+
+//======================================================================
+//======================================================================
+
+
+BOOST_AUTO_TEST_CASE( test_multipoint_copy_on_dereference )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "*** MULTIPOINT WITH COPY-ON-DEREFERENCE ITERATOR ***"
+ << std::endl;
+#endif
+
+ typedef tuple_multi_point_type TMP;
+ typedef multipoint_copy_on_dereference<point_type> MP;
+
+ typedef test_point_iterator_of_geometry
+ <
+ MP, TMP, false // no concept checks
+ > tester;
+
+ // bg::read_wkt does not work for this multipoint type so we have
+ // to initialize the multipoint manually
+ MP multipoint;
+ for (int i = 1; i < 10; ++i)
+ {
+ multipoint.push_back(point_type(i, -i));
+ }
+
+ tester::apply(multipoint,
+ // from_wkt<MP>("MULTIPOINT(1 -1,2 -2,3 -3,4 -4,5 -5,6 -6, 7 -7,8 -8,9 -9)"),
+ ba::tuple_list_of(1,-1)(2,-2)(3,-3)(4,-4)(5,-5)(6,-6)\
+ (7,-7)(8,-8)(9,-9)
+ );
+}
+
+
+//======================================================================
+//======================================================================
+
+
+BOOST_AUTO_TEST_CASE( test_linestring_copy_on_dereference )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "*** LINESTRING WITH COPY-ON-DEREFERENCE ITERATOR ***"
+ << std::endl;
+#endif
+
+ typedef tuple_multi_point_type TMP;
+ typedef linestring_copy_on_dereference<point_type> L;
+
+ typedef test_point_iterator_of_geometry
+ <
+ L, TMP, false // no concept checks
+ > tester;
+
+ tester::apply(from_wkt<L>("LINESTRING(1 -1,2 -2,3 -3,4 -4,5 -5,6 -6, 7 -7,8 -8,9 -9)"),
+ ba::tuple_list_of(1,-1)(2,-2)(3,-3)(4,-4)(5,-5)(6,-6)\
+ (7,-7)(8,-8)(9,-9)
+ );
+}
diff --git a/libs/geometry/test/iterators/segment_iterator.cpp b/libs/geometry/test/iterators/segment_iterator.cpp
index d5f4ee482d..bd38221758 100644
--- a/libs/geometry/test/iterators/segment_iterator.cpp
+++ b/libs/geometry/test/iterators/segment_iterator.cpp
@@ -45,6 +45,8 @@
#include <boost/geometry/iterators/segment_iterator.hpp>
+#include <test_common/with_pointer.hpp>
+#include <test_geometries/copy_on_dereference_geometries.hpp>
namespace ba = ::boost::assign;
namespace bg = ::boost::geometry;
@@ -71,6 +73,9 @@ BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
BOOST_GEOMETRY_REGISTER_LINESTRING(tuple_linestring_type)
BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING(tuple_multi_linestring_type)
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
+
+
template <typename Geometry>
inline Geometry from_wkt(std::string const& wkt)
{
@@ -117,14 +122,14 @@ struct equals
{
++num_elems;
}
- BOOST_CHECK( size == num_elems );
+ BOOST_CHECK(size == num_elems);
num_elems = 0;
for (Iterator it = end; it != begin; --it)
{
++num_elems;
}
- BOOST_CHECK( size == num_elems );
+ BOOST_CHECK(size == num_elems);
return num_elems;
}
@@ -136,7 +141,7 @@ struct equals
std::size_t num_points1 = number_of_elements(begin1, end1);
std::size_t num_points2 = number_of_elements(begin2, end2);
- if ( num_points1 != num_points2 )
+ if (num_points1 != num_points2)
{
return false;
}
@@ -145,7 +150,7 @@ struct equals
Iterator2 it2 = begin2;
for (; it1 != end1; ++it1, ++it2)
{
- if ( !bg::equals(*it1, *it2) )
+ if (! bg::equals(*it1, *it2))
{
return false;
}
@@ -173,15 +178,15 @@ struct test_segment_iterator_of_geometry
if (check_num_segments)
{
- BOOST_CHECK( std::size_t(std::distance(begin, end))
- ==
- bg::num_segments(geometry) );
+ BOOST_CHECK(std::size_t(std::distance(begin, end))
+ ==
+ bg::num_segments(geometry));
}
- BOOST_CHECK( equals::apply(begin, end,
- bg::segments_begin(segment_range),
- bg::segments_end(segment_range))
- );
+ BOOST_CHECK(equals::apply(begin, end,
+ bg::segments_begin(segment_range),
+ bg::segments_end(segment_range))
+ );
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::string closure
@@ -220,8 +225,20 @@ struct test_segment_iterator_of_geometry
boost::ignore_unused(first_segment);
#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ typedef bg::model::segment
+ <
+ bg::model::point<double, 2, bg::cs::cartesian>
+ > other_segment;
+ other_segment other_seg;
+ // convert is used as a workaround for geometries whose
+ // point is a pointer. WKT does not seem to work for
+ // segment iterators created this way.
+ bg::convert(first_segment, other_seg);
std::cout << "first segment in geometry: "
- << bg::wkt(first_segment)
+ << bg::wkt(other_seg)
+ << std::endl;
+ std::cout << "first segment in geometry (DSV): "
+ << bg::dsv(first_segment)
<< std::endl;
std::cout << std::endl << std::endl;
@@ -234,10 +251,10 @@ struct test_segment_iterator_of_geometry
bg::segments_end(geometry),
std::back_inserter(segments));
- BOOST_CHECK( std::size_t( std::distance(bg::segments_begin(geometry),
- bg::segments_end(geometry)) )
- ==
- segments.size() );
+ BOOST_CHECK(std::size_t( std::distance(bg::segments_begin(geometry),
+ bg::segments_end(geometry)) )
+ ==
+ segments.size());
}
static inline void apply(Geometry geometry,
@@ -655,3 +672,76 @@ BOOST_AUTO_TEST_CASE( test_multi_polygon_segment_iterator )
std::cout << std::endl << std::endl << std::endl;
#endif
}
+
+//======================================================================
+//======================================================================
+
+BOOST_AUTO_TEST_CASE( test_linestring_of_point_pointers )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "*** LINESTRING OF POINT POINTERS ***" << std::endl;
+#endif
+
+ typedef tuple_multi_linestring_type TML;
+ typedef std::vector<test::test_point_xy*> L;
+
+ std::vector<test::test_point_xy*> linestring;
+ for (int i = 1; i < 10; i++)
+ {
+ test::test_point_xy* p = new test::test_point_xy;
+ p->x = i;
+ p->y = -i;
+ linestring.push_back(p);
+ }
+
+ test::test_point_xy* zero = new test::test_point_xy;
+ zero->x = 0;
+ zero->y = 0;
+
+ typedef test_segment_iterator_of_geometry<L, TML> tester;
+
+ tester::apply(linestring,
+ ba::list_of<tuple_linestring_type>
+ ( ba::tuple_list_of(1,-1)(2,-2) )
+ ( ba::tuple_list_of(2,-2)(3,-3) )
+ ( ba::tuple_list_of(3,-3)(4,-4) )
+ ( ba::tuple_list_of(4,-4)(5,-5) )
+ ( ba::tuple_list_of(5,-5)(6,-6) )
+ ( ba::tuple_list_of(6,-6)(7,-7) )
+ ( ba::tuple_list_of(7,-7)(8,-8) )
+ ( ba::tuple_list_of(8,-8)(9,-9) )
+ );
+
+ for (unsigned int i = 0; i < linestring.size(); i++)
+ {
+ delete linestring[i];
+ }
+}
+
+//======================================================================
+//======================================================================
+
+BOOST_AUTO_TEST_CASE( test_linestring_copy_on_dereference )
+{
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::cout << "*** LINESTRING WITH COPY-ON-DEREFERENCE ITERATOR ***"
+ << std::endl;
+#endif
+
+ typedef tuple_multi_linestring_type TML;
+ typedef linestring_copy_on_dereference<point_type> L;
+
+ typedef test_segment_iterator_of_geometry<L, TML> tester;
+
+ tester::apply(from_wkt<L>("LINESTRING(1 -1,2 -2,3 -3,4 -4,5 -5,6 -6, 7 -7,8 -8,9 -9)"),
+ ba::list_of<tuple_linestring_type>
+ ( ba::tuple_list_of(1,-1)(2,-2) )
+ ( ba::tuple_list_of(2,-2)(3,-3) )
+ ( ba::tuple_list_of(3,-3)(4,-4) )
+ ( ba::tuple_list_of(4,-4)(5,-5) )
+ ( ba::tuple_list_of(5,-5)(6,-6) )
+ ( ba::tuple_list_of(6,-6)(7,-7) )
+ ( ba::tuple_list_of(7,-7)(8,-8) )
+ ( ba::tuple_list_of(8,-8)(9,-9) )
+ );
+}
diff --git a/libs/geometry/test/point_concept/Jamfile.v2 b/libs/geometry/test/point_concept/Jamfile.v2
deleted file mode 100644
index c8bc7c1576..0000000000
--- a/libs/geometry/test/point_concept/Jamfile.v2
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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.
-#
-# 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)
-
-test-suite boost-geometry-point-concept
- :
- [ compile concept_checker.cpp ]
- [ compile well_formed_non_cartesian_point.cpp ]
- [ compile well_formed_point.cpp ]
- [ compile well_formed_point_traits.cpp ]
- [ compile array_point.cpp ]
- [ compile-fail geographic_custom_point_with_wrong_units.cpp ]
- [ compile-fail geographic_point_with_wrong_units.cpp ]
- [ compile-fail point_without_coordinate_type.cpp ]
- [ compile-fail point_without_dimension.cpp ]
- [ compile-fail point_without_getter.cpp ]
- [ compile-fail point_without_setter.cpp ]
- [ compile-fail point_with_incorrect_dimension.cpp ]
- [ compile-fail spherical_equatorial_custom_point_with_wrong_units.cpp ]
- [ compile-fail spherical_equatorial_point_with_wrong_units.cpp ]
- ;
diff --git a/libs/geometry/test/policies/Jamfile.v2 b/libs/geometry/test/policies/Jamfile.v2
index 22c58c89cd..fd3afcf2d4 100644
--- a/libs/geometry/test/policies/Jamfile.v2
+++ b/libs/geometry/test/policies/Jamfile.v2
@@ -1,8 +1,9 @@
# 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.
+# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
+# Copyright (c) 2009-2015 Adam Wulkiewicz, Lodz, Poland.
#
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -10,6 +11,6 @@
test-suite boost-geometry-policies
:
- [ run compare.cpp ]
- [ run rescale_policy.cpp ]
+ [ run compare.cpp : : : : policies_compare ]
+ [ run rescale_policy.cpp : : : : policies_rescale_policy ]
;
diff --git a/libs/geometry/test/robustness/convex_hull/random_multi_points.cpp b/libs/geometry/test/robustness/convex_hull/random_multi_points.cpp
index c7b1466814..93662ca9d6 100644
--- a/libs/geometry/test/robustness/convex_hull/random_multi_points.cpp
+++ b/libs/geometry/test/robustness/convex_hull/random_multi_points.cpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Robustness Test - convex_hull
-// Copyright (c) 2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2012-2015 Barend Gehrels, 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
@@ -23,7 +23,6 @@
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_geometries.hpp>
#include <boost/geometry/io/svg/svg_mapper.hpp>
struct settings_type
diff --git a/libs/geometry/test/robustness/overlay/areal_areal/test_overlay_p_q.hpp b/libs/geometry/test/robustness/overlay/areal_areal/test_overlay_p_q.hpp
index fa5544a77d..6fbd38b3ef 100644
--- a/libs/geometry/test/robustness/overlay/areal_areal/test_overlay_p_q.hpp
+++ b/libs/geometry/test/robustness/overlay/areal_areal/test_overlay_p_q.hpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
//
-// Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2009-2015 Barend Gehrels, 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)
@@ -27,7 +27,6 @@
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <boost/geometry/io/svg/svg_mapper.hpp>
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
diff --git a/libs/geometry/test/robustness/overlay/areal_areal/ticket_9081.cpp b/libs/geometry/test/robustness/overlay/areal_areal/ticket_9081.cpp
index 9c2f815972..91f336c6f1 100644
--- a/libs/geometry/test/robustness/overlay/areal_areal/ticket_9081.cpp
+++ b/libs/geometry/test/robustness/overlay/areal_areal/ticket_9081.cpp
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Robustness Test
-// Copyright (c) 2013 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2013-2015 Barend Gehrels, 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
@@ -20,7 +20,7 @@
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/geometries/register/ring.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
- #include <boost/geometry/multi/geometries/multi_polygon.hpp>
+ #include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/foreach.hpp>
#include <boost/timer.hpp>
diff --git a/libs/geometry/test/robustness/overlay/buffer/many_ring_buffer.cpp b/libs/geometry/test/robustness/overlay/buffer/many_ring_buffer.cpp
index 82226a0871..1fd54c23f7 100644
--- a/libs/geometry/test/robustness/overlay/buffer/many_ring_buffer.cpp
+++ b/libs/geometry/test/robustness/overlay/buffer/many_ring_buffer.cpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2012-2015 Barend Gehrels, 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
@@ -14,7 +14,7 @@
#include <test_buffer.hpp>
#include <boost/geometry/algorithms/difference.hpp>
-#include <boost/geometry/multi/geometries/multi_geometries.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
#include <boost/random/linear_congruential.hpp>
#include <boost/random/uniform_int.hpp>
diff --git a/libs/geometry/test/robustness/overlay/buffer/multi_point_growth.cpp b/libs/geometry/test/robustness/overlay/buffer/multi_point_growth.cpp
index d74a6c5f66..4aed939cf6 100644
--- a/libs/geometry/test/robustness/overlay/buffer/multi_point_growth.cpp
+++ b/libs/geometry/test/robustness/overlay/buffer/multi_point_growth.cpp
@@ -8,7 +8,7 @@
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/geometry.hpp>
-#include <boost/geometry/multi/geometries/multi_geometries.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
#include <boost/foreach.hpp>
#include <boost/timer.hpp>
diff --git a/libs/geometry/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp b/libs/geometry/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp
index 737f22c2e2..8816e2b599 100644
--- a/libs/geometry/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp
+++ b/libs/geometry/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp
@@ -1,7 +1,12 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Robustness Test
-// Copyright (c) 2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands.
+
+// This file was modified by Oracle on 2015.
+// Modifications copyright (c) 2015 Oracle and/or its affiliates.
+
+// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -26,7 +31,6 @@
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_geometries.hpp>
#include <boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp>
@@ -61,7 +65,7 @@ void create_svg(std::string const& filename
bg::buffer(box, box, 1.0);
mapper.add(box);
- if (bg::num_points(buffer) > 0)
+ if (! bg::is_empty(buffer))
{
bg::envelope(buffer, box);
bg::buffer(box, box, 1.0);
diff --git a/libs/geometry/test/robustness/overlay/linear_areal/recursive_polygons_linear_areal.cpp b/libs/geometry/test/robustness/overlay/linear_areal/recursive_polygons_linear_areal.cpp
index 8e057471da..c29a0df120 100644
--- a/libs/geometry/test/robustness/overlay/linear_areal/recursive_polygons_linear_areal.cpp
+++ b/libs/geometry/test/robustness/overlay/linear_areal/recursive_polygons_linear_areal.cpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Robustness Test
-// Copyright (c) 2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2012-2015 Barend Gehrels, 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
@@ -26,7 +26,6 @@
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_geometries.hpp>
#include <boost/geometry/io/svg/svg_mapper.hpp>
#include <boost/geometry/extensions/algorithms/midpoints.hpp>
diff --git a/libs/geometry/test/strategies/Jamfile.v2 b/libs/geometry/test/strategies/Jamfile.v2
index beb772b2a6..2bbc554ee5 100644
--- a/libs/geometry/test/strategies/Jamfile.v2
+++ b/libs/geometry/test/strategies/Jamfile.v2
@@ -16,23 +16,24 @@
test-suite boost-geometry-strategies
:
- [ run andoyer.cpp ]
- [ run cross_track.cpp ]
- [ run crossings_multiply.cpp ]
- [ run distance_default_result.cpp ]
- [ run douglas_peucker.cpp ]
- [ run franklin.cpp ]
- [ run haversine.cpp ]
- [ run point_in_box.cpp ]
- [ run projected_point.cpp ]
- [ run projected_point_ax.cpp ]
- [ run pythagoras.cpp ]
- [ run pythagoras_point_box.cpp ]
- [ run spherical_side.cpp ]
- [ run segment_intersection_collinear.cpp ]
- [ run side_of_intersection.cpp ]
- [ run transform_cs.cpp ]
- [ run transformer.cpp ]
- [ run vincenty.cpp ]
- [ run winding.cpp ]
+ [ run andoyer.cpp : : : : strategies_andoyer ]
+ [ run cross_track.cpp : : : : strategies_cross_track ]
+ [ run crossings_multiply.cpp : : : : strategies_crossings_multiply ]
+ [ run distance_default_result.cpp : : : : strategies_distance_default_result ]
+ [ run douglas_peucker.cpp : : : : strategies_douglas_peucker ]
+ [ run franklin.cpp : : : : strategies_franklin ]
+ [ run haversine.cpp : : : : strategies_haversine ]
+ [ run point_in_box.cpp : : : : strategies_point_in_box ]
+ [ run projected_point.cpp : : : : strategies_projected_point ]
+ [ run projected_point_ax.cpp : : : : strategies_projected_point_ax ]
+ [ run pythagoras.cpp : : : : strategies_pythagoras ]
+ [ run pythagoras_point_box.cpp : : : : strategies_pythagoras_point_box ]
+ [ run spherical_side.cpp : : : : strategies_spherical_side ]
+ [ run segment_intersection_collinear.cpp : : : : strategies_segment_intersection_collinear ]
+ [ run side_of_intersection.cpp : : : : strategies_side_of_intersection ]
+ [ run thomas.cpp : : : : strategies_thomas ]
+ [ run transform_cs.cpp : : : : strategies_transform_cs ]
+ [ run transformer.cpp : : : : strategies_transformer ]
+ [ run vincenty.cpp : : : : strategies_vincenty ]
+ [ run winding.cpp : : : : strategies_winding ]
;
diff --git a/libs/geometry/test/strategies/andoyer.cpp b/libs/geometry/test/strategies/andoyer.cpp
index c1fe0293be..12d23ddc74 100644
--- a/libs/geometry/test/strategies/andoyer.cpp
+++ b/libs/geometry/test/strategies/andoyer.cpp
@@ -5,8 +5,8 @@
// 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.
+// This file was modified by Oracle on 2014, 2015.
+// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -23,6 +23,7 @@
#include <boost/concept_check.hpp>
#include <boost/geometry/strategies/geographic/distance_andoyer.hpp>
+#include <boost/geometry/strategies/geographic/side_andoyer.hpp>
#include <boost/geometry/core/srs.hpp>
#include <boost/geometry/strategies/strategies.hpp>
@@ -37,7 +38,7 @@
template <typename P1, typename P2>
-void test_andoyer(double lon1, double lat1, double lon2, double lat2, double expected_km)
+void test_distance(double lon1, double lat1, double lon2, double lat2, double expected_km)
{
// Set radius type, but for integer coordinates we want to have floating point radius type
typedef typename bg::promote_floating_point
@@ -58,8 +59,8 @@ void test_andoyer(double lon1, double lat1, double lon2, double lat2, double exp
typedef typename bg::strategy::distance
::services::return_type<andoyer_type, P1, P2>::type return_type;
-
- P1 p1, p2;
+ P1 p1;
+ P2 p2;
bg::assign_values(p1, lon1, lat1);
bg::assign_values(p2, lon2, lat2);
@@ -68,12 +69,42 @@ void test_andoyer(double lon1, double lat1, double lon2, double lat2, double exp
BOOST_CHECK_CLOSE(bg::distance(p1, p2, andoyer), return_type(1000.0 * expected_km), 0.001);
}
+template <typename PS, typename P>
+void test_side(double lon1, double lat1,
+ double lon2, double lat2,
+ double lon, double lat,
+ int expected_side)
+{
+ // Set radius type, but for integer coordinates we want to have floating point radius type
+ typedef typename bg::promote_floating_point
+ <
+ typename bg::coordinate_type<PS>::type
+ >::type rtype;
+
+ typedef bg::srs::spheroid<rtype> stype;
+
+ typedef bg::strategy::side::andoyer<stype> strategy_type;
+
+ strategy_type strategy;
+
+ PS p1, p2;
+ P p;
+
+ bg::assign_values(p1, lon1, lat1);
+ bg::assign_values(p2, lon2, lat2);
+ bg::assign_values(p, lon, lat);
+
+ int side = strategy.apply(p1, p2, p);
+
+ BOOST_CHECK_EQUAL(side, expected_side);
+}
+
template <typename P1, typename P2>
void test_all()
{
- test_andoyer<P1, P2>(0, 90, 1, 80, 1116.814237); // polar
- test_andoyer<P1, P2>(4, 52, 4, 52, 0.0); // no point difference
- test_andoyer<P1, P2>(4, 52, 3, 40, 1336.039890); // normal case
+ test_distance<P1, P2>(0, 90, 1, 80, 1116.814237); // polar
+ test_distance<P1, P2>(4, 52, 4, 52, 0.0); // no point difference
+ test_distance<P1, P2>(4, 52, 3, 40, 1336.039890); // normal case
/* SQL Server gives:
1116.82586908528, 0, 1336.02721932545
@@ -83,6 +114,19 @@ SELECT 0.001 * geography::STGeomFromText('POINT(0 90)', 4326).STDistance(geograp
union SELECT 0.001 * geography::STGeomFromText('POINT(4 52)', 4326).STDistance(geography::STGeomFromText('POINT(4 52)', 4326))
union SELECT 0.001 * geography::STGeomFromText('POINT(4 52)', 4326).STDistance(geography::STGeomFromText('POINT(3 40)', 4326))
*/
+
+ test_side<P1, P2>(0, 0, 0, 1, 0, 2, 0);
+ test_side<P1, P2>(0, 0, 0, 1, 0, -2, 0);
+ test_side<P1, P2>(10, 0, 10, 1, 10, 2, 0);
+ test_side<P1, P2>(10, 0, 10, -1, 10, 2, 0);
+
+ test_side<P1, P2>(10, 0, 10, 1, 0, 2, 1); // left
+ test_side<P1, P2>(10, 0, 10, -1, 0, 2, -1); // right
+
+ test_side<P1, P2>(-10, -10, 10, 10, 10, 0, -1); // right
+ test_side<P1, P2>(-10, -10, 10, 10, -10, 0, 1); // left
+ test_side<P1, P2>(170, -10, -170, 10, -170, 0, -1); // right
+ test_side<P1, P2>(170, -10, -170, 10, 170, 0, 1); // left
}
template <typename P>
diff --git a/libs/geometry/test/strategies/segment_intersection.cpp b/libs/geometry/test/strategies/segment_intersection.cpp
index fdd66eeb90..baa947b265 100644
--- a/libs/geometry/test/strategies/segment_intersection.cpp
+++ b/libs/geometry/test/strategies/segment_intersection.cpp
@@ -30,7 +30,6 @@
#include <boost/geometry/policies/relate/intersection_points.hpp>
#include <boost/geometry/policies/relate/direction.hpp>
-//#include <boost/geometry/policies/relate/de9im.hpp>
#include <boost/geometry/policies/relate/tupled.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
diff --git a/libs/geometry/test/strategies/segment_intersection_collinear.cpp b/libs/geometry/test/strategies/segment_intersection_collinear.cpp
index 8c25d5fe6a..620b0036d0 100644
--- a/libs/geometry/test/strategies/segment_intersection_collinear.cpp
+++ b/libs/geometry/test/strategies/segment_intersection_collinear.cpp
@@ -23,7 +23,6 @@
#include <boost/geometry/policies/relate/intersection_points.hpp>
#include <boost/geometry/policies/relate/direction.hpp>
-#include <boost/geometry/policies/relate/de9im.hpp>
#include <boost/geometry/policies/relate/tupled.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
diff --git a/libs/geometry/test/strategies/side_of_intersection.cpp b/libs/geometry/test/strategies/side_of_intersection.cpp
index c5de7e0ea2..b42270e3d1 100644
--- a/libs/geometry/test/strategies/side_of_intersection.cpp
+++ b/libs/geometry/test/strategies/side_of_intersection.cpp
@@ -19,9 +19,13 @@ namespace bg = boost::geometry;
int test_main(int, char* [])
{
- typedef bg::model::d2::point_xy<int> point;
+ typedef bg::model::d2::point_xy<boost::long_long_type> point;
typedef bg::model::segment<point> segment;
+ typedef bg::strategy::side::side_of_intersection side;
+
+ point no_fb(-99, -99);
+
segment a(point(20, 10), point(10, 20));
segment b1(point(11, 16), point(20, 14)); // IP with a: (14.857, 15.143)
@@ -31,27 +35,70 @@ int test_main(int, char* [])
segment c2(point(15, 16), point(14, 8));
segment c3(point(15, 16), point(15, 8));
- typedef bg::strategy::side::side_of_intersection side;
-
- BOOST_CHECK_EQUAL( 1, side::apply(a, b1, c1));
- BOOST_CHECK_EQUAL(-1, side::apply(a, b1, c2));
- BOOST_CHECK_EQUAL(-1, side::apply(a, b1, c3));
-
- BOOST_CHECK_EQUAL( 1, side::apply(a, b2, c1));
- BOOST_CHECK_EQUAL( 1, side::apply(a, b2, c2));
- BOOST_CHECK_EQUAL( 0, side::apply(a, b2, c3));
-
- // Check internal calculation-method:
- BOOST_CHECK_EQUAL(-1400, side::side_value<int>(a, b1, c2));
- BOOST_CHECK_EQUAL( 2800, side::side_value<int>(a, b1, c1));
-
- BOOST_CHECK_EQUAL (2800, side::side_value<int>(a, b1, c1));
- BOOST_CHECK_EQUAL(-1400, side::side_value<int>(a, b1, c2));
- BOOST_CHECK_EQUAL(-5600, side::side_value<int>(a, b1, c3));
- BOOST_CHECK_EQUAL(12800, side::side_value<int>(a, b2, c1));
- BOOST_CHECK_EQUAL( 6400, side::side_value<int>(a, b2, c2));
- BOOST_CHECK_EQUAL( 0, side::side_value<int>(a, b2, c3));
+ BOOST_CHECK_EQUAL( 1, side::apply(a, b1, c1, no_fb));
+ BOOST_CHECK_EQUAL(-1, side::apply(a, b1, c2, no_fb));
+ BOOST_CHECK_EQUAL(-1, side::apply(a, b1, c3, no_fb));
+
+ BOOST_CHECK_EQUAL( 1, side::apply(a, b2, c1, no_fb));
+ BOOST_CHECK_EQUAL( 1, side::apply(a, b2, c2, no_fb));
+ BOOST_CHECK_EQUAL( 0, side::apply(a, b2, c3, no_fb));
+
+ // Collinear cases
+ // 1: segments intersecting are collinear (with a fallback point):
+ {
+ point fb(5, 5);
+ segment col1(point(0, 5), point(5, 5));
+ segment col2(point(5, 5), point(10, 5)); // One IP with col1 at (5,5)
+ segment col3(point(5, 0), point(5, 5));
+ BOOST_CHECK_EQUAL( 0, side::apply(col1, col2, col3, fb));
+ }
+ // 2: segment of side calculation collinear with one of the segments
+ {
+ point fb(5, 5);
+ segment col1(point(0, 5), point(10, 5));
+ segment col2(point(5, 5), point(5, 12)); // IP with col1 at (5,5)
+ segment col3(point(5, 1), point(5, 5)); // collinear with col2
+ BOOST_CHECK_EQUAL( 0, side::apply(col1, col2, col3, fb));
+ }
+ {
+ point fb(5, 5);
+ segment col1(point(10, 5), point(0, 5));
+ segment col2(point(5, 5), point(5, 12)); // IP with col1 at (5,5)
+ segment col3(point(5, 1), point(5, 5)); // collinear with col2
+ BOOST_CHECK_EQUAL( 0, side::apply(col1, col2, col3, fb));
+ }
+ {
+ point fb(5, 5);
+ segment col1(point(0, 5), point(10, 5));
+ segment col2(point(5, 12), point(5, 5)); // IP with col1 at (5,5)
+ segment col3(point(5, 1), point(5, 5)); // collinear with col2
+ BOOST_CHECK_EQUAL( 0, side::apply(col1, col2, col3, fb));
+ }
+
+ {
+ point fb(517248, -517236);
+ segment col1(point(-172408, -517236), point(862076, -517236));
+ segment col2(point(517248, -862064), point(517248, -172408));
+ segment col3(point(517248, -172408), point(517248, -517236));
+ BOOST_CHECK_EQUAL( 0, side::apply(col1, col2, col3, fb));
+ }
+ {
+ point fb(-221647, -830336);
+ segment col1(point(-153817, -837972), point(-222457, -830244));
+ segment col2(point(-221139, -833615), point(-290654, -384388));
+ segment col3(point(-255266, -814663), point(-264389, -811197));
+ BOOST_CHECK_EQUAL(1, side::apply(col1, col2, col3, fb)); // Left of segment...
+ }
+
+
+ {
+ point fb(27671131, 30809240);
+ segment col1(point(27671116, 30809247), point(27675474, 30807351));
+ segment col2(point(27666779, 30811130), point(27671139, 30809237));
+ segment col3(point(27671122, 30809244), point(27675480, 30807348));
+ BOOST_CHECK_EQUAL(1, side::apply(col1, col2, col3, fb)); // Left of segment...
+ }
// TODO: we might add a check calculating the IP, determining the side
// with the normal side strategy, and verify the results are equal
diff --git a/libs/geometry/test/strategies/spherical_side.cpp b/libs/geometry/test/strategies/spherical_side.cpp
index 6965692ea0..b834e016a8 100644
--- a/libs/geometry/test/strategies/spherical_side.cpp
+++ b/libs/geometry/test/strategies/spherical_side.cpp
@@ -3,8 +3,8 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
-// This file was modified by Oracle on 2014.
-// Modifications copyright (c) 2014, Oracle and/or its affiliates.
+// This file was modified by Oracle on 2014, 2015.
+// Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -18,19 +18,23 @@
#include <boost/geometry/algorithms/assign.hpp>
+#include <boost/geometry/core/coordinate_type.hpp>
+#include <boost/geometry/core/cs.hpp>
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/segment.hpp>
#include <boost/geometry/strategies/spherical/side_by_cross_track.hpp>
//#include <boost/geometry/strategies/spherical/side_via_plane.hpp>
#include <boost/geometry/strategies/spherical/ssf.hpp>
#include <boost/geometry/strategies/cartesian/side_by_triangle.hpp>
-#include <boost/geometry/strategies/agnostic/side_by_azimuth.hpp>
#include <boost/geometry/strategies/geographic/mapping_ssf.hpp>
+#include <boost/geometry/strategies/geographic/side_andoyer.hpp>
+#include <boost/geometry/strategies/geographic/side_thomas.hpp>
+#include <boost/geometry/strategies/geographic/side_vincenty.hpp>
-#include <boost/geometry/core/cs.hpp>
-
-#include <boost/geometry/geometries/point.hpp>
-#include <boost/geometry/geometries/segment.hpp>
+#include <boost/geometry/util/math.hpp>
namespace boost { namespace geometry {
@@ -69,10 +73,12 @@ void test_side1(std::string const& /*case_id*/, Point const& p1, Point const& p2
// non-official
typedef bg::srs::spheroid<double> spheroid;
spheroid const sph(1.0, 1.0);
- int side_azi = bgss::side_by_azimuth<spheroid>(sph).apply(p1, p2, p3);
int side_mssf1 = bgss::mapping_spherical_side_formula<spheroid>(sph).apply(p1, p2, p3);
int side_mssf2 = bgss::mapping_spherical_side_formula<spheroid, bgss::mapping_reduced>(sph).apply(p1, p2, p3);
int side_mssf3 = bgss::mapping_spherical_side_formula<spheroid, bgss::mapping_geocentric>(sph).apply(p1, p2, p3);
+ int side_andoyer = bgss::andoyer<spheroid>(sph).apply(p1, p2, p3);
+ int side_thomas = bgss::thomas<spheroid>(sph).apply(p1, p2, p3);
+ int side_vincenty = bgss::vincenty<spheroid>(sph).apply(p1, p2, p3);
// cartesian
typedef bg::strategy::side::services::default_strategy<bg::cartesian_tag>::type cartesian_strategy;
@@ -80,10 +86,12 @@ void test_side1(std::string const& /*case_id*/, Point const& p1, Point const& p2
BOOST_CHECK_EQUAL(side_ssf, expected);
BOOST_CHECK_EQUAL(side_ct, expected);
- BOOST_CHECK_EQUAL(side_azi, expected);
BOOST_CHECK_EQUAL(side_mssf1, expected);
BOOST_CHECK_EQUAL(side_mssf2, expected);
BOOST_CHECK_EQUAL(side_mssf3, expected);
+ BOOST_CHECK_EQUAL(side_andoyer, expected);
+ BOOST_CHECK_EQUAL(side_thomas, expected);
+ BOOST_CHECK_EQUAL(side_vincenty, expected);
BOOST_CHECK_EQUAL(side_cart, expected_cartesian);
/*
@@ -114,7 +122,9 @@ void test_side(std::string const& case_id, Point const& p1, Point const& p2, Poi
template <typename Point>
void test_all()
{
- Point amsterdam(5.9, 52.4);
+ typedef typename bg::coordinate_type<Point>::type CT;
+
+ Point amsterdam(bg::math::rounding_cast<CT>(5.9), bg::math::rounding_cast<CT>(52.4));
Point barcelona(2.0, 41.0);
Point paris(2.0, 48.0);
Point milan(7.0, 45.0);
diff --git a/libs/geometry/test/strategies/thomas.cpp b/libs/geometry/test/strategies/thomas.cpp
new file mode 100644
index 0000000000..cac10ac51d
--- /dev/null
+++ b/libs/geometry/test/strategies/thomas.cpp
@@ -0,0 +1,145 @@
+// 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 2015.
+// Modifications copyright (c) 2015 Oracle and/or its affiliates.
+
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
+// 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)
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/concept_check.hpp>
+
+#include <boost/geometry/strategies/geographic/distance_thomas.hpp>
+#include <boost/geometry/strategies/geographic/side_thomas.hpp>
+
+#include <boost/geometry/core/srs.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+#include <boost/geometry/algorithms/assign.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <test_common/test_point.hpp>
+
+#ifdef HAVE_TTMATH
+# include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
+#endif
+
+
+
+template <typename P1, typename P2>
+void test_distance(double lon1, double lat1, double lon2, double lat2, double expected_km)
+{
+ // Set radius type, but for integer coordinates we want to have floating point radius type
+ typedef typename bg::promote_floating_point
+ <
+ typename bg::coordinate_type<P1>::type
+ >::type rtype;
+
+ typedef bg::srs::spheroid<rtype> stype;
+
+ typedef bg::strategy::distance::thomas<stype> thomas_type;
+
+ BOOST_CONCEPT_ASSERT
+ (
+ (bg::concept::PointDistanceStrategy<thomas_type, P1, P2>)
+ );
+
+ thomas_type thomas;
+ typedef typename bg::strategy::distance
+ ::services::return_type<thomas_type, P1, P2>::type return_type;
+
+
+ P1 p1;
+ P2 p2;
+
+ bg::assign_values(p1, lon1, lat1);
+ bg::assign_values(p2, lon2, lat2);
+
+ BOOST_CHECK_CLOSE(thomas.apply(p1, p2), return_type(1000.0 * expected_km), 0.001);
+ BOOST_CHECK_CLOSE(bg::distance(p1, p2, thomas), return_type(1000.0 * expected_km), 0.001);
+}
+
+template <typename PS, typename P>
+void test_side(double lon1, double lat1,
+ double lon2, double lat2,
+ double lon, double lat,
+ int expected_side)
+{
+ // Set radius type, but for integer coordinates we want to have floating point radius type
+ typedef typename bg::promote_floating_point
+ <
+ typename bg::coordinate_type<PS>::type
+ >::type rtype;
+
+ typedef bg::srs::spheroid<rtype> stype;
+
+ typedef bg::strategy::side::thomas<stype> strategy_type;
+
+ strategy_type strategy;
+
+ PS p1, p2;
+ P p;
+
+ bg::assign_values(p1, lon1, lat1);
+ bg::assign_values(p2, lon2, lat2);
+ bg::assign_values(p, lon, lat);
+
+ int side = strategy.apply(p1, p2, p);
+
+ BOOST_CHECK_EQUAL(side, expected_side);
+}
+
+template <typename P1, typename P2>
+void test_all()
+{
+ test_distance<P1, P2>(0, 90, 1, 80, 1116.825795); // polar
+ test_distance<P1, P2>(0, -90, 1, -80, 1116.825795); // polar
+ test_distance<P1, P2>(4, 52, 4, 52, 0.0); // no point difference
+ test_distance<P1, P2>(4, 52, 3, 40, 1336.025365); // normal case
+
+ test_side<P1, P2>(0, 0, 0, 1, 0, 2, 0);
+ test_side<P1, P2>(0, 0, 0, 1, 0, -2, 0);
+ test_side<P1, P2>(10, 0, 10, 1, 10, 2, 0);
+ test_side<P1, P2>(10, 0, 10, -1, 10, 2, 0);
+
+ test_side<P1, P2>(10, 0, 10, 1, 0, 2, 1); // left
+ test_side<P1, P2>(10, 0, 10, -1, 0, 2, -1); // right
+
+ test_side<P1, P2>(-10, -10, 10, 10, 10, 0, -1); // right
+ test_side<P1, P2>(-10, -10, 10, 10, -10, 0, 1); // left
+ test_side<P1, P2>(170, -10, -170, 10, -170, 0, -1); // right
+ test_side<P1, P2>(170, -10, -170, 10, 170, 0, 1); // left
+}
+
+template <typename P>
+void test_all()
+{
+ test_all<P, P>();
+}
+
+int test_main(int, char* [])
+{
+ //test_all<float[2]>();
+ //test_all<double[2]>();
+ test_all<bg::model::point<int, 2, bg::cs::geographic<bg::degree> > >();
+ test_all<bg::model::point<float, 2, bg::cs::geographic<bg::degree> > >();
+ test_all<bg::model::point<double, 2, bg::cs::geographic<bg::degree> > >();
+
+#if defined(HAVE_TTMATH)
+ test_all<bg::model::point<ttmath::Big<1,4>, 2, bg::cs::geographic<bg::degree> > >();
+ test_all<bg::model::point<ttmath_big, 2, bg::cs::geographic<bg::degree> > >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/strategies/vincenty.cpp b/libs/geometry/test/strategies/vincenty.cpp
index b80da4bb52..d49a49172d 100644
--- a/libs/geometry/test/strategies/vincenty.cpp
+++ b/libs/geometry/test/strategies/vincenty.cpp
@@ -5,8 +5,8 @@
// 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.
+// This file was modified by Oracle on 2014, 2015.
+// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -23,6 +23,7 @@
#include <boost/concept_check.hpp>
#include <boost/geometry/strategies/geographic/distance_vincenty.hpp>
+#include <boost/geometry/strategies/geographic/side_vincenty.hpp>
#include <boost/geometry/algorithms/detail/vincenty_inverse.hpp>
#include <boost/geometry/algorithms/detail/vincenty_direct.hpp>
@@ -106,7 +107,7 @@ template <typename P1, typename P2, typename Spheroid>
void test_vincenty(double lon1, double lat1, double lon2, double lat2,
double expected_distance,
double expected_azimuth_12,
- double expected_azimuth_21,
+ double /*expected_azimuth_21*/,
Spheroid const& spheroid)
{
typedef typename bg::promote_floating_point
@@ -121,41 +122,48 @@ void test_vincenty(double lon1, double lat1, double lon2, double lat2,
// formula
{
- bg::detail::vincenty_inverse<calc_t> vi(lon1 * bg::math::d2r,
- lat1 * bg::math::d2r,
- lon2 * bg::math::d2r,
- lat2 * bg::math::d2r,
- spheroid);
- calc_t dist = vi.distance();
- calc_t az12 = vi.azimuth12();
- calc_t az21 = vi.azimuth21();
-
- calc_t az12_deg = az12 * bg::math::r2d;
- calc_t az21_deg = az21 * bg::math::r2d;
+ double const d2r = bg::math::d2r<double>();
+ double const r2d = bg::math::r2d<double>();
+
+ typedef bg::detail::vincenty_inverse<calc_t, true, true> inverse_formula;
+ typename inverse_formula::result_type
+ result_i = inverse_formula::apply(lon1 * d2r,
+ lat1 * d2r,
+ lon2 * d2r,
+ lat2 * d2r,
+ spheroid);
+ calc_t dist = result_i.distance;
+ calc_t az12 = result_i.azimuth;
+ //calc_t az21 = vi.azimuth21();
+
+ calc_t az12_deg = az12 * r2d;
+ //calc_t az21_deg = az21 * r2d;
BOOST_CHECK_CLOSE(dist, calc_t(expected_distance), tolerance);
check_deg("az12_deg", az12_deg, calc_t(expected_azimuth_12), tolerance, error);
- check_deg("az21_deg", az21_deg, calc_t(expected_azimuth_21), tolerance, error);
-
- bg::detail::vincenty_direct<calc_t> vd(lon1 * bg::math::d2r,
- lat1 * bg::math::d2r,
- dist,
- az12,
- spheroid);
- calc_t direct_lon2 = vd.lon2();
- calc_t direct_lat2 = vd.lat2();
- calc_t direct_az21 = vd.azimuth21();
-
- calc_t direct_lon2_deg = direct_lon2 * bg::math::r2d;
- calc_t direct_lat2_deg = direct_lat2 * bg::math::r2d;
- calc_t direct_az21_deg = direct_az21 * bg::math::r2d;
+ //check_deg("az21_deg", az21_deg, calc_t(expected_azimuth_21), tolerance, error);
+
+ typedef bg::detail::vincenty_direct<calc_t> direct_formula;
+ typename direct_formula::result_type
+ result_d = direct_formula::apply(lon1 * d2r,
+ lat1 * d2r,
+ dist,
+ az12,
+ spheroid);
+ calc_t direct_lon2 = result_d.lon2;
+ calc_t direct_lat2 = result_d.lat2;
+ //calc_t direct_az21 = vd.azimuth21();
+
+ calc_t direct_lon2_deg = direct_lon2 * r2d;
+ calc_t direct_lat2_deg = direct_lat2 * r2d;
+ //calc_t direct_az21_deg = direct_az21 * r2d;
check_deg("direct_lon2_deg", direct_lon2_deg, calc_t(lon2), tolerance, error);
check_deg("direct_lat2_deg", direct_lat2_deg, calc_t(lat2), tolerance, error);
- check_deg("direct_az21_deg", direct_az21_deg, az21_deg, tolerance, error);
+ //check_deg("direct_az21_deg", direct_az21_deg, az21_deg, tolerance, error);
}
- // strategy
+ // distance strategy
{
typedef bg::strategy::distance::vincenty<Spheroid> vincenty_type;
@@ -189,6 +197,36 @@ void test_vincenty(double lon1, double lat1, double lon2, double lat2,
bg::srs::spheroid<double>());
}
+template <typename PS, typename P>
+void test_side(double lon1, double lat1,
+ double lon2, double lat2,
+ double lon, double lat,
+ int expected_side)
+{
+ // Set radius type, but for integer coordinates we want to have floating point radius type
+ typedef typename bg::promote_floating_point
+ <
+ typename bg::coordinate_type<PS>::type
+ >::type rtype;
+
+ typedef bg::srs::spheroid<rtype> stype;
+
+ typedef bg::strategy::side::vincenty<stype> strategy_type;
+
+ strategy_type strategy;
+
+ PS p1, p2;
+ P p;
+
+ bg::assign_values(p1, lon1, lat1);
+ bg::assign_values(p2, lon2, lat2);
+ bg::assign_values(p, lon, lat);
+
+ int side = strategy.apply(p1, p2, p);
+
+ BOOST_CHECK_EQUAL(side, expected_side);
+}
+
template <typename P1, typename P2>
void test_all()
{
@@ -245,6 +283,19 @@ void test_all()
test_vincenty<P1, P2>(0, 89, 1, 80, 1005153.5769, azimuth(178,53,23.85), azimuth(359,53,18.35)); // sub-polar
test_vincenty<P1, P2>(4, 52, 4, 52, 0.0, 0, 0); // no point difference
test_vincenty<P1, P2>(4, 52, 3, 40, 1336039.890, azimuth(183,41,29.08), azimuth(2,58,5.13)); // normal case
+
+ test_side<P1, P2>(0, 0, 0, 1, 0, 2, 0);
+ test_side<P1, P2>(0, 0, 0, 1, 0, -2, 0);
+ test_side<P1, P2>(10, 0, 10, 1, 10, 2, 0);
+ test_side<P1, P2>(10, 0, 10, -1, 10, 2, 0);
+
+ test_side<P1, P2>(10, 0, 10, 1, 0, 2, 1); // left
+ test_side<P1, P2>(10, 0, 10, -1, 0, 2, -1); // right
+
+ test_side<P1, P2>(-10, -10, 10, 10, 10, 0, -1); // right
+ test_side<P1, P2>(-10, -10, 10, 10, -10, 0, 1); // left
+ test_side<P1, P2>(170, -10, -170, 10, -170, 0, -1); // right
+ test_side<P1, P2>(170, -10, -170, 10, 170, 0, 1); // left
}
template <typename P>
diff --git a/libs/geometry/test/test_geometries/copy_on_dereference_geometries.hpp b/libs/geometry/test/test_geometries/copy_on_dereference_geometries.hpp
new file mode 100644
index 0000000000..2d7d9d6ed7
--- /dev/null
+++ b/libs/geometry/test/test_geometries/copy_on_dereference_geometries.hpp
@@ -0,0 +1,177 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2015, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
+
+// Licensed under the Boost Software License version 1.0.
+// http://www.boost.org/users/license.html
+
+#ifndef GEOMETRY_TEST_TEST_GEOMETRIES_COPY_ON_DEREFERENCE_GEOMETRIES_HPP
+#define GEOMETRY_TEST_TEST_GEOMETRIES_COPY_ON_DEREFERENCE_GEOMETRIES_HPP
+
+#include <cstddef>
+#include <iterator>
+#include <vector>
+
+#include <boost/iterator/iterator_facade.hpp>
+#include <boost/iterator/iterator_categories.hpp>
+
+#include <boost/geometry/core/tag.hpp>
+
+
+template <typename RandomAccessIterator>
+class copy_on_dereference_iterator
+ : public boost::iterator_facade
+ <
+ copy_on_dereference_iterator<RandomAccessIterator>,
+ typename std::iterator_traits<RandomAccessIterator>::value_type,
+ boost::random_access_traversal_tag,
+ typename std::iterator_traits<RandomAccessIterator>::value_type,
+ typename std::iterator_traits<RandomAccessIterator>::difference_type
+ >
+{
+private:
+ typedef boost::iterator_facade
+ <
+ copy_on_dereference_iterator<RandomAccessIterator>,
+ typename std::iterator_traits<RandomAccessIterator>::value_type,
+ boost::random_access_traversal_tag,
+ typename std::iterator_traits<RandomAccessIterator>::value_type,
+ typename std::iterator_traits<RandomAccessIterator>::difference_type
+ > base_type;
+
+public:
+ typedef typename base_type::reference reference;
+ typedef typename base_type::difference_type difference_type;
+
+ copy_on_dereference_iterator() {}
+ copy_on_dereference_iterator(RandomAccessIterator it) : m_it(it) {}
+
+ template <typename OtherRAI>
+ copy_on_dereference_iterator
+ (copy_on_dereference_iterator<OtherRAI> const& other)
+ : m_it(other.m_it)
+ {}
+
+private:
+ friend class boost::iterator_core_access;
+
+ template <typename OtherRAI>
+ friend class copy_on_dereference_iterator;
+
+ inline reference dereference() const { return *m_it; }
+ inline void increment() { ++m_it; }
+ inline void decrement() { --m_it; }
+ inline void advance(difference_type n) { m_it += n; }
+
+ template <typename OtherRAI>
+ inline bool equal(copy_on_dereference_iterator<OtherRAI> const& other) const
+ {
+ return m_it == other.m_it;
+ }
+
+ template <typename OtherRAI>
+ inline difference_type
+ distance_to(copy_on_dereference_iterator<OtherRAI> const& other) const
+ {
+ return std::distance(m_it, other.m_it);
+ }
+
+private:
+ RandomAccessIterator m_it;
+};
+
+
+template <typename Value>
+class range_copy_on_dereference : private std::vector<Value>
+{
+private:
+ typedef std::vector<Value> base_type;
+
+public:
+ typedef typename base_type::size_type size_type;
+
+ typedef copy_on_dereference_iterator
+ <
+ typename base_type::const_iterator
+ > const_iterator;
+
+ typedef const_iterator iterator;
+
+ inline iterator begin()
+ {
+ return iterator(base_type::begin());
+ }
+
+ inline iterator end()
+ {
+ return iterator(base_type::end());
+ }
+
+ inline const_iterator begin() const
+ {
+ return const_iterator(base_type::begin());
+ }
+
+ inline const_iterator end() const
+ {
+ return const_iterator(base_type::end());
+ }
+
+ inline void clear()
+ {
+ base_type::clear();
+ }
+
+ inline void push_back(Value const& value)
+ {
+ base_type::push_back(value);
+ }
+
+ inline void resize(std::size_t n)
+ {
+ base_type::resize(n);
+ }
+
+ inline size_type size() const
+ {
+ return base_type::size();
+ }
+};
+
+
+template <typename Point>
+struct multipoint_copy_on_dereference : range_copy_on_dereference<Point>
+{};
+
+template <typename Point>
+struct linestring_copy_on_dereference : range_copy_on_dereference<Point>
+{};
+
+
+namespace boost { namespace geometry
+{
+
+namespace traits
+{
+
+template <typename Point>
+struct tag< multipoint_copy_on_dereference<Point> >
+{
+ typedef multi_point_tag type;
+};
+
+template <typename Point>
+struct tag< linestring_copy_on_dereference<Point> >
+{
+ typedef linestring_tag type;
+};
+
+} // namespace traits
+
+}} // namespace boost::geometry
+
+
+#endif // GEOMETRY_TEST_TEST_GEOMETRIES_COPY_ON_DEREFERENCE_GEOMETRIES_HPP
diff --git a/libs/geometry/test/util/Jamfile.v2 b/libs/geometry/test/util/Jamfile.v2
index 70a4637779..39ef14af27 100644
--- a/libs/geometry/test/util/Jamfile.v2
+++ b/libs/geometry/test/util/Jamfile.v2
@@ -8,6 +8,7 @@
# Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
#
# Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
+# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
#
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,12 +16,14 @@
test-suite boost-geometry-util
:
- [ run calculation_type.cpp ]
- [ run for_each_coordinate.cpp ]
- [ run math_sqrt.cpp ]
- [ run promote_integral.cpp ]
- [ run range.cpp ]
- [ run rational.cpp ]
- [ run select_most_precise.cpp ]
- [ run write_dsv.cpp ]
+ [ run calculation_type.cpp : : : : util_calculation_type ]
+ [ run for_each_coordinate.cpp : : : : util_for_each_coordinate ]
+ [ run math_abs.cpp : : : : util_math_abs ]
+ [ run math_equals.cpp : : : : util_math_equals ]
+ [ run math_sqrt.cpp : : : : util_math_sqrt ]
+ [ run promote_integral.cpp : : : : util_promote_integral ]
+ [ run range.cpp : : : : util_range ]
+ [ run rational.cpp : : : : util_rational ]
+ [ run select_most_precise.cpp : : : : util_select_most_precise ]
+ [ run write_dsv.cpp : : : : util_write_dsv ]
;
diff --git a/libs/geometry/test/util/math_abs.cpp b/libs/geometry/test/util/math_abs.cpp
new file mode 100644
index 0000000000..c1cfbf51e5
--- /dev/null
+++ b/libs/geometry/test/util/math_abs.cpp
@@ -0,0 +1,102 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2015, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Adam Wulkiewicz, 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_math_abs
+#endif
+
+#include <cmath>
+#include <iostream>
+
+#include <boost/test/included/unit_test.hpp>
+
+#include <boost/config.hpp>
+
+#include "number_types.hpp"
+
+// important: the include above must precede the include below,
+// otherwise the test will fail for the custom number type:
+// custom_with_global_sqrt
+
+#include <boost/geometry/util/math.hpp>
+#include <boost/geometry/algorithms/not_implemented.hpp>
+
+#ifdef HAVE_TTMATH
+# include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
+#endif
+
+namespace bg = boost::geometry;
+namespace bgm = boost::geometry::math;
+
+template <typename T>
+bool eq(T const& l, T const& r)
+{
+ return !(l < r || r < l);
+}
+
+BOOST_AUTO_TEST_CASE( test_math_abs )
+{
+ {
+ float p1 = bgm::pi<float>();
+ double p2 = bgm::pi<double>();
+ long double p3 = bgm::pi<long double>();
+
+ BOOST_CHECK(bgm::abs(p1) == p1);
+ BOOST_CHECK(bgm::abs(p2) == p2);
+ BOOST_CHECK(bgm::abs(p3) == p3);
+
+ float n1 = -p1;
+ double n2 = -p2;
+ long double n3 = -p3;
+
+ BOOST_CHECK(bgm::abs(n1) == p1);
+ BOOST_CHECK(bgm::abs(n2) == p2);
+ BOOST_CHECK(bgm::abs(n3) == p3);
+ }
+
+ {
+ number_types::custom<double> p1(bgm::pi<double>());
+ number_types::custom_with_global_sqrt<double> p2(bgm::pi<double>());
+ custom_global<double> p3(bgm::pi<double>());
+ custom_raw<double> p4(bgm::pi<double>());
+
+ BOOST_CHECK(eq(bgm::abs(p1), p1));
+ BOOST_CHECK(eq(bgm::abs(p2), p2));
+ BOOST_CHECK(eq(bgm::abs(p3), p3));
+ BOOST_CHECK(eq(bgm::abs(p4), p4));
+
+ number_types::custom<double> n1 = -p1;
+ number_types::custom_with_global_sqrt<double> n2 = -p2;
+ custom_global<double> n3 = -p3;
+ custom_raw<double> n4 = -p4;
+
+ BOOST_CHECK(eq(bgm::abs(n1), p1));
+ BOOST_CHECK(eq(bgm::abs(n2), p2));
+ BOOST_CHECK(eq(bgm::abs(n3), p3));
+ BOOST_CHECK(eq(bgm::abs(n4), p4));
+ }
+
+#ifdef HAVE_TTMATH
+ {
+ ttmath_big p1 = bgm::pi<ttmath_big>();
+ ttmath::Big<1, 4> p1 = bgm::pi<ttmath::Big<1, 4> >();
+
+ BOOST_CHECK(bgm::abs(p1) == p1);
+ BOOST_CHECK(bgm::abs(p2) == p2);
+
+ ttmath_big n1 = -p1;
+ ttmath::Big<1, 4> n2 = -p2;
+
+ BOOST_CHECK(bgm::abs(n1) == p1);
+ BOOST_CHECK(bgm::abs(n2) == p2);
+ }
+#endif
+}
+
diff --git a/libs/geometry/test/util/math_equals.cpp b/libs/geometry/test/util/math_equals.cpp
new file mode 100644
index 0000000000..0f26f6951e
--- /dev/null
+++ b/libs/geometry/test/util/math_equals.cpp
@@ -0,0 +1,79 @@
+// Boost.Geometry
+// Unit Test
+
+// Copyright (c) 2015 Oracle and/or its affiliates.
+
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
+// 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 <limits>
+#include <boost/geometry/util/condition.hpp>
+#include <boost/geometry/util/math.hpp>
+
+namespace bgm = bg::math;
+
+template <typename T>
+void test_all()
+{
+ BOOST_CHECK(bgm::equals(0, 0));
+ BOOST_CHECK(bgm::equals(1, 1));
+ BOOST_CHECK(bgm::equals(123456, 123456));
+
+ T eps = std::numeric_limits<T>::epsilon();
+ if ( eps > 0 )
+ {
+ BOOST_CHECK(bgm::equals(0, 0+eps));
+ BOOST_CHECK(bgm::equals(0+eps, 0));
+ BOOST_CHECK(bgm::equals(1, 1+eps));
+ BOOST_CHECK(bgm::equals(1+eps, 1));
+ BOOST_CHECK(bgm::equals(12345+eps, 12345));
+ }
+
+ if (BOOST_GEOMETRY_CONDITION(std::numeric_limits<T>::has_infinity))
+ {
+ T inf = std::numeric_limits<T>::infinity();
+ BOOST_CHECK(!bgm::equals(0, inf));
+ BOOST_CHECK(!bgm::equals(0, -inf));
+ BOOST_CHECK(!bgm::equals(1, inf));
+ BOOST_CHECK(!bgm::equals(1, -inf));
+ BOOST_CHECK(!bgm::equals(12345, inf));
+ BOOST_CHECK(!bgm::equals(12345, -inf));
+ BOOST_CHECK(!bgm::equals(inf, 0));
+ BOOST_CHECK(!bgm::equals(-inf, 0));
+ BOOST_CHECK(!bgm::equals(inf, 1));
+ BOOST_CHECK(!bgm::equals(-inf, 1));
+ BOOST_CHECK(!bgm::equals(inf, 12345));
+ BOOST_CHECK(!bgm::equals(-inf, 12345));
+ BOOST_CHECK(bgm::equals(inf, inf));
+ BOOST_CHECK(bgm::equals(-inf, -inf));
+ BOOST_CHECK(!bgm::equals(inf, -inf));
+ BOOST_CHECK(!bgm::equals(-inf, inf));
+ }
+
+ if (BOOST_GEOMETRY_CONDITION(std::numeric_limits<T>::has_quiet_NaN))
+ {
+ T nan = std::numeric_limits<T>::quiet_NaN();
+ BOOST_CHECK(!bgm::equals(0, nan));
+ BOOST_CHECK(!bgm::equals(nan, 0));
+ BOOST_CHECK(!bgm::equals(nan, nan));
+ BOOST_CHECK(!bgm::equals(1, nan));
+ BOOST_CHECK(!bgm::equals(nan, 1));
+ BOOST_CHECK(!bgm::equals(12345, nan));
+ BOOST_CHECK(!bgm::equals(nan, 12345));
+ }
+}
+
+int test_main(int, char* [])
+{
+ test_all<int>();
+ test_all<float>();
+ test_all<double>();
+
+ return 0;
+}
diff --git a/libs/geometry/test/util/number_types.hpp b/libs/geometry/test/util/number_types.hpp
index bec68bf934..815dc956dc 100644
--- a/libs/geometry/test/util/number_types.hpp
+++ b/libs/geometry/test/util/number_types.hpp
@@ -1,9 +1,10 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
-// Copyright (c) 2014, Oracle and/or its affiliates.
+// Copyright (c) 2014-2015 Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
@@ -50,6 +51,12 @@ inline custom<T> sqrt(custom<T> const& c)
return custom<T>(std::sqrt(c.m_value));
}
+template <typename T>
+inline custom<T> fabs(custom<T> const& c)
+{
+ return custom<T>(c.m_value < T(0) ? c.m_value : -c.m_value);
+}
+
} // namespace number_types
@@ -96,7 +103,13 @@ sqrt(number_types::custom_with_global_sqrt<T> const& c)
return number_types::custom_with_global_sqrt<T>(std::sqrt(c.m_value));
}
-
+template <typename T>
+inline number_types::custom_with_global_sqrt<T>
+fabs(number_types::custom_with_global_sqrt<T> const& c)
+{
+ return number_types::custom_with_global_sqrt<T>
+ (c.m_value < T(0) ? c.m_value : -c.m_value);
+}
@@ -136,4 +149,39 @@ inline custom_global<T> sqrt(custom_global<T> const& c)
return custom_global<T>(std::sqrt(c.m_value));
}
+template <typename T>
+inline custom_global<T> fabs(custom_global<T> const& c)
+{
+ return custom_global<T>(c.m_value < T(0) ? c.m_value : -c.m_value);
+}
+
+
+
+// custom number type without functions definition
+template <typename T>
+struct custom_raw
+{
+ typedef custom_raw<T> self;
+
+ T m_value;
+
+ custom_raw() : m_value(0) {}
+ explicit custom_raw(T const& value) : m_value(value) {}
+
+ bool operator<(self const& other) const
+ {
+ return m_value < other.m_value;
+ }
+
+ self operator-() const
+ {
+ return self(-m_value);
+ }
+
+ self operator-(self const& other) const
+ {
+ return self(m_value - other.m_value);
+ }
+};
+
#endif // BOOST_GEOMETRY_TEST_UTIL_NUMBER_TYPES_HPP