summaryrefslogtreecommitdiff
path: root/libs/geometry/test
diff options
context:
space:
mode:
Diffstat (limited to 'libs/geometry/test')
-rw-r--r--libs/geometry/test/Jamfile.v232
-rw-r--r--libs/geometry/test/algorithms/Jamfile.v250
-rw-r--r--libs/geometry/test/algorithms/algorithms_tests.sln193
-rw-r--r--libs/geometry/test/algorithms/append.cpp105
-rw-r--r--libs/geometry/test/algorithms/append.vcproj174
-rw-r--r--libs/geometry/test/algorithms/area.cpp274
-rw-r--r--libs/geometry/test/algorithms/area.vcproj174
-rw-r--r--libs/geometry/test/algorithms/assign.cpp273
-rw-r--r--libs/geometry/test/algorithms/assign.vcproj174
-rw-r--r--libs/geometry/test/algorithms/buffer.cpp55
-rw-r--r--libs/geometry/test/algorithms/buffer.vcproj174
-rw-r--r--libs/geometry/test/algorithms/centroid.cpp149
-rw-r--r--libs/geometry/test/algorithms/centroid.vcproj174
-rw-r--r--libs/geometry/test/algorithms/comparable_distance.cpp146
-rw-r--r--libs/geometry/test/algorithms/comparable_distance.vcproj174
-rw-r--r--libs/geometry/test/algorithms/convert.cpp323
-rw-r--r--libs/geometry/test/algorithms/convert.vcproj174
-rw-r--r--libs/geometry/test/algorithms/convex_hull.cpp66
-rw-r--r--libs/geometry/test/algorithms/convex_hull.vcproj174
-rw-r--r--libs/geometry/test/algorithms/correct.cpp182
-rw-r--r--libs/geometry/test/algorithms/correct.vcproj174
-rw-r--r--libs/geometry/test/algorithms/covered_by.cpp149
-rw-r--r--libs/geometry/test/algorithms/covered_by.vcproj174
-rw-r--r--libs/geometry/test/algorithms/detail/Jamfile.v216
-rw-r--r--libs/geometry/test/algorithms/detail/detail.sln19
-rw-r--r--libs/geometry/test/algorithms/detail/partition.cpp476
-rw-r--r--libs/geometry/test/algorithms/detail/partition.vcproj174
-rw-r--r--libs/geometry/test/algorithms/detail/sections/Jamfile.v215
-rw-r--r--libs/geometry/test/algorithms/detail/sections/range_by_section.cpp102
-rw-r--r--libs/geometry/test/algorithms/detail/sections/range_by_section.vcproj174
-rw-r--r--libs/geometry/test/algorithms/detail/sections/sectionalize.cpp341
-rw-r--r--libs/geometry/test/algorithms/detail/sections/sectionalize.sln25
-rw-r--r--libs/geometry/test/algorithms/detail/sections/sectionalize.vcproj174
-rw-r--r--libs/geometry/test/algorithms/difference.cpp518
-rw-r--r--libs/geometry/test/algorithms/difference.vcproj174
-rw-r--r--libs/geometry/test/algorithms/disjoint.cpp237
-rw-r--r--libs/geometry/test/algorithms/disjoint.vcproj174
-rw-r--r--libs/geometry/test/algorithms/distance.cpp317
-rw-r--r--libs/geometry/test/algorithms/distance.vcproj174
-rw-r--r--libs/geometry/test/algorithms/envelope.cpp80
-rw-r--r--libs/geometry/test/algorithms/envelope.vcproj174
-rw-r--r--libs/geometry/test/algorithms/equals.cpp162
-rw-r--r--libs/geometry/test/algorithms/equals.vcproj174
-rw-r--r--libs/geometry/test/algorithms/expand.cpp153
-rw-r--r--libs/geometry/test/algorithms/expand.vcproj174
-rw-r--r--libs/geometry/test/algorithms/for_each.cpp81
-rw-r--r--libs/geometry/test/algorithms/for_each.vcproj174
-rw-r--r--libs/geometry/test/algorithms/intersection.cpp535
-rw-r--r--libs/geometry/test/algorithms/intersection.vcproj176
-rw-r--r--libs/geometry/test/algorithms/intersection_segment.cpp134
-rw-r--r--libs/geometry/test/algorithms/intersects.cpp168
-rw-r--r--libs/geometry/test/algorithms/intersects.vcproj174
-rw-r--r--libs/geometry/test/algorithms/length.cpp55
-rw-r--r--libs/geometry/test/algorithms/length.vcproj174
-rw-r--r--libs/geometry/test/algorithms/make.cpp137
-rw-r--r--libs/geometry/test/algorithms/make.vcproj174
-rw-r--r--libs/geometry/test/algorithms/overlaps.cpp59
-rw-r--r--libs/geometry/test/algorithms/overlaps.vcproj174
-rw-r--r--libs/geometry/test/algorithms/overlay/Jamfile.v221
-rw-r--r--libs/geometry/test/algorithms/overlay/assemble.cpp199
-rw-r--r--libs/geometry/test/algorithms/overlay/assemble.vcproj174
-rw-r--r--libs/geometry/test/algorithms/overlay/ccw_traverse.cpp346
-rw-r--r--libs/geometry/test/algorithms/overlay/ccw_traverse.vcproj174
-rw-r--r--libs/geometry/test/algorithms/overlay/dissolver.cpp219
-rw-r--r--libs/geometry/test/algorithms/overlay/dissolver.vcproj174
-rw-r--r--libs/geometry/test/algorithms/overlay/enrich_intersection_points.cpp186
-rw-r--r--libs/geometry/test/algorithms/overlay/enrich_intersection_points.vcproj174
-rw-r--r--libs/geometry/test/algorithms/overlay/get_turn_info.cpp859
-rw-r--r--libs/geometry/test/algorithms/overlay/get_turn_info.vcproj174
-rw-r--r--libs/geometry/test/algorithms/overlay/get_turn_info.xlsbin0 -> 133120 bytes
-rw-r--r--libs/geometry/test/algorithms/overlay/get_turns.cpp385
-rw-r--r--libs/geometry/test/algorithms/overlay/get_turns.vcproj174
-rw-r--r--libs/geometry/test/algorithms/overlay/merge_intersection_points.vcproj173
-rw-r--r--libs/geometry/test/algorithms/overlay/overlay.sln61
-rw-r--r--libs/geometry/test/algorithms/overlay/overlay_cases.hpp711
-rw-r--r--libs/geometry/test/algorithms/overlay/overlay_common.hpp464
-rw-r--r--libs/geometry/test/algorithms/overlay/relative_order.cpp207
-rw-r--r--libs/geometry/test/algorithms/overlay/relative_order.vcproj174
-rw-r--r--libs/geometry/test/algorithms/overlay/robustness/interior_triangles.cpp163
-rw-r--r--libs/geometry/test/algorithms/overlay/robustness/interior_triangles.vcproj223
-rw-r--r--libs/geometry/test/algorithms/overlay/robustness/intersection_pies.cpp300
-rw-r--r--libs/geometry/test/algorithms/overlay/robustness/intersection_pies.vcproj223
-rw-r--r--libs/geometry/test/algorithms/overlay/robustness/intersection_stars.cpp182
-rw-r--r--libs/geometry/test/algorithms/overlay/robustness/intersection_stars.vcproj223
-rw-r--r--libs/geometry/test/algorithms/overlay/robustness/intersects.cpp174
-rw-r--r--libs/geometry/test/algorithms/overlay/robustness/intersects.vcproj223
-rw-r--r--libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.cpp252
-rw-r--r--libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.vcproj223
-rw-r--r--libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.cpp217
-rw-r--r--libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.vcproj223
-rw-r--r--libs/geometry/test/algorithms/overlay/robustness/robustness.sln55
-rw-r--r--libs/geometry/test/algorithms/overlay/robustness/star_comb.cpp146
-rw-r--r--libs/geometry/test/algorithms/overlay/robustness/star_comb.hpp130
-rw-r--r--libs/geometry/test/algorithms/overlay/robustness/star_comb.vcproj223
-rw-r--r--libs/geometry/test/algorithms/overlay/robustness/test_overlay_p_q.hpp210
-rw-r--r--libs/geometry/test/algorithms/overlay/select_rings.cpp130
-rw-r--r--libs/geometry/test/algorithms/overlay/select_rings.vcproj174
-rw-r--r--libs/geometry/test/algorithms/overlay/self_intersection_points.cpp247
-rw-r--r--libs/geometry/test/algorithms/overlay/self_intersection_points.vcproj174
-rw-r--r--libs/geometry/test/algorithms/overlay/split_rings.cpp155
-rw-r--r--libs/geometry/test/algorithms/overlay/split_rings.vcproj173
-rw-r--r--libs/geometry/test/algorithms/overlay/traverse.cpp1030
-rw-r--r--libs/geometry/test/algorithms/overlay/traverse.vcproj174
-rw-r--r--libs/geometry/test/algorithms/overlay/traverse_gmp.cpp209
-rw-r--r--libs/geometry/test/algorithms/perimeter.cpp63
-rw-r--r--libs/geometry/test/algorithms/perimeter.vcproj174
-rw-r--r--libs/geometry/test/algorithms/reverse.cpp75
-rw-r--r--libs/geometry/test/algorithms/reverse.vcproj174
-rw-r--r--libs/geometry/test/algorithms/simplify.cpp107
-rw-r--r--libs/geometry/test/algorithms/simplify.vcproj174
-rw-r--r--libs/geometry/test/algorithms/test_area.hpp84
-rw-r--r--libs/geometry/test/algorithms/test_centroid.hpp99
-rw-r--r--libs/geometry/test/algorithms/test_convert.hpp69
-rw-r--r--libs/geometry/test/algorithms/test_convex_hull.hpp127
-rw-r--r--libs/geometry/test/algorithms/test_covered_by.hpp123
-rw-r--r--libs/geometry/test/algorithms/test_difference.hpp310
-rw-r--r--libs/geometry/test/algorithms/test_distance.hpp158
-rw-r--r--libs/geometry/test/algorithms/test_envelope.hpp107
-rw-r--r--libs/geometry/test/algorithms/test_equals.hpp58
-rw-r--r--libs/geometry/test/algorithms/test_expand.hpp56
-rw-r--r--libs/geometry/test/algorithms/test_for_each.hpp277
-rw-r--r--libs/geometry/test/algorithms/test_intersection.hpp241
-rw-r--r--libs/geometry/test/algorithms/test_intersects.hpp67
-rw-r--r--libs/geometry/test/algorithms/test_length.hpp64
-rw-r--r--libs/geometry/test/algorithms/test_overlaps.hpp44
-rw-r--r--libs/geometry/test/algorithms/test_overlay.hpp161
-rw-r--r--libs/geometry/test/algorithms/test_perimeter.hpp64
-rw-r--r--libs/geometry/test/algorithms/test_relate.hpp33
-rw-r--r--libs/geometry/test/algorithms/test_reverse.hpp38
-rw-r--r--libs/geometry/test/algorithms/test_simplify.hpp96
-rw-r--r--libs/geometry/test/algorithms/test_touches.hpp61
-rw-r--r--libs/geometry/test/algorithms/test_union.hpp174
-rw-r--r--libs/geometry/test/algorithms/test_unique.hpp39
-rw-r--r--libs/geometry/test/algorithms/test_within.hpp126
-rw-r--r--libs/geometry/test/algorithms/touches.cpp154
-rw-r--r--libs/geometry/test/algorithms/touches.vcproj174
-rw-r--r--libs/geometry/test/algorithms/transform.cpp140
-rw-r--r--libs/geometry/test/algorithms/transform.vcproj174
-rw-r--r--libs/geometry/test/algorithms/union.cpp442
-rw-r--r--libs/geometry/test/algorithms/union.vcproj176
-rw-r--r--libs/geometry/test/algorithms/unique.cpp60
-rw-r--r--libs/geometry/test/algorithms/unique.vcproj174
-rw-r--r--libs/geometry/test/algorithms/within.cpp271
-rw-r--r--libs/geometry/test/algorithms/within.vcproj174
-rw-r--r--libs/geometry/test/arithmetic/Jamfile.v215
-rw-r--r--libs/geometry/test/arithmetic/arithmetic.cpp144
-rw-r--r--libs/geometry/test/arithmetic/arithmetic.vcproj169
-rw-r--r--libs/geometry/test/arithmetic/arithmetic_tests.sln25
-rw-r--r--libs/geometry/test/arithmetic/dot_product.cpp53
-rw-r--r--libs/geometry/test/arithmetic/dot_product.vcproj169
-rw-r--r--libs/geometry/test/boost.vsprops21
-rw-r--r--libs/geometry/test/concepts/Jamfile.v215
-rw-r--r--libs/geometry/test/concepts/concepts_tests.sln25
-rw-r--r--libs/geometry/test/concepts/linestring_concept.cpp77
-rw-r--r--libs/geometry/test/concepts/linestring_concept.vcproj172
-rw-r--r--libs/geometry/test/core/Jamfile.v226
-rw-r--r--libs/geometry/test/core/access.cpp133
-rw-r--r--libs/geometry/test/core/access.vcproj174
-rw-r--r--libs/geometry/test/core/coordinate_dimension.cpp74
-rw-r--r--libs/geometry/test/core/coordinate_system.cpp101
-rw-r--r--libs/geometry/test/core/coordinate_type.cpp78
-rw-r--r--libs/geometry/test/core/core.sln37
-rw-r--r--libs/geometry/test/core/geometry_id.cpp73
-rw-r--r--libs/geometry/test/core/point_type.cpp82
-rw-r--r--libs/geometry/test/core/radian_access.cpp110
-rw-r--r--libs/geometry/test/core/radian_access.vcproj174
-rw-r--r--libs/geometry/test/core/reverse_dispatch.cpp65
-rw-r--r--libs/geometry/test/core/reverse_dispatch.vcproj174
-rw-r--r--libs/geometry/test/core/ring.cpp74
-rw-r--r--libs/geometry/test/core/ring.vcproj174
-rw-r--r--libs/geometry/test/core/tag.cpp74
-rw-r--r--libs/geometry/test/core/topological_dimension.cpp73
-rw-r--r--libs/geometry/test/geometries/Jamfile.v228
-rw-r--r--libs/geometry/test/geometries/adapted.cpp112
-rw-r--r--libs/geometry/test/geometries/boost_array_as_point.cpp36
-rw-r--r--libs/geometry/test/geometries/boost_array_as_point.vcproj174
-rw-r--r--libs/geometry/test/geometries/boost_fusion.cpp71
-rw-r--r--libs/geometry/test/geometries/boost_fusion.vcproj174
-rw-r--r--libs/geometry/test/geometries/boost_polygon.cpp174
-rw-r--r--libs/geometry/test/geometries/boost_polygon.vcproj174
-rw-r--r--libs/geometry/test/geometries/boost_polygon_overlay.cpp122
-rw-r--r--libs/geometry/test/geometries/boost_polygon_overlay.vcproj174
-rw-r--r--libs/geometry/test/geometries/boost_range.cpp116
-rw-r--r--libs/geometry/test/geometries/boost_range.vcproj174
-rw-r--r--libs/geometry/test/geometries/boost_tuple.cpp39
-rw-r--r--libs/geometry/test/geometries/box.cpp105
-rw-r--r--libs/geometry/test/geometries/box.vcproj174
-rw-r--r--libs/geometry/test/geometries/concepts/check.cpp76
-rw-r--r--libs/geometry/test/geometries/concepts/check.sln19
-rw-r--r--libs/geometry/test/geometries/concepts/check.vcproj173
-rw-r--r--libs/geometry/test/geometries/custom_linestring.cpp128
-rw-r--r--libs/geometry/test/geometries/custom_linestring.vcproj174
-rw-r--r--libs/geometry/test/geometries/geometries_tests.sln61
-rw-r--r--libs/geometry/test/geometries/segment.cpp101
-rw-r--r--libs/geometry/test/geometries/segment.vcproj174
-rw-r--r--libs/geometry/test/geometry_test_common.hpp165
-rw-r--r--libs/geometry/test/io/Jamfile.v211
-rw-r--r--libs/geometry/test/io/wkt/Jamfile.v215
-rw-r--r--libs/geometry/test/io/wkt/io_wkt_tests.sln19
-rw-r--r--libs/geometry/test/io/wkt/wkt.cpp248
-rw-r--r--libs/geometry/test/io/wkt/wkt.vcproj174
-rw-r--r--libs/geometry/test/iterators/Jamfile.v215
-rw-r--r--libs/geometry/test/iterators/closing_iterator.cpp119
-rw-r--r--libs/geometry/test/iterators/closing_iterator.vcproj178
-rw-r--r--libs/geometry/test/iterators/ever_circling_iterator.cpp97
-rw-r--r--libs/geometry/test/iterators/ever_circling_iterator.vcproj178
-rw-r--r--libs/geometry/test/iterators/iterators.sln25
-rw-r--r--libs/geometry/test/multi/Jamfile.v212
-rw-r--r--libs/geometry/test/multi/algorithms/Jamfile.v242
-rw-r--r--libs/geometry/test/multi/algorithms/multi_area.cpp39
-rw-r--r--libs/geometry/test/multi/algorithms/multi_area.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_centroid.cpp122
-rw-r--r--libs/geometry/test/multi/algorithms/multi_centroid.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_clear.cpp69
-rw-r--r--libs/geometry/test/multi/algorithms/multi_convert.cpp102
-rw-r--r--libs/geometry/test/multi/algorithms/multi_convert.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_convex_hull.cpp92
-rw-r--r--libs/geometry/test/multi/algorithms/multi_convex_hull.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_correct.cpp63
-rw-r--r--libs/geometry/test/multi/algorithms/multi_correct.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_covered_by.cpp59
-rw-r--r--libs/geometry/test/multi/algorithms/multi_covered_by.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_difference.cpp216
-rw-r--r--libs/geometry/test/multi/algorithms/multi_difference.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_disjoint.cpp157
-rw-r--r--libs/geometry/test/multi/algorithms/multi_disjoint.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_distance.cpp171
-rw-r--r--libs/geometry/test/multi/algorithms/multi_distance.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_envelope.cpp71
-rw-r--r--libs/geometry/test/multi/algorithms/multi_envelope.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_equals.cpp57
-rw-r--r--libs/geometry/test/multi/algorithms/multi_equals.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_for_each.cpp84
-rw-r--r--libs/geometry/test/multi/algorithms/multi_for_each.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_intersection.cpp227
-rw-r--r--libs/geometry/test/multi/algorithms/multi_intersection.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_intersects.cpp51
-rw-r--r--libs/geometry/test/multi/algorithms/multi_length.cpp38
-rw-r--r--libs/geometry/test/multi/algorithms/multi_length.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_num_geometries.cpp62
-rw-r--r--libs/geometry/test/multi/algorithms/multi_num_geometries.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_num_interior_rings.cpp55
-rw-r--r--libs/geometry/test/multi/algorithms/multi_num_interior_rings.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_num_points.cpp72
-rw-r--r--libs/geometry/test/multi/algorithms/multi_num_points.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_perimeter.cpp39
-rw-r--r--libs/geometry/test/multi/algorithms/multi_perimeter.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_reverse.cpp57
-rw-r--r--libs/geometry/test/multi/algorithms/multi_reverse.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_simplify.cpp68
-rw-r--r--libs/geometry/test/multi/algorithms/multi_simplify.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_touches.cpp80
-rw-r--r--libs/geometry/test/multi/algorithms/multi_touches.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_transform.cpp97
-rw-r--r--libs/geometry/test/multi/algorithms/multi_transform.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_union.cpp149
-rw-r--r--libs/geometry/test/multi/algorithms/multi_union.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_unique.cpp60
-rw-r--r--libs/geometry/test/multi/algorithms/multi_unique.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/multi_within.cpp59
-rw-r--r--libs/geometry/test/multi/algorithms/multi_within.vcproj174
-rw-r--r--libs/geometry/test/multi/algorithms/overlay/Jamfile.v214
-rw-r--r--libs/geometry/test/multi/algorithms/overlay/multi_overlay.sln19
-rw-r--r--libs/geometry/test/multi/algorithms/overlay/multi_overlay_cases.hpp446
-rw-r--r--libs/geometry/test/multi/algorithms/overlay/multi_overlay_common.hpp40
-rw-r--r--libs/geometry/test/multi/algorithms/overlay/multi_traverse.cpp447
-rw-r--r--libs/geometry/test/multi/algorithms/overlay/multi_traverse.vcproj174
-rw-r--r--libs/geometry/test/multi/io/Jamfile.v212
-rw-r--r--libs/geometry/test/multi/io/dsv/Jamfile.v215
-rw-r--r--libs/geometry/test/multi/io/dsv/dsv.cpp100
-rw-r--r--libs/geometry/test/multi/io/dsv/dsv.sln19
-rw-r--r--libs/geometry/test/multi/io/dsv/dsv.vcproj174
-rw-r--r--libs/geometry/test/multi/io/wkt/Jamfile.v215
-rw-r--r--libs/geometry/test/multi/io/wkt/io_wkt_tests.sln27
-rw-r--r--libs/geometry/test/multi/io/wkt/wkt.cpp103
-rw-r--r--libs/geometry/test/multi/io/wkt/wkt.vcproj174
-rw-r--r--libs/geometry/test/multi/multi_tests.sln163
-rw-r--r--libs/geometry/test/point_concept/Jamfile.v222
-rw-r--r--libs/geometry/test/point_concept/array_point.cpp29
-rw-r--r--libs/geometry/test/point_concept/concept_checker.cpp76
-rw-r--r--libs/geometry/test/point_concept/function_asserting_a_point.hpp30
-rw-r--r--libs/geometry/test/point_concept/function_requiring_a_point.hpp32
-rw-r--r--libs/geometry/test/point_concept/point_with_incorrect_dimension.cpp58
-rw-r--r--libs/geometry/test/point_concept/point_without_coordinate_type.cpp53
-rw-r--r--libs/geometry/test/point_concept/point_without_dimension.cpp55
-rw-r--r--libs/geometry/test/point_concept/point_without_getter.cpp51
-rw-r--r--libs/geometry/test/point_concept/point_without_setter.cpp51
-rw-r--r--libs/geometry/test/point_concept/well_formed_point.cpp34
-rw-r--r--libs/geometry/test/point_concept/well_formed_point_traits.cpp88
-rw-r--r--libs/geometry/test/policies/Jamfile.v214
-rw-r--r--libs/geometry/test/policies/compare.cpp245
-rw-r--r--libs/geometry/test/policies/compare.vcproj174
-rw-r--r--libs/geometry/test/policies/policy_tests.sln19
-rw-r--r--libs/geometry/test/robustness/common/common_settings.hpp32
-rw-r--r--libs/geometry/test/robustness/common/make_square_polygon.hpp46
-rw-r--r--libs/geometry/test/robustness/convex_hull/Jamfile.v218
-rw-r--r--libs/geometry/test/robustness/convex_hull/random_multi_points.cpp225
-rw-r--r--libs/geometry/test/robustness/convex_hull/random_multi_points.sln20
-rw-r--r--libs/geometry/test/robustness/convex_hull/random_multi_points.vcproj223
-rw-r--r--libs/geometry/test/robustness/overlay/buffer/Jamfile.v219
-rw-r--r--libs/geometry/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp352
-rw-r--r--libs/geometry/test/robustness/overlay/buffer/recursive_polygons_buffer.sln20
-rw-r--r--libs/geometry/test/robustness/overlay/buffer/recursive_polygons_buffer.vcproj222
-rw-r--r--libs/geometry/test/robustness/overlay/linear_areal/Jamfile.v219
-rw-r--r--libs/geometry/test/robustness/overlay/linear_areal/recursive_polygons_linear_areal.cpp501
-rw-r--r--libs/geometry/test/robustness/overlay/linear_areal/recursive_polygons_linear_areal.sln20
-rw-r--r--libs/geometry/test/robustness/overlay/linear_areal/recursive_polygons_linear_areal.vcproj223
-rw-r--r--libs/geometry/test/strategies/Jamfile.v221
-rw-r--r--libs/geometry/test/strategies/cross_track.cpp151
-rw-r--r--libs/geometry/test/strategies/cross_track.vcproj174
-rw-r--r--libs/geometry/test/strategies/haversine.cpp274
-rw-r--r--libs/geometry/test/strategies/haversine.vcproj174
-rw-r--r--libs/geometry/test/strategies/projected_point.cpp188
-rw-r--r--libs/geometry/test/strategies/projected_point.vcproj174
-rw-r--r--libs/geometry/test/strategies/pythagoras.cpp362
-rw-r--r--libs/geometry/test/strategies/pythagoras.vcproj174
-rw-r--r--libs/geometry/test/strategies/segment_intersection.cpp374
-rw-r--r--libs/geometry/test/strategies/segment_intersection.vcproj174
-rw-r--r--libs/geometry/test/strategies/segment_intersection_collinear.cpp256
-rw-r--r--libs/geometry/test/strategies/segment_intersection_collinear.vcproj174
-rw-r--r--libs/geometry/test/strategies/spherical_side.cpp142
-rw-r--r--libs/geometry/test/strategies/spherical_side.vcproj174
-rw-r--r--libs/geometry/test/strategies/strategies_tests.sln73
-rw-r--r--libs/geometry/test/strategies/transform_cs.cpp149
-rw-r--r--libs/geometry/test/strategies/transform_cs.vcproj174
-rw-r--r--libs/geometry/test/strategies/transformer.cpp113
-rw-r--r--libs/geometry/test/strategies/transformer.vcproj174
-rw-r--r--libs/geometry/test/strategies/within.cpp194
-rw-r--r--libs/geometry/test/strategies/within.vcproj174
-rw-r--r--libs/geometry/test/test_common/test_point.hpp94
-rw-r--r--libs/geometry/test/test_common/with_pointer.hpp87
-rw-r--r--libs/geometry/test/test_geometries/all_custom_container.hpp137
-rw-r--r--libs/geometry/test/test_geometries/all_custom_linestring.hpp137
-rw-r--r--libs/geometry/test/test_geometries/all_custom_polygon.hpp130
-rw-r--r--libs/geometry/test/test_geometries/all_custom_ring.hpp142
-rw-r--r--libs/geometry/test/test_geometries/custom_segment.hpp58
-rw-r--r--libs/geometry/test/test_geometries/wrapped_boost_array.hpp151
-rw-r--r--libs/geometry/test/ttmath.vsprops15
-rw-r--r--libs/geometry/test/util/Jamfile.v218
-rw-r--r--libs/geometry/test/util/as_range.cpp79
-rw-r--r--libs/geometry/test/util/as_range.vcproj174
-rw-r--r--libs/geometry/test/util/calculation_type.cpp206
-rw-r--r--libs/geometry/test/util/calculation_type.vcproj174
-rw-r--r--libs/geometry/test/util/for_each_coordinate.cpp84
-rw-r--r--libs/geometry/test/util/for_each_coordinate.vcproj174
-rw-r--r--libs/geometry/test/util/rational.cpp61
-rw-r--r--libs/geometry/test/util/rational.vcproj174
-rw-r--r--libs/geometry/test/util/select_most_precise.cpp69
-rw-r--r--libs/geometry/test/util/select_most_precise.vcproj174
-rw-r--r--libs/geometry/test/util/util_tests.sln49
-rw-r--r--libs/geometry/test/util/write_dsv.cpp73
-rw-r--r--libs/geometry/test/util/write_dsv.vcproj174
-rw-r--r--libs/geometry/test/views/Jamfile.v218
-rw-r--r--libs/geometry/test/views/box_view.cpp81
-rw-r--r--libs/geometry/test/views/box_view.vcproj178
-rw-r--r--libs/geometry/test/views/closeable_view.cpp134
-rw-r--r--libs/geometry/test/views/closeable_view.vcproj176
-rw-r--r--libs/geometry/test/views/reversible_closeable.cpp165
-rw-r--r--libs/geometry/test/views/reversible_closeable.vcproj176
-rw-r--r--libs/geometry/test/views/reversible_view.cpp81
-rw-r--r--libs/geometry/test/views/reversible_view.vcproj176
-rw-r--r--libs/geometry/test/views/segment_view.cpp86
-rw-r--r--libs/geometry/test/views/segment_view.vcproj178
-rw-r--r--libs/geometry/test/views/views.sln43
364 files changed, 52740 insertions, 0 deletions
diff --git a/libs/geometry/test/Jamfile.v2 b/libs/geometry/test/Jamfile.v2
new file mode 100644
index 000000000..d91542951
--- /dev/null
+++ b/libs/geometry/test/Jamfile.v2
@@ -0,0 +1,32 @@
+# 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)
+
+import testing ;
+
+project boost-geometry-test
+ :
+ requirements
+ <include>.
+ <include>../../../boost/geometry/extensions/contrib/ttmath
+ <toolset>msvc:<asynch-exceptions>on
+ ;
+
+build-project core ;
+build-project point_concept ;
+build-project geometries ;
+build-project arithmetic ;
+build-project algorithms ;
+build-project iterators ;
+build-project strategies ;
+build-project policies ;
+build-project io ;
+build-project util ;
+build-project views ;
+build-project multi ;
diff --git a/libs/geometry/test/algorithms/Jamfile.v2 b/libs/geometry/test/algorithms/Jamfile.v2
new file mode 100644
index 000000000..13811d303
--- /dev/null
+++ b/libs/geometry/test/algorithms/Jamfile.v2
@@ -0,0 +1,50 @@
+# 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-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 covered_by.cpp ]
+ [ run difference.cpp ]
+ [ run disjoint.cpp ]
+ [ run distance.cpp ]
+ [ run envelope.cpp ]
+ [ run equals.cpp ]
+ [ run expand.cpp ]
+ [ run for_each.cpp ]
+ [ run intersection.cpp ]
+ [ run intersects.cpp ]
+ [ run length.cpp ]
+ [ run make.cpp ]
+ [ run overlaps.cpp ]
+ [ run perimeter.cpp ]
+ [ run reverse.cpp ]
+ [ run simplify.cpp ]
+ [ run touches.cpp ]
+ [ run transform.cpp ]
+ [ run union.cpp ]
+ [ run unique.cpp ]
+ [ run within.cpp ]
+ ;
+
+build-project overlay
+ ;
+
+build-project detail
+ ;
+
diff --git a/libs/geometry/test/algorithms/algorithms_tests.sln b/libs/geometry/test/algorithms/algorithms_tests.sln
new file mode 100644
index 000000000..96ba06492
--- /dev/null
+++ b/libs/geometry/test/algorithms/algorithms_tests.sln
@@ -0,0 +1,193 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "append", "append.vcproj", "{774F6471-D8A0-481C-9B0A-4903EED25C70}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "area", "area.vcproj", "{E86E6687-AC05-4DBE-A8BD-C47BCB6AEE90}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assign", "assign.vcproj", "{94BC6547-67C1-44DB-903D-526537A91E23}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "expand", "expand.vcproj", "{5330DAB1-DF27-44FC-971B-3C5094F82FA3}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "convex_hull", "convex_hull.vcproj", "{0AFF7A85-63A7-4178-92A5-CC692B09F5B9}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "distance", "distance.vcproj", "{347D08A4-22E9-45B1-A55B-AE84AA2EAA53}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "envelope", "envelope.vcproj", "{26EFCAF4-7907-4A47-ACBF-6CAB738CDCEB}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make", "make.vcproj", "{BCD17F3E-8DF2-4B00-A75E-BF7372D2873B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simplify", "simplify.vcproj", "{B1760CB8-553B-42AB-B54E-3D0320FF252F}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "transform", "transform.vcproj", "{41413E56-08DA-4592-94D2-5311FE90C62B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "buffer", "buffer.vcproj", "{C66E1F6F-84F6-44E2-B5E8-2B127065BE31}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "for_each", "for_each.vcproj", "{774F6471-D8A0-481C-9B0A-4903EAD25B70}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "disjoint", "disjoint.vcproj", "{96D51D96-B35F-47C8-864D-371DF2280686}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "centroid", "centroid.vcproj", "{1E90E5BC-1280-4A6A-B197-132ABBF97EB9}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "intersection", "intersection.vcproj", "{2FD8EDAB-B3C3-4654-B6C3-B25C12A063D3}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "correct", "correct.vcproj", "{71582BDA-D4DF-400D-8630-378BE102C038}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "within", "within.vcproj", "{C7BCD670-543D-4B29-B2D6-F3169949F79D}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "length", "length.vcproj", "{C4D75B1E-34D5-4A98-8535-A9535BE949E4}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "perimeter", "perimeter.vcproj", "{EFC23FC0-86D3-4C81-A218-26F0D5A4D50B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "union", "union.vcproj", "{CA5EE1D6-CB4B-4A15-85C5-31D5C00289C4}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "overlaps", "overlaps.vcproj", "{30C37854-9ED6-4C1E-97FB-BF8637BD5811}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "intersects", "intersects.vcproj", "{B1A97F62-85CD-4239-BB56-619988B08260}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "equals", "equals.vcproj", "{E54F493F-BF9D-4A6D-AE2F-5F97AC95251A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "difference", "difference.vcproj", "{4EBFC27A-75C9-43A1-8DDA-AFEB45C564DC}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unique", "unique.vcproj", "{104D31F9-49BA-4A1A-B84F-0A3AEE3C4DB2}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reverse", "reverse.vcproj", "{14B5DFC5-D511-4D8C-A231-EE90A05687E1}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "comparable_distance", "comparable_distance.vcproj", "{F11970B5-BE16-4FF5-9780-4C15082B76A0}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "convert", "convert.vcproj", "{FABF1AA7-F695-49F8-92F6-AB6C4B0C088A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "covered_by", "covered_by.vcproj", "{5ABF0B56-F9F1-4D93-B15A-E3972F45D97B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "touches", "touches.vcproj", "{8359726E-9F03-4300-8F63-1FEAC84251D0}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {774F6471-D8A0-481C-9B0A-4903EED25C70}.Debug|Win32.ActiveCfg = Debug|Win32
+ {774F6471-D8A0-481C-9B0A-4903EED25C70}.Debug|Win32.Build.0 = Debug|Win32
+ {774F6471-D8A0-481C-9B0A-4903EED25C70}.Release|Win32.ActiveCfg = Release|Win32
+ {774F6471-D8A0-481C-9B0A-4903EED25C70}.Release|Win32.Build.0 = Release|Win32
+ {E86E6687-AC05-4DBE-A8BD-C47BCB6AEE90}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E86E6687-AC05-4DBE-A8BD-C47BCB6AEE90}.Debug|Win32.Build.0 = Debug|Win32
+ {E86E6687-AC05-4DBE-A8BD-C47BCB6AEE90}.Release|Win32.ActiveCfg = Release|Win32
+ {E86E6687-AC05-4DBE-A8BD-C47BCB6AEE90}.Release|Win32.Build.0 = Release|Win32
+ {94BC6547-67C1-44DB-903D-526537A91E23}.Debug|Win32.ActiveCfg = Debug|Win32
+ {94BC6547-67C1-44DB-903D-526537A91E23}.Debug|Win32.Build.0 = Debug|Win32
+ {94BC6547-67C1-44DB-903D-526537A91E23}.Release|Win32.ActiveCfg = Release|Win32
+ {94BC6547-67C1-44DB-903D-526537A91E23}.Release|Win32.Build.0 = Release|Win32
+ {5330DAB1-DF27-44FC-971B-3C5094F82FA3}.Debug|Win32.ActiveCfg = Debug|Win32
+ {5330DAB1-DF27-44FC-971B-3C5094F82FA3}.Debug|Win32.Build.0 = Debug|Win32
+ {5330DAB1-DF27-44FC-971B-3C5094F82FA3}.Release|Win32.ActiveCfg = Release|Win32
+ {5330DAB1-DF27-44FC-971B-3C5094F82FA3}.Release|Win32.Build.0 = Release|Win32
+ {0AFF7A85-63A7-4178-92A5-CC692B09F5B9}.Debug|Win32.ActiveCfg = Debug|Win32
+ {0AFF7A85-63A7-4178-92A5-CC692B09F5B9}.Debug|Win32.Build.0 = Debug|Win32
+ {0AFF7A85-63A7-4178-92A5-CC692B09F5B9}.Release|Win32.ActiveCfg = Release|Win32
+ {0AFF7A85-63A7-4178-92A5-CC692B09F5B9}.Release|Win32.Build.0 = Release|Win32
+ {347D08A4-22E9-45B1-A55B-AE84AA2EAA53}.Debug|Win32.ActiveCfg = Debug|Win32
+ {347D08A4-22E9-45B1-A55B-AE84AA2EAA53}.Debug|Win32.Build.0 = Debug|Win32
+ {347D08A4-22E9-45B1-A55B-AE84AA2EAA53}.Release|Win32.ActiveCfg = Release|Win32
+ {347D08A4-22E9-45B1-A55B-AE84AA2EAA53}.Release|Win32.Build.0 = Release|Win32
+ {26EFCAF4-7907-4A47-ACBF-6CAB738CDCEB}.Debug|Win32.ActiveCfg = Debug|Win32
+ {26EFCAF4-7907-4A47-ACBF-6CAB738CDCEB}.Debug|Win32.Build.0 = Debug|Win32
+ {26EFCAF4-7907-4A47-ACBF-6CAB738CDCEB}.Release|Win32.ActiveCfg = Release|Win32
+ {26EFCAF4-7907-4A47-ACBF-6CAB738CDCEB}.Release|Win32.Build.0 = Release|Win32
+ {BCD17F3E-8DF2-4B00-A75E-BF7372D2873B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {BCD17F3E-8DF2-4B00-A75E-BF7372D2873B}.Debug|Win32.Build.0 = Debug|Win32
+ {BCD17F3E-8DF2-4B00-A75E-BF7372D2873B}.Release|Win32.ActiveCfg = Release|Win32
+ {BCD17F3E-8DF2-4B00-A75E-BF7372D2873B}.Release|Win32.Build.0 = Release|Win32
+ {B1760CB8-553B-42AB-B54E-3D0320FF252F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B1760CB8-553B-42AB-B54E-3D0320FF252F}.Debug|Win32.Build.0 = Debug|Win32
+ {B1760CB8-553B-42AB-B54E-3D0320FF252F}.Release|Win32.ActiveCfg = Release|Win32
+ {B1760CB8-553B-42AB-B54E-3D0320FF252F}.Release|Win32.Build.0 = Release|Win32
+ {41413E56-08DA-4592-94D2-5311FE90C62B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {41413E56-08DA-4592-94D2-5311FE90C62B}.Debug|Win32.Build.0 = Debug|Win32
+ {41413E56-08DA-4592-94D2-5311FE90C62B}.Release|Win32.ActiveCfg = Release|Win32
+ {41413E56-08DA-4592-94D2-5311FE90C62B}.Release|Win32.Build.0 = Release|Win32
+ {C66E1F6F-84F6-44E2-B5E8-2B127065BE31}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C66E1F6F-84F6-44E2-B5E8-2B127065BE31}.Debug|Win32.Build.0 = Debug|Win32
+ {C66E1F6F-84F6-44E2-B5E8-2B127065BE31}.Release|Win32.ActiveCfg = Release|Win32
+ {C66E1F6F-84F6-44E2-B5E8-2B127065BE31}.Release|Win32.Build.0 = Release|Win32
+ {774F6471-D8A0-481C-9B0A-4903EAD25B70}.Debug|Win32.ActiveCfg = Debug|Win32
+ {774F6471-D8A0-481C-9B0A-4903EAD25B70}.Debug|Win32.Build.0 = Debug|Win32
+ {774F6471-D8A0-481C-9B0A-4903EAD25B70}.Release|Win32.ActiveCfg = Release|Win32
+ {774F6471-D8A0-481C-9B0A-4903EAD25B70}.Release|Win32.Build.0 = Release|Win32
+ {96D51D96-B35F-47C8-864D-371DF2280686}.Debug|Win32.ActiveCfg = Debug|Win32
+ {96D51D96-B35F-47C8-864D-371DF2280686}.Debug|Win32.Build.0 = Debug|Win32
+ {96D51D96-B35F-47C8-864D-371DF2280686}.Release|Win32.ActiveCfg = Release|Win32
+ {96D51D96-B35F-47C8-864D-371DF2280686}.Release|Win32.Build.0 = Release|Win32
+ {1E90E5BC-1280-4A6A-B197-132ABBF97EB9}.Debug|Win32.ActiveCfg = Debug|Win32
+ {1E90E5BC-1280-4A6A-B197-132ABBF97EB9}.Debug|Win32.Build.0 = Debug|Win32
+ {1E90E5BC-1280-4A6A-B197-132ABBF97EB9}.Release|Win32.ActiveCfg = Release|Win32
+ {1E90E5BC-1280-4A6A-B197-132ABBF97EB9}.Release|Win32.Build.0 = Release|Win32
+ {2FD8EDAB-B3C3-4654-B6C3-B25C12A063D3}.Debug|Win32.ActiveCfg = Debug|Win32
+ {2FD8EDAB-B3C3-4654-B6C3-B25C12A063D3}.Debug|Win32.Build.0 = Debug|Win32
+ {2FD8EDAB-B3C3-4654-B6C3-B25C12A063D3}.Release|Win32.ActiveCfg = Release|Win32
+ {2FD8EDAB-B3C3-4654-B6C3-B25C12A063D3}.Release|Win32.Build.0 = Release|Win32
+ {71582BDA-D4DF-400D-8630-378BE102C038}.Debug|Win32.ActiveCfg = Debug|Win32
+ {71582BDA-D4DF-400D-8630-378BE102C038}.Debug|Win32.Build.0 = Debug|Win32
+ {71582BDA-D4DF-400D-8630-378BE102C038}.Release|Win32.ActiveCfg = Release|Win32
+ {71582BDA-D4DF-400D-8630-378BE102C038}.Release|Win32.Build.0 = Release|Win32
+ {C7BCD670-543D-4B29-B2D6-F3169949F79D}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C7BCD670-543D-4B29-B2D6-F3169949F79D}.Debug|Win32.Build.0 = Debug|Win32
+ {C7BCD670-543D-4B29-B2D6-F3169949F79D}.Release|Win32.ActiveCfg = Release|Win32
+ {C7BCD670-543D-4B29-B2D6-F3169949F79D}.Release|Win32.Build.0 = Release|Win32
+ {C4D75B1E-34D5-4A98-8535-A9535BE949E4}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C4D75B1E-34D5-4A98-8535-A9535BE949E4}.Debug|Win32.Build.0 = Debug|Win32
+ {C4D75B1E-34D5-4A98-8535-A9535BE949E4}.Release|Win32.ActiveCfg = Release|Win32
+ {C4D75B1E-34D5-4A98-8535-A9535BE949E4}.Release|Win32.Build.0 = Release|Win32
+ {EFC23FC0-86D3-4C81-A218-26F0D5A4D50B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {EFC23FC0-86D3-4C81-A218-26F0D5A4D50B}.Debug|Win32.Build.0 = Debug|Win32
+ {EFC23FC0-86D3-4C81-A218-26F0D5A4D50B}.Release|Win32.ActiveCfg = Release|Win32
+ {EFC23FC0-86D3-4C81-A218-26F0D5A4D50B}.Release|Win32.Build.0 = Release|Win32
+ {CA5EE1D6-CB4B-4A15-85C5-31D5C00289C4}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CA5EE1D6-CB4B-4A15-85C5-31D5C00289C4}.Debug|Win32.Build.0 = Debug|Win32
+ {CA5EE1D6-CB4B-4A15-85C5-31D5C00289C4}.Release|Win32.ActiveCfg = Release|Win32
+ {CA5EE1D6-CB4B-4A15-85C5-31D5C00289C4}.Release|Win32.Build.0 = Release|Win32
+ {30C37854-9ED6-4C1E-97FB-BF8637BD5811}.Debug|Win32.ActiveCfg = Debug|Win32
+ {30C37854-9ED6-4C1E-97FB-BF8637BD5811}.Debug|Win32.Build.0 = Debug|Win32
+ {30C37854-9ED6-4C1E-97FB-BF8637BD5811}.Release|Win32.ActiveCfg = Release|Win32
+ {30C37854-9ED6-4C1E-97FB-BF8637BD5811}.Release|Win32.Build.0 = Release|Win32
+ {B1A97F62-85CD-4239-BB56-619988B08260}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B1A97F62-85CD-4239-BB56-619988B08260}.Debug|Win32.Build.0 = Debug|Win32
+ {B1A97F62-85CD-4239-BB56-619988B08260}.Release|Win32.ActiveCfg = Release|Win32
+ {B1A97F62-85CD-4239-BB56-619988B08260}.Release|Win32.Build.0 = Release|Win32
+ {E54F493F-BF9D-4A6D-AE2F-5F97AC95251A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E54F493F-BF9D-4A6D-AE2F-5F97AC95251A}.Debug|Win32.Build.0 = Debug|Win32
+ {E54F493F-BF9D-4A6D-AE2F-5F97AC95251A}.Release|Win32.ActiveCfg = Release|Win32
+ {E54F493F-BF9D-4A6D-AE2F-5F97AC95251A}.Release|Win32.Build.0 = Release|Win32
+ {4EBFC27A-75C9-43A1-8DDA-AFEB45C564DC}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4EBFC27A-75C9-43A1-8DDA-AFEB45C564DC}.Debug|Win32.Build.0 = Debug|Win32
+ {4EBFC27A-75C9-43A1-8DDA-AFEB45C564DC}.Release|Win32.ActiveCfg = Release|Win32
+ {4EBFC27A-75C9-43A1-8DDA-AFEB45C564DC}.Release|Win32.Build.0 = Release|Win32
+ {104D31F9-49BA-4A1A-B84F-0A3AEE3C4DB2}.Debug|Win32.ActiveCfg = Debug|Win32
+ {104D31F9-49BA-4A1A-B84F-0A3AEE3C4DB2}.Debug|Win32.Build.0 = Debug|Win32
+ {104D31F9-49BA-4A1A-B84F-0A3AEE3C4DB2}.Release|Win32.ActiveCfg = Release|Win32
+ {104D31F9-49BA-4A1A-B84F-0A3AEE3C4DB2}.Release|Win32.Build.0 = Release|Win32
+ {14B5DFC5-D511-4D8C-A231-EE90A05687E1}.Debug|Win32.ActiveCfg = Debug|Win32
+ {14B5DFC5-D511-4D8C-A231-EE90A05687E1}.Debug|Win32.Build.0 = Debug|Win32
+ {14B5DFC5-D511-4D8C-A231-EE90A05687E1}.Release|Win32.ActiveCfg = Release|Win32
+ {14B5DFC5-D511-4D8C-A231-EE90A05687E1}.Release|Win32.Build.0 = Release|Win32
+ {F11970B5-BE16-4FF5-9780-4C15082B76A0}.Debug|Win32.ActiveCfg = Debug|Win32
+ {F11970B5-BE16-4FF5-9780-4C15082B76A0}.Debug|Win32.Build.0 = Debug|Win32
+ {F11970B5-BE16-4FF5-9780-4C15082B76A0}.Release|Win32.ActiveCfg = Release|Win32
+ {F11970B5-BE16-4FF5-9780-4C15082B76A0}.Release|Win32.Build.0 = Release|Win32
+ {FABF1AA7-F695-49F8-92F6-AB6C4B0C088A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {FABF1AA7-F695-49F8-92F6-AB6C4B0C088A}.Debug|Win32.Build.0 = Debug|Win32
+ {FABF1AA7-F695-49F8-92F6-AB6C4B0C088A}.Release|Win32.ActiveCfg = Release|Win32
+ {FABF1AA7-F695-49F8-92F6-AB6C4B0C088A}.Release|Win32.Build.0 = Release|Win32
+ {5ABF0B56-F9F1-4D93-B15A-E3972F45D97B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {5ABF0B56-F9F1-4D93-B15A-E3972F45D97B}.Debug|Win32.Build.0 = Debug|Win32
+ {5ABF0B56-F9F1-4D93-B15A-E3972F45D97B}.Release|Win32.ActiveCfg = Release|Win32
+ {5ABF0B56-F9F1-4D93-B15A-E3972F45D97B}.Release|Win32.Build.0 = Release|Win32
+ {8359726E-9F03-4300-8F63-1FEAC84251D0}.Debug|Win32.ActiveCfg = Debug|Win32
+ {8359726E-9F03-4300-8F63-1FEAC84251D0}.Debug|Win32.Build.0 = Debug|Win32
+ {8359726E-9F03-4300-8F63-1FEAC84251D0}.Release|Win32.ActiveCfg = Release|Win32
+ {8359726E-9F03-4300-8F63-1FEAC84251D0}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/algorithms/append.cpp b/libs/geometry/test/algorithms/append.cpp
new file mode 100644
index 000000000..7c7728eeb
--- /dev/null
+++ b/libs/geometry/test/algorithms/append.cpp
@@ -0,0 +1,105 @@
+// 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.
+
+// 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 <deque>
+#include <vector>
+
+#include <boost/concept/requires.hpp>
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/core/access.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/register/linestring.hpp>
+#include <boost/variant/variant.hpp>
+
+#include <test_common/test_point.hpp>
+#include <test_geometries/wrapped_boost_array.hpp>
+
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque)
+
+
+template <typename G>
+void test_geometry(G& geometry, bool check)
+{
+ typedef typename bg::point_type<G>::type P;
+
+ bg::append(geometry, bg::make_zero<P>());
+ if (check)
+ {
+ BOOST_CHECK_EQUAL(bg::num_points(geometry), 1u);
+ }
+
+ // Append a range
+ std::vector<P> v;
+ v.push_back(bg::make_zero<P>());
+ v.push_back(bg::make_zero<P>());
+ bg::append(geometry, v);
+
+ if (check)
+ {
+ BOOST_CHECK_EQUAL(bg::num_points(geometry), 3u);
+ }
+
+ bg::clear(geometry);
+
+ if (check)
+ {
+ BOOST_CHECK_EQUAL(bg::num_points(geometry), 0u);
+ }
+
+ //P p = boost::range::front(geometry);
+}
+
+template <typename G>
+void test_geometry_and_variant(bool check = true)
+{
+ G geometry;
+ boost::variant<G> variant_geometry = G();
+ test_geometry(geometry, check);
+ test_geometry(variant_geometry, check);
+}
+
+template <typename P>
+void test_all()
+{
+ test_geometry_and_variant<P>(false);
+ test_geometry_and_variant<bg::model::box<P> >(false);
+ test_geometry_and_variant<bg::model::segment<P> >(false);
+ test_geometry_and_variant<bg::model::linestring<P> >();
+ test_geometry_and_variant<bg::model::ring<P> >();
+ test_geometry_and_variant<bg::model::polygon<P> >();
+
+ test_geometry_and_variant<std::vector<P> >();
+ test_geometry_and_variant<std::deque<P> >();
+ //test_geometry_and_variant<std::list<P> >();
+}
+
+int test_main(int, char* [])
+{
+ test_all<test::test_point>();
+ test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+#ifdef HAVE_TTMATH
+ test_all<bg::model::point<ttmath_big, 2, bg::cs::cartesian> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/append.vcproj b/libs/geometry/test/algorithms/append.vcproj
new file mode 100644
index 000000000..b162dd1b0
--- /dev/null
+++ b/libs/geometry/test/algorithms/append.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="append"
+ ProjectGUID="{774F6471-D8A0-481C-9B0A-4903EED25C70}"
+ RootNamespace="append"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\append"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\append"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\append.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/area.cpp b/libs/geometry/test/algorithms/area.cpp
new file mode 100644
index 000000000..1d05439f6
--- /dev/null
+++ b/libs/geometry/test/algorithms/area.cpp
@@ -0,0 +1,274 @@
+// 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.
+
+// 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 <algorithms/test_area.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+#include <boost/geometry/geometries/ring.hpp>
+#include <boost/geometry/geometries/polygon.hpp>
+
+#include <test_geometries/all_custom_ring.hpp>
+#include <test_geometries/all_custom_polygon.hpp>
+//#define GEOMETRY_TEST_DEBUG
+
+#include <boost/variant/variant.hpp>
+
+template <typename Polygon>
+void test_polygon()
+{
+ // Rotated square, length=sqrt(2) -> area=2
+ test_geometry<Polygon>("POLYGON((1 1,2 2,3 1,2 0,1 1))", 2.0);
+ test_geometry<Polygon>("POLYGON((1 1,2 2,3 1,2 0,1 1))", 2.0);
+ test_geometry<Polygon>("POLYGON((0 0,0 7,4 2,2 0,0 0))", 16.0);
+ test_geometry<Polygon>("POLYGON((1 1,2 1,2 2,1 2,1 1))", -1.0);
+ test_geometry<Polygon>("POLYGON((0 0,0 7,4 2,2 0,0 0), (1 1,2 1,2 2,1 2,1 1))", 15.0);
+}
+
+
+template <typename P>
+void test_all()
+{
+ test_geometry<bg::model::box<P> >("POLYGON((0 0,2 2))", 4.0);
+ test_geometry<bg::model::box<P> >("POLYGON((2 2,0 0))", 4.0);
+
+ test_polygon<bg::model::polygon<P> >();
+ test_polygon<all_custom_polygon<P> >();
+
+ // clockwise rings (second is wrongly ordered)
+ test_geometry<bg::model::ring<P> >("POLYGON((0 0,0 7,4 2,2 0,0 0))", 16.0);
+ test_geometry<bg::model::ring<P> >("POLYGON((0 0,2 0,4 2,0 7,0 0))", -16.0);
+
+ test_geometry<all_custom_ring<P> >("POLYGON((0 0,0 7,4 2,2 0,0 0))", 16.0);
+
+ // ccw
+ test_geometry<bg::model::polygon<P, false> >
+ ("POLYGON((0 0,0 7,4 2,2 0,0 0), (1 1,2 1,2 2,1 2,1 1))", -15.0);
+}
+
+template <typename Point>
+void test_spherical(bool polar = false)
+{
+ typedef typename bg::coordinate_type<Point>::type ct;
+ bg::model::polygon<Point> geometry;
+
+ // unit-sphere has area of 4-PI. Polygon covering 1/8 of it:
+ // calculations splitted for ttmath
+ ct const four = 4.0;
+ ct const eight = 8.0;
+ ct expected = four * boost::geometry::math::pi<ct>() / eight;
+ bg::read_wkt("POLYGON((0 0,0 90,90 0,0 0))", geometry);
+
+ ct area = bg::area(geometry);
+ BOOST_CHECK_CLOSE(area, expected, 0.0001);
+
+ // With strategy, radius 2 -> 4 pi r^2
+ bg::strategy::area::huiller
+ <
+ typename bg::point_type<Point>::type
+ > strategy(2.0);
+
+ area = bg::area(geometry, strategy);
+ ct const two = 2.0;
+ BOOST_CHECK_CLOSE(area, two * two * expected, 0.0001);
+
+ // Wrangel Island (dateline crossing)
+ // With (spherical) Earth strategy
+ bg::strategy::area::huiller
+ <
+ typename bg::point_type<Point>::type
+ > spherical_earth(6373);
+ bg::read_wkt("POLYGON((-178.7858 70.7852, 177.4758 71.2333, 179.7436 71.5733, -178.7858 70.7852))", geometry);
+ area = bg::area(geometry, spherical_earth);
+ // SQL Server gives: 4537.9654419375
+ // PostGIS gives: 4537.9311668307
+ // Note: those are Geographic, this test is Spherical
+ BOOST_CHECK_CLOSE(area, 4506.6389, 0.001);
+
+ // Wrangel, more in detail
+ bg::read_wkt("POLYGON((-178.568604 71.564148,-178.017548 71.449692,-177.833313 71.3461,-177.502838 71.277466 ,-177.439453 71.226929,-177.620026 71.116638,-177.9389 71.037491,-178.8186 70.979965,-179.274445 70.907761,-180 70.9972,179.678314 70.895538,179.272766 70.888596,178.791016 70.7964,178.617737 71.035538,178.872192 71.217484,179.530273 71.4383 ,-180 71.535843 ,-179.628601 71.577194,-179.305298 71.551361,-179.03421 71.597748,-178.568604 71.564148))", geometry);
+ area = bg::area(geometry, spherical_earth);
+ // SQL Server gives: 7669.10402181435
+ // PostGIS gives: 7669.55565459832
+ BOOST_CHECK_CLOSE(area, 7616.523769, 0.001);
+
+ // Check more at the equator
+ /*
+ select 1,geography::STGeomFromText('POLYGON((-178.7858 10.7852 , 179.7436 11.5733 , 177.4758 11.2333 , -178.7858 10.7852))',4326) .STArea()/1000000.0
+ union select 2,geography::STGeomFromText('POLYGON((-178.7858 20.7852 , 179.7436 21.5733 , 177.4758 21.2333 , -178.7858 20.7852))',4326) .STArea()/1000000.0
+ union select 3,geography::STGeomFromText('POLYGON((-178.7858 30.7852 , 179.7436 31.5733 , 177.4758 31.2333 , -178.7858 30.7852))',4326) .STArea()/1000000.0
+ union select 0,geography::STGeomFromText('POLYGON((-178.7858 0.7852 , 179.7436 1.5733 , 177.4758 1.2333 , -178.7858 0.7852))',4326) .STArea()/1000000.0
+ union select 4,geography::STGeomFromText('POLYGON((-178.7858 40.7852 , 179.7436 41.5733 , 177.4758 41.2333 , -178.7858 40.7852))',4326) .STArea()/1000000.0
+ */
+
+ bg::read_wkt("POLYGON((-178.7858 0.7852, 177.4758 1.2333, 179.7436 1.5733, -178.7858 0.7852))", geometry);
+ area = bg::area(geometry, spherical_earth);
+ BOOST_CHECK_CLOSE(area, 14136.09946, 0.001); // SQL Server gives: 14064.1902284513
+
+
+ bg::read_wkt("POLYGON((-178.7858 10.7852, 177.4758 11.2333, 179.7436 11.5733, -178.7858 10.7852))", geometry);
+ area = bg::area(geometry, spherical_earth);
+ BOOST_CHECK_CLOSE(area, 13760.2456, 0.001); // SQL Server gives: 13697.0941155193
+
+ bg::read_wkt("POLYGON((-178.7858 20.7852, 177.4758 21.2333, 179.7436 21.5733, -178.7858 20.7852))", geometry);
+ area = bg::area(geometry, spherical_earth);
+ BOOST_CHECK_CLOSE(area, 12987.8682, 0.001); // SQL Server gives: 12944.3970990317 -> -39m^2
+
+ bg::read_wkt("POLYGON((-178.7858 30.7852, 177.4758 31.2333, 179.7436 31.5733, -178.7858 30.7852))", geometry);
+ area = bg::area(geometry, spherical_earth);
+ BOOST_CHECK_CLOSE(area, 11856.3935, 0.001); // SQL Server gives: 11838.5338423574 -> -18m^2
+
+ bg::read_wkt("POLYGON((-178.7858 40.7852, 177.4758 41.2333, 179.7436 41.5733, -178.7858 40.7852))", geometry);
+ area = bg::area(geometry, spherical_earth);
+ BOOST_CHECK_CLOSE(area, 10404.627685523914, 0.001); // SQL Server gives: 10412.0607137119, -> +8m^2
+
+ // Concave
+ bg::read_wkt("POLYGON((0 40,1 42,0 44,2 43,4 44,3 42,4 40,2 41,0 40))", geometry);
+ area = bg::area(geometry, spherical_earth);
+ BOOST_CHECK_CLOSE(area, 73538.2958, 0.001); // SQL Server gives: 73604.2047689719
+
+ // With hole POLYGON((0 40,4 40,4 44,0 44,0 40),(1 41,2 43,3 42,1 41))
+ bg::read_wkt("POLYGON((0 40,0 44,4 44,4 40,0 40),(1 41,3 42,2 43,1 41))", geometry);
+ area = bg::area(geometry, spherical_earth);
+ BOOST_CHECK_CLOSE(area, 133233.844876, 0.001); // SQL Server gives: 133353.335
+
+ {
+ 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);
+ if (polar)
+ {
+ // Create colatitudes (measured from pole)
+ BOOST_FOREACH(Point& p, aurha)
+ {
+ bg::set<1>(p, ct(90) - bg::get<1>(p));
+ }
+ bg::correct(aurha);
+ }
+ bg::strategy::area::huiller
+ <
+ typename bg::point_type<Point>::type
+ > huiller(6372.795);
+ area = bg::area(aurha, huiller);
+ BOOST_CHECK_CLOSE(area, 1476.645675, 0.0001);
+
+ // SQL Server gives: 1481.55595960659
+ // for select geography::STGeomFromText('POLYGON((4.892 52.373,4.23 52.08,4.479 51.930,5.119 52.093,4.892 52.373))',4326).STArea()/1000000.0
+ }
+}
+
+template <typename P>
+void test_ccw()
+{
+ typedef bg::model::polygon<P, false> ccw_polygon;
+ // counterclockwise rings (second is wrongly ordered)
+ test_geometry<ccw_polygon>("POLYGON((1 1,2 2,3 1,2 0,1 1))", -2.0);
+ test_geometry<ccw_polygon>("POLYGON((1 1,2 0,3 1,2 2,1 1))", +2.0);
+ test_geometry<ccw_polygon>("POLYGON((0 0,0 7,4 2,2 0,0 0))", -16.0);
+ test_geometry<ccw_polygon>("POLYGON((0 0,2 0,4 2,0 7,0 0))", +16.0);
+}
+
+template <typename P>
+void test_open()
+{
+ typedef bg::model::polygon<P, true, false> open_polygon;
+ test_geometry<open_polygon>("POLYGON((1 1,2 2,3 1,2 0))", 2.0);
+ // Note the triangular testcase used in CCW is not sensible for open/close
+}
+
+template <typename P>
+void test_open_ccw()
+{
+ typedef bg::model::polygon<P, false, false> open_polygon;
+ test_geometry<open_polygon>("POLYGON((1 1,2 0,3 1,2 2))", 2.0);
+ // Note the triangular testcase used in CCW is not sensible for open/close
+}
+
+template <typename P>
+void test_empty_input()
+{
+ bg::model::polygon<P> poly_empty;
+ bg::model::ring<P> ring_empty;
+
+ test_empty_input(poly_empty);
+ test_empty_input(ring_empty);
+}
+
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ bg::model::polygon<int_point_type> int_poly;
+ bg::model::polygon<double_point_type> double_poly;
+
+ std::string const polygon_li = "POLYGON((1872000 528000,1872000 192000,1536119 192000,1536000 528000,1200000 528000,1200000 863880,1536000 863880,1872000 863880,1872000 528000))";
+ bg::read_wkt(polygon_li, int_poly);
+ bg::read_wkt(polygon_li, double_poly);
+
+ double int_area = bg::area(int_poly);
+ double double_area = bg::area(double_poly);
+
+ BOOST_CHECK_CLOSE(int_area, double_area, 0.0001);
+}
+
+void test_variant()
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+ typedef bg::model::polygon<double_point_type> polygon_type;
+ typedef bg::model::box<double_point_type> box_type;
+
+ polygon_type poly;
+ std::string const polygon_li = "POLYGON((18 5,18 1,15 1,15 5,12 5,12 8,15 8,18 8,18 5))";
+ bg::read_wkt(polygon_li, poly);
+
+ box_type box;
+ std::string const box_li = "BOX(0 0,2 2)";
+ bg::read_wkt(box_li, box);
+
+ boost::variant<polygon_type, box_type> v;
+
+ v = poly;
+ BOOST_CHECK_CLOSE(bg::area(v), bg::area(poly), 0.0001);
+ v = box;
+ BOOST_CHECK_CLOSE(bg::area(v), bg::area(box), 0.0001);
+}
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+ test_spherical<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> > >();
+ //test_spherical<bg::model::point<double, 2, bg::cs::spherical<bg::degree> > >(true);
+
+ test_ccw<bg::model::point<double, 2, bg::cs::cartesian> >();
+ test_open<bg::model::point<double, 2, bg::cs::cartesian> >();
+ test_open_ccw<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+#ifdef HAVE_TTMATH
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+ test_spherical<bg::model::point<ttmath_big, 2, bg::cs::spherical_equatorial<bg::degree> > >();
+#endif
+
+ test_large_integers();
+
+ test_variant();
+
+ // test_empty_input<bg::model::d2::point_xy<int> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/area.vcproj b/libs/geometry/test/algorithms/area.vcproj
new file mode 100644
index 000000000..e091e28fa
--- /dev/null
+++ b/libs/geometry/test/algorithms/area.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="area"
+ ProjectGUID="{E86E6687-AC05-4DBE-A8BD-C47BCB6AEE90}"
+ RootNamespace="area"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\area"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\area"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\area.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/assign.cpp b/libs/geometry/test/algorithms/assign.cpp
new file mode 100644
index 000000000..82251db5a
--- /dev/null
+++ b/libs/geometry/test/algorithms/assign.cpp
@@ -0,0 +1,273 @@
+// 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.
+
+// 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/geometry/arithmetic/arithmetic.hpp>
+#include <boost/geometry/algorithms/assign.hpp>
+#include <boost/geometry/algorithms/num_points.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include <test_common/test_point.hpp>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+template <typename Linestring>
+void check_linestring_2d(Linestring const& line)
+{
+ BOOST_CHECK((boost::size(line) == 3));
+ BOOST_CHECK((bg::num_points(line) == 3));
+
+ typedef typename bg::point_type<Linestring>::type point_type;
+ point_type const& p0 = line[0];
+ BOOST_CHECK(bg::get<0>(p0) == 1);
+ BOOST_CHECK(bg::get<1>(p0) == 2);
+
+ point_type const& p1 = line[1];
+ BOOST_CHECK(bg::get<0>(p1) == 3);
+ BOOST_CHECK(bg::get<1>(p1) == 4);
+
+ point_type const& p2 = line[2];
+ BOOST_CHECK(bg::get<0>(p2) == 5);
+ BOOST_CHECK(bg::get<1>(p2) == 6);
+}
+
+template <typename Point>
+void test_assign_linestring_2d()
+{
+ bg::model::linestring<Point> line;
+
+ // Test assignment of plain array (note that this is only possible if adapted c-array is included!)
+ const double coors[3][2] = { {1, 2}, {3, 4}, {5, 6} };
+ bg::assign_points(line, coors);
+ check_linestring_2d(line);
+
+ // Test assignment of point array
+ Point points[3];
+ bg::assign_values(points[0], 1, 2);
+ bg::assign_values(points[1], 3, 4);
+ bg::assign_values(points[2], 5, 6);
+ bg::assign_points(line, points);
+ check_linestring_2d(line);
+
+ // Test assignment of array with different point-type (tuple adaption should be included)
+ boost::tuple<float, float> tuples[3];
+ tuples[0] = boost::make_tuple(1, 2);
+ tuples[1] = boost::make_tuple(3, 4);
+ tuples[2] = boost::make_tuple(5, 6);
+ bg::assign_points(line, tuples);
+ check_linestring_2d(line);
+}
+
+namespace detail
+{
+ template <typename BoxOrSegment>
+ void test_assign_box_or_segment_2d()
+ {
+ BoxOrSegment geometry;
+ bg::assign_values(geometry, 1, 2, 3, 4);
+ BOOST_CHECK((bg::get<bg::min_corner, 0>(geometry) == 1));
+ BOOST_CHECK((bg::get<bg::min_corner, 1>(geometry) == 2));
+ BOOST_CHECK((bg::get<bg::max_corner, 0>(geometry) == 3));
+ BOOST_CHECK((bg::get<bg::max_corner, 1>(geometry) == 4));
+
+ bg::assign_zero(geometry);
+ BOOST_CHECK((bg::get<bg::min_corner, 0>(geometry) == 0));
+ BOOST_CHECK((bg::get<bg::min_corner, 1>(geometry) == 0));
+ BOOST_CHECK((bg::get<bg::max_corner, 0>(geometry) == 0));
+ BOOST_CHECK((bg::get<bg::max_corner, 1>(geometry) == 0));
+
+ bg::assign_inverse(geometry);
+ BOOST_CHECK((bg::get<bg::min_corner, 0>(geometry) > 9999));
+ BOOST_CHECK((bg::get<bg::min_corner, 1>(geometry) > 9999));
+ BOOST_CHECK((bg::get<bg::max_corner, 0>(geometry) < 9999));
+ BOOST_CHECK((bg::get<bg::max_corner, 1>(geometry) < 9999));
+ }
+}
+
+template <typename Point>
+void test_assign_box_or_segment_2d()
+{
+ detail::test_assign_box_or_segment_2d<bg::model::box<Point> >();
+ detail::test_assign_box_or_segment_2d<bg::model::segment<Point> >();
+}
+
+template <typename Point>
+void test_assign_box_2d()
+{
+ detail::test_assign_box_or_segment_2d<bg::model::box<Point> >();
+}
+
+
+template <typename Point>
+void test_assign_point_3d()
+{
+ Point p;
+ bg::assign_values(p, 1, 2, 3);
+ BOOST_CHECK(bg::get<0>(p) == 1);
+ BOOST_CHECK(bg::get<1>(p) == 2);
+ BOOST_CHECK(bg::get<2>(p) == 3);
+
+ bg::assign_value(p, 123);
+ BOOST_CHECK(bg::get<0>(p) == 123);
+ BOOST_CHECK(bg::get<1>(p) == 123);
+ BOOST_CHECK(bg::get<2>(p) == 123);
+
+ bg::assign_zero(p);
+ BOOST_CHECK(bg::get<0>(p) == 0);
+ BOOST_CHECK(bg::get<1>(p) == 0);
+ BOOST_CHECK(bg::get<2>(p) == 0);
+
+}
+
+template <typename P>
+void test_assign_conversion()
+{
+ typedef bg::model::box<P> box_type;
+ typedef bg::model::ring<P> ring_type;
+ typedef bg::model::polygon<P> polygon_type;
+
+ P p;
+ bg::assign_values(p, 1, 2);
+
+ box_type b;
+ bg::assign(b, p);
+
+ BOOST_CHECK_CLOSE((bg::get<0, 0>(b)), 1.0, 0.001);
+ BOOST_CHECK_CLOSE((bg::get<0, 1>(b)), 2.0, 0.001);
+ BOOST_CHECK_CLOSE((bg::get<1, 0>(b)), 1.0, 0.001);
+ BOOST_CHECK_CLOSE((bg::get<1, 1>(b)), 2.0, 0.001);
+
+
+ bg::set<bg::min_corner, 0>(b, 1);
+ bg::set<bg::min_corner, 1>(b, 2);
+ bg::set<bg::max_corner, 0>(b, 3);
+ bg::set<bg::max_corner, 1>(b, 4);
+
+ ring_type ring;
+ bg::assign(ring, b);
+
+ {
+ typedef bg::model::ring<P, false, false> ring_type_ccw;
+ ring_type_ccw ring_ccw;
+ // Should NOT compile (currently): bg::assign(ring_ccw, ring);
+
+ }
+
+
+ //std::cout << bg::wkt(b) << std::endl;
+ //std::cout << bg::wkt(ring) << std::endl;
+
+ typename boost::range_const_iterator<ring_type>::type it = ring.begin();
+ BOOST_CHECK_CLOSE(bg::get<0>(*it), 1.0, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(*it), 2.0, 0.001);
+ it++;
+ BOOST_CHECK_CLOSE(bg::get<0>(*it), 1.0, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(*it), 4.0, 0.001);
+ it++;
+ BOOST_CHECK_CLOSE(bg::get<0>(*it), 3.0, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(*it), 4.0, 0.001);
+ it++;
+ BOOST_CHECK_CLOSE(bg::get<0>(*it), 3.0, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(*it), 2.0, 0.001);
+ it++;
+ BOOST_CHECK_CLOSE(bg::get<0>(*it), 1.0, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(*it), 2.0, 0.001);
+
+ BOOST_CHECK_EQUAL(ring.size(), 5u);
+
+
+ polygon_type polygon;
+
+ bg::assign(polygon, ring);
+ BOOST_CHECK_EQUAL(bg::num_points(polygon), 5u);
+
+ ring_type ring2;
+ bg::assign(ring2, polygon);
+ BOOST_CHECK_EQUAL(bg::num_points(ring2), 5u);
+}
+
+
+template <typename Point>
+void test_assign_point_2d()
+{
+ Point p;
+ bg::assign_values(p, 1, 2);
+ BOOST_CHECK(bg::get<0>(p) == 1);
+ BOOST_CHECK(bg::get<1>(p) == 2);
+
+ bg::assign_value(p, 123);
+ BOOST_CHECK(bg::get<0>(p) == 123);
+ BOOST_CHECK(bg::get<1>(p) == 123);
+
+ bg::assign_zero(p);
+ BOOST_CHECK(bg::get<0>(p) == 0);
+ BOOST_CHECK(bg::get<1>(p) == 0);
+}
+
+
+
+
+
+int test_main(int, char* [])
+{
+ test_assign_point_3d<int[3]>();
+ test_assign_point_3d<float[3]>();
+ test_assign_point_3d<double[3]>();
+ test_assign_point_3d<test::test_point>();
+ test_assign_point_3d<bg::model::point<int, 3, bg::cs::cartesian> >();
+ test_assign_point_3d<bg::model::point<float, 3, bg::cs::cartesian> >();
+ test_assign_point_3d<bg::model::point<double, 3, bg::cs::cartesian> >();
+
+ test_assign_point_2d<int[2]>();
+ test_assign_point_2d<float[2]>();
+ test_assign_point_2d<double[2]>();
+ test_assign_point_2d<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_assign_point_2d<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_assign_point_2d<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+ test_assign_conversion<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+
+ // Segment (currently) cannot handle array's because derived from std::pair
+ test_assign_box_2d<int[2]>();
+ test_assign_box_2d<float[2]>();
+ test_assign_box_2d<double[2]>();
+
+ test_assign_box_or_segment_2d<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_assign_box_or_segment_2d<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_assign_box_or_segment_2d<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+ test_assign_linestring_2d<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_assign_linestring_2d<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_assign_linestring_2d<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+#ifdef HAVE_TTMATH
+ // Next 3 need extra traits for c-array with custom type:
+ // test_assign_point_2d<ttmath_big[2]>();
+ // test_assign_point_3d<ttmath_big[3]>();
+ // test_assign_box_2d<ttmath_big[2]>();
+
+ test_assign_point_2d<bg::model::point<ttmath_big, 2, bg::cs::cartesian> >();
+ test_assign_point_3d<bg::model::point<ttmath_big, 3, bg::cs::cartesian> >();
+ test_assign_box_or_segment_2d<bg::model::point<ttmath_big, 2, bg::cs::cartesian> >();
+ test_assign_linestring_2d<bg::model::point<ttmath_big, 2, bg::cs::cartesian> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/assign.vcproj b/libs/geometry/test/algorithms/assign.vcproj
new file mode 100644
index 000000000..50214b53b
--- /dev/null
+++ b/libs/geometry/test/algorithms/assign.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="assign"
+ ProjectGUID="{94BC6547-67C1-44DB-903D-526537A91E23}"
+ RootNamespace="assign"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\assign"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\assign"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\assign.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/buffer.cpp b/libs/geometry/test/algorithms/buffer.cpp
new file mode 100644
index 000000000..f64a25f9d
--- /dev/null
+++ b/libs/geometry/test/algorithms/buffer.cpp
@@ -0,0 +1,55 @@
+// 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.
+
+// 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/geometry/algorithms/buffer.hpp>
+#include <boost/geometry/core/coordinate_type.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+#include <test_common/test_point.hpp>
+
+
+template <typename P>
+void test_all()
+{
+ typedef typename bg::coordinate_type<P>::type coordinate_type;
+
+ P p1(0, 0);
+ P p2(2, 2);
+ bg::model::box<P> b1(p1, p2);
+
+ bg::model::box<P> b2;
+ bg::buffer(b1, b2, coordinate_type(2));
+
+ // TODO: Check if buffer is correct
+ // using bg::equals to compare boxes
+ // (TODO: implement that)
+}
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+#ifdef HAVE_TTMATH
+ test_all<bg::model::point<ttmath_big, 2, bg::cs::cartesian> >();
+#endif
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/buffer.vcproj b/libs/geometry/test/algorithms/buffer.vcproj
new file mode 100644
index 000000000..60514c768
--- /dev/null
+++ b/libs/geometry/test/algorithms/buffer.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="buffer"
+ ProjectGUID="{C66E1F6F-84F6-44E2-B5E8-2B127065BE31}"
+ RootNamespace="buffer"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\buffer"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\buffer"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\buffer.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/centroid.cpp b/libs/geometry/test/algorithms/centroid.cpp
new file mode 100644
index 000000000..90eca01ab
--- /dev/null
+++ b/libs/geometry/test/algorithms/centroid.cpp
@@ -0,0 +1,149 @@
+// 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.
+
+// 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 <algorithms/test_centroid.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+#include <test_geometries/all_custom_polygon.hpp>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+template <typename Polygon>
+void test_polygon()
+{
+ test_centroid<Polygon>(
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2"
+ ",3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3))",
+ 4.06923363095238, 1.65055803571429);
+
+ // with holes
+ test_centroid<Polygon>(
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2"
+ ",3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3)"
+ ",(4 2,4.2 1.4,4.8 1.9,4.4 2.2,4 2))"
+ ,
+ 4.0466264962959677, 1.6348996057331333);
+
+}
+
+
+template <typename P>
+void test_2d()
+{
+ test_centroid<bg::model::linestring<P> >("LINESTRING(1 1, 2 2, 3 3)", 2.0, 2.0);
+ test_centroid<bg::model::linestring<P> >("LINESTRING(0 0,0 4, 4 4)", 1.0, 3.0);
+ test_centroid<bg::model::linestring<P> >("LINESTRING(0 0,3 3,0 6,3 9,0 12)", 1.5, 6.0);
+
+ test_centroid<bg::model::ring<P> >(
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2"
+ ",3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3))",
+ 4.06923363095238, 1.65055803571429);
+
+ test_polygon<bg::model::polygon<P> >();
+ test_polygon<all_custom_polygon<P> >();
+
+ // ccw
+ test_centroid<bg::model::ring<P, false> >(
+ "POLYGON((2 1.3,2.9 0.7,4.9 0.8,5.4 1.2,5.3 2.6,4.1 3,3.4 2"
+ ",3.7 1.6,3.4 1.2,2.8 1.8,2.4 1.7,2 1.3))",
+ 4.06923363095238, 1.65055803571429);
+
+ // open / closed
+ test_centroid<bg::model::ring<P, true, true> >(
+ "POLYGON((1 1,2 2,3 1,2 0,1 1))", 2.0, 1.0);
+ test_centroid<bg::model::ring<P, true, false> >(
+ "POLYGON((1 1,2 2,3 1,2 0))", 2.0, 1.0);
+
+ test_centroid<bg::model::box<P> >("POLYGON((1 2,3 4))", 2, 3);
+ test_centroid<P>("POINT(3 3)", 3, 3);
+}
+
+
+template <typename P>
+void test_3d()
+{
+ test_centroid<bg::model::linestring<P> >("LINESTRING(1 2 3,4 5 -6,7 -8 9,-10 11 12,13 -14 -15, 16 17 18)",
+ 5.6748865168734692, 0.31974938587214002, 1.9915270387763671);
+ test_centroid<bg::model::box<P> >("POLYGON((1 2 3,5 6 7))", 3, 4, 5);
+ test_centroid<P>("POINT(1 2 3)", 1, 2, 3);
+}
+
+
+template <typename P>
+void test_5d()
+{
+ test_centroid<bg::model::linestring<P> >("LINESTRING(1 2 3 4 95,4 5 -6 24 40,7 -8 9 -5 -7,-10 11 12 -5 5,13 -14 -15 4 3, 16 17 18 5 12)",
+ 4.9202312983547678, 0.69590937869808345, 1.2632138719797417, 6.0468332057401986, 23.082402715244868);
+}
+
+template <typename P>
+void test_exceptions()
+{
+ test_centroid_exception<bg::model::linestring<P> >();
+ test_centroid_exception<bg::model::polygon<P> >();
+ test_centroid_exception<bg::model::ring<P> >();
+}
+
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ bg::model::polygon<int_point_type> int_poly;
+ bg::model::polygon<double_point_type> double_poly;
+
+ std::string const polygon_li = "POLYGON((1872000 528000,1872000 192000,1536119 192000,1536000 528000,1200000 528000,1200000 863880,1536000 863880,1872000 863880,1872000 528000))";
+ bg::read_wkt(polygon_li, int_poly);
+ bg::read_wkt(polygon_li, double_poly);
+
+ int_point_type int_centroid;
+ double_point_type double_centroid;
+
+ bg::centroid(int_poly, int_centroid);
+ bg::centroid(double_poly, double_centroid);
+
+ int_point_type 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));
+ BOOST_CHECK_EQUAL(bg::get<1>(int_centroid), bg::get<1>(double_centroid_as_int));
+}
+
+
+int test_main(int, char* [])
+{
+ test_2d<bg::model::d2::point_xy<double> >();
+ test_2d<boost::tuple<float, float> >();
+ test_2d<bg::model::d2::point_xy<float> >();
+
+ test_3d<boost::tuple<double, double, double> >();
+
+ test_5d<boost::tuple<double, double, double, double, double> >();
+
+#if defined(HAVE_TTMATH)
+ test_2d<bg::model::d2::point_xy<ttmath_big> >();
+ test_3d<boost::tuple<ttmath_big, ttmath_big, ttmath_big> >();
+#endif
+
+ test_large_integers();
+ test_exceptions<bg::model::d2::point_xy<double> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/centroid.vcproj b/libs/geometry/test/algorithms/centroid.vcproj
new file mode 100644
index 000000000..5c908c654
--- /dev/null
+++ b/libs/geometry/test/algorithms/centroid.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="centroid"
+ ProjectGUID="{1E90E5BC-1280-4A6A-B197-132ABBF97EB9}"
+ RootNamespace="centroid"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\centroid"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\centroid"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\centroid.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/comparable_distance.cpp b/libs/geometry/test/algorithms/comparable_distance.cpp
new file mode 100644
index 000000000..294321c4f
--- /dev/null
+++ b/libs/geometry/test/algorithms/comparable_distance.cpp
@@ -0,0 +1,146 @@
+// 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.
+
+// 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 <sstream>
+
+#include <boost/mpl/if.hpp>
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/geometry.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/linestring.hpp>
+
+#include <boost/geometry/algorithms/comparable_distance.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+
+template <typename P>
+void test_distance_result()
+{
+ typedef typename bg::default_distance_result<P, P>::type distance_type;
+
+ P p1 = bg::make<P>(0, 0);
+ P p2 = bg::make<P>(3, 0);
+ P p3 = bg::make<P>(0, 4);
+
+ distance_type dr12 = bg::comparable_distance(p1, p2);
+ distance_type dr13 = bg::comparable_distance(p1, p3);
+ distance_type dr23 = bg::comparable_distance(p2, p3);
+
+ BOOST_CHECK_CLOSE(dr12, 9.000, 0.001);
+ BOOST_CHECK_CLOSE(dr13, 16.000, 0.001);
+ BOOST_CHECK_CLOSE(dr23, 25.000, 0.001);
+
+}
+
+template <typename P>
+void test_distance_point()
+{
+ P p1;
+ bg::set<0>(p1, 1);
+ bg::set<1>(p1, 1);
+
+ P p2;
+ bg::set<0>(p2, 2);
+ bg::set<1>(p2, 2);
+
+ typename bg::coordinate_type<P>::type d = bg::comparable_distance(p1, p2);
+ BOOST_CHECK_CLOSE(d, 2.0, 0.001);
+}
+
+template <typename P>
+void test_distance_segment()
+{
+ typedef typename bg::coordinate_type<P>::type coordinate_type;
+
+ P s1 = bg::make<P>(2, 2);
+ P s2 = bg::make<P>(3, 3);
+
+ // Check points left, right, projected-left, projected-right, on segment
+ P p1 = bg::make<P>(0, 0);
+ P p2 = bg::make<P>(4, 4);
+ P p3 = bg::make<P>(2.4, 2.6);
+ P p4 = bg::make<P>(2.6, 2.4);
+ P p5 = bg::make<P>(2.5, 2.5);
+
+ bg::model::referring_segment<P const> const seg(s1, s2);
+
+ coordinate_type d1 = bg::comparable_distance(p1, seg); BOOST_CHECK_CLOSE(d1, 8.0, 0.001);
+ coordinate_type d2 = bg::comparable_distance(p2, seg); BOOST_CHECK_CLOSE(d2, 2.0, 0.001);
+ coordinate_type d3 = bg::comparable_distance(p3, seg); BOOST_CHECK_CLOSE(d3, 0.02, 0.001);
+ coordinate_type d4 = bg::comparable_distance(p4, seg); BOOST_CHECK_CLOSE(d4, 0.02, 0.001);
+ coordinate_type d5 = bg::comparable_distance(p5, seg); BOOST_CHECK_CLOSE(d5, 0.0, 0.001);
+
+ // Reverse case
+ coordinate_type dr1 = bg::comparable_distance(seg, p1); BOOST_CHECK_CLOSE(dr1, d1, 0.001);
+ coordinate_type dr2 = bg::comparable_distance(seg, p2); BOOST_CHECK_CLOSE(dr2, d2, 0.001);
+}
+
+template <typename P>
+void test_distance_linestring()
+{
+ bg::model::linestring<P> points;
+ points.push_back(bg::make<P>(1, 1));
+ points.push_back(bg::make<P>(3, 3));
+
+ P p = bg::make<P>(2, 1);
+
+ typename bg::coordinate_type<P>::type d = bg::comparable_distance(p, points);
+ BOOST_CHECK_CLOSE(d, 0.5, 0.001);
+
+ p = bg::make<P>(5, 5);
+ d = bg::comparable_distance(p, points);
+ BOOST_CHECK_CLOSE(d, 8.0, 0.001);
+
+
+ bg::model::linestring<P> line;
+ line.push_back(bg::make<P>(1,1));
+ line.push_back(bg::make<P>(2,2));
+ line.push_back(bg::make<P>(3,3));
+
+ p = bg::make<P>(5, 5);
+
+ d = bg::comparable_distance(p, line);
+ BOOST_CHECK_CLOSE(d, 8.0, 0.001);
+
+ // Reverse case
+ d = bg::comparable_distance(line, p);
+ BOOST_CHECK_CLOSE(d, 8.0, 0.001);
+}
+
+template <typename P>
+void test_all()
+{
+ test_distance_result<P>();
+ test_distance_point<P>();
+ test_distance_segment<P>();
+ test_distance_linestring<P>();
+}
+
+int test_main(int, char* [])
+{
+ //test_all<bg::model::d2::point_xy<int> >();
+ 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
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/comparable_distance.vcproj b/libs/geometry/test/algorithms/comparable_distance.vcproj
new file mode 100644
index 000000000..cf9b8ea41
--- /dev/null
+++ b/libs/geometry/test/algorithms/comparable_distance.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="comparable_distance"
+ ProjectGUID="{F11970B5-BE16-4FF5-9780-4C15082B76A0}"
+ RootNamespace="comparable_distance"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\comparable_distance"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\comparable_distance"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\comparable_distance.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/convert.cpp b/libs/geometry/test/algorithms/convert.cpp
new file mode 100644
index 000000000..90856ff4e
--- /dev/null
+++ b/libs/geometry/test/algorithms/convert.cpp
@@ -0,0 +1,323 @@
+// 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.
+
+// 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 <algorithms/test_convert.hpp>
+
+
+
+template <typename Point1, typename Point2>
+void test_mixed_point_types()
+{
+ // Point
+ test_mixed_identical_result<Point1, Point2>("POINT(1 2)");
+
+ // Box
+ test_mixed_identical_result
+ <
+ bg::model::box<Point1>,
+ bg::model::box<Point2>
+ >
+ ("POLYGON((1 2,1 4,3 4,3 2,1 2))");
+
+ test_mixed_identical_result
+ <
+ bg::model::segment<Point1>,
+ bg::model::segment<Point2>
+ >
+ ("LINESTRING(1 1,2 2)");
+
+ // Linestring
+ test_mixed_identical_result
+ <
+ bg::model::linestring<Point1>,
+ bg::model::linestring<Point2>
+ >
+ ("LINESTRING(1 1,2 2)");
+
+ // Ring
+ test_mixed_identical_result
+ <
+ bg::model::ring<Point1>,
+ bg::model::ring<Point2>
+ >
+ ("POLYGON((1 1,2 2,3 0,1 1))");
+
+ test_mixed_reversible_result
+ <
+ bg::model::ring<Point1, true>,
+ bg::model::ring<Point2, false>
+ >
+ (
+ "POLYGON((1 1,2 2,3 0,1 1))",
+ "POLYGON((1 1,3 0,2 2,1 1))"
+ );
+
+ test_mixed
+ <
+ bg::model::ring<Point1, true, true>,
+ bg::model::ring<Point2, true, false>
+ >
+ (
+ "POLYGON((1 1,2 2,3 0,1 1))",
+ "POLYGON((1 1,2 2,3 0))"
+ );
+
+ test_mixed
+ <
+ bg::model::ring<Point1, true, false>,
+ bg::model::ring<Point2, true, true>
+ >
+ (
+ "POLYGON((1 1,2 2,3 0))",
+ "POLYGON((1 1,2 2,3 0,1 1))"
+ );
+
+ // Polygon
+ test_mixed_reversible_result
+ <
+ bg::model::polygon<Point1, true>,
+ bg::model::polygon<Point2, false>
+ >
+ (
+ "POLYGON((0 0,0 5,5 5,5 0,0 0),(1 1,3 2,2 4,1 1))",
+ "POLYGON((0 0,5 0,5 5,0 5,0 0),(1 1,2 4,3 2,1 1))"
+ );
+
+ test_mixed
+ <
+ bg::model::polygon<Point1>,
+ bg::model::polygon<Point2, false, false>
+ >
+ (
+ "POLYGON((0 0,0 5,5 5,5 0,0 0),(1 1,3 2,2 4,1 1))",
+ "POLYGON((0 0,5 0,5 5,0 5),(1 1,2 4,3 2))"
+ );
+ // (polygon uses ring, so other tests omitted here)
+
+ // Combinations:
+ // ring <-> polygon
+ test_mixed_identical_result
+ <
+ bg::model::polygon<Point1>,
+ bg::model::ring<Point2>
+ >
+ ("POLYGON((1 1,2 2,3 0,1 1))");
+
+ test_mixed_reversible_result
+ <
+ bg::model::polygon<Point1, true>,
+ bg::model::ring<Point2, false>
+ >
+ (
+ "POLYGON((1 1,2 2,3 0,1 1))",
+ "POLYGON((1 1,3 0,2 2,1 1))"
+ );
+
+ // Any hole will be omitted going from polygon to ring
+ test_mixed
+ <
+ bg::model::polygon<Point1>,
+ bg::model::ring<Point2>
+ >
+ (
+ "POLYGON((0 0,0 5,5 5,5 0,0 0),(1 1,3 2,2 4,1 1))",
+ "POLYGON((0 0,0 5,5 5,5 0,0 0))"
+ );
+
+ // point -> box
+ test_mixed
+ <
+ Point1,
+ bg::model::box<Point2>
+ >
+ (
+ "POINT(0 0)",
+ "POLYGON((0 0,0 0,0 0,0 0,0 0))"
+ );
+
+ // segment -> line
+ test_mixed
+ <
+ bg::model::segment<Point1>,
+ bg::model::linestring<Point2>
+ >
+ (
+ "LINESTRING(0 0,1 1)",
+ "LINESTRING(0 0,1 1)"
+ );
+
+ // box -> ring ( <- is NYI)
+ test_mixed
+ <
+ bg::model::box<Point1>,
+ bg::model::ring<Point2>
+ >
+ (
+ "BOX(0 0,2 2)",
+ "POLYGON((0 0,0 2,2 2,2 0,0 0))"
+ );
+
+ test_mixed
+ <
+ bg::model::box<Point1>,
+ bg::model::ring<Point2, false>
+ >
+ (
+ "BOX(0 0,2 2)",
+ "POLYGON((0 0,2 0,2 2,0 2,0 0))"
+ );
+
+ test_mixed
+ <
+ bg::model::box<Point1>,
+ bg::model::ring<Point2, true, false>
+ >
+ (
+ "BOX(0 0,2 2)",
+ "POLYGON((0 0,0 2,2 2,2 0))"
+ );
+
+ test_mixed
+ <
+ bg::model::box<Point1>,
+ bg::model::ring<Point2, false, false>
+ >
+ (
+ "BOX(0 0,2 2)",
+ "POLYGON((0 0,2 0,2 2,0 2))"
+ );
+
+ // box -> polygon ( <- is NYI)
+ test_mixed
+ <
+ bg::model::box<Point1>,
+ bg::model::polygon<Point2>
+ >
+ (
+ "BOX(0 0,2 2)",
+ "POLYGON((0 0,0 2,2 2,2 0,0 0))"
+ );
+
+ test_mixed
+ <
+ bg::model::box<Point1>,
+ bg::model::polygon<Point2, false>
+ >
+ (
+ "BOX(0 0,2 2)",
+ "POLYGON((0 0,2 0,2 2,0 2,0 0))"
+ );
+
+ test_mixed
+ <
+ bg::model::box<Point1>,
+ bg::model::polygon<Point2, true, false>
+ >
+ (
+ "BOX(0 0,2 2)",
+ "POLYGON((0 0,0 2,2 2,2 0))"
+ );
+
+ test_mixed
+ <
+ bg::model::box<Point1>,
+ bg::model::polygon<Point2, false, false>
+ >
+ (
+ "BOX(0 0,2 2)",
+ "POLYGON((0 0,2 0,2 2,0 2))"
+ );
+}
+
+template <typename Point1, typename Point2>
+void test_mixed_point_types_3d()
+{
+ // Point
+ test_mixed_identical_result<Point1, Point2>("POINT(1 2 3)");
+
+ test_mixed_identical_result
+ <
+ bg::model::segment<Point1>,
+ bg::model::segment<Point2>
+ >
+ ("LINESTRING(1 2 3,4 5 6)");
+
+ // Linestring
+ test_mixed_identical_result
+ <
+ bg::model::linestring<Point1>,
+ bg::model::linestring<Point2>
+ >
+ ("LINESTRING(1 2 3,4 5 6,7 8 9)");
+
+ // segment -> line
+ test_mixed
+ <
+ bg::model::segment<Point1>,
+ bg::model::linestring<Point2>
+ >
+ (
+ "LINESTRING(1 2 3,4 5 6)",
+ "LINESTRING(1 2 3,4 5 6)"
+ );
+}
+
+
+
+template <typename Point1, typename Point2>
+void test_mixed_types()
+{
+ test_mixed_point_types<Point1, Point2>();
+ test_mixed_point_types<Point2, Point1>();
+}
+
+
+template <typename Point1, typename Point2>
+void test_mixed_types_3d()
+{
+ test_mixed_point_types_3d<Point1, Point2>();
+ test_mixed_point_types_3d<Point2, Point1>();
+}
+
+void test_array()
+{
+ int a[2] = {1, 2};
+ int b[2];
+ bg::convert(a, b);
+ BOOST_CHECK_EQUAL(b[0], 1);
+ BOOST_CHECK_EQUAL(b[1], 2);
+}
+
+int test_main(int, char* [])
+{
+ test_mixed_types
+ <
+ bg::model::point<int, 2, bg::cs::cartesian>,
+ bg::model::point<double, 2, bg::cs::cartesian>
+ >();
+ test_mixed_types
+ <
+ boost::tuple<float, float>,
+ bg::model::point<float, 2, bg::cs::cartesian>
+ >();
+ test_mixed_types_3d
+ <
+ boost::tuple<double, double, double>,
+ bg::model::point<double, 3, bg::cs::cartesian>
+ >();
+
+ test_array();
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/convert.vcproj b/libs/geometry/test/algorithms/convert.vcproj
new file mode 100644
index 000000000..c75bf0ee5
--- /dev/null
+++ b/libs/geometry/test/algorithms/convert.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="convert"
+ ProjectGUID="{FABF1AA7-F695-49F8-92F6-AB6C4B0C088A}"
+ RootNamespace="convert"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\convert"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\convert"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\convert.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/convex_hull.cpp b/libs/geometry/test/algorithms/convex_hull.cpp
new file mode 100644
index 000000000..f268aa90e
--- /dev/null
+++ b/libs/geometry/test/algorithms/convex_hull.cpp
@@ -0,0 +1,66 @@
+// 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.
+
+// 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 <cstddef>
+#include <string>
+
+#include <algorithms/test_convex_hull.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+
+template <typename P>
+void test_all()
+{
+ // from sample linestring
+ test_geometry<bg::model::linestring<P> >(
+ "linestring(1.1 1.1, 2.5 2.1, 3.1 3.1, 4.9 1.1, 3.1 1.9)", 5, 4, 3.8);
+
+ // rectangular, with concavity
+ test_geometry<bg::model::polygon<P> >(
+ "polygon((1 1, 1 4, 3 4, 3 3, 4 3, 4 4, 5 4, 5 1, 1 1))",
+ 9, 5, 12.0);
+
+ // from sample polygon, with concavity
+ test_geometry<bg::model::polygon<P> >(
+ "polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0"
+ ", 5.3 2.6, 5.4 1.2, 4.9 0.8, 2.9 0.7,2.0 1.3))",
+ 12, 8, 5.245);
+
+ test_geometry<bg::model::ring<P> >(
+ "polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0"
+ ", 5.3 2.6, 5.4 1.2, 4.9 0.8, 2.9 0.7,2.0 1.3))",
+ 12, 8, 5.245);
+
+ test_geometry<bg::model::box<P> >("box(0 0,2 2)", 4, 5, 4);
+
+ test_empty_input<bg::model::linestring<P> >();
+ test_empty_input<bg::model::ring<P> >();
+ test_empty_input<bg::model::polygon<P> >();
+}
+
+
+int test_main(int, char* [])
+{
+ //test_all<bg::model::d2::point_xy<int> >();
+ test_all<bg::model::d2::point_xy<float> >();
+ 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/convex_hull.vcproj b/libs/geometry/test/algorithms/convex_hull.vcproj
new file mode 100644
index 000000000..365f60c0f
--- /dev/null
+++ b/libs/geometry/test/algorithms/convex_hull.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="convex_hull"
+ ProjectGUID="{0AFF7A85-63A7-4178-92A5-CC692B09F5B9}"
+ RootNamespace="convex_hull"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\convex_hull"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\convex_hull"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\convex_hull.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/correct.cpp b/libs/geometry/test/algorithms/correct.cpp
new file mode 100644
index 000000000..b92928659
--- /dev/null
+++ b/libs/geometry/test/algorithms/correct.cpp
@@ -0,0 +1,182 @@
+// 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.
+
+// 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 <sstream>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/correct.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/io/dsv/write.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/io/wkt/write.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/box.hpp>
+#include <boost/geometry/geometries/ring.hpp>
+#include <boost/geometry/geometries/polygon.hpp>
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt, std::string const& expected)
+{
+ Geometry geometry;
+
+ bg::read_wkt(wkt, geometry);
+ bg::correct(geometry);
+
+ std::ostringstream out;
+ out << bg::wkt(geometry);
+
+ BOOST_CHECK_EQUAL(out.str(), expected);
+}
+
+
+// Note: 3D/box test cannot be done using WKT because:
+// -> wkt-box does not exist
+// -> so it is converted to a ring
+// -> ring representation of 3d-box is not supported, nor feasible
+// -> so it uses DSV which can represent a box
+template <typename Geometry>
+void test_geometry_dsv(std::string const& wkt, std::string const& expected)
+{
+ Geometry geometry;
+
+ bg::read_wkt(wkt, geometry);
+ bg::correct(geometry);
+
+ std::ostringstream out;
+ out << bg::dsv(geometry);
+
+ BOOST_CHECK_EQUAL(out.str(), expected);
+}
+
+
+
+
+
+
+template <typename P>
+void test_all()
+{
+ // Define clockwise and counter clockwise polygon
+ std::string cw_ring = "POLYGON((0 0,0 1,1 1,1 0,0 0))";
+ std::string ccw_ring = "POLYGON((0 0,1 0,1 1,0 1,0 0))";
+ std::string cw_open_ring = "POLYGON((0 0,0 1,1 1,1 0))";
+ std::string ccw_open_ring = "POLYGON((0 0,1 0,1 1,0 1))";
+
+ // already cw_ring
+ test_geometry<bg::model::ring<P> >(cw_ring, cw_ring);
+
+ // wrong order
+ test_geometry<bg::model::ring<P> >(ccw_ring, cw_ring);
+
+ // ccw-ring, input ccw-ring, already correct
+ test_geometry<bg::model::ring<P, false> >(ccw_ring, ccw_ring);
+
+ // ccw-ring, input cw-ring, corrected
+ test_geometry<bg::model::ring<P, false> >(cw_ring, ccw_ring);
+
+ // open-ring, input ccw-ring, already correct
+ test_geometry<bg::model::ring<P, true, false> >(cw_open_ring, cw_open_ring);
+
+ // ccw-ring, input cw-ring, corrected
+ test_geometry<bg::model::ring<P, true, false> >(ccw_open_ring, "POLYGON((0 1,1 1,1 0,0 0))");
+
+
+
+ // not closed
+ test_geometry<bg::model::ring<P> >(
+ ccw_open_ring,
+ cw_ring);
+
+ // counter clockwise, cw_ring
+ test_geometry<bg::model::ring<P, false> >(ccw_ring, ccw_ring);
+
+ test_geometry<bg::model::ring<P, false> >(cw_ring, ccw_ring);
+
+
+ // polygon: cw_ring
+ test_geometry<bg::model::polygon<P> >(cw_ring, cw_ring);
+ // wrong order
+ test_geometry<bg::model::polygon<P> >(
+ "POLYGON((0 0,1 0,1 1,0 1,0 0))",
+ cw_ring);
+ // wrong order & not closed
+ test_geometry<bg::model::polygon<P> >(
+ ccw_open_ring,
+ cw_ring);
+
+
+ std::string cw_holey_polygon =
+ "POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,2 1,2 2,1 2,1 1))";
+ std::string ccw_holey_polygon =
+ "POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1,1 2,2 2,2 1,1 1))";
+
+ // with holes: cw_ring
+ test_geometry<bg::model::polygon<P> >(
+ cw_holey_polygon,
+ cw_holey_polygon);
+ // wrong order of main
+ test_geometry<bg::model::polygon<P> >(
+ "POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1))",
+ cw_holey_polygon);
+ // wrong order of hole
+ test_geometry<bg::model::polygon<P> >(
+ "POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,1 2,2 2,2 1,1 1))",
+ cw_holey_polygon);
+
+ // wrong order of main and hole
+ test_geometry<bg::model::polygon<P> >(ccw_holey_polygon, cw_holey_polygon);
+
+ // test the counter-clockwise
+ test_geometry<bg::model::polygon<P, false> >(
+ ccw_holey_polygon, ccw_holey_polygon);
+
+ // Boxes
+ std::string proper_box = "POLYGON((0 0,0 2,2 2,2 0,0 0))";
+ test_geometry<bg::model::box<P> >(proper_box, proper_box);
+ test_geometry<bg::model::box<P> >("BOX(0 0,2 2)", proper_box);
+ test_geometry<bg::model::box<P> >("BOX(2 2,0 0)", proper_box);
+ test_geometry<bg::model::box<P> >("BOX(0 2,2 0)", proper_box);
+
+ // Cubes
+ typedef bg::model::box<bg::model::point<double, 3, bg::cs::cartesian> > box3d;
+ std::string proper_3d_dsv_box = "((0, 0, 0), (2, 2, 2))";
+ test_geometry_dsv<box3d>("BOX(0 0 0,2 2 2)", proper_3d_dsv_box);
+ test_geometry_dsv<box3d>("BOX(2 2 2,0 0 0)", proper_3d_dsv_box);
+ test_geometry_dsv<box3d>("BOX(0 2 2,2 0 0)", proper_3d_dsv_box);
+ test_geometry_dsv<box3d>("BOX(2 0 2,0 2 0)", proper_3d_dsv_box);
+ test_geometry_dsv<box3d>("BOX(0 0 2,2 2 0)", proper_3d_dsv_box);
+}
+
+
+int test_main(int, char* [])
+{
+ //test_all<int[2]>();
+ //test_all<float[2]>(); not yet because cannot be copied, for polygon
+ //test_all<double[2]>();
+
+ test_all<bg::model::d2::point_xy<int> >();
+ test_all<bg::model::d2::point_xy<float> >();
+ 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/correct.vcproj b/libs/geometry/test/algorithms/correct.vcproj
new file mode 100644
index 000000000..e36945a2d
--- /dev/null
+++ b/libs/geometry/test/algorithms/correct.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="correct"
+ ProjectGUID="{71582BDA-D4DF-400D-8630-378BE102C038}"
+ RootNamespace="correct"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\correct"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\correct"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\correct.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/covered_by.cpp b/libs/geometry/test/algorithms/covered_by.cpp
new file mode 100644
index 000000000..32683cbe7
--- /dev/null
+++ b/libs/geometry/test/algorithms/covered_by.cpp
@@ -0,0 +1,149 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 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_covered_by.hpp>
+
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+
+template <typename P>
+void test_all()
+{
+ /*
+ // trivial case
+ test_ring<P>("POINT(1 1)", "POLYGON((0 0,0 2,2 2,2 0,0 0))", true, false);
+
+ // on border/corner
+ test_ring<P>("POINT(0 0)", "POLYGON((0 0,0 2,2 2,2 0,0 0))", false, true);
+ test_ring<P>("POINT(0 1)", "POLYGON((0 0,0 2,2 2,2 0,0 0))", false, true);
+
+ // aligned to segment/vertex
+ test_ring<P>("POINT(1 1)", "POLYGON((0 0,0 3,3 3,3 1,2 1,2 0,0 0))", true, false);
+ test_ring<P>("POINT(1 1)", "POLYGON((0 0,0 3,4 3,3 1,2 2,2 0,0 0))", true, false);
+
+ // same polygon, but point on border
+ test_ring<P>("POINT(3 3)", "POLYGON((0 0,0 3,3 3,3 1,2 1,2 0,0 0))", false, true);
+ test_ring<P>("POINT(3 3)", "POLYGON((0 0,0 3,4 3,3 1,2 2,2 0,0 0))", false, true);
+
+ // holes
+ test_geometry<P, bg::model::polygon<P> >("POINT(2 2)",
+ "POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,3 1,3 3,1 3,1 1))", false);
+
+ */
+
+ typedef bg::model::box<P> box_type;
+
+ test_geometry<P, box_type>("POINT(1 1)", "BOX(0 0,2 2)", true);
+ test_geometry<P, box_type>("POINT(0 0)", "BOX(0 0,2 2)", true);
+ test_geometry<P, box_type>("POINT(2 2)", "BOX(0 0,2 2)", true);
+ test_geometry<P, box_type>("POINT(0 1)", "BOX(0 0,2 2)", true);
+ test_geometry<P, box_type>("POINT(1 0)", "BOX(0 0,2 2)", true);
+ test_geometry<P, box_type>("POINT(3 3)", "BOX(0 0,2 2)", false);
+
+ test_geometry<box_type, box_type>("BOX(1 1,2 2)", "BOX(0 0,3 3)", true);
+ test_geometry<box_type, box_type>("BOX(0 0,3 3)", "BOX(1 1,2 2)", false);
+ test_geometry<box_type, box_type>("BOX(0 0,2 2)", "BOX(0 0,3 3)", true);
+ test_geometry<box_type, box_type>("BOX(1 1,3 3)", "BOX(0 0,3 3)", true);
+ test_geometry<box_type, box_type>("BOX(1 2,3 3)", "BOX(0 0,3 3)", true);
+ test_geometry<box_type, box_type>("BOX(1 1,4 3)", "BOX(0 0,3 3)", false);
+
+
+ /*
+ test_within_code<P, box_type>("POINT(1 1)", "BOX(0 0,2 2)", 1);
+ test_within_code<P, box_type>("POINT(1 0)", "BOX(0 0,2 2)", 0);
+ test_within_code<P, box_type>("POINT(0 1)", "BOX(0 0,2 2)", 0);
+ test_within_code<P, box_type>("POINT(0 3)", "BOX(0 0,2 2)", -1);
+ test_within_code<P, box_type>("POINT(3 3)", "BOX(0 0,2 2)", -1);
+
+ test_within_code<box_type, box_type>("BOX(1 1,2 2)", "BOX(0 0,3 3)", 1);
+ test_within_code<box_type, box_type>("BOX(0 1,2 2)", "BOX(0 0,3 3)", 0);
+ test_within_code<box_type, box_type>("BOX(1 0,2 2)", "BOX(0 0,3 3)", 0);
+ test_within_code<box_type, box_type>("BOX(1 1,2 3)", "BOX(0 0,3 3)", 0);
+ test_within_code<box_type, box_type>("BOX(1 1,3 2)", "BOX(0 0,3 3)", 0);
+ test_within_code<box_type, box_type>("BOX(1 1,3 4)", "BOX(0 0,3 3)", -1);
+ */
+}
+
+
+void test_3d()
+{
+ typedef boost::geometry::model::point<double, 3, boost::geometry::cs::cartesian> point_type;
+ typedef boost::geometry::model::box<point_type> box_type;
+ box_type box(point_type(0, 0, 0), point_type(4, 4, 4));
+ BOOST_CHECK_EQUAL(bg::covered_by(point_type(2, 2, 2), box), true);
+ BOOST_CHECK_EQUAL(bg::covered_by(point_type(2, 4, 2), box), true);
+ BOOST_CHECK_EQUAL(bg::covered_by(point_type(2, 2, 4), box), true);
+ BOOST_CHECK_EQUAL(bg::covered_by(point_type(2, 2, 5), box), false);
+}
+
+template <typename P1, typename P2>
+void test_mixed_of()
+{
+ typedef boost::geometry::model::polygon<P1> polygon_type1;
+ typedef boost::geometry::model::polygon<P2> polygon_type2;
+ typedef boost::geometry::model::box<P1> box_type1;
+ typedef boost::geometry::model::box<P2> box_type2;
+
+ polygon_type1 poly1, poly2;
+ boost::geometry::read_wkt("POLYGON((0 0,0 5,5 5,5 0,0 0))", poly1);
+ boost::geometry::read_wkt("POLYGON((0 0,0 5,5 5,5 0,0 0))", poly2);
+
+ box_type1 box1(P1(1, 1), P1(4, 4));
+ box_type2 box2(P2(0, 0), P2(5, 5));
+ P1 p1(3, 3);
+ P2 p2(3, 3);
+
+ BOOST_CHECK_EQUAL(bg::covered_by(p1, poly2), true);
+ BOOST_CHECK_EQUAL(bg::covered_by(p2, poly1), true);
+ BOOST_CHECK_EQUAL(bg::covered_by(p2, box1), true);
+ BOOST_CHECK_EQUAL(bg::covered_by(p1, box2), true);
+ BOOST_CHECK_EQUAL(bg::covered_by(box1, box2), true);
+ BOOST_CHECK_EQUAL(bg::covered_by(box2, box1), false);
+}
+
+
+void test_mixed()
+{
+ // Mixing point types and coordinate types
+ test_mixed_of
+ <
+ boost::geometry::model::d2::point_xy<double>,
+ boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>
+ >();
+ test_mixed_of
+ <
+ boost::geometry::model::d2::point_xy<float>,
+ boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>
+ >();
+ test_mixed_of
+ <
+ boost::geometry::model::d2::point_xy<int>,
+ boost::geometry::model::d2::point_xy<double>
+ >();
+}
+
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<int> >();
+ test_all<bg::model::d2::point_xy<double> >();
+
+ //test_spherical<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> > >();
+
+ test_mixed();
+ test_3d();
+
+
+#if defined(HAVE_TTMATH)
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+ //test_spherical<bg::model::point<ttmath_big, 2, bg::cs::spherical_equatorial<bg::degree> > >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/covered_by.vcproj b/libs/geometry/test/algorithms/covered_by.vcproj
new file mode 100644
index 000000000..13f41e930
--- /dev/null
+++ b/libs/geometry/test/algorithms/covered_by.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="covered_by"
+ ProjectGUID="{5ABF0B56-F9F1-4D93-B15A-E3972F45D97B}"
+ RootNamespace="covered_by"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\covered_by"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\covered_by"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\covered_by.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/detail/Jamfile.v2 b/libs/geometry/test/algorithms/detail/Jamfile.v2
new file mode 100644
index 000000000..015e2be6a
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/Jamfile.v2
@@ -0,0 +1,16 @@
+# 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-algorithms-detail
+ :
+ [ run partition.cpp ]
+ ;
+
+build-project sections ;
diff --git a/libs/geometry/test/algorithms/detail/detail.sln b/libs/geometry/test/algorithms/detail/detail.sln
new file mode 100644
index 000000000..394921ecc
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/detail.sln
@@ -0,0 +1,19 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "partition", "partition.vcproj", "{5EF21715-DB87-41AB-9D0A-59ED04F316A1}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {5EF21715-DB87-41AB-9D0A-59ED04F316A1}.Debug|Win32.ActiveCfg = Debug|Win32
+ {5EF21715-DB87-41AB-9D0A-59ED04F316A1}.Debug|Win32.Build.0 = Debug|Win32
+ {5EF21715-DB87-41AB-9D0A-59ED04F316A1}.Release|Win32.ActiveCfg = Release|Win32
+ {5EF21715-DB87-41AB-9D0A-59ED04F316A1}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/algorithms/detail/partition.cpp b/libs/geometry/test/algorithms/detail/partition.cpp
new file mode 100644
index 000000000..4bf75529b
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/partition.cpp
@@ -0,0 +1,476 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 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 <algorithms/test_overlay.hpp>
+
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/multi/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>
+#endif
+
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/variate_generator.hpp>
+
+
+template <typename Box>
+struct box_item
+{
+ int id;
+ Box box;
+ box_item(int i = 0, std::string const& wkt = "")
+ : id(i)
+ {
+ if (! wkt.empty())
+ {
+ bg::read_wkt(wkt, box);
+ }
+ }
+};
+
+
+struct get_box
+{
+ template <typename Box, typename InputItem>
+ static inline void apply(Box& total, InputItem const& item)
+ {
+ bg::expand(total, item.box);
+ }
+};
+
+struct ovelaps_box
+{
+ template <typename Box, typename InputItem>
+ static inline bool apply(Box const& box, InputItem const& item)
+ {
+ return ! bg::detail::disjoint::disjoint_box_box(box, item.box);
+ }
+};
+
+
+template <typename Box>
+struct box_visitor
+{
+ int count;
+ typename bg::default_area_result<Box>::type area;
+
+ box_visitor()
+ : count(0)
+ , area(0)
+ {}
+
+ template <typename Item>
+ inline void apply(Item const& item1, Item const& item2)
+ {
+ if (bg::intersects(item1.box, item2.box))
+ {
+ Box b;
+ bg::intersection(item1.box, item2.box, b);
+ area += bg::area(b);
+ count++;
+ }
+ }
+};
+
+
+
+template <typename Box>
+void test_boxes(std::string const& wkt_box_list, double expected_area, int expected_count)
+{
+ std::vector<std::string> wkt_boxes;
+
+ boost::split(wkt_boxes, wkt_box_list, boost::is_any_of(";"), boost::token_compress_on);
+
+ typedef box_item<Box> sample;
+ std::vector<sample> boxes;
+
+ int index = 1;
+ BOOST_FOREACH(std::string const& wkt, wkt_boxes)
+ {
+ boxes.push_back(sample(index++, wkt));
+ }
+
+ box_visitor<Box> visitor;
+ bg::partition
+ <
+ Box, get_box, ovelaps_box
+ >::apply(boxes, visitor, 1);
+
+ BOOST_CHECK_CLOSE(visitor.area, expected_area, 0.001);
+ BOOST_CHECK_EQUAL(visitor.count, expected_count);
+}
+
+
+
+struct point_item
+{
+ point_item()
+ : id(0)
+ {}
+
+ int id;
+ double x;
+ double y;
+};
+
+BOOST_GEOMETRY_REGISTER_POINT_2D(point_item, double, cs::cartesian, x, y)
+
+
+struct get_point
+{
+ template <typename Box, typename InputItem>
+ static inline void apply(Box& total, InputItem const& item)
+ {
+ bg::expand(total, item);
+ }
+};
+
+struct ovelaps_point
+{
+ template <typename Box, typename InputItem>
+ static inline bool apply(Box const& box, InputItem const& item)
+ {
+ return ! bg::disjoint(item, box);
+ }
+};
+
+
+struct point_visitor
+{
+ int count;
+
+ point_visitor()
+ : count(0)
+ {}
+
+ template <typename Item>
+ inline void apply(Item const& item1, Item const& item2)
+ {
+ if (bg::equals(item1, item2))
+ {
+ count++;
+ }
+ }
+};
+
+
+
+void test_points(std::string const& wkt1, std::string const& wkt2, int expected_count)
+{
+ bg::model::multi_point<point_item> mp1, mp2;
+ bg::read_wkt(wkt1, mp1);
+ bg::read_wkt(wkt2, mp2);
+
+ int id = 1;
+ BOOST_FOREACH(point_item& p, mp1)
+ { p.id = id++; }
+ id = 1;
+ BOOST_FOREACH(point_item& p, mp2)
+ { p.id = id++; }
+
+ point_visitor visitor;
+ bg::partition
+ <
+ bg::model::box<point_item>, get_point, ovelaps_point
+ >::apply(mp1, mp2, visitor, 1);
+
+ BOOST_CHECK_EQUAL(visitor.count, expected_count);
+}
+
+
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::box<P> box;
+
+ test_boxes<box>(
+ // 1 2 3 4 5 6 7
+ "box(0 0,1 1); box(0 0,2 2); box(9 9,10 10); box(8 8,9 9); box(4 4,6 6); box(2 4,6 8); box(7 1,8 2)",
+ 5, // Area(Intersection(1,2)) + A(I(5,6))
+ 3);
+
+ test_boxes<box>(
+ "box(0 0,10 10); box(4 4,6 6); box(3 3,7 7)",
+ 4 + 16 + 4, // A(I(1,2)) + A(I(1,3)) + A(I(2,3))
+ 3);
+
+ test_boxes<box>(
+ "box(0 2,10 3); box(3 1,4 5); box(7 1,8 5)",
+ 1 + 1, // A(I(1,2)) + A(I(1,3))
+ 2);
+
+ test_points("multipoint((1 1))", "multipoint((1 1))", 1);
+ test_points("multipoint((0 0),(1 1),(7 3),(10 10))", "multipoint((1 1),(2 2),(7 3))", 2);
+
+}
+
+//------------------- higher volumes
+
+template <typename SvgMapper>
+struct svg_visitor
+{
+ SvgMapper& m_mapper;
+
+ svg_visitor(SvgMapper& mapper)
+ : m_mapper(mapper)
+ {}
+
+ template <typename Box>
+ inline void apply(Box const& box, int level)
+ {
+ /*
+ std::string color("rgb(64,64,64)");
+ switch(level)
+ {
+ case 0 : color = "rgb(255,0,0)"; break;
+ case 1 : color = "rgb(0,255,0)"; break;
+ case 2 : color = "rgb(0,0,255)"; break;
+ case 3 : color = "rgb(255,255,0)"; break;
+ case 4 : color = "rgb(255,0,255)"; break;
+ case 5 : color = "rgb(0,255,255)"; break;
+ case 6 : color = "rgb(255,128,0)"; break;
+ case 7 : color = "rgb(0,128,255)"; break;
+ }
+ std::ostringstream style;
+ style << "fill:none;stroke-width:" << (5.0 - level / 2.0) << ";stroke:" << color << ";";
+ m_mapper.map(box, style.str());
+ */
+ m_mapper.map(box, "fill:none;stroke-width:2;stroke:rgb(0,0,0);");
+
+ }
+};
+
+
+
+
+template <typename Collection>
+void fill_points(Collection& collection, int seed, int size, int count)
+{
+ typedef boost::minstd_rand base_generator_type;
+
+ base_generator_type generator(seed);
+
+ boost::uniform_int<> random_coordinate(0, size - 1);
+ boost::variate_generator<base_generator_type&, boost::uniform_int<> >
+ coordinate_generator(generator, random_coordinate);
+
+ std::set<std::pair<int, int> > included;
+
+ int n = 0;
+ for (int i = 0; n < count && i < count*count; i++)
+ {
+ int x = coordinate_generator();
+ int y = coordinate_generator();
+ std::pair<int, int> pair = std::make_pair(x, y);
+ if (included.find(pair) == included.end())
+ {
+ included.insert(pair);
+ typename boost::range_value<Collection>::type item;
+ item.x = x;
+ item.y = y;
+ collection.push_back(item);
+ n++;
+ }
+ }
+}
+
+void test_many_points(int seed, int size, int count)
+{
+ bg::model::multi_point<point_item> mp1, mp2;
+
+ fill_points(mp1, seed, size, count);
+ fill_points(mp2, seed * 2, size, count);
+
+ // Test equality in quadratic loop
+ int expected_count = 0;
+ BOOST_FOREACH(point_item const& item1, mp1)
+ {
+ BOOST_FOREACH(point_item const& item2, mp2)
+ {
+ if (bg::equals(item1, item2))
+ {
+ expected_count++;
+ }
+ }
+ }
+
+#if defined(TEST_WITH_SVG)
+ std::ostringstream filename;
+ filename << "partition" << seed << ".svg";
+ std::ofstream svg(filename.str().c_str());
+
+ bg::svg_mapper<point_item> mapper(svg, 800, 800);
+
+ {
+ point_item p;
+ p.x = -1; p.y = -1; mapper.add(p);
+ p.x = size + 1; p.y = size + 1; mapper.add(p);
+ }
+
+ typedef svg_visitor<bg::svg_mapper<point_item> > box_visitor_type;
+ box_visitor_type box_visitor(mapper);
+#else
+ typedef bg::visit_no_policy box_visitor_type;
+ box_visitor_type box_visitor;
+#endif
+
+ point_visitor visitor;
+ bg::partition
+ <
+ bg::model::box<point_item>, get_point, ovelaps_point,
+ box_visitor_type
+ >::apply(mp1, mp2, visitor, 2, box_visitor);
+
+ BOOST_CHECK_EQUAL(visitor.count, expected_count);
+
+#if defined(TEST_WITH_SVG)
+ BOOST_FOREACH(point_item const& item, mp1)
+ {
+ mapper.map(item, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1", 8);
+ }
+ BOOST_FOREACH(point_item const& item, mp2)
+ {
+ mapper.map(item, "fill:rgb(0,128,255);stroke:rgb(0,0,100);stroke-width:1", 4);
+ }
+#endif
+}
+
+template <typename Collection>
+void fill_boxes(Collection& collection, int seed, int size, int count)
+{
+ typedef boost::minstd_rand base_generator_type;
+
+ base_generator_type generator(seed);
+
+ boost::uniform_int<> random_coordinate(0, size * 10 - 1);
+ boost::variate_generator<base_generator_type&, boost::uniform_int<> >
+ coordinate_generator(generator, random_coordinate);
+
+ int n = 0;
+ for (int i = 0; n < count && i < count*count; i++)
+ {
+ int w = coordinate_generator() % 30;
+ int h = coordinate_generator() % 30;
+ if (w > 0 && h > 0)
+ {
+ int x = coordinate_generator();
+ int y = coordinate_generator();
+ if (x + w < size * 10 && y + h < size * 10)
+ {
+ typename boost::range_value<Collection>::type item(n+1);
+ bg::assign_values(item.box, x / 10.0, y / 10.0, (x + w) / 10.0, (y + h) / 10.0);
+ collection.push_back(item);
+ n++;
+ }
+ }
+ }
+}
+
+
+
+void test_many_boxes(int seed, int size, int count)
+{
+ typedef bg::model::box<point_item> box_type;
+ std::vector<box_item<box_type> > boxes;
+
+ fill_boxes(boxes, seed, size, count);
+
+ // Test equality in quadratic loop
+ int expected_count = 0;
+ double expected_area = 0.0;
+ BOOST_FOREACH(box_item<box_type> const& item1, boxes)
+ {
+ BOOST_FOREACH(box_item<box_type> const& item2, boxes)
+ {
+ if (item1.id < item2.id)
+ {
+ if (bg::intersects(item1.box, item2.box))
+ {
+ box_type b;
+ bg::intersection(item1.box, item2.box, b);
+ expected_area += bg::area(b);
+ expected_count++;
+ }
+ }
+ }
+ }
+
+
+#if defined(TEST_WITH_SVG)
+ std::ostringstream filename;
+ filename << "partition_box_" << seed << ".svg";
+ std::ofstream svg(filename.str().c_str());
+
+ bg::svg_mapper<point_item> mapper(svg, 800, 800);
+
+ {
+ point_item p;
+ p.x = -1; p.y = -1; mapper.add(p);
+ p.x = size + 1; p.y = size + 1; mapper.add(p);
+ }
+
+ BOOST_FOREACH(box_item<box_type> const& item, boxes)
+ {
+ mapper.map(item.box, "opacity:0.6;fill:rgb(50,50,210);stroke:rgb(0,0,0);stroke-width:1");
+ }
+
+ typedef svg_visitor<bg::svg_mapper<point_item> > partition_visitor_type;
+ partition_visitor_type partition_visitor(mapper);
+
+
+ box_visitor<box_type> visitor;
+ bg::partition
+ <
+ box_type, get_box, ovelaps_box,
+ partition_visitor_type
+ >::apply(boxes, visitor, 2, partition_visitor);
+
+ BOOST_CHECK_EQUAL(visitor.count, expected_count);
+ BOOST_CHECK_CLOSE(visitor.area, expected_area, 0.001);
+
+#endif
+}
+
+
+
+
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+ test_many_points(12345, 20, 40);
+ test_many_points(54321, 20, 60);
+ test_many_points(67890, 20, 80);
+ test_many_points(98765, 20, 100);
+ for (int i = 1; i < 10; i++)
+ {
+ test_many_points(i, 30, i * 20);
+ }
+
+ test_many_boxes(12345, 20, 40);
+ for (int i = 1; i < 10; i++)
+ {
+ test_many_boxes(i, 20, i * 10);
+ }
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/detail/partition.vcproj b/libs/geometry/test/algorithms/detail/partition.vcproj
new file mode 100644
index 000000000..66e26a973
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/partition.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="partition"
+ ProjectGUID="{5EF21715-DB87-41AB-9D0A-59ED04F316A1}"
+ RootNamespace="partition"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\partition"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../../../../..;../..;../../../../../boost/geometry/extensions/contrib/ttmath"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\partition"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=".;../../../../..;../..;../../../../../boost/geometry/extensions/contrib/ttmath"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\partition.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/detail/sections/Jamfile.v2 b/libs/geometry/test/algorithms/detail/sections/Jamfile.v2
new file mode 100644
index 000000000..973ed75f6
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/sections/Jamfile.v2
@@ -0,0 +1,15 @@
+# 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-algorithms-detail-sections
+ :
+ [ run sectionalize.cpp ]
+ [ run range_by_section.cpp ]
+ ;
diff --git a/libs/geometry/test/algorithms/detail/sections/range_by_section.cpp b/libs/geometry/test/algorithms/detail/sections/range_by_section.cpp
new file mode 100644
index 000000000..e1d1bca1d
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/sections/range_by_section.cpp
@@ -0,0 +1,102 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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 <iostream>
+#include <string>
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/detail/sections/sectionalize.hpp>
+#include <boost/geometry/algorithms/detail/sections/range_by_section.hpp>
+#include <boost/geometry/views/detail/range_type.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/io/wkt/wkt.hpp>
+
+
+
+template <int DimensionCount, bool Reverse, typename Geometry>
+void test_sectionalize(std::string const caseid, Geometry const& geometry, std::size_t section_count)
+{
+ typedef typename bg::point_type<Geometry>::type point;
+ typedef bg::model::box<point> box;
+ typedef bg::sections<box, DimensionCount> sections;
+
+ sections s;
+ bg::sectionalize<Reverse>(geometry, s);
+
+ BOOST_CHECK_EQUAL(s.size(), section_count);
+
+ typedef typename bg::closeable_view
+ <
+ typename bg::detail::range_type<Geometry>::type const,
+ bg::closure<Geometry>::value
+ >::type cview_type;
+ typedef typename bg::reversible_view
+ <
+ cview_type const,
+ Reverse ? bg::iterate_reverse : bg::iterate_forward
+ >::type view_type;
+ typedef typename boost::range_iterator
+ <
+ view_type const
+ >::type range_iterator;
+
+ BOOST_FOREACH(typename sections::value_type const& sec, s)
+ {
+ cview_type cview(bg::range_by_section(geometry, sec));
+ view_type view(cview);
+ range_iterator it1 = boost::begin(view) + sec.begin_index;
+ range_iterator it2 = boost::begin(view) + sec.end_index;
+ int count = 0;
+ for (range_iterator it = it1; it != it2; ++it)
+ {
+ count++;
+ }
+ BOOST_CHECK_EQUAL(int(sec.count), count);
+ }
+}
+
+template <typename Geometry, bool Reverse>
+void test_sectionalize(std::string const& caseid, std::string const& wkt,
+ std::size_t count1)
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ if (bg::closure<Geometry>::value == bg::open)
+ {
+ geometry.outer().resize(geometry.outer().size() - 1);
+ }
+ //bg::correct(geometry);
+ test_sectionalize<1, Reverse>(caseid + "_d1", geometry, count1);
+}
+
+template <typename P>
+void test_all()
+{
+ std::string const first = "polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0, 5.3 2.6, 5.4 1.2, 4.9 0.8, 2.9 0.7,2.0 1.3))";
+ test_sectionalize<bg::model::polygon<P>, false>("first", first, 4);
+
+ test_sectionalize<bg::model::polygon<P, false>, true>("first_reverse",
+ first, 4);
+
+ test_sectionalize<bg::model::polygon<P, false, true>, false>("first_open",
+ first, 4);
+
+ test_sectionalize<bg::model::polygon<P, true, false>, true>("first_open_reverse",
+ first, 4);
+}
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/detail/sections/range_by_section.vcproj b/libs/geometry/test/algorithms/detail/sections/range_by_section.vcproj
new file mode 100644
index 000000000..0d7ffb6cf
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/sections/range_by_section.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="range_by_section"
+ ProjectGUID="{A91434CB-CB32-48AE-8C74-81B6A1EB342F}"
+ RootNamespace="range_by_section"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\range_by_section"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../../..;../../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\range_by_section"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../../..;../../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\range_by_section.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/detail/sections/sectionalize.cpp b/libs/geometry/test/algorithms/detail/sections/sectionalize.cpp
new file mode 100644
index 000000000..762190704
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/sections/sectionalize.cpp
@@ -0,0 +1,341 @@
+// 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.
+
+// 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 <iostream>
+#include <string>
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/make.hpp>
+#include <boost/geometry/algorithms/num_points.hpp>
+#include <boost/geometry/algorithms/detail/sections/sectionalize.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/io/wkt/write.hpp>
+
+
+#include <test_common/test_point.hpp>
+
+#if defined(TEST_WITH_SVG)
+# include <boost/geometry/io/svg/svg_mapper.hpp>
+# include <boost/geometry/algorithms/buffer.hpp>
+# include <boost/geometry/algorithms/centroid.hpp>
+#endif
+
+
+
+template <int DimensionCount, typename Geometry>
+void test_sectionalize_part()
+{
+ typedef typename bg::point_type<Geometry>::type point_type;
+ typedef bg::model::box<point_type> box_type;
+
+ typedef bg::sections<box_type, DimensionCount> sections_type;
+ typedef typename boost::range_value<sections_type>::type section_type;
+
+ typedef bg::detail::sectionalize::sectionalize_part
+ <
+ Geometry, point_type, sections_type, 1, 10
+ > sectionalize_part;
+
+ sections_type sections;
+ section_type section;
+
+
+ Geometry geometry;
+ geometry.push_back(bg::make<point_type>(1, 1));
+
+ bg::ring_identifier ring_id;
+ int index = 0;
+ int ndi = 0;
+ sectionalize_part::apply(sections, section, index, ndi, geometry, ring_id);
+ // There should not yet be anything generated, because it is only ONE point
+
+ geometry.push_back(bg::make<point_type>(2, 2));
+ sectionalize_part::apply(sections, section, index, ndi, geometry, ring_id);
+
+}
+
+
+template <int DimensionCount, bool Reverse, typename G>
+void test_sectionalize(std::string const caseid, G const& g, std::size_t section_count,
+ std::string const& index_check, std::string const& dir_check)
+{
+ typedef typename bg::point_type<G>::type point;
+ typedef bg::model::box<point> box;
+ typedef bg::sections<box, DimensionCount> sections;
+
+ sections s;
+ bg::sectionalize<Reverse>(g, s);
+
+ BOOST_CHECK_EQUAL(s.size(), section_count);
+
+ // Check if sections are consecutive and consistent
+ int previous_index = -1;
+ BOOST_FOREACH(typename sections::value_type const& sec, s)
+ {
+ if (sec.begin_index > 0)
+ {
+ BOOST_CHECK_EQUAL(previous_index, sec.begin_index);
+ }
+ BOOST_CHECK_EQUAL(int(sec.count), int(sec.end_index - sec.begin_index));
+ previous_index = sec.end_index;
+ }
+
+ // Output streams for sections, boxes, other
+ std::ostringstream out_sections;
+ std::ostringstream out_boxes;
+ std::ostringstream out_dirs;
+
+
+ for (typename sections::size_type i = 0; i < s.size(); i++)
+ {
+ box const& b = s[i].bounding_box;
+
+ if (i > 0)
+ {
+ out_sections << "|";
+ out_dirs << "|";
+ out_boxes << "|";
+ }
+
+ out_sections << s[i].begin_index << ".." << s[i].end_index;
+ out_boxes << bg::get<0,0>(b) << " " << bg::get<0,1>(b)
+ << ".." << bg::get<1,0>(b) << " " << bg::get<1,1>(b);
+ for (int d = 0; d < DimensionCount; d++)
+ {
+ out_dirs << (d == 0 ? "" : " ");
+ switch(s[i].directions[d])
+ {
+ case -99: out_dirs << "DUP"; break;
+ case -1 : out_dirs << "-"; break;
+ case 0 : out_dirs << "."; break;
+ case +1 : out_dirs << "+"; break;
+ }
+ }
+ }
+
+ if (! index_check.empty())
+ {
+ BOOST_CHECK_EQUAL(out_sections.str(), index_check);
+ }
+ if (! dir_check.empty())
+ {
+ BOOST_CHECK_EQUAL(out_dirs.str(), dir_check);
+ }
+ else
+ {
+ if (out_sections.str().length() < 80)
+ {
+ std::cout << std::endl << bg::wkt(g) << std::endl;
+ std::cout << out_sections.str() << std::endl;
+ //std::cout << out_boxes.str() << std::endl;
+ }
+ std::cout << out_dirs.str() << std::endl;
+ }
+
+#if defined(TEST_WITH_SVG)
+ {
+ std::ostringstream filename;
+ filename << "sectionalize_"
+ << caseid << ".svg";
+
+ std::ofstream svg(filename.str().c_str());
+
+ typedef typename bg::point_type<G>::type point_type;
+ bg::svg_mapper<point_type> mapper(svg, 500, 500);
+
+ mapper.add(g);
+
+ static const bool is_line = bg::geometry_id<G>::type::value == 2;
+ mapper.map(g, is_line
+ ? "opacity:0.6;stroke:rgb(0,0,255);stroke-width:5"
+ : "opacity:0.6;fill:rgb(0,0,255);stroke:rgb(0,0,0);stroke-width:0.5");
+
+
+ for (typename sections::size_type i = 0; i < s.size(); i++)
+ {
+ box b = s[i].bounding_box;
+ bg::buffer(b, b, 0.01);
+ mapper.map(b, s[i].duplicate
+ ? "fill-opacity:0.4;stroke-opacity:0.6;fill:rgb(0,128,0);stroke:rgb(0,255,0);stroke-width:2.0"
+ : "fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,0,0);stroke:rgb(255,0,0);stroke-width:0.5");
+
+ std::ostringstream out;
+
+ for (int d = 0; d < DimensionCount; d++)
+ {
+ out << (d == 0 ? "[" : " ");
+ switch(s[i].directions[d])
+ {
+ case -99: out << "DUP"; break;
+ case -1 : out << "-"; break;
+ case 0 : out << "."; break;
+ case +1 : out << "+"; break;
+ }
+ }
+ out << "] " << s[i].begin_index << ".." << s[i].end_index;
+
+
+ point_type p;
+ bg::centroid(b, p);
+ mapper.text(p, out.str(), "");
+ }
+ }
+#endif
+
+}
+
+template <typename G, bool Reverse>
+void test_sectionalize(std::string const& caseid, std::string const& wkt,
+ std::size_t count2, std::string const& s2, std::string const d2,
+ std::size_t count1, std::string const& s1, std::string const d1)
+{
+ G g;
+ bg::read_wkt(wkt, g);
+ test_sectionalize<2, Reverse>(caseid + "_d2", g, count2, s2, d2);
+ test_sectionalize<1, Reverse>(caseid + "_d1", g, count1, s1, d1);
+}
+
+template <typename P>
+void test_all()
+{
+ test_sectionalize_part<1, bg::model::linestring<P> >();
+
+ test_sectionalize<bg::model::linestring<P>, false>("ls",
+ "LINESTRING(1 1,2 2,3 0,5 0,5 8)",
+ 4, "0..1|1..2|2..3|3..4", "+ +|+ -|+ .|. +",
+ 2, "0..3|3..4", "+|.");
+
+ // These strings mean:
+ // 0..1|1..2 -> first section: [0, 1] | second section [1, 2], etc
+ // + +|+ - -> X increases, Y increases | X increases, Y decreases
+ // +|. -> (only X considered) X increases | X constant
+
+ test_sectionalize<bg::model::polygon<P>, false>("simplex",
+ "POLYGON((0 0,0 7,4 2,2 0,0 0))",
+ 4, "0..1|1..2|2..3|3..4", ". +|+ -|- -|- .",
+ // . + - - -> 3 sections
+ 3, "0..1|1..2|2..4", ".|+|-");
+
+ // CCW polygon - orientation is not (always) relevant for sections,
+ // they are just generated in the order they come.
+ test_sectionalize<bg::model::polygon<P, false>, false>("simplex_ccw",
+ "POLYGON((0 0,2 0,4 2,0 7,0 0))",
+ 4, "0..1|1..2|2..3|3..4", "+ .|+ +|- +|. -",
+ // . + - - -> 3 sections
+ 3, "0..2|2..3|3..4", "+|-|.");
+
+ // Open polygon - closeness IS relevant for sections, the
+ // last section which is not explicit here should be included.
+ // So results are the same as the pre-previous one.
+ test_sectionalize<bg::model::polygon<P, true, false>, false>("simplex_open",
+ "POLYGON((0 0,0 7,4 2,2 0))",
+ 4, "0..1|1..2|2..3|3..4", ". +|+ -|- -|- .",
+ // . + - - -> 3 sections
+ 3, "0..1|1..2|2..4", ".|+|-");
+
+ test_sectionalize<bg::model::polygon<P>, false>("first",
+ "polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0, 5.3 2.6, 5.4 1.2, 4.9 0.8, 2.9 0.7,2.0 1.3))",
+ 8, "0..2|2..3|3..4|4..5|5..6|6..8|8..10|10..11", "+ +|+ -|+ +|- +|+ +|+ -|- -|- +",
+ 4, "0..4|4..5|5..8|8..11", "+|-|+|-");
+
+ test_sectionalize<bg::model::polygon<P, false>, true>("first_reverse",
+ "polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0, 5.3 2.6, 5.4 1.2, 4.9 0.8, 2.9 0.7,2.0 1.3))",
+ 8, "0..1|1..3|3..5|5..6|6..7|7..8|8..9|9..11", "+ -|+ +|- +|- -|+ -|- -|- +|- -",
+ 4, "0..3|3..6|6..7|7..11", "+|-|+|-");
+
+ test_sectionalize<bg::model::polygon<P>, false>("second",
+ "POLYGON((3 1,2 2,1 3,2 4,3 5,4 4,5 3,4 2,3 1))",
+ 4, "0..2|2..4|4..6|6..8", "- +|+ +|+ -|- -",
+ // - - - + + + + - - -> 3 sections
+ 3, "0..2|2..6|6..8", "-|+|-");
+
+ // With holes
+ test_sectionalize<bg::model::polygon<P>, false>("with_holes",
+ "POLYGON((3 1,2 2,1 3,2 4,3 5,4 4,5 3,4 2,3 1), (3 2,2 2,3 4,3 2))",
+ 7, "0..2|2..4|4..6|6..8|0..1|1..2|2..3", "- +|+ +|+ -|- -|- .|+ +|. -",
+ // - - - + + + + - - - + . -> 6 sections
+ 6, "0..2|2..6|6..8|0..1|1..2|2..3", "-|+|-|-|+|.");
+
+ // With duplicates
+ test_sectionalize<bg::model::linestring<P>, false>("with_dups",
+ "LINESTRING(1 1,2 2,3 0,3 0,5 0,5 8)",
+ 5, "0..1|1..2|2..3|3..4|4..5", "+ +|+ -|DUP DUP|+ .|. +",
+ 4, "0..2|2..3|3..4|4..5", "+|DUP|+|.");
+ // With two subsequent duplicate segments
+ test_sectionalize<bg::model::linestring<P>, false>("with_subseq_dups",
+ "LINESTRING(1 1,2 2,3 0,3 0,3 0,5 0,5 0,5 0,5 0,5 8)",
+ 6, "0..1|1..2|2..4|4..5|5..8|8..9", "+ +|+ -|DUP DUP|+ .|DUP DUP|. +",
+ 5, "0..2|2..4|4..5|5..8|8..9", "+|DUP|+|DUP|.");
+
+
+ typedef bg::model::box<P> B;
+ test_sectionalize<2, false, B>("box2", bg::make<B>(0,0,4,4),
+ 4, "0..1|1..2|2..3|3..4", ". +|+ .|. -|- .");
+ test_sectionalize<1, false, B>("box1", bg::make<B>(0,0,4,4),
+ 4, "0..1|1..2|2..3|3..4", ".|+|.|-");
+
+ return;
+ // Buffer-case
+ test_sectionalize<bg::model::polygon<P>, false>("buffer",
+ "POLYGON((-1.1713 0.937043,2.8287 5.93704,2.90334 6.02339,2.98433 6.10382,2.98433 6.10382,3.07121 6.17786,3.16346 6.24507,3.16346 6.24507,3.16346 6.24507,3.26056 6.30508,3.36193 6.35752,3.36193 6.35752,3.46701 6.40211,3.57517 6.43858,3.57517 6.43858,3.57517 6.43858,3.57517 6.43858,3.68579 6.46672,3.79822 6.48637,3.79822 6.48637,3.91183 6.49741,4.02595 6.49978,4.02595 6.49978,4.02595 6.49978,4.13991 6.49346,4.25307 6.4785,4.25307 6.4785,4.36476 6.45497,4.47434 6.42302,4.47434 6.42302,4.47434 6.42302,4.47434 6.42302,7.47434 5.42302,6.84189 3.52566,4.39043 4.68765,0.390434 -0.312348,-1.1713 0.937043))",
+ 8, "0..2|2..3|3..4|4..5|5..6|6..8|8..10|10..11", "+ +|+ -|+ +|- +|+ +|+ -|- -|- +",
+ 4, "0..4|4..5|5..8|8..11", "+|-|+|-");
+}
+
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ std::string const polygon_li = "POLYGON((1872000 528000,1872000 192000,1536119 192000,1536000 528000,1200000 528000,1200000 863880,1536000 863880,1872000 863880,1872000 528000))";
+ bg::model::polygon<int_point_type> int_poly;
+ bg::model::polygon<double_point_type> double_poly;
+ bg::read_wkt(polygon_li, int_poly);
+ bg::read_wkt(polygon_li, double_poly);
+
+ bg::sections<bg::model::box<int_point_type>, 1> int_sections;
+ bg::sections<bg::model::box<double_point_type>, 1> double_sections;
+
+ bg::sectionalize<false>(int_poly, int_sections);
+ bg::sectionalize<false>(double_poly, double_sections);
+
+ bool equally_sized = int_sections.size() == double_sections.size();
+ BOOST_CHECK(equally_sized);
+ if (! equally_sized)
+ {
+ return;
+ }
+
+ for (unsigned int i = 0; i < int_sections.size(); i++)
+ {
+ BOOST_CHECK(int_sections[i].begin_index == double_sections[i].begin_index);
+ BOOST_CHECK(int_sections[i].count == double_sections[i].count);
+ }
+
+}
+
+
+int test_main(int, char* [])
+{
+ test_large_integers();
+
+ //test_all<bg::model::d2::point_xy<float> >();
+ test_all<bg::model::d2::point_xy<double> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/detail/sections/sectionalize.sln b/libs/geometry/test/algorithms/detail/sections/sectionalize.sln
new file mode 100644
index 000000000..5b2ae402b
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/sections/sectionalize.sln
@@ -0,0 +1,25 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sectionalize", "sectionalize.vcproj", "{50410F81-7B83-49D9-BDAE-FA3F0ADB2ADC}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "range_by_section", "range_by_section.vcproj", "{A91434CB-CB32-48AE-8C74-81B6A1EB342F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {50410F81-7B83-49D9-BDAE-FA3F0ADB2ADC}.Debug|Win32.ActiveCfg = Debug|Win32
+ {50410F81-7B83-49D9-BDAE-FA3F0ADB2ADC}.Debug|Win32.Build.0 = Debug|Win32
+ {50410F81-7B83-49D9-BDAE-FA3F0ADB2ADC}.Release|Win32.ActiveCfg = Release|Win32
+ {50410F81-7B83-49D9-BDAE-FA3F0ADB2ADC}.Release|Win32.Build.0 = Release|Win32
+ {A91434CB-CB32-48AE-8C74-81B6A1EB342F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {A91434CB-CB32-48AE-8C74-81B6A1EB342F}.Debug|Win32.Build.0 = Debug|Win32
+ {A91434CB-CB32-48AE-8C74-81B6A1EB342F}.Release|Win32.ActiveCfg = Release|Win32
+ {A91434CB-CB32-48AE-8C74-81B6A1EB342F}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/algorithms/detail/sections/sectionalize.vcproj b/libs/geometry/test/algorithms/detail/sections/sectionalize.vcproj
new file mode 100644
index 000000000..7c7ee5ac8
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/sections/sectionalize.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="sectionalize"
+ ProjectGUID="{50410F81-7B83-49D9-BDAE-FA3F0ADB2ADC}"
+ RootNamespace="sectionalize"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\sectionalize"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../../..;../../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\sectionalize"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../../..;../../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\sectionalize.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/difference.cpp b/libs/geometry/test/algorithms/difference.cpp
new file mode 100644
index 000000000..acc9284d5
--- /dev/null
+++ b/libs/geometry/test/algorithms/difference.cpp
@@ -0,0 +1,518 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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)
+
+// #define TEST_ISOVIST
+
+//#define HAVE_TTMATH
+
+//#define BOOST_GEOMETRY_CHECK_WITH_POSTGIS
+
+//#define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
+//#define BOOST_GEOMETRY_DEBUG_INTERSECTION
+//#define BOOST_GEOMETRY_DEBUG_TRAVERSE
+//#define BOOST_GEOMETRY_DEBUG_FOLLOW
+//#define BOOST_GEOMETRY_DEBUG_ASSEMBLE
+//#define BOOST_GEOMETRY_DEBUG_IDENTIFIER
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+
+#include <boost/geometry/algorithms/correct.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/geometries/point_xy.hpp>
+
+//#include <boost/geometry/extensions/gis/io/wkb/read_wkb.hpp>
+//#include <boost/geometry/extensions/gis/io/wkb/utility.hpp>
+
+#include <algorithms/test_difference.hpp>
+#include <algorithms/test_overlay.hpp>
+#include <algorithms/overlay/overlay_cases.hpp>
+#include <multi/algorithms/overlay/multi_overlay_cases.hpp>
+#include <boost/geometry/multi/io/wkt/wkt.hpp>
+
+
+#ifdef HAVE_TTMATH
+# include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
+#endif
+
+
+
+template <typename Polygon, typename LineString>
+void test_areal_linear()
+{
+ std::string const poly_simplex = "POLYGON((1 1,1 3,3 3,3 1,1 1))";
+ test_one_lp<LineString, LineString, Polygon>("simplex", "LINESTRING(0 2,4 2)", poly_simplex, 2, 4, 2.0);
+ test_one_lp<LineString, LineString, Polygon>("case2", "LINESTRING(0 1,4 3)", poly_simplex, 2, 4, sqrt(5.0));
+ test_one_lp<LineString, LineString, Polygon>("case3", "LINESTRING(0 1,1 2,3 2,4 3,6 3,7 4)", "POLYGON((2 0,2 5,5 5,5 0,2 0))", 2, 6, 2.0 + 2.0 * sqrt(2.0));
+ test_one_lp<LineString, LineString, Polygon>("case4", "LINESTRING(1 1,3 2,1 3)", "POLYGON((0 0,0 4,2 4,2 0,0 0))", 1, 3, sqrt(5.0));
+
+ test_one_lp<LineString, LineString, Polygon>("case5", "LINESTRING(0 1,3 4)", poly_simplex, 2, 4, 2.0 * sqrt(2.0));
+ test_one_lp<LineString, LineString, Polygon>("case6", "LINESTRING(1 1,10 3)", "POLYGON((2 0,2 4,3 4,3 1,4 1,4 3,5 3,5 1,6 1,6 3,7 3,7 1,8 1,8 3,9 3,9 0,2 0))", 5, 10,
+ // Pieces are 1 x 2/9:
+ 5.0 * sqrt(1.0 + 4.0/81.0));
+
+
+ test_one_lp<LineString, LineString, Polygon>("case7", "LINESTRING(1.5 1.5,2.5 2.5)", poly_simplex, 0, 0, 0.0);
+ test_one_lp<LineString, LineString, Polygon>("case8", "LINESTRING(1 0,2 0)", poly_simplex, 1, 2, 1.0);
+
+ std::string const poly_9 = "POLYGON((1 1,1 4,4 4,4 1,1 1))";
+ test_one_lp<LineString, LineString, Polygon>("case9", "LINESTRING(0 1,1 2,2 2)", poly_9, 1, 2, sqrt(2.0));
+ test_one_lp<LineString, LineString, Polygon>("case10", "LINESTRING(0 1,1 2,0 2)", poly_9, 1, 3, 1.0 + sqrt(2.0));
+ test_one_lp<LineString, LineString, Polygon>("case11", "LINESTRING(2 2,4 2,3 3)", poly_9, 0, 0, 0.0);
+ test_one_lp<LineString, LineString, Polygon>("case12", "LINESTRING(2 3,4 4,5 6)", poly_9, 1, 2, sqrt(5.0));
+
+ test_one_lp<LineString, LineString, Polygon>("case13", "LINESTRING(3 2,4 4,2 3)", poly_9, 0, 0, 0.0);
+ test_one_lp<LineString, LineString, Polygon>("case14", "LINESTRING(5 6,4 4,6 5)", poly_9, 1, 3, 2.0 * sqrt(5.0));
+
+ test_one_lp<LineString, LineString, Polygon>("case15", "LINESTRING(0 2,1 2,1 3,0 3)", poly_9, 2, 4, 2.0);
+ test_one_lp<LineString, LineString, Polygon>("case16", "LINESTRING(2 2,1 2,1 3,2 3)", poly_9, 0, 0, 0.0);
+
+ std::string const angly = "LINESTRING(2 2,2 1,4 1,4 2,5 2,5 3,4 3,4 4,5 4,3 6,3 5,2 5,2 6,0 4)";
+ test_one_lp<LineString, LineString, Polygon>("case17", angly, "POLYGON((1 1,1 5,4 5,4 1,1 1))", 3, 11, 6.0 + 4.0 * sqrt(2.0));
+ test_one_lp<LineString, LineString, Polygon>("case18", angly, "POLYGON((1 1,1 5,5 5,5 1,1 1))", 2, 6, 2.0 + 3.0 * sqrt(2.0));
+ test_one_lp<LineString, LineString, Polygon>("case19", "LINESTRING(1 2,1 3,0 3)", poly_9, 1, 2, 1.0);
+ test_one_lp<LineString, LineString, Polygon>("case20", "LINESTRING(1 2,1 3,2 3)", poly_9, 0, 0, 0.0);
+
+ test_one_lp<LineString, LineString, Polygon>("case21", "LINESTRING(1 2,1 4,4 4,4 1,2 1,2 2)", poly_9, 0, 0, 0.0);
+
+ // More collinear (opposite) cases
+ test_one_lp<LineString, LineString, Polygon>("case22", "LINESTRING(4 1,4 4,7 4)", poly_9, 1, 2, 3.0);
+ test_one_lp<LineString, LineString, Polygon>("case23", "LINESTRING(4 0,4 4,7 4)", poly_9, 2, 4, 4.0);
+ test_one_lp<LineString, LineString, Polygon>("case24", "LINESTRING(4 1,4 5,7 5)", poly_9, 1, 3, 4.0);
+ test_one_lp<LineString, LineString, Polygon>("case25", "LINESTRING(4 0,4 5,7 5)", poly_9, 2, 5, 5.0);
+ test_one_lp<LineString, LineString, Polygon>("case26", "LINESTRING(4 0,4 3,4 5,7 5)", poly_9, 2, 5, 5.0);
+ test_one_lp<LineString, LineString, Polygon>("case27", "LINESTRING(4 4,4 5,5 5)", poly_9, 1, 3, 2.0);
+}
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::box<P> box;
+ typedef bg::model::polygon<P> polygon;
+ typedef bg::model::linestring<P> linestring;
+ typedef bg::model::ring<P> ring;
+
+ typedef typename bg::coordinate_type<P>::type ct;
+
+ test_areal_linear<polygon, linestring>();
+
+
+ test_one<polygon, polygon, polygon>("simplex_normal",
+ simplex_normal[0], simplex_normal[1],
+ 3, 12, 2.52636706856656,
+ 3, 12, 3.52636706856656);
+
+ test_one<polygon, polygon, polygon>("simplex_with_empty",
+ simplex_normal[0], polygon_empty,
+ 1, 4, 8.0,
+ 0, 0, 0.0);
+
+ test_one<polygon, polygon, polygon>(
+ "star_ring", example_star, example_ring,
+ 5, 22, 1.1901714,
+ 5, 27, 1.6701714);
+
+ test_one<polygon, polygon, polygon>("two_bends",
+ two_bends[0], two_bends[1],
+ 1, 5, 8.0,
+ 1, 5, 8.0);
+
+ test_one<polygon, polygon, polygon>("star_comb_15",
+ star_comb_15[0], star_comb_15[1],
+ 30, 160, 227.658275102812,
+ 30, 198, 480.485775259312);
+
+ test_one<polygon, polygon, polygon>("new_hole",
+ new_hole[0], new_hole[1],
+ 1, 9, 7.0,
+ 1, 13, 14.0);
+
+
+ test_one<polygon, polygon, polygon>("crossed",
+ crossed[0], crossed[1],
+ 1, 18, 19.5,
+ 1, 7, 2.5);
+
+ test_one<polygon, polygon, polygon>("disjoint",
+ disjoint[0], disjoint[1],
+ 1, 5, 1.0,
+ 1, 5, 1.0);
+
+ test_one<polygon, polygon, polygon>("distance_zero",
+ distance_zero[0], distance_zero[1],
+ 2, -1, 8.7048386,
+ if_typed<ct, float>(1, 2), // The too small one is discarded for floating point
+ -1, 0.0098387);
+
+
+ test_one<polygon, polygon, polygon>("equal_holes_disjoint",
+ equal_holes_disjoint[0], equal_holes_disjoint[1],
+ 1, 5, 9.0,
+ 1, 5, 9.0);
+
+ test_one<polygon, polygon, polygon>("only_hole_intersections1",
+ only_hole_intersections[0], only_hole_intersections[1],
+ 2, 10, 1.9090909,
+ 4, 16, 10.9090909);
+
+ test_one<polygon, polygon, polygon>("only_hole_intersection2",
+ only_hole_intersections[0], only_hole_intersections[2],
+ 3, 20, 30.9090909,
+ 4, 16, 10.9090909);
+
+ test_one<polygon, polygon, polygon>("first_within_second",
+ first_within_second[1], first_within_second[0],
+ 1, 10, 24,
+ 0, 0, 0);
+
+ test_one<polygon, polygon, polygon>("fitting",
+ fitting[0], fitting[1],
+ 1, 9, 21.0,
+ 1, 4, 4.0);
+
+ test_one<polygon, polygon, polygon>("identical",
+ identical[0], identical[1],
+ 0, 0, 0.0,
+ 0, 0, 0.0);
+
+ test_one<polygon, polygon, polygon>("intersect_exterior_and_interiors_winded",
+ intersect_exterior_and_interiors_winded[0], intersect_exterior_and_interiors_winded[1],
+ 4, 20, 11.533333,
+ 5, 26, 29.783333);
+
+ test_one<polygon, polygon, polygon>("intersect_holes_intersect_and_disjoint",
+ intersect_holes_intersect_and_disjoint[0], intersect_holes_intersect_and_disjoint[1],
+ 2, 16, 15.75,
+ 3, 17, 6.75);
+
+ test_one<polygon, polygon, polygon>("intersect_holes_intersect_and_touch",
+ intersect_holes_intersect_and_touch[0], intersect_holes_intersect_and_touch[1],
+ 3, 21, 16.25,
+ 3, 17, 6.25);
+
+ test_one<polygon, polygon, polygon>("intersect_holes_new_ring",
+ intersect_holes_new_ring[0], intersect_holes_new_ring[1],
+ 3, 15, 9.8961,
+ 4, 25, 121.8961, 0.01);
+
+ test_one<polygon, polygon, polygon>("first_within_hole_of_second",
+ first_within_hole_of_second[0], first_within_hole_of_second[1],
+ 1, 5, 1,
+ 1, 10, 16);
+
+ test_one<polygon, polygon, polygon>("intersect_holes_disjoint",
+ intersect_holes_disjoint[0], intersect_holes_disjoint[1],
+ 2, 14, 16.0,
+ 2, 10, 6.0);
+
+ test_one<polygon, polygon, polygon>("intersect_holes_intersect",
+ intersect_holes_intersect[0], intersect_holes_intersect[1],
+ 2, 16, 15.75,
+ 2, 12, 5.75);
+
+ test_one<polygon, polygon, polygon>(
+ "case4", case_4[0], case_4[1],
+ 6, 28, 2.77878787878788,
+ 4, 22, 4.77878787878788);
+
+ test_one<polygon, polygon, polygon>(
+ "case5", case_5[0], case_5[1],
+ 8, 36, 2.43452380952381,
+ 7, 33, 3.18452380952381);
+
+ test_one<polygon, polygon, polygon>("winded",
+ winded[0], winded[1],
+ 3, 37, 61,
+ 1, 15, 13);
+
+ test_one<polygon, polygon, polygon>("within_holes_disjoint",
+ within_holes_disjoint[0], within_holes_disjoint[1],
+ 2, 15, 25,
+ 1, 5, 1);
+
+ test_one<polygon, polygon, polygon>("side_side",
+ side_side[0], side_side[1],
+ 1, 5, 1,
+ 1, 5, 1);
+
+ test_one<polygon, polygon, polygon>("buffer_mp1",
+ buffer_mp1[0], buffer_mp1[1],
+ 1, 61, 10.2717,
+ 1, 61, 10.2717);
+
+ if (boost::is_same<ct, double>::value)
+ {
+ test_one<polygon, polygon, polygon>("buffer_mp2",
+ buffer_mp2[0], buffer_mp2[1],
+ 1, 92, 12.09857,
+ 1, 157, 24.19787);
+ }
+
+ /*** TODO: self-tangencies for difference
+ test_one<polygon, polygon, polygon>("wrapped_a",
+ wrapped[0], wrapped[1],
+ 3, 1, 61,
+ 1, 0, 13);
+
+ test_one<polygon, polygon, polygon>("wrapped_b",
+ wrapped[0], wrapped[2],
+ 3, 1, 61,
+ 1, 0, 13);
+ ***/
+
+#ifdef _MSC_VER
+#ifdef TEST_ISOVIST
+ test_one<polygon, polygon, polygon>("isovist",
+ isovist1[0], isovist1[1],
+ if_typed_tt<ct>(4, 2), 0, 0.279121891701124,
+ if_typed_tt<ct>(4, 3), 0, if_typed_tt<ct>(224.889211358929, 223.777),
+ if_typed_tt<ct>(0.001, 0.2));
+
+ // SQL Server gives: 0.279121891701124 and 224.889211358929
+ // PostGIS gives: 0.279121991127244 and 224.889205853156
+
+#endif
+
+ 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);
+#endif
+
+ test_one<polygon, polygon, polygon>("ggl_list_20110307_javier",
+ ggl_list_20110307_javier[0], ggl_list_20110307_javier[1],
+ 1, 13, 16815.6,
+ 1, 4, 3200.4,
+ 0.01);
+
+ if (! boost::is_same<ct, float>::value)
+ {
+ 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
+ );
+ }
+
+ 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);
+
+ 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);
+
+#ifdef _MSC_VER
+ // 2011-07-02
+ // Interesting FP-precision case.
+ // sql server gives: 6.62295817619452E-05
+ // PostGIS gives: 0.0 (no output)
+ // Boost.Geometry gives results depending on FP-type, and compiler, and operating system.
+ // For double, it is zero (skipped). On gcc/Linux, for float either.
+ // Because we cannot predict this, we only test for MSVC
+ test_one<polygon, polygon, polygon>("ggl_list_20110627_phillip",
+ ggl_list_20110627_phillip[0], ggl_list_20110627_phillip[1],
+ if_typed_tt<ct>(1, 0), -1,
+ if_typed_tt<ct>(0.0000000000001105367, 0.0),
+ 1, -1, 3577.40960816756,
+ 0.01
+ );
+#endif
+
+ // Other combi's
+ {
+ test_one<polygon, polygon, ring>(
+ "star_ring_ring", example_star, example_ring,
+ 5, 22, 1.1901714, 5, 27, 1.6701714);
+
+ test_one<polygon, ring, polygon>(
+ "ring_star_ring", example_ring, example_star,
+ 5, 27, 1.6701714, 5, 22, 1.1901714);
+
+ static std::string const clip = "POLYGON((2.5 0.5,5.5 2.5))";
+
+ test_one<polygon, box, ring>("star_box",
+ clip, example_star,
+ 4, 20, 2.833333, 4, 16, 0.833333);
+
+ test_one<polygon, ring, box>("box_star",
+ example_star, clip,
+ 4, 16, 0.833333, 4, 20, 2.833333);
+ }
+
+ // Counter clockwise
+ {
+ typedef bg::model::polygon<P, false> polygon_ccw;
+ test_one<polygon, polygon_ccw, polygon_ccw>(
+ "star_ring_ccw", example_star, example_ring,
+ 5, 22, 1.1901714, 5, 27, 1.6701714);
+ test_one<polygon, polygon, polygon_ccw>(
+ "star_ring_ccw1", example_star, example_ring,
+ 5, 22, 1.1901714, 5, 27, 1.6701714);
+ test_one<polygon, polygon_ccw, polygon>(
+ "star_ring_ccw2", example_star, example_ring,
+ 5, 22, 1.1901714, 5, 27, 1.6701714);
+ }
+
+
+
+ // Multi/box (should be moved to multi)
+ {
+ /* Tested with SQL Geometry:
+ with viewy as (select geometry::STGeomFromText(
+ 'MULTIPOLYGON(((0 1,2 5,5 3,0 1)),((1 1,5 2,5 0,1 1)))',0) as p,
+ geometry::STGeomFromText(
+ 'POLYGON((2 2,2 4,4 4,4 2,2 2))',0) as q)
+
+ select
+ p.STDifference(q).STArea(),p.STDifference(q).STNumGeometries(),p.STDifference(q) as p_min_q,
+ q.STDifference(p).STArea(),q.STDifference(p).STNumGeometries(),q.STDifference(p) as q_min_p,
+ p.STSymDifference(q).STArea(),q.STSymDifference(p) as p_xor_q
+ from viewy
+
+ */
+ typedef bg::model::multi_polygon<polygon> mp;
+
+ static std::string const clip = "POLYGON((2 2,4 4))";
+
+ test_one<polygon, box, mp>("simplex_multi_box_mp",
+ clip, case_multi_simplex[0],
+ 2, -1, 0.53333333333, 3, -1, 8.53333333333);
+ test_one<polygon, mp, box>("simplex_multi_mp_box",
+ case_multi_simplex[0], clip,
+ 3, -1, 8.53333333333, 2, -1, 0.53333333333);
+
+ }
+
+ /***
+ Experimental (cut), does not work:
+ test_one<polygon, polygon, polygon>(
+ "polygon_pseudo_line",
+ "POLYGON((0 0,0 4,4 4,4 0,0 0))",
+ "POLYGON((2 -2,2 -1,2 6,2 -2))",
+ 5, 22, 1.1901714,
+ 5, 27, 1.6701714);
+ ***/
+}
+
+/*******
+// To be moved to another file
+template <typename T>
+void test_difference_parcel_precision()
+{
+ typedef bg::model::d2::point_xy<T> point_type;
+ typedef bg::model::polygon<point_type> polygon_type;
+ typedef bg::model::linestring<point_type> linestring_type;
+ typedef std::vector<boost::uint8_t> byte_vector;
+
+ polygon_type parcel, buffer;
+
+ {
+ byte_vector wkb;
+ bg::hex2wkb("0103000000010000001A00000023DBF97EE316064146B6F3FDD32513415A643BDFD216064175931804E225134196438B6C52150641C976BE9F34261341F6285C8F06150641022B871641261341F853E3A5D3140641E17A14AE50261341B81E85EBFB120641A4703D8A142713414E6210584D120641AC1C5A64602713414E621058431106414E621058C9271341A01A2FDD1B11064121B07268D8271341F4FDD478571006411904560ECF271341448B6CE7DD0F06418195438BC1271341F6285C8F6A0F06413BDF4F0DA72713410E2DB29D360F06416F1283C091271341E5D022DB070F0641F6285C0F7227134160E5D022DA0E06416F1283404F271341448B6CE7D30E0641F853E3A52427134154E3A59BE60E06411904568E07271341643BDF4F0C0F0641D7A3703DFC2613414A0C022B100F064125068115FB26134191ED7C3F310F0641B6F3FDD4F42613414C378941F11006414A0C022BA0261341EC51B81ECC1206413BDF4F0D40261341022B87167514064125068115F1251341B4C876BE8C160641C74B37897F25134121B07268C6160641508D976E7525134123DBF97EE316064146B6F3FDD3251341", std::back_inserter(wkb));
+ bg::read_wkb(wkb.begin(), wkb.end(), parcel);
+ }
+ {
+ byte_vector wkb;
+ bg::hex2wkb("01030000000100000083000000000032FCD716064100009E998F25134100000706D81606410040A4998F2513410000DA0FD816064100C0E6998F2513410000A819D81606410080659A8F25134100806A23D816064100C0209B8F25134100801E2DD81606410080189C8F2513410000BE36D816064100404D9D8F25134100004540D816064100C0BE9E8F2513410000AF49D816064100806DA08F2513410000F752D8160641008059A28F2513410000195CD816064100C082A48F25134100800F65D81606410080E9A68F2513410000D66DD816064100408EA98F25134100006876D816064100C070AC8F2513410000C17ED8160641000091AF8F2513410080DC86D816064100C0EFB28F25134100009E8ED816064100C081B68F2513410080EC95D816064100803ABA8F2513410080C79CD8160641000018BE8F25134100002FA3D8160641008017C28F251341008022A9D8160641000037C68F2513410080A1AED8160641000074CA8F2513410000ACB3D81606410040CCCE8F251341000042B8D816064100403DD38F251341000062BCD81606410000C5D78F25134100000DC0D8160641000061DC8F251341000042C3D816064100000FE18F251341000001C6D81606410080CCE58F251341008049C8D8160641004097EA8F25134100001BCAD816064100006DEF8F251341008075CBD816064100804BF48F251341008058CCD8160641004030F98F2513410000C4CCD8160641000019FE8F2513410080B7CCD81606410080030390251341008032CCD81606410000ED0790251341000035CBD81606410000D40C902513410080BEC9D81606410040B511902513410000CFC7D816064100408F1690251341008065C5D816064100005F1B90251341008082C2D81606410080222090251341000025BFD81606410080D7249025134100004DBBD816064100807B29902513410080FAB6D816064100800C2E9025134100002DB2D816064100C08732902513410080E3ACD81606410000EB369025134100801EA7D81606410000343B902513410000DEA0D81606410080603F902513410080209AD816064100406E43902513410080209AC015064100406E43302613410080FC92C015064100004F473026134100008B8BC01506410040F64A302613410000D083C015064100C0634E302613410000D17BC0150641008097513026134100009273C015064100409154302613410000186BC015064100C050573026134100806762C01506410000D6593026134100808559C01506410000215C3026134100007650C01506410000315E3026134100003E47C015064100800660302613410000E23DC01506410000A1613026134100006734C015064100800063302613410080D12AC015064100C024643026134100002621C015064100800D653026134100006917C015064100C0BA653026134100809F0DC015064100402C66302613410000CE03C015064100006266302613410000F9F9BF15064100C05B6630261341000026F0BF1506410040196630261341000058E6BF15064100809A6530261341008095DCBF1506410040DF64302613410080E1D2BF1506410080E76330261341000042C9BF15064100C0B262302613410000BBBFBF1506410040416130261341000051B6BF1506410080925F30261341000009ADBF1506410080A65D302613410000E7A3BF15064100407D5B302613410080F09ABF150641008016593026134100002A92BF15064100C071563026134100009889BF15064100408F533026134100003F81BF15064100006F503026134100802379BF1506410040104D3026134100006271BF15064100407E49302613410080136ABF1506410080C5453026134100803863BF1506410000E841302613410000D15CBF1506410080E83D302613410080DD56BF1506410000C9393026134100805E51BF15064100008C35302613410000544CBF15064100C03331302613410000BE47BF15064100C0C22C3026134100009E43BF15064100003B28302613410000F33FBF15064100009F23302613410000BE3CBF1506410000F11E302613410000FF39BF1506410080331A302613410080B637BF15064100C06815302613410000E535BF150641000093103026134100808A34BF1506410080B40B302613410080A733BF15064100C0CF063026134100003C33BF1506410000E7013026134100804833BF1506410080FCFC2F2613410080CD33BF150641000013F82F2613410000CB34BF15064100002CF32F26134100804136BF15064100C04AEE2F26134100003138BF15064100C070E92F26134100809A3ABF1506410000A1E42F26134100807D3DBF1506410080DDDF2F2613410000DB40BF150641008028DB2F2613410000B344BF150641008084D62F26134100800549BF1506410080F3D12F2613410000D34DBF150641004078CD2F26134100801C53BF150641000015C92F2613410080E158BF1506410000CCC42F2613410000225FBF15064100809FC02F2613410080DF65BF15064100C091BC2F2613410080DF65D716064100C091BC8F2513410080036DD71606410000B1B88F25134100007574D716064100C009B58F2513410000307CD716064100409CB18F25134100002F84D7160641008068AE8F25134100006E8CD716064100C06EAB8F2513410000E894D71606410040AFA88F2513410080989DD716064100002AA68F25134100807AA6D71606410000DFA38F25134100008AAFD71606410000CFA18F2513410000C2B8D71606410080F99F8F25134100001EC2D716064100005F9E8F251341000099CBD71606410080FF9C8F25134100802ED5D71606410040DB9B8F2513410000DADED71606410080F29A8F251341000097E8D71606410040459A8F251341008060F2D716064100C0D3998F251341000032FCD716064100009E998F251341", std::back_inserter(wkb));
+ bg::read_wkb(wkb.begin(), wkb.end(), buffer);
+ }
+ bg::correct(parcel);
+ bg::correct(buffer);
+
+ std::vector<polygon_type> pieces;
+ bg::difference(parcel, buffer, pieces);
+
+ std::vector<polygon_type> filled_out;
+ bg::difference(parcel, pieces.back(), filled_out);
+
+#if defined(TEST_OUTPUT)
+ std::cout << bg::area(parcel) << std::endl;
+ std::cout << bg::area(buffer) << std::endl;
+ std::cout << pieces.size() << std::endl;
+ std::cout << bg::area(pieces.front()) << std::endl;
+ std::cout << filled_out.size() << std::endl;
+ std::cout << std::setprecision(16) << bg::wkt(filled_out.front()) << std::endl;
+ std::cout << bg::wkt(filled_out.front()) << std::endl;
+ std::cout << bg::area(filled_out.front()) << std::endl;
+ std::cout << bg::perimeter(filled_out.front()) << std::endl;
+#endif
+
+#if defined(TEST_WITH_SVG)
+ {
+ linestring_type cut_line;
+ bg::read_wkt("linestring(180955 313700,180920 313740)", cut_line);
+
+ std::ostringstream filename;
+ filename << "difference_precision_"
+ << string_from_type<T>::name()
+ << ".svg";
+
+ std::ofstream svg(filename.str().c_str());
+
+ bg::svg_mapper<point_type> mapper(svg, 500, 500);
+
+ mapper.add(cut_line);
+
+ //mapper.map(parcel, "fill-opacity:0.5;fill:rgb(153,204,0);stroke:rgb(153,204,0);stroke-width:3");
+ mapper.map(pieces.front(), "fill-opacity:0.5;fill:rgb(153,204,0);stroke:rgb(153,204,0);stroke-width:1");
+ mapper.map(pieces.back(), "fill-opacity:0.5;fill:rgb(153,204,0);stroke:rgb(153,204,0);stroke-width:1");
+ mapper.map(filled_out.front(), "fill-opacity:0.3;fill:rgb(51,51,153);stroke:rgb(51,51,153);stroke-width:3");
+
+ mapper.map(cut_line, "opacity:0.8;fill:none;stroke:rgb(255,128,0);stroke-width:5;stroke-dasharray:1,7;stroke-linecap:round");
+ //mapper.map(cut_line, "opacity:0.8;fill:none;stroke:rgb(255,128,0);stroke-width:2");
+ }
+#endif
+}
+*****/
+
+
+template <typename P, bool clockwise, bool closed>
+void test_specific()
+{
+ typedef bg::model::polygon<P, clockwise, closed> polygon;
+
+ 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, 0.01);
+}
+
+
+int test_main(int, char* [])
+{
+ //test_difference_parcel_precision<float>();
+ //test_difference_parcel_precision<double>();
+
+ test_all<bg::model::d2::point_xy<double> >();
+
+ test_specific<bg::model::d2::point_xy<int>, false, false>();
+
+#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
+ test_all<bg::model::d2::point_xy<float> >();
+
+#ifdef HAVE_TTMATH
+ std::cout << "Testing TTMATH" << std::endl;
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+ //test_difference_parcel_precision<ttmath_big>();
+#endif
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/difference.vcproj b/libs/geometry/test/algorithms/difference.vcproj
new file mode 100644
index 000000000..2302ee27f
--- /dev/null
+++ b/libs/geometry/test/algorithms/difference.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="difference"
+ ProjectGUID="{4EBFC27A-75C9-43A1-8DDA-AFEB45C564DC}"
+ RootNamespace="difference"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\difference"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;..;../$(TTMATH_ROOT)"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NONDLL;_CRT_SECURE_NO_WARNINGS"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\difference"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NONDLL;_CRT_SECURE_NO_WARNINGS"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\difference.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/disjoint.cpp b/libs/geometry/test/algorithms/disjoint.cpp
new file mode 100644
index 000000000..51d12cf64
--- /dev/null
+++ b/libs/geometry/test/algorithms/disjoint.cpp
@@ -0,0 +1,237 @@
+// 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.
+
+// 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 <iostream>
+#include <string>
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/disjoint.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <test_common/test_point.hpp>
+
+#include <algorithms/test_relate.hpp>
+
+
+template <typename G1, typename G2>
+void test_disjoint(std::string const& id,
+ std::string const& wkt1,
+ std::string const& wkt2, bool expected)
+{
+ G1 g1;
+ bg::read_wkt(wkt1, g1);
+
+ G2 g2;
+ bg::read_wkt(wkt2, g2);
+
+ bool detected = bg::disjoint(g1, g2);
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "disjoint: " << id
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+}
+
+
+
+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;
+
+ // Four times same test with other types
+ test_disjoint<polygon, polygon>("disjoint_simplex_pp", disjoint_simplex[0], disjoint_simplex[1], true);
+ test_disjoint<ring, polygon>("disjoint_simplex_rp", disjoint_simplex[0], disjoint_simplex[1], true);
+ test_disjoint<ring, ring>("disjoint_simplex_rr", disjoint_simplex[0], disjoint_simplex[1], true);
+ test_disjoint<polygon, ring>("disjoint_simplex_pr", disjoint_simplex[0], disjoint_simplex[1], true);
+
+ // 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;
+ test_disjoint<ls, ls>("ls/ls 1", "linestring(0 0,1 1)", "linestring(1 0,0 1)", false);
+ test_disjoint<ls, ls>("ls/ls 2", "linestring(0 0,1 1)", "linestring(1 0,2 1)", true);
+ test_disjoint<segment, segment>("s/s 1", "linestring(0 0,1 1)", "linestring(1 0,0 1)", false);
+ test_disjoint<segment, segment>("s/s 2", "linestring(0 0,1 1)", "linestring(1 0,2 1)", true);
+
+ // Test degenerate segments (patched by Karsten Ahnert on 2012-07-25)
+ test_disjoint<segment, segment>("s/s 3", "linestring(0 0,0 0)", "linestring(1 0,0 1)", true);
+ test_disjoint<segment, segment>("s/s 4", "linestring(0 0,0 0)", "linestring(0 0,0 0)", false);
+ test_disjoint<segment, segment>("s/s 5", "linestring(0 0,0 0)", "linestring(1 0,1 0)", true);
+ test_disjoint<segment, segment>("s/s 6", "linestring(0 0,0 0)", "linestring(0 1,0 1)", true);
+
+ // Collinear opposite
+ test_disjoint<ls, ls>("ls/ls co", "linestring(0 0,2 2)", "linestring(1 1,0 0)", false);
+ // Collinear opposite and equal
+ 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
+ std::string const a = "linestring(100 10, 0 10)";
+ std::string const b = "linestring(50 10, 50 10)"; // one point only, with same y-coordinate
+ std::string const c = "linestring(100 10, 100 10)"; // idem, at left side
+ test_disjoint<ls, ls>("dls/dls 1", a, b, false);
+ test_disjoint<ls, ls>("dls/dls 2", b, a, false);
+ test_disjoint<segment, segment>("ds/ds 1", a, b, false);
+ test_disjoint<segment, segment>("ds/ds 2", b, a, false);
+ test_disjoint<ls, ls>("dls/dls 1", a, c, false);
+ }
+
+ // Linestrings making angles normally ignored
+ {
+ // These (non-disjoint) cases
+ // correspond to the test "segment_intersection_collinear"
+
+ // Collinear ('a')
+ // a1---------->a2
+ // b1--->b2
+ test_disjoint<ls, ls>("n1", "linestring(2 0,0 6)", "linestring(0 0,2 0)", false);
+
+ // a1---------->a2
+ // b1--->b2
+ test_disjoint<ls, ls>("n7", "linestring(2 0,6 0)", "linestring(6 0,8 0)", false);
+
+ // Collinear - opposite ('f')
+ // a1---------->a2
+ // b2<---b1
+ test_disjoint<ls, ls>("o1", "linestring(2 0,6 0)", "linestring(2 0,0 0)", false);
+ }
+
+ {
+ // Starting in the middle ('s')
+ // b2
+ // ^
+ // |
+ // |
+ // a1--------b1----->a2
+ test_disjoint<ls, ls>("case_s", "linestring(0 0,4 0)", "linestring(2 0,2 2)", false);
+
+ // Collinear, but disjoint
+ test_disjoint<ls, ls>("c-d", "linestring(2 0,6 0)", "linestring(7 0,8 0)", true);
+
+ // Parallel, disjoint
+ test_disjoint<ls, ls>("c-d", "linestring(2 0,6 0)", "linestring(2 1,6 1)", true);
+
+ // Error still there until 1.48 (reported "error", was reported to disjoint, so that's why it did no harm)
+ test_disjoint<ls, ls>("case_recursive_boxes_1",
+ "linestring(10 7,10 6)", "linestring(10 10,10 9)", true);
+
+ }
+
+ // TODO test_disjoint<segment, ls>("s/ls 1", "linestring(0 0,1 1)", "linestring(1 0,0 1)", false);
+ // TODO test_disjoint<segment, ls>("s/ls 2", "linestring(0 0,1 1)", "linestring(1 0,2 1)", true);
+ // TODO test_disjoint<ls, segment>("ls/s 1", "linestring(0 0,1 1)", "linestring(1 0,0 1)", false);
+ // TODO test_disjoint<ls, segment>("ls/s 2", "linestring(0 0,1 1)", "linestring(1 0,2 1)", true);
+
+}
+
+
+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/disjoint.vcproj b/libs/geometry/test/algorithms/disjoint.vcproj
new file mode 100644
index 000000000..d27526cc7
--- /dev/null
+++ b/libs/geometry/test/algorithms/disjoint.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="disjoint"
+ ProjectGUID="{96D51D96-B35F-47C8-864D-371DF2280686}"
+ RootNamespace="disjoint"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;..;"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\disjoint.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/distance.cpp b/libs/geometry/test/algorithms/distance.cpp
new file mode 100644
index 000000000..e7d072976
--- /dev/null
+++ b/libs/geometry/test/algorithms/distance.cpp
@@ -0,0 +1,317 @@
+// 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.
+
+// 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)
+
+#define TEST_ARRAY
+
+#include <sstream>
+
+#include <algorithms/test_distance.hpp>
+
+#include <boost/mpl/if.hpp>
+#include <boost/array.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+#include <test_common/test_point.hpp>
+#include <test_geometries/custom_segment.hpp>
+#include <test_geometries/wrapped_boost_array.hpp>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+// Register boost array as a linestring
+namespace boost { namespace geometry { namespace traits
+{
+template <typename Point, std::size_t PointCount>
+struct tag< boost::array<Point, PointCount> >
+{
+ typedef linestring_tag type;
+};
+
+}}}
+
+template <typename P>
+void test_distance_point()
+{
+ namespace services = bg::strategy::distance::services;
+ typedef typename bg::default_distance_result<P>::type return_type;
+
+ // Basic, trivial test
+
+ P p1;
+ bg::set<0>(p1, 1);
+ bg::set<1>(p1, 1);
+
+ P p2;
+ bg::set<0>(p2, 2);
+ bg::set<1>(p2, 2);
+
+ return_type d = bg::distance(p1, p2);
+ BOOST_CHECK_CLOSE(d, return_type(1.4142135), 0.001);
+
+ // Test specifying strategy manually
+ typename services::default_strategy<bg::point_tag, P>::type strategy;
+
+ d = bg::distance(p1, p2, strategy);
+ BOOST_CHECK_CLOSE(d, return_type(1.4142135), 0.001);
+
+ {
+ // Test custom strategy
+ BOOST_CONCEPT_ASSERT( (bg::concept::PointDistanceStrategy<taxicab_distance<P> >) );
+
+ typedef typename services::return_type<taxicab_distance<P> >::type cab_return_type;
+ BOOST_MPL_ASSERT((boost::is_same<cab_return_type, typename bg::coordinate_type<P>::type>));
+
+ taxicab_distance<P> tcd;
+ cab_return_type d = bg::distance(p1, p2, tcd);
+
+ BOOST_CHECK( bg::math::abs(d - cab_return_type(2)) <= cab_return_type(0.01) );
+ }
+
+ {
+ // test comparability
+
+ typedef typename services::default_strategy<bg::point_tag, P>::type strategy_type;
+ typedef typename services::comparable_type<strategy_type>::type comparable_strategy_type;
+
+ strategy_type strategy;
+ comparable_strategy_type comparable_strategy = services::get_comparable<strategy_type>::apply(strategy);
+ return_type comparable = services::result_from_distance<comparable_strategy_type>::apply(comparable_strategy, 3);
+
+ BOOST_CHECK_CLOSE(comparable, return_type(9), 0.001);
+ }
+}
+
+template <typename P>
+void test_distance_segment()
+{
+ typedef typename bg::default_distance_result<P>::type return_type;
+ typedef typename bg::coordinate_type<P>::type coordinate_type;
+
+ P s1; bg::set<0>(s1, 1); bg::set<1>(s1, 1);
+ P s2; bg::set<0>(s2, 4); bg::set<1>(s2, 4);
+
+ // Check points left, right, projected-left, projected-right, on segment
+ P p1; bg::set<0>(p1, 0); bg::set<1>(p1, 1);
+ P p2; bg::set<0>(p2, 1); bg::set<1>(p2, 0);
+ P p3; bg::set<0>(p3, 3); bg::set<1>(p3, 1);
+ P p4; bg::set<0>(p4, 1); bg::set<1>(p4, 3);
+ P p5; bg::set<0>(p5, 3); bg::set<1>(p5, 3);
+
+ bg::model::referring_segment<P const> const seg(s1, s2);
+
+ return_type d1 = bg::distance(p1, seg);
+ return_type d2 = bg::distance(p2, seg);
+ return_type d3 = bg::distance(p3, seg);
+ return_type d4 = bg::distance(p4, seg);
+ return_type d5 = bg::distance(p5, seg);
+
+ BOOST_CHECK_CLOSE(d1, return_type(1), 0.001);
+ BOOST_CHECK_CLOSE(d2, return_type(1), 0.001);
+ BOOST_CHECK_CLOSE(d3, return_type(1.4142135), 0.001);
+ BOOST_CHECK_CLOSE(d4, return_type(1.4142135), 0.001);
+ BOOST_CHECK_CLOSE(d5, return_type(0), 0.001);
+
+ // Reverse case: segment/point instead of point/segment
+ return_type dr1 = bg::distance(seg, p1);
+ return_type dr2 = bg::distance(seg, p2);
+
+ BOOST_CHECK_CLOSE(dr1, d1, 0.001);
+ BOOST_CHECK_CLOSE(dr2, d2, 0.001);
+
+ // Test specifying strategy manually:
+ // 1) point-point-distance
+ typename bg::strategy::distance::services::default_strategy<bg::point_tag, P>::type pp_strategy;
+ d1 = bg::distance(p1, seg, pp_strategy);
+ BOOST_CHECK_CLOSE(d1, return_type(1), 0.001);
+
+ // 2) point-segment-distance
+ typename bg::strategy::distance::services::default_strategy<bg::segment_tag, P>::type ps_strategy;
+ d1 = bg::distance(p1, seg, ps_strategy);
+ BOOST_CHECK_CLOSE(d1, return_type(1), 0.001);
+
+ // 3) custom point strategy
+ taxicab_distance<P> tcd;
+ d1 = bg::distance(p1, seg, tcd);
+ BOOST_CHECK_CLOSE(d1, return_type(1), 0.001);
+}
+
+
+template <typename P>
+void test_distance_array_as_linestring()
+{
+ typedef typename bg::default_distance_result<P>::type return_type;
+
+ // Normal array does not have
+ boost::array<P, 2> points;
+ bg::set<0>(points[0], 1);
+ bg::set<1>(points[0], 1);
+ bg::set<0>(points[1], 3);
+ bg::set<1>(points[1], 3);
+
+ P p;
+ bg::set<0>(p, 2);
+ bg::set<1>(p, 1);
+
+ return_type d = bg::distance(p, points);
+ BOOST_CHECK_CLOSE(d, return_type(0.70710678), 0.001);
+
+ bg::set<0>(p, 5); bg::set<1>(p, 5);
+ d = bg::distance(p, points);
+ BOOST_CHECK_CLOSE(d, return_type(2.828427), 0.001);
+}
+
+
+
+
+template <typename P>
+void test_all()
+{
+ test_distance_point<P>();
+ test_distance_segment<P>();
+ test_distance_array_as_linestring<P>();
+
+ test_geometry<P, bg::model::segment<P> >("POINT(1 3)", "LINESTRING(1 1,4 4)", sqrt(2.0));
+ test_geometry<P, bg::model::segment<P> >("POINT(3 1)", "LINESTRING(1 1,4 4)", sqrt(2.0));
+
+ test_geometry<P, P>("POINT(1 1)", "POINT(2 2)", sqrt(2.0));
+ test_geometry<P, P>("POINT(0 0)", "POINT(0 3)", 3.0);
+ test_geometry<P, P>("POINT(0 0)", "POINT(4 0)", 4.0);
+ test_geometry<P, P>("POINT(0 3)", "POINT(4 0)", 5.0);
+ test_geometry<P, bg::model::linestring<P> >("POINT(1 3)", "LINESTRING(1 1,4 4)", sqrt(2.0));
+ test_geometry<P, bg::model::linestring<P> >("POINT(3 1)", "LINESTRING(1 1,4 4)", sqrt(2.0));
+ test_geometry<P, bg::model::linestring<P> >("POINT(50 50)", "LINESTRING(50 40, 40 50)", sqrt(50.0));
+ test_geometry<P, bg::model::linestring<P> >("POINT(50 50)", "LINESTRING(50 40, 40 50, 0 90)", sqrt(50.0));
+ test_geometry<bg::model::linestring<P>, P>("LINESTRING(1 1,4 4)", "POINT(1 3)", sqrt(2.0));
+ test_geometry<bg::model::linestring<P>, P>("LINESTRING(50 40, 40 50)", "POINT(50 50)", sqrt(50.0));
+ test_geometry<bg::model::linestring<P>, P>("LINESTRING(50 40, 40 50, 0 90)", "POINT(50 50)", sqrt(50.0));
+
+ // Rings
+ test_geometry<P, bg::model::ring<P> >("POINT(1 3)", "POLYGON((1 1,4 4,5 0,1 1))", sqrt(2.0));
+ test_geometry<P, bg::model::ring<P> >("POINT(3 1)", "POLYGON((1 1,4 4,5 0,1 1))", 0.0);
+ // other way round
+ test_geometry<bg::model::ring<P>, P>("POLYGON((1 1,4 4,5 0,1 1))", "POINT(3 1)", 0.0);
+ // open ring
+ test_geometry<P, bg::model::ring<P, true, false> >("POINT(1 3)", "POLYGON((4 4,5 0,1 1))", sqrt(2.0));
+
+ // Polygons
+ test_geometry<P, bg::model::polygon<P> >("POINT(1 3)", "POLYGON((1 1,4 4,5 0,1 1))", sqrt(2.0));
+ test_geometry<P, bg::model::polygon<P> >("POINT(3 1)", "POLYGON((1 1,4 4,5 0,1 1))", 0.0);
+ // other way round
+ test_geometry<bg::model::polygon<P>, P>("POLYGON((1 1,4 4,5 0,1 1))", "POINT(3 1)", 0.0);
+ // open polygon
+ test_geometry<P, bg::model::polygon<P, true, false> >("POINT(1 3)", "POLYGON((4 4,5 0,1 1))", sqrt(2.0));
+
+ // Polygons with holes
+ std::string donut = "POLYGON ((0 0,1 9,8 1,0 0),(1 1,4 1,1 4,1 1))";
+ test_geometry<P, bg::model::polygon<P> >("POINT(2 2)", donut, 0.5 * sqrt(2.0));
+ test_geometry<P, bg::model::polygon<P> >("POINT(3 3)", donut, 0.0);
+ // other way round
+ test_geometry<bg::model::polygon<P>, P>(donut, "POINT(2 2)", 0.5 * sqrt(2.0));
+ // open
+ test_geometry<P, bg::model::polygon<P, true, false> >("POINT(2 2)", "POLYGON ((0 0,1 9,8 1),(1 1,4 1,1 4))", 0.5 * sqrt(2.0));
+
+ // Should (currently) give compiler assertion
+ // test_geometry<bg::model::polygon<P>, bg::model::polygon<P> >(donut, donut, 0.5 * sqrt(2.0));
+
+ // DOES NOT COMPILE - cannot do read_wkt (because boost::array is not variably sized)
+ // test_geometry<P, boost::array<P, 2> >("POINT(3 1)", "LINESTRING(1 1,4 4)", sqrt(2.0));
+
+ test_geometry<P, test::wrapped_boost_array<P, 2> >("POINT(3 1)", "LINESTRING(1 1,4 4)", sqrt(2.0));
+
+}
+
+template <typename P>
+void test_empty_input()
+{
+ P p;
+ bg::model::linestring<P> line_empty;
+ bg::model::polygon<P> poly_empty;
+ bg::model::ring<P> ring_empty;
+
+ test_empty_input(p, line_empty);
+ test_empty_input(p, poly_empty);
+ test_empty_input(p, ring_empty);
+}
+
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ // point-point
+ {
+ std::string const a = "POINT(2544000 528000)";
+ std::string const b = "POINT(2768040 528000)";
+ int_point_type ia, ib;
+ double_point_type da, db;
+ bg::read_wkt(a, ia);
+ bg::read_wkt(b, ib);
+ bg::read_wkt(a, da);
+ bg::read_wkt(b, db);
+
+ BOOST_AUTO(idist, bg::distance(ia, ib));
+ BOOST_AUTO(ddist, bg::distance(da, db));
+
+ BOOST_CHECK_MESSAGE(std::abs(idist - ddist) < 0.1,
+ "within<a double> different from within<an int>");
+ }
+ // Point-segment
+ {
+ std::string const a = "POINT(2600000 529000)";
+ std::string const b = "LINESTRING(2544000 528000, 2768040 528000)";
+ int_point_type ia;
+ double_point_type da;
+ bg::model::segment<int_point_type> ib;
+ bg::model::segment<double_point_type> db;
+ bg::read_wkt(a, ia);
+ bg::read_wkt(b, ib);
+ bg::read_wkt(a, da);
+ bg::read_wkt(b, db);
+
+ BOOST_AUTO(idist, bg::distance(ia, ib));
+ BOOST_AUTO(ddist, bg::distance(da, db));
+
+ BOOST_CHECK_MESSAGE(std::abs(idist - ddist) < 0.1,
+ "within<a double> different from within<an int>");
+ }
+}
+
+int test_main(int, char* [])
+{
+#ifdef TEST_ARRAY
+ //test_all<int[2]>();
+ //test_all<float[2]>();
+ //test_all<double[2]>();
+ //test_all<test::test_point>(); // located here because of 3D
+#endif
+
+ test_large_integers();
+
+ test_all<bg::model::d2::point_xy<int> >();
+ test_all<boost::tuple<float, float> >();
+ 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_empty_input<bg::model::d2::point_xy<int> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/distance.vcproj b/libs/geometry/test/algorithms/distance.vcproj
new file mode 100644
index 000000000..831fafbaa
--- /dev/null
+++ b/libs/geometry/test/algorithms/distance.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="distance"
+ ProjectGUID="{347D08A4-22E9-45B1-A55B-AE84AA2EAA53}"
+ RootNamespace="distance"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\distance"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\distance"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\distance.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/envelope.cpp b/libs/geometry/test/algorithms/envelope.cpp
new file mode 100644
index 000000000..92d69e8ac
--- /dev/null
+++ b/libs/geometry/test/algorithms/envelope.cpp
@@ -0,0 +1,80 @@
+// 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.
+
+// 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 <algorithms/test_envelope.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include <boost/geometry/geometries/adapted/std_pair_as_segment.hpp>
+#include <test_common/test_point.hpp>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+template <typename P>
+void test_2d()
+{
+ test_envelope<P>("POINT(1 1)", 1, 1, 1, 1);
+ test_envelope<bg::model::linestring<P> >("LINESTRING(1 1,2 2)", 1, 2, 1, 2);
+ test_envelope<bg::model::polygon<P> >("POLYGON((1 1,1 3,3 3,3 1,1 1))", 1, 3, 1, 3);
+
+ test_envelope<bg::model::ring<P> >("POLYGON((1 1,1 3,3 3,3 1,1 1))", 1, 3, 1, 3);
+ test_envelope<bg::model::box<P> >("BOX(1 1,3 3)", 1, 3, 1, 3);
+
+ // Triangle, closed and open, and CCW.
+ // Note that for the envelope algorithm,
+ // these combinations should theoretically not differ
+ test_envelope<bg::model::ring<P> >("POLYGON((4 1,0 7,7 9,4 1))", 0, 7, 1, 9);
+ test_envelope<bg::model::ring<P, true, false> >("POLYGON((4 1,0 7,7 9))", 0, 7, 1, 9);
+ test_envelope<bg::model::ring<P, false> >("POLYGON((4 1,7 9,0 7,4 1))", 0, 7, 1, 9);
+ test_envelope<bg::model::ring<P, false, false> >("POLYGON((4 1,7 9,0 7))", 0, 7, 1, 9);
+
+ typedef std::pair<P, P> segment_type;
+ test_envelope<segment_type>("SEGMENT(1 1,3 3)", 1, 3, 1, 3);
+}
+
+template <typename P>
+void test_3d()
+{
+ test_envelope<P>("POINT(1 2 3)", 1, 1, 2, 2, 3, 3);
+ test_envelope<P>("POINT(3 2 1)", 3, 3, 2, 2, 1, 1);
+ test_envelope<bg::model::linestring<P> >("LINESTRING(1 1 1,2 2 2)", 1, 2, 1, 2, 1, 2);
+ test_envelope<bg::model::box<P> >("BOX(1 1 1,3 3 3)", 1, 3, 1, 3, 1, 3);
+}
+
+
+int test_main(int, char* [])
+{
+ //test_2d<int[2]>();
+ //test_2d<float[2]>();
+ //test_2d<double[2]>();
+ test_2d<boost::tuple<float, float> >();
+ test_2d<bg::model::d2::point_xy<int> >();
+ test_2d<bg::model::d2::point_xy<float> >();
+ test_2d<bg::model::d2::point_xy<double> >();
+
+ test_3d<test::test_point>();
+ test_3d<boost::tuple<int, int, int> >();
+
+#ifdef HAVE_TTMATH
+ test_2d<bg::model::d2::point_xy<ttmath_big> >();
+ test_3d<boost::tuple<ttmath_big, ttmath_big, ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/envelope.vcproj b/libs/geometry/test/algorithms/envelope.vcproj
new file mode 100644
index 000000000..aa26c762b
--- /dev/null
+++ b/libs/geometry/test/algorithms/envelope.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="envelope"
+ ProjectGUID="{26EFCAF4-7907-4A47-ACBF-6CAB738CDCEB}"
+ RootNamespace="envelope"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\envelope"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\envelope"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\envelope.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/equals.cpp b/libs/geometry/test/algorithms/equals.cpp
new file mode 100644
index 000000000..c651b13ee
--- /dev/null
+++ b/libs/geometry/test/algorithms/equals.cpp
@@ -0,0 +1,162 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 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_equals.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.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;
+
+ std::string case_p1 = "POLYGON((0 0,0 2,2 2,0 0))";
+
+ test_geometry<P, P>("p1", "POINT(1 1)", "POINT(1 1)", true);
+ test_geometry<P, P>("p2", "POINT(1 1)", "POINT(1 2)", false);
+ test_geometry<box, box>("b1", "BOX(1 1,2 2)", "BOX(1 2,2 2)", false);
+ test_geometry<box, box>("b1", "BOX(1 2,3 4)", "BOX(1 2,3 4)", true);
+
+ // Completely equal
+ test_geometry<ring, ring>("poly_eq", case_p1, case_p1, true);
+
+ // Shifted
+ test_geometry<ring, ring>("poly_sh", "POLYGON((2 2,0 0,0 2,2 2))", case_p1, true);
+ test_geometry<polygon, polygon>("poly_sh2", case_p1, "POLYGON((0 2,2 2,0 0,0 2))", true);
+
+ // Extra coordinate
+ test_geometry<ring, ring>("poly_extra", case_p1, "POLYGON((0 0,0 2,2 2,1 1,0 0))", true);
+
+ // Shifted + extra (redundant) coordinate
+ test_geometry<ring, ring>("poly_shifted_extra1", "POLYGON((2 2,1 1,0 0,0 2,2 2))", case_p1, true);
+
+ // Shifted + extra (redundant) coordinate being first/last point
+ test_geometry<ring, ring>("poly_shifted_extra2", "POLYGON((1 1,0 0,0 2,2 2,1 1))", case_p1, true);
+
+ // Degenerate (duplicate) points
+ test_geometry<ring, ring>("poly_degenerate", "POLYGON((0 0,0 2,2 2,2 2,0 0))", "POLYGON((0 0,0 2,0 2,2 2,0 0))", true);
+
+ // Two different bends, same area, unequal
+ test_geometry<ring, ring>("poly_bends",
+ "POLYGON((4 0,5 3,8 4,7 7,4 8,0 4,4 0))",
+ "POLYGON((4 0,7 1,8 4,5 5,4 8,0 4,4 0))", false);
+
+ // Unequal (but same area)
+ test_geometry<ring, ring>("poly_uneq", case_p1, "POLYGON((1 1,1 3,3 3,1 1))", false);
+
+ // One having hole
+ test_geometry<polygon, polygon>("poly_hole", "POLYGON((0 0,0 4,4 4,0 0))", "POLYGON((0 0,0 4,4 4,0 0),(1 1,2 1,2 2,1 2,1 1))", false);
+
+ // Both having holes
+ test_geometry<polygon, polygon>("poly_holes",
+ "POLYGON((0 0,0 4,4 4,0 0),(1 1,2 1,2 2,1 2,1 1))",
+ "POLYGON((0 0,0 4,4 4,0 0),(1 1,2 1,2 2,1 2,1 1))", true);
+
+ // Both having holes, outer equal, inner not equal
+ test_geometry<polygon, polygon>("poly_uneq_holes",
+ "POLYGON((0 0,0 4,4 4,0 0),(1 1,2 1,2 2,1 2,1 1))",
+ "POLYGON((0 0,0 4,4 4,0 0),(2 2,3 2,3 3,2 3,2 2))", false);
+
+ // Both having 2 holes, equal but in different order
+ test_geometry<polygon, polygon>("poly_holes_diff_order",
+ "POLYGON((0 0,0 4,4 4,0 0),(1 1,2 1,2 2,1 2,1 1),(2 2,3 2,3 3,2 3,2 2))",
+ "POLYGON((0 0,0 4,4 4,0 0),(2 2,3 2,3 3,2 3,2 2),(1 1,2 1,2 2,1 2,1 1))", true);
+
+ // Both having 3 holes, equal but in different order
+ test_geometry<polygon, polygon>("poly_holes_diff_order_3",
+ "POLYGON((0 0,0 10,10 10,0 0),(1 1,2 1,2 2,1 2,1 1),(4 1,5 1,5 2,4 2,4 1),(2 2,3 2,3 3,2 3,2 2))",
+ "POLYGON((0 0,0 10,10 10,0 0),(4 1,5 1,5 2,4 2,4 1),(2 2,3 2,3 3,2 3,2 2),(1 1,2 1,2 2,1 2,1 1))", true);
+
+ // polygon/ring vv
+ test_geometry<polygon, ring>("poly_sh2_pr", case_p1, case_p1, true);
+ test_geometry<ring, polygon>("poly_sh2_rp", case_p1, case_p1, true);
+
+ // box/ring/poly
+ test_geometry<box, ring>("boxring1", "BOX(1 1,2 2)", "POLYGON((1 1,1 2,2 2,2 1,1 1))", true);
+ test_geometry<ring, box>("boxring2", "POLYGON((1 1,1 2,2 2,2 1,1 1))", "BOX(1 1,2 2)", true);
+ test_geometry<box, polygon>("boxpoly1", "BOX(1 1,2 2)", "POLYGON((1 1,1 2,2 2,2 1,1 1))", true);
+ test_geometry<polygon, box>("boxpoly2", "POLYGON((1 1,1 2,2 2,2 1,1 1))", "BOX(1 1,2 2)", true);
+
+ test_geometry<polygon, box>("boxpoly2", "POLYGON((1 1,1 2,2 2,2 1,1 1))", "BOX(1 1,2 3)", false);
+
+ // linestring/linestring
+ // simplex
+ test_geometry<linestring, linestring>("ls1", "LINESTRING(1 1,2 2)", "LINESTRING(1 1,2 2)", true);
+
+ // REVERSE linestring
+ // Is this equal? To be decided.
+ //test_geometry<linestring, linestring>("ls1", "LINESTRING(1 1,2 2)", "LINESTRING(2 2,1 1)", true);
+
+}
+
+
+template <typename T>
+void verify()
+{
+ T dxn1, dyn1, dxn2, dyn2;
+
+ {
+ T x1 = "0", y1 = "0", x2 = "3", y2 = "3";
+ T dx = x2 - x1, dy = y2 - y1;
+ T mag = sqrt(dx * dx + dy * dy);
+ dxn1 = dx / mag;
+ dyn1 = dy / mag;
+ }
+
+ {
+ T x1 = "0", y1 = "0", x2 = "1", y2 = "1";
+ T dx = x2 - x1, dy = y2 - y1;
+ T mag = sqrt(dx * dx + dy * dy);
+ dxn2 = dx / mag;
+ dyn2 = dy / mag;
+ }
+
+ if (dxn1 == dxn2 && dyn1 == dyn2)
+ {
+ //std::cout << "vectors are equal, using ==" << std::endl;
+ }
+ if (boost::geometry::math::equals(dxn1, dxn2)
+ && boost::geometry::math::equals(dyn1, dyn2))
+ {
+ //std::cout << "vectors are equal, using bg::math::equals" << std::endl;
+ }
+
+ bool equals = boost::geometry::math::equals_with_epsilon(dxn1, dxn2)
+ && boost::geometry::math::equals_with_epsilon(dyn1, dyn2);
+
+ if (equals)
+ {
+ //std::cout << "vectors are equal, using bg::math::equals_with_epsilon" << std::endl;
+ }
+
+ BOOST_CHECK_EQUAL(equals, true);
+}
+
+
+int test_main( int , char* [] )
+{
+ //verify<double>();
+#if defined(HAVE_TTMATH)
+ verify<ttmath_big>();
+#endif
+
+ test_all<bg::model::d2::point_xy<int> >();
+ 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/equals.vcproj b/libs/geometry/test/algorithms/equals.vcproj
new file mode 100644
index 000000000..64697ef87
--- /dev/null
+++ b/libs/geometry/test/algorithms/equals.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="equals"
+ ProjectGUID="{E54F493F-BF9D-4A6D-AE2F-5F97AC95251A}"
+ RootNamespace="equals"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\equals"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\equals"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\equals.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/expand.cpp b/libs/geometry/test/algorithms/expand.cpp
new file mode 100644
index 000000000..213e0b1d9
--- /dev/null
+++ b/libs/geometry/test/algorithms/expand.cpp
@@ -0,0 +1,153 @@
+// 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.
+
+// 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 <algorithms/test_expand.hpp>
+
+
+#include <boost/geometry/algorithms/make.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include <boost/geometry/geometries/adapted/std_pair_as_segment.hpp>
+#include <test_common/test_point.hpp>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+template <typename Point>
+void test_point_3d()
+{
+ bg::model::box<Point> b = bg::make_inverse<bg::model::box<Point> >();
+
+ test_expand<Point>(b, "POINT(1 2 5)", "(1,2,5),(1,2,5)");
+ test_expand<Point>(b, "POINT(3 4 6)", "(1,2,5),(3,4,6)");
+
+ test_expand<Point>(b, "POINT(4 4 5)", "(1,2,5),(4,4,6)");
+ test_expand<Point>(b, "POINT(4 5 5)", "(1,2,5),(4,5,6)");
+ test_expand<Point>(b, "POINT(10 10 4)", "(1,2,4),(10,10,6)");
+ test_expand<Point>(b, "POINT(9 9 4)", "(1,2,4),(10,10,6)");
+
+ test_expand<Point>(b, "POINT(0 2 7)", "(0,2,4),(10,10,7)");
+ test_expand<Point>(b, "POINT(0 0 7)", "(0,0,4),(10,10,7)");
+ test_expand<Point>(b, "POINT(-1 -1 5)", "(-1,-1,4),(10,10,7)");
+ test_expand<Point>(b, "POINT(0 0 5)", "(-1,-1,4),(10,10,7)");
+
+ test_expand<Point>(b, "POINT(15 -1 0)", "(-1,-1,0),(15,10,7)");
+ test_expand<Point>(b, "POINT(-1 15 10)", "(-1,-1,0),(15,15,10)");
+}
+
+template <typename Point>
+void test_box_3d()
+{
+ typedef bg::model::box<Point> box_type;
+ box_type b = bg::make_inverse<box_type>();
+
+ test_expand<box_type>(b, "BOX(0 2 5,4 4 6)", "(0,2,5),(4,4,6)");
+ test_expand<box_type>(b, "BOX(0 1 5,4 6 6)", "(0,1,5),(4,6,6)");
+ test_expand<box_type>(b, "BOX(-1 -1 6,10 10 5)", "(-1,-1,5),(10,10,6)");
+ test_expand<box_type>(b, "BOX(3 3 6,3 3 5)", "(-1,-1,5),(10,10,6)");
+
+ test_expand<box_type>(b, "BOX(3 15 7,-1 3 4)", "(-1,-1,4),(10,15,7)");
+ test_expand<box_type>(b, "BOX(-15 3 7,3 20 4)", "(-15,-1,4),(10,20,7)");
+ test_expand<box_type>(b, "BOX(3 -20 8,3 20 3)", "(-15,-20,3),(10,20,8)");
+ test_expand<box_type>(b, "BOX(-20 3 8,20 3 3)", "(-20,-20,3),(20,20,8)");
+}
+
+
+
+template <typename P>
+void test_3d()
+{
+ test_point_3d<P>();
+ test_box_3d<P>();
+}
+
+template <typename Point>
+void test_2d()
+{
+ typedef bg::model::box<Point> box_type;
+ typedef std::pair<Point, Point> segment_type;
+
+ box_type b = bg::make_inverse<box_type>();
+
+ test_expand<box_type>(b, "BOX(1 1,2 2)", "(1,1),(2,2)");
+
+ // Test an 'incorrect' box -> should also correctly update the bbox
+ test_expand<box_type>(b, "BOX(3 4,0 1)", "(0,1),(3,4)");
+
+ // Test a segment
+ test_expand<segment_type>(b, "SEGMENT(5 6,7 8)", "(0,1),(7,8)");
+}
+
+template <typename Point>
+void test_spherical_degree()
+{
+ bg::model::box<Point> b = bg::make_inverse<bg::model::box<Point> >();
+
+ test_expand<Point>(b, "POINT(179.73 71.56)",
+ "(179.73,71.56),(179.73,71.56)");
+ test_expand<Point>(b, "POINT(177.47 71.23)",
+ "(177.47,71.23),(179.73,71.56)");
+
+ // It detects that this point is lying RIGHT of the others,
+ // and then it "expands" it.
+ // It might be argued that "181.22" is displayed instead. However, they are
+ // the same.
+ test_expand<Point>(b, "POINT(-178.78 70.78)",
+ "(177.47,70.78),(-178.78,71.56)");
+}
+
+
+template <typename Point>
+void test_spherical_radian()
+{
+ bg::model::box<Point> b = bg::make_inverse<bg::model::box<Point> >();
+
+ test_expand<Point>(b, "POINT(3.128 1.249)",
+ "(3.128,1.249),(3.128,1.249)");
+ test_expand<Point>(b, "POINT(3.097 1.243)",
+ "(3.097,1.243),(3.128,1.249)");
+
+ // It detects that this point is lying RIGHT of the others,
+ // and then it "expands" it.
+ // It might be argued that "181.22" is displayed instead. However, they are
+ // the same.
+ test_expand<Point>(b, "POINT(-3.121 1.235)",
+ "(3.097,1.235),(-3.121,1.249)");
+}
+
+int test_main(int, char* [])
+{
+ test_2d<bg::model::point<int, 2, bg::cs::cartesian> >();
+
+
+ test_3d<test::test_point>();
+ test_3d<bg::model::point<int, 3, bg::cs::cartesian> >();
+ test_3d<bg::model::point<float, 3, bg::cs::cartesian> >();
+ test_3d<bg::model::point<double, 3, bg::cs::cartesian> >();
+
+ test_spherical_degree<bg::model::point<double, 2, bg::cs::spherical<bg::degree> > >();
+ test_spherical_radian<bg::model::point<double, 2, bg::cs::spherical<bg::radian> > >();
+
+
+#if defined(HAVE_TTMATH)
+ test_3d<bg::model::point<ttmath_big, 3, bg::cs::cartesian> >();
+ test_spherical_degree<bg::model::point<ttmath_big, 2, bg::cs::spherical<bg::degree> > >();
+ test_spherical_radian<bg::model::point<ttmath_big, 2, bg::cs::spherical<bg::radian> > >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/expand.vcproj b/libs/geometry/test/algorithms/expand.vcproj
new file mode 100644
index 000000000..7fb588e5d
--- /dev/null
+++ b/libs/geometry/test/algorithms/expand.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="expand"
+ ProjectGUID="{5330DAB1-DF27-44FC-971B-3C5094F82FA3}"
+ RootNamespace="expand"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\expand"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\expand"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\expand.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/for_each.cpp b/libs/geometry/test/algorithms/for_each.cpp
new file mode 100644
index 000000000..f61397eec
--- /dev/null
+++ b/libs/geometry/test/algorithms/for_each.cpp
@@ -0,0 +1,81 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_for_each.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+
+
+template <typename P>
+void test_all()
+{
+ test_geometry<P>
+ (
+ "POINT(1 1)"
+
+ // per point
+ , 1
+ , "POINT(101 1)"
+ , "POINT(101 100)"
+ // per segment
+ , ""
+ , 0
+ , "POINT(1 1)"
+ );
+ test_geometry<bg::model::linestring<P> >
+ (
+ "LINESTRING(1 1,2 2)"
+
+ , 3
+ , "LINESTRING(101 1,102 2)"
+ , "LINESTRING(101 100,102 200)"
+
+ , "((1, 1), (2, 2))"
+ , std::sqrt(2.0)
+ , "LINESTRING(10 1,2 2)"
+ );
+ test_geometry<bg::model::ring<P> >
+ (
+ "POLYGON((1 1,1 4,4 4,4 1,1 1))"
+
+ , 11
+ , "POLYGON((101 1,101 4,104 4,104 1,101 1))"
+ , "POLYGON((101 100,101 400,104 400,104 100,101 100))"
+
+ , "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1))"
+ , 4 * 3.0
+ , "POLYGON((10 1,10 4,4 4,4 1,1 1))"
+ );
+ test_geometry<bg::model::polygon<P> >
+ (
+ "POLYGON((1 1,1 4,4 4,4 1,1 1),(2 2,3 2,3 3,2 3,2 2))"
+
+ , 23
+ , "POLYGON((101 1,101 4,104 4,104 1,101 1),(102 2,103 2,103 3,102 3,102 2))"
+ , "POLYGON((101 100,101 400,104 400,104 100,101 100),(102 200,103 200,103 300,102 300,102 200))"
+
+ , "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1)) "
+ "((2, 2), (3, 2)) ((3, 2), (3, 3)) ((3, 3), (2, 3)) ((2, 3), (2, 2))"
+ , 4 * 3.0 + 4 * 1.0
+ , "POLYGON((10 1,10 4,4 4,4 1,1 1),(2 2,3 2,3 3,2 3,2 2))"
+ );
+}
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+#if defined(HAVE_TTMATH)
+ test_all<bg::model::point<ttmath_big, 2, bg::cs::cartesian> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/for_each.vcproj b/libs/geometry/test/algorithms/for_each.vcproj
new file mode 100644
index 000000000..453064a3b
--- /dev/null
+++ b/libs/geometry/test/algorithms/for_each.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="for_each"
+ ProjectGUID="{774F6471-D8A0-481C-9B0A-4903EAD25B70}"
+ RootNamespace="for_each"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\for_each"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\for_each"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\for_each.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/intersection.cpp b/libs/geometry/test/algorithms/intersection.cpp
new file mode 100644
index 000000000..ba303e24f
--- /dev/null
+++ b/libs/geometry/test/algorithms/intersection.cpp
@@ -0,0 +1,535 @@
+// 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.
+
+// 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 <iostream>
+#include <string>
+
+#define BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
+#define TEST_ISOVIST
+
+//#define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
+//#define BOOST_GEOMETRY_DEBUG_INTERSECTION
+//#define BOOST_GEOMETRY_DEBUG_TRAVERSE
+//#define BOOST_GEOMETRY_DEBUG_FOLLOW
+//#define BOOST_GEOMETRY_DEBUG_ASSEMBLE
+//#define BOOST_GEOMETRY_DEBUG_IDENTIFIER
+
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/register/linestring.hpp>
+
+#include <boost/geometry/util/rational.hpp>
+
+#include <algorithms/test_intersection.hpp>
+#include <algorithms/test_overlay.hpp>
+
+#include <algorithms/overlay/overlay_cases.hpp>
+
+#include <test_common/test_point.hpp>
+#include <test_common/with_pointer.hpp>
+#include <test_geometries/custom_segment.hpp>
+
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
+
+
+static std::string pie_2_3_23_0[2] =
+{
+ "POLYGON((2500 2500,2855 3828,2500 3875,2500 2500))",
+ "POLYGON((2500 2500,2791 3586,2499 3625,2208 3586,2500 2500))"
+};
+
+template <typename Polygon>
+void test_areal()
+{
+ test_one<Polygon, Polygon, Polygon>("pie_2_3_23_0",
+ pie_2_3_23_0[0], pie_2_3_23_0[1],
+ 1, 4, 163292.679042133, 0.1);
+
+ test_one<Polygon, Polygon, Polygon>("simplex_with_empty_1",
+ simplex_normal[0], polygon_empty,
+ 0, 0, 0.0);
+ test_one<Polygon, Polygon, Polygon>("simplex_with_empty_2",
+ polygon_empty, simplex_normal[0],
+ 0, 0, 0.0);
+
+ test_one<Polygon, Polygon, Polygon>("simplex_normal",
+ simplex_normal[0], simplex_normal[1],
+ 1, 7, 5.47363293);
+ test_one<Polygon, Polygon, Polygon>("star_ring", example_star, example_ring,
+ 1, 18, 2.80983);
+
+ test_one<Polygon, Polygon, Polygon>("star_poly", example_star, example_polygon,
+ 1, 0, // CLN: 23 points, other types: 22 point (one is merged)
+ 2.5020508);
+ test_one<Polygon, Polygon, Polygon>("first_within_second1",
+ first_within_second[0], first_within_second[1],
+ 1, 5, 1.0);
+
+ test_one<Polygon, Polygon, Polygon>("first_within_second2",
+ first_within_second[1], first_within_second[0],
+ 1, 5, 1.0);
+
+ test_one<Polygon, Polygon, Polygon>("first_within_hole_of_second",
+ first_within_hole_of_second[0], first_within_hole_of_second[1],
+ 0, 0, 0.0);
+
+ // Two forming new hole
+ test_one<Polygon, Polygon, Polygon>("new_hole",
+ new_hole[0], new_hole[1],
+ 2, 10, 2.0);
+
+ // Two identical
+ test_one<Polygon, Polygon, Polygon>("identical",
+ identical[0], identical[1],
+ 1, 5, 1.0);
+
+ test_one<Polygon, Polygon, Polygon>("intersect_exterior_and_interiors_winded",
+ intersect_exterior_and_interiors_winded[0], intersect_exterior_and_interiors_winded[1],
+ 1, 14, 25.2166667);
+
+ test_one<Polygon, Polygon, Polygon>("intersect_holes_disjoint",
+ intersect_holes_disjoint[0], intersect_holes_disjoint[1],
+ 1, 15, 18.0);
+
+ test_one<Polygon, Polygon, Polygon>("intersect_holes_intersect",
+ intersect_holes_intersect[0], intersect_holes_intersect[1],
+ 1, 14, 18.25);
+
+ test_one<Polygon, Polygon, Polygon>("intersect_holes_intersect_and_disjoint",
+ intersect_holes_intersect_and_disjoint[0], intersect_holes_intersect_and_disjoint[1],
+ 1, 19, 17.25);
+
+ test_one<Polygon, Polygon, Polygon>("intersect_holes_intersect_and_touch",
+ intersect_holes_intersect_and_touch[0], intersect_holes_intersect_and_touch[1],
+ 1, 23, 17.25);
+
+ test_one<Polygon, Polygon, Polygon>("intersect_holes_new_ring",
+ intersect_holes_new_ring[0], intersect_holes_new_ring[1],
+ 2, 23, 122.1039);
+
+ test_one<Polygon, Polygon, Polygon>("winded",
+ winded[0], winded[1],
+ 1, 22, 40.0);
+
+ test_one<Polygon, Polygon, Polygon>("within_holes_disjoint",
+ within_holes_disjoint[0], within_holes_disjoint[1],
+ 1, 15, 23.0);
+
+ test_one<Polygon, Polygon, Polygon>("side_side",
+ side_side[0], side_side[1],
+ 0, 0, 0.0);
+
+ test_one<Polygon, Polygon, Polygon>("two_bends",
+ two_bends[0], two_bends[1],
+ 1, 7, 24.0);
+
+ test_one<Polygon, Polygon, Polygon>("star_comb_15",
+ star_comb_15[0], star_comb_15[1],
+ 28, 150, 189.952883);
+
+ test_one<Polygon, Polygon, Polygon>("simplex_normal",
+ simplex_normal[0], simplex_normal[1],
+ 1, 7, 5.47363293);
+
+ test_one<Polygon, Polygon, Polygon>("distance_zero",
+ distance_zero[0], distance_zero[1],
+ 1, 0 /* f: 4, other: 5 */, 0.29516139, 0.01);
+
+ test_one<Polygon, Polygon, Polygon>("equal_holes_disjoint",
+ equal_holes_disjoint[0], equal_holes_disjoint[1],
+ 1, 20, 81 - 2 * 3 * 3 - 3 * 7);
+
+ test_one<Polygon, Polygon, Polygon>("only_hole_intersections1",
+ only_hole_intersections[0], only_hole_intersections[1],
+ 1, 21, 178.090909);
+ test_one<Polygon, Polygon, Polygon>("only_hole_intersection2",
+ only_hole_intersections[0], only_hole_intersections[2],
+ 1, 21, 149.090909);
+
+ test_one<Polygon, Polygon, Polygon>("fitting",
+ fitting[0], fitting[1],
+ 0, 0, 0);
+
+ test_one<Polygon, Polygon, Polygon>("crossed",
+ crossed[0], crossed[1],
+ 3, 0, 1.5);
+
+ typedef typename bg::coordinate_type<Polygon>::type ct;
+
+#ifdef TEST_ISOVIST
+#ifdef _MSC_VER
+ test_one<Polygon, Polygon, Polygon>("isovist",
+ isovist1[0], isovist1[1],
+ 1, 20, 88.19203,
+ if_typed_tt<ct>(0.01, 0.1));
+
+ // SQL Server gives: 88.1920416352664
+ // PostGIS gives: 88.19203677911
+
+#endif
+#endif
+
+ //std::cout << typeid(ct).name() << std::endl;
+
+ test_one<Polygon, Polygon, Polygon>("ggl_list_20110306_javier",
+ ggl_list_20110306_javier[0], ggl_list_20110306_javier[1],
+ 1, if_typed_tt<ct>(5, 4),
+ 0.6649875,
+ if_typed<ct, float>(1.0, 0.01));
+
+ 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);
+
+ 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);
+
+#ifdef _MSC_VER // gcc/linux behaves differently
+ if (! boost::is_same<ct, float>::value)
+ {
+ test_one<Polygon, Polygon, Polygon>("ggl_list_20110716_enrico",
+ ggl_list_20110716_enrico[0], ggl_list_20110716_enrico[1],
+ 3,
+ if_typed<ct, float>(19, if_typed<ct, double>(22, 21)),
+ 35723.8506317139);
+ }
+#endif
+
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_f", buffer_rt_f[0], buffer_rt_f[1],
+ 1, 4, 0.00029437899183903937, 0.01);
+
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_g", buffer_rt_g[0], buffer_rt_g[1],
+ 1, 0, 2.914213562373);
+
+ test_one<Polygon, Polygon, Polygon>("ticket_8254", ticket_8254[0], ticket_8254[1],
+ 1, 4, 3.63593e-08, 0.01);
+
+ test_one<Polygon, Polygon, Polygon>("buffer_mp1", buffer_mp1[0], buffer_mp1[1],
+ 1, 31, 2.271707796);
+
+ test_one<Polygon, Polygon, Polygon>("buffer_mp2", buffer_mp2[0], buffer_mp2[1],
+ 1, 29, 0.457126);
+
+ return;
+
+
+ test_one<Polygon, Polygon, Polygon>(
+ "polygon_pseudo_line",
+ "Polygon((0 0,0 4,4 4,4 0,0 0))",
+ "Polygon((2 -2,2 -1,2 6,2 -2))",
+ 5, 22, 1.1901714);
+}
+
+template <typename Polygon, typename Box>
+void test_areal_clip()
+{
+ test_one<Polygon, Box, Polygon>("boxring", example_box, example_ring,
+ 2, 12, 1.09125);
+ test_one<Polygon, Polygon, Box>("boxring2", example_ring,example_box,
+ 2, 12, 1.09125);
+
+ test_one<Polygon, Box, Polygon>("boxpoly", example_box, example_polygon,
+ 3, 19, 0.840166);
+
+ test_one<Polygon, Box, Polygon>("poly1", example_box,
+ "POLYGON((3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2))",
+ 2, 12, 1.09125);
+
+ test_one<Polygon, Box, Polygon>("clip_poly2", example_box,
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,5.3 2.5,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3))",
+ 2, 12, 1.00375);
+
+ test_one<Polygon, Box, Polygon>("clip_poly3", example_box,
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,4.5 2.5,4.5 1.2,4.9 0.8,2.9 0.7,2 1.3))",
+ 2, 12, 1.00375);
+
+ test_one<Polygon, Box, Polygon>("clip_poly4", example_box,
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,4.5 2.5,4.5 2.3,5.0 2.3,5.0 2.1,4.5 2.1,4.5 1.9,4.0 1.9,4.5 1.2,4.9 0.8,2.9 0.7,2 1.3))",
+ 2, 16, 0.860892);
+
+ test_one<Polygon, Box, Polygon>("clip_poly5", example_box,
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,4.5 1.2,2.9 0.7,2 1.3))",
+ 2, 11, 0.7575961);
+
+ test_one<Polygon, Box, Polygon>("clip_poly6", example_box,
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.0 3.0,5.0 2.0,2.9 0.7,2 1.3))",
+ 2, 13, 1.0744456);
+
+ test_one<Polygon, Box, Polygon>("clip_poly7", "Box(0 0, 3 3)",
+ "POLYGON((2 2, 1 4, 2 4, 3 3, 2 2))",
+ 1, 4, 0.75);
+}
+
+
+template <typename Box>
+void test_boxes(std::string const& wkt1, std::string const& wkt2, double expected_area, bool expected_result)
+{
+ Box box1, box2;
+ bg::read_wkt(wkt1, box1);
+ bg::read_wkt(wkt2, box2);
+
+ Box box_out;
+ bool detected = bg::intersection(box1, box2, box_out);
+ typename bg::default_area_result<Box>::type area = bg::area(box_out);
+
+ BOOST_CHECK_EQUAL(detected, expected_result);
+ if (detected && expected_result)
+ {
+ BOOST_CHECK_CLOSE(area, expected_area, 0.01);
+ }
+}
+
+
+template <typename P>
+void test_point_output()
+{
+ typedef bg::model::linestring<P> linestring;
+ typedef bg::model::polygon<P> polygon;
+ typedef bg::model::box<P> box;
+ typedef bg::model::segment<P> segment;
+
+ test_point_output<polygon, polygon>(simplex_normal[0], simplex_normal[1], 6);
+ test_point_output<box, polygon>("box(1 1,6 4)", simplex_normal[0], 4);
+ test_point_output<linestring, polygon>("linestring(0 2,6 2)", simplex_normal[0], 2);
+ // NYI because of sectionize:
+ // test_point_output<segment, polygon>("linestring(0 2,6 2)", simplex_normal[0], 2);
+ // NYI because needs special treatment:
+ // test_point_output<box, box>("box(0 0,4 4)", "box(2 2,6 6)", 2);
+}
+
+
+template <typename Polygon, typename LineString>
+void test_areal_linear()
+{
+ std::string const poly_simplex = "POLYGON((1 1,1 3,3 3,3 1,1 1))";
+
+ test_one_lp<LineString, Polygon, LineString>("simplex", poly_simplex, "LINESTRING(0 2,4 2)", 1, 2, 2.0);
+ test_one_lp<LineString, Polygon, LineString>("case2", poly_simplex, "LINESTRING(0 1,4 3)", 1, 2, sqrt(5.0));
+ test_one_lp<LineString, Polygon, LineString>("case3", "POLYGON((2 0,2 5,5 5,5 0,2 0))", "LINESTRING(0 1,1 2,3 2,4 3,6 3,7 4)", 1, 4, 2 + sqrt(2.0));
+ test_one_lp<LineString, Polygon, LineString>("case4", "POLYGON((0 0,0 4,2 4,2 0,0 0))", "LINESTRING(1 1,3 2,1 3)", 2, 4, sqrt(5.0));
+
+ test_one_lp<LineString, Polygon, LineString>("case5", poly_simplex, "LINESTRING(0 1,3 4)", 1, 2, sqrt(2.0));
+ test_one_lp<LineString, Polygon, LineString>("case6", "POLYGON((2 0,2 4,3 4,3 1,4 1,4 3,5 3,5 1,6 1,6 3,7 3,7 1,8 1,8 3,9 3,9 0,2 0))", "LINESTRING(1 1,10 3)", 4, 8,
+ // Pieces are 1 x 2/9:
+ 4.0 * sqrt(1.0 + 4.0/81.0));
+ test_one_lp<LineString, Polygon, LineString>("case7", poly_simplex, "LINESTRING(1.5 1.5,2.5 2.5)", 1, 2, sqrt(2.0));
+ test_one_lp<LineString, Polygon, LineString>("case8", poly_simplex, "LINESTRING(1 0,2 0)", 0, 0, 0.0);
+
+ std::string const poly_9 = "POLYGON((1 1,1 4,4 4,4 1,1 1))";
+ test_one_lp<LineString, Polygon, LineString>("case9", poly_9, "LINESTRING(0 1,1 2,2 2)", 1, 2, 1.0);
+ test_one_lp<LineString, Polygon, LineString>("case10", poly_9, "LINESTRING(0 1,1 2,0 2)", 0, 0, 0.0);
+ test_one_lp<LineString, Polygon, LineString>("case11", poly_9, "LINESTRING(2 2,4 2,3 3)", 1, 3, 2.0 + sqrt(2.0));
+ test_one_lp<LineString, Polygon, LineString>("case12", poly_9, "LINESTRING(2 3,4 4,5 6)", 1, 2, sqrt(5.0));
+
+ test_one_lp<LineString, Polygon, LineString>("case13", poly_9, "LINESTRING(3 2,4 4,2 3)", 1, 3, 2.0 * sqrt(5.0));
+ test_one_lp<LineString, Polygon, LineString>("case14", poly_9, "LINESTRING(5 6,4 4,6 5)", 0, 0, 0.0);
+ test_one_lp<LineString, Polygon, LineString>("case15", poly_9, "LINESTRING(0 2,1 2,1 3,0 3)", 1, 2, 1.0);
+ test_one_lp<LineString, Polygon, LineString>("case16", poly_9, "LINESTRING(2 2,1 2,1 3,2 3)", 1, 4, 3.0);
+
+ std::string const angly = "LINESTRING(2 2,2 1,4 1,4 2,5 2,5 3,4 3,4 4,5 4,3 6,3 5,2 5,2 6,0 4)";
+ test_one_lp<LineString, Polygon, LineString>("case17", "POLYGON((1 1,1 5,4 5,4 1,1 1))", angly, 3, 8, 6.0);
+ test_one_lp<LineString, Polygon, LineString>("case18", "POLYGON((1 1,1 5,5 5,5 1,1 1))", angly, 2, 12, 10.0 + sqrt(2.0));
+ test_one_lp<LineString, Polygon, LineString>("case19", poly_9, "LINESTRING(1 2,1 3,0 3)", 1, 2, 1.0);
+ test_one_lp<LineString, Polygon, LineString>("case20", poly_9, "LINESTRING(1 2,1 3,2 3)", 1, 3, 2.0);
+
+ test_one_lp<LineString, Polygon, LineString>("case21", poly_9, "LINESTRING(1 2,1 4,4 4,4 1,2 1,2 2)", 1, 6, 11.0);
+
+ // Compile test - arguments in any order:
+ test_one<LineString, Polygon, LineString>("simplex", poly_simplex, "LINESTRING(0 2,4 2)", 1, 2, 2.0);
+ test_one<LineString, LineString, Polygon>("simplex", "LINESTRING(0 2,4 2)", poly_simplex, 1, 2, 2.0);
+
+ typedef typename bg::point_type<Polygon>::type Point;
+ test_one<LineString, bg::model::ring<Point>, LineString>("simplex", poly_simplex, "LINESTRING(0 2,4 2)", 1, 2, 2.0);
+
+}
+
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::linestring<P> linestring;
+ typedef bg::model::polygon<P> polygon;
+ typedef bg::model::box<P> box;
+ typedef bg::model::segment<P> segment;
+
+ typedef bg::model::polygon<P, false> polygon_ccw;
+ typedef bg::model::polygon<P, true, false> polygon_open;
+ typedef bg::model::polygon<P, false, false> polygon_ccw_open;
+
+ std::string clip = "box(2 2,8 8)";
+
+ test_areal_linear<polygon, linestring>();
+ test_areal_linear<polygon_open, linestring>();
+ test_areal_linear<polygon_ccw, linestring>();
+ test_areal_linear<polygon_ccw_open, linestring>();
+
+ // Test polygons clockwise and counter clockwise
+ test_areal<polygon>();
+
+ test_areal<polygon_ccw>();
+ test_areal<polygon_open>();
+ test_areal<polygon_ccw_open>();
+
+
+ test_areal_clip<polygon, box>();
+ test_areal_clip<polygon_ccw, box>();
+
+#if defined(TEST_FAIL_DIFFERENT_ORIENTATIONS)
+ // Should NOT compile
+ // NOTE: this can probably be relaxed later on.
+ test_one<polygon, polygon_ccw, polygon>("simplex_normal",
+ simplex_normal[0], simplex_normal[1],
+ 1, 7, 5.47363293);
+ // Output ccw, nyi (should be just reversing afterwards)
+ test_one<polygon, polygon, polygon_ccw>("simplex_normal",
+ simplex_normal[0], simplex_normal[1],
+ 1, 7, 5.47363293);
+#endif
+
+ // Basic check: box/linestring, is clipping OK? should compile in any order
+ test_one<linestring, linestring, box>("llb", "LINESTRING(0 0,10 10)", clip, 1, 2, sqrt(2.0 * 6.0 * 6.0));
+ test_one<linestring, box, linestring>("lbl", clip, "LINESTRING(0 0,10 10)", 1, 2, sqrt(2.0 * 6.0 * 6.0));
+
+ // Box/segment
+ test_one<linestring, segment, box>("lsb", "LINESTRING(0 0,10 10)", clip, 1, 2, sqrt(2.0 * 6.0 * 6.0));
+ test_one<linestring, box, segment>("lbs", clip, "LINESTRING(0 0,10 10)", 1, 2, sqrt(2.0 * 6.0 * 6.0));
+
+ // Completely inside
+ test_one<linestring, linestring, box>("llbi", "LINESTRING(3 3,7 7)", clip, 1, 2, sqrt(2.0 * 4.0 * 4.0));
+
+ // Completely outside
+ test_one<linestring, linestring, box>("llbo", "LINESTRING(9 9,10 10)", clip, 0, 0, 0);
+
+ // Touching with point (-> output linestring with ONE point)
+ //std::cout << "Note: the output line is degenerate! Might be removed!" << std::endl;
+ test_one<linestring, linestring, box>("llb_touch", "LINESTRING(8 8,10 10)", clip, 1, 1, 0.0);
+
+ // Along border
+ test_one<linestring, linestring, box>("llb_along", "LINESTRING(2 2,2 8)", clip, 1, 2, 6);
+
+ // Outputting two lines (because of 3-4-5 constructions (0.3,0.4,0.5)
+ // which occur 4 times, the length is expected to be 2.0)
+ test_one<linestring, linestring, box>("llb_2", "LINESTRING(1.7 1.6,2.3 2.4,2.9 1.6,3.5 2.4,4.1 1.6)", clip, 2, 6, 4 * 0.5);
+
+ // linear
+ test_one<P, linestring, linestring>("llp1", "LINESTRING(0 0,1 1)", "LINESTRING(0 1,1 0)", 1, 1, 0);
+ test_one<P, segment, segment>("ssp1", "LINESTRING(0 0,1 1)", "LINESTRING(0 1,1 0)", 1, 1, 0);
+ test_one<P, linestring, linestring>("llp2", "LINESTRING(0 0,1 1)", "LINESTRING(0 0,2 2)", 2, 2, 0);
+
+ // polygons outputing points
+ //test_one<P, polygon, polygon>("ppp1", simplex_normal[0], simplex_normal[1], 1, 7, 5.47363293);
+
+ test_boxes<box>("box(2 2,8 8)", "box(4 4,10 10)", 16, true);
+ test_boxes<box>("box(2 2,8 7)", "box(4 4,10 10)", 12, true);
+ test_boxes<box>("box(2 2,8 7)", "box(14 4,20 10)", 0, false);
+ test_boxes<box>("box(2 2,4 4)", "box(4 4,8 8)", 0, true);
+
+ test_point_output<P>();
+
+
+ /*
+ test_one<polygon, box, polygon>(99, "box(115041.10 471900.10, 118334.60 474523.40)",
+ "POLYGON ((115483.40 474533.40, 116549.40 474059.20, 117199.90 473762.50, 117204.90 473659.50, 118339.40 472796.90, 118334.50 472757.90, 118315.10 472604.00, 118344.60 472520.90, 118277.90 472419.10, 118071.40 472536.80, 118071.40 472536.80, 117943.10 472287.70, 117744.90 472248.40, 117708.00 472034.50, 117481.90 472056.90, 117481.90 472056.90, 117272.30 471890.10, 117077.90 472161.20, 116146.60 473054.50, 115031.10 473603.30, 115483.40 474533.40))",
+ 1, 26, 3727690.74);
+ */
+
+}
+
+void test_pointer_version()
+{
+ std::vector<test::test_point_xy*> ln;
+ test::test_point_xy* p;
+ p = new test::test_point_xy; p->x = 0; p->y = 0; ln.push_back(p);
+ p = new test::test_point_xy; p->x = 10; p->y = 10; ln.push_back(p);
+
+ bg::model::box<bg::model::d2::point_xy<double> > box;
+ bg::assign_values(box, 2, 2, 8, 8);
+
+ typedef bg::model::linestring<bg::model::d2::point_xy<double> > output_type;
+ std::vector<output_type> clip;
+ bg::detail::intersection::intersection_insert<output_type>(box, ln, std::back_inserter(clip));
+
+ double length = 0;
+ int n = 0;
+ for (std::vector<output_type>::const_iterator it = clip.begin();
+ it != clip.end(); ++it)
+ {
+ length += bg::length(*it);
+ n += bg::num_points(*it);
+ }
+
+ BOOST_CHECK_EQUAL(clip.size(), 1u);
+ BOOST_CHECK_EQUAL(n, 2);
+ BOOST_CHECK_CLOSE(length, sqrt(2.0 * 6.0 * 6.0), 0.001);
+
+ for (unsigned int i = 0; i < ln.size(); i++)
+ {
+ delete ln[i];
+ }
+}
+
+
+template <typename P>
+void test_exception()
+{
+ typedef bg::model::polygon<P> polygon;
+
+ try
+ {
+ // Define polygon with a spike (= invalid)
+ std::string spike = "POLYGON((0 0,0 4,2 4,2 6,2 4,4 4,4 0,0 0))";
+
+ test_one<polygon, polygon, polygon>("with_spike",
+ simplex_normal[0], spike,
+ 0, 0, 0);
+ }
+ catch(bg::overlay_invalid_input_exception const& )
+ {
+ return;
+ }
+ BOOST_CHECK_MESSAGE(false, "No exception thrown");
+}
+
+template <typename Point>
+void test_rational()
+{
+ typedef bg::model::polygon<Point> polygon;
+ test_one<polygon, polygon, polygon>("simplex_normal",
+ simplex_normal[0], simplex_normal[1],
+ 1, 7, 5.47363293);
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
+ test_all<bg::model::d2::point_xy<float> >();
+
+#if defined(HAVE_TTMATH)
+ std::cout << "Testing TTMATH" << std::endl;
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+#endif
+
+ test_exception<bg::model::d2::point_xy<double> >();
+ test_pointer_version();
+ test_rational<bg::model::d2::point_xy<boost::rational<int> > >();
+
+ return 0;
+}
+
diff --git a/libs/geometry/test/algorithms/intersection.vcproj b/libs/geometry/test/algorithms/intersection.vcproj
new file mode 100644
index 000000000..a9bc3a6f3
--- /dev/null
+++ b/libs/geometry/test/algorithms/intersection.vcproj
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="intersection"
+ ProjectGUID="{2FD8EDAB-B3C3-4654-B6C3-B25C12A063D3}"
+ RootNamespace="intersection"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\intersection"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/bigobj"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NONDLL;_CRT_SECURE_NO_WARNINGS"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\intersection"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/bigobj"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NONDLL;_CRT_SECURE_NO_WARNINGS"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\intersection.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/intersection_segment.cpp b/libs/geometry/test/algorithms/intersection_segment.cpp
new file mode 100644
index 000000000..664d37c9b
--- /dev/null
+++ b/libs/geometry/test/algorithms/intersection_segment.cpp
@@ -0,0 +1,134 @@
+// 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.
+
+// 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 <algorithm>
+#include <ostream>
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include <boost/config.hpp>
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/correct.hpp>
+#include <boost/geometry/algorithms/within.hpp>
+#include <boost/geometry/algorithms/intersection_segment.hpp>
+#include <boost/geometry/io/wkt/aswkt.hpp>
+
+static std::ostream & operator<<(std::ostream &s, const bg::intersection_result& r)
+{
+ switch(r)
+ {
+ case bg::is_intersect_no : s << "is_intersect_no"; break;
+ case bg::is_intersect : s << "is_intersect"; break;
+ case bg::is_parallel : s << "is_parallel"; break;
+ case bg::is_collinear_no : s << "is_collinear_no"; break;
+ case bg::is_collinear_one : s << "is_collinear_one"; break;
+ case bg::is_collinear_connect : s << "is_collinear_connect"; break;
+ case bg::is_collinear_overlap : s << "is_collinear_overlap"; break;
+ case bg::is_collinear_overlap_opposite : s << "is_collinear_overlap_opposite"; break;
+ case bg::is_collinear_connect_opposite : s << "is_collinear_connect_opposite"; break;
+
+ // detailed connection results:
+ case bg::is_intersect_connect_s1p1 : s << "is_intersect_connect_s1p1"; break;
+ case bg::is_intersect_connect_s1p2 : s << "is_intersect_connect_s1p2"; break;
+ case bg::is_intersect_connect_s2p1 : s << "is_intersect_connect_s2p1"; break;
+ case bg::is_intersect_connect_s2p2 : s << "is_intersect_connect_s2p2"; break;
+ }
+ return s;
+}
+
+static std::string as_string(const bg::intersection_result& r)
+{
+ std::stringstream out;
+ out << r;
+ return out.str();
+}
+
+typedef bg::model::point<double> P;
+typedef bg::const_segment<P> S;
+
+
+static void test_intersection(double s1x1, double s1y1, double s1x2, double s1y2,
+ double s2x1, double s2y1, double s2x2, double s2y2,
+ // Expected results
+ bg::intersection_result expected_result,
+ int exptected_count, const P& exp_p1, const P& exp_p2)
+{
+ S s1(P(s1x1, s1y1), P(s1x2, s1y2));
+ S s2(P(s2x1, s2y1), P(s2x2, s2y2));
+ std::vector<P> ip;
+ double ra, rb;
+ bg::intersection_result r = bg::intersection_s(s1, s2, ra, rb, ip);
+ r = bg::intersection_connect_result(r, ra, rb);
+
+ BOOST_CHECK_EQUAL(ip.size(), exptected_count);
+ BOOST_CHECK_EQUAL(as_string(expected_result), as_string(r));
+
+ if (ip.size() == 2 && ip[0] != exp_p1)
+ {
+ // Swap results, second point is not as expected, swap results, order is not prescribed,
+ // it might be OK.
+ std::reverse(ip.begin(), ip.end());
+ }
+
+ if (ip.size() >= 1)
+ {
+ BOOST_CHECK_EQUAL(ip[0], exp_p1);
+ }
+ if (ip.size() >= 2)
+ {
+ BOOST_CHECK_EQUAL(ip[1], exp_p2);
+ }
+
+
+ /*
+ std::cout << exptected_count << " " << r;
+ if (exptected_count >= 1) std::cout << " " << ip[0];
+ if (exptected_count >= 2) std::cout << " " << ip[1];
+ std::cout << std::endl;
+ */
+}
+
+//BOOST_AUTO_TEST_CASE( test1 )
+int test_main( int , char* [] )
+{
+ // Identical cases
+ test_intersection(0,0, 1,1, 0,0, 1,1, bg::is_collinear_overlap, 2, P(0,0), P(1,1));
+ test_intersection(1,1, 0,0, 0,0, 1,1, bg::is_collinear_overlap_opposite, 2, P(1,1), P(0,0));
+ test_intersection(0,1, 0,2, 0,1, 0,2, bg::is_collinear_overlap, 2, P(0,1), P(0,2)); // Vertical
+ test_intersection(0,2, 0,1, 0,1, 0,2, bg::is_collinear_overlap_opposite, 2, P(0,2), P(0,1)); // Vertical
+ // Overlap cases
+ test_intersection(0,0, 1,1, -0.5,-0.5, 2,2, bg::is_collinear_overlap, 2, P(0,0), P(1,1));
+ test_intersection(0,0, 1,1, 0.5,0.5, 1.5,1.5, bg::is_collinear_overlap, 2, P(0.5,0.5), P(1,1));
+ test_intersection(0,0, 0,1, 0,-10, 0,10, bg::is_collinear_overlap, 2, P(0,0), P(0,1)); // Vertical
+ test_intersection(0,0, 0,1, 0,10, 0,-10, bg::is_collinear_overlap_opposite, 2, P(0,0), P(0,1)); // Vertical
+ test_intersection(0,0, 1,1, 1,1, 2,2, bg::is_collinear_connect, 1, P(1,1), P(0,0)); // Single point
+ // Colinear, non overlap cases
+ test_intersection(0,0, 1,1, 1.5,1.5, 2.5,2.5, bg::is_collinear_no, 0, P(0,0), P(0,0));
+ test_intersection(0,0, 0,1, 0,5, 0,6, bg::is_collinear_no, 0, P(0,0), P(0,0)); // Vertical
+ // Parallel cases
+ test_intersection(0,0, 1,1, 1,0, 2,1, bg::is_parallel, 0, P(0,0), P(0,1));
+ // Intersect cases
+ test_intersection(0,2, 4,2, 3,0, 3,4, bg::is_intersect, 1, P(3,2), P(0,0));
+ // Non intersect cases
+
+ // Single point cases
+ test_intersection(0,0, 0,0, 1,1, 2,2, bg::is_collinear_no, 0, P(1,1), P(0,0)); // Colinear/no
+ test_intersection(2,2, 2,2, 1,1, 3,3, bg::is_collinear_one, 1, P(2,2.01), P(0,0)); // On segment
+ test_intersection(1,1, 3,3, 2,2, 2,2, bg::is_collinear_one, 1, P(2,2), P(0,0)); // On segment
+ test_intersection(1,1, 3,3, 1,1, 1,1, bg::is_collinear_one, 1, P(1,1), P(0,0)); // On segment, start
+ test_intersection(1,1, 3,3, 3,3, 3,3, bg::is_collinear_one, 1, P(3,3), P(0,0)); // On segment, end
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/intersects.cpp b/libs/geometry/test/algorithms/intersects.cpp
new file mode 100644
index 000000000..feafb0437
--- /dev/null
+++ b/libs/geometry/test/algorithms/intersects.cpp
@@ -0,0 +1,168 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 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_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);
+
+
+ // 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> >(
+ "POINT(0 0)",
+ "POLYGON((0 0,3 3,3 3,4 1))",
+ true);
+ test_geometry<P, bg::model::polygon<P> >(
+ "POINT(0 0)",
+ "POLYGON((0 0,3 3,3 3,4 1))",
+ true);
+
+ test_geometry<bg::model::ring<P>, P>(
+ "POLYGON((0 0,3 3,3 3,4 1))",
+ "POINT(0 0)",
+ true);
+ test_geometry<bg::model::polygon<P>, P>(
+ "POLYGON((0 0,3 3,3 3,4 1))",
+ "POINT(0 0)",
+ true);
+}
+
+
+
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+ test_all<bg::model::d2::point_xy<boost::rational<int> > >();
+
+
+#if defined(HAVE_TTMATH)
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/intersects.vcproj b/libs/geometry/test/algorithms/intersects.vcproj
new file mode 100644
index 000000000..f3f5f64db
--- /dev/null
+++ b/libs/geometry/test/algorithms/intersects.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="intersects"
+ ProjectGUID="{B1A97F62-85CD-4239-BB56-619988B08260}"
+ RootNamespace="intersects"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\intersects"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NONDLL;_CRT_SECURE_NO_WARNINGS"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\intersects"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NONDLL;_CRT_SECURE_NO_WARNINGS"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\intersects.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/length.cpp b/libs/geometry/test/algorithms/length.cpp
new file mode 100644
index 000000000..11e18d396
--- /dev/null
+++ b/libs/geometry/test/algorithms/length.cpp
@@ -0,0 +1,55 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_length.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/adapted/std_pair_as_segment.hpp>
+
+#include <test_geometries/all_custom_linestring.hpp>
+#include <test_geometries/wrapped_boost_array.hpp>
+
+
+template <typename P>
+void test_all()
+{
+ // 3-4-5 triangle
+ test_geometry<std::pair<P, P> >("LINESTRING(0 0,3 4)", 5);
+
+ // 3-4-5 plus 1-1
+ test_geometry<bg::model::linestring<P> >("LINESTRING(0 0,3 4,4 3)", 5 + sqrt(2.0));
+ test_geometry<all_custom_linestring<P> >("LINESTRING(0 0,3 4,4 3)", 5 + sqrt(2.0));
+ test_geometry<test::wrapped_boost_array<P, 3> >("LINESTRING(0 0,3 4,4 3)", 5 + sqrt(2.0));
+
+ // Geometries with length zero
+ test_geometry<P>("POINT(0 0)", 0);
+ test_geometry<bg::model::polygon<P> >("POLYGON((0 0,0 1,1 1,1 0,0 0))", 0);
+}
+
+template <typename P>
+void test_empty_input()
+{
+ test_empty_input(bg::model::linestring<P>());
+}
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<int> >();
+ test_all<bg::model::d2::point_xy<float> >();
+ test_all<bg::model::d2::point_xy<double> >();
+
+#if defined(HAVE_TTMATH)
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ // test_empty_input<bg::model::d2::point_xy<int> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/length.vcproj b/libs/geometry/test/algorithms/length.vcproj
new file mode 100644
index 000000000..17058ddcf
--- /dev/null
+++ b/libs/geometry/test/algorithms/length.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="length"
+ ProjectGUID="{C4D75B1E-34D5-4A98-8535-A9535BE949E4}"
+ RootNamespace="length"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\length"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\length"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\length.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/make.cpp b/libs/geometry/test/algorithms/make.cpp
new file mode 100644
index 000000000..fae968a8c
--- /dev/null
+++ b/libs/geometry/test/algorithms/make.cpp
@@ -0,0 +1,137 @@
+// 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.
+
+// 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/geometry/algorithms/make.hpp>
+
+#include <boost/geometry/io/wkt/write.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include <test_common/test_point.hpp>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+template <typename T, typename P>
+void test_point_2d()
+{
+ P p = bg::make<P>((T) 123, (T) 456);
+ BOOST_CHECK_CLOSE(bg::get<0>(p), 123.0, 1.0e-6);
+ BOOST_CHECK_CLOSE(bg::get<1>(p), 456.0, 1.0e-6);
+}
+
+template <typename T, typename P>
+void test_point_3d()
+{
+ P p = bg::make<P>((T) 123, (T) 456, (T) 789);
+ BOOST_CHECK_CLOSE( bg::get<0>(p), 123.0, 1.0e-6);
+ BOOST_CHECK_CLOSE( bg::get<1>(p), 456.0, 1.0e-6);
+ BOOST_CHECK_CLOSE( bg::get<2>(p), 789.0, 1.0e-6);
+}
+
+template <typename T, typename P>
+void test_box_2d()
+{
+ typedef bg::model::box<P> B;
+ B b = bg::make<B>((T) 123, (T) 456, (T) 789, (T) 1011);
+ BOOST_CHECK_CLOSE( (bg::get<bg::min_corner, 0>(b)), 123.0, 1.0e-6);
+ BOOST_CHECK_CLOSE( (bg::get<bg::min_corner, 1>(b)), 456.0, 1.0e-6);
+ BOOST_CHECK_CLOSE( (bg::get<bg::max_corner, 0>(b)), 789.0, 1.0e-6);
+ BOOST_CHECK_CLOSE( (bg::get<bg::max_corner, 1>(b)), 1011.0, 1.0e-6);
+
+ b = bg::make_inverse<B>();
+}
+
+template <typename T, typename P>
+void test_linestring_2d()
+{
+ typedef bg::model::linestring<P> L;
+
+ T coors[][2] = {{1,2}, {3,4}};
+
+ L line = bg::detail::make::make_points<L>(coors);
+
+ BOOST_CHECK_EQUAL(line.size(), 2u);
+}
+
+template <typename T, typename P>
+void test_linestring_3d()
+{
+ typedef bg::model::linestring<P> L;
+
+ T coors[][3] = {{1,2,3}, {4,5,6}};
+
+ L line = bg::detail::make::make_points<L>(coors);
+
+ BOOST_CHECK_EQUAL(line.size(), 2u);
+ //std::cout << dsv(line) << std::endl;
+
+}
+
+template <typename T, typename P>
+void test_2d_t()
+{
+ test_point_2d<T, P>();
+ test_box_2d<T, P>();
+ test_linestring_2d<T, P>();
+}
+
+template <typename P>
+void test_2d()
+{
+ test_2d_t<int, P>();
+ test_2d_t<float, P>();
+ test_2d_t<double, P>();
+}
+
+template <typename T, typename P>
+void test_3d_t()
+{
+ test_linestring_3d<T, P>();
+// test_point_3d<T, test_point>();
+}
+
+template <typename P>
+void test_3d()
+{
+ test_3d_t<int, P>();
+ test_3d_t<float, P>();
+ test_3d_t<double, P>();
+}
+
+int test_main(int, char* [])
+{
+ //test_2d<int[2]>();
+ //test_2d<float[2]>();
+ //test_2d<double[2]>();
+ test_2d<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_2d<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_2d<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+
+ test_3d<bg::model::point<double, 3, bg::cs::cartesian> >();
+
+#if defined(HAVE_TTMATH)
+ test_2d<bg::model::point<ttmath_big, 2, bg::cs::cartesian> >();
+ test_3d<bg::model::point<ttmath_big, 3, bg::cs::cartesian> >();
+#endif
+
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/make.vcproj b/libs/geometry/test/algorithms/make.vcproj
new file mode 100644
index 000000000..37ee7ce50
--- /dev/null
+++ b/libs/geometry/test/algorithms/make.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="make"
+ ProjectGUID="{BCD17F3E-8DF2-4B00-A75E-BF7372D2873B}"
+ RootNamespace="make"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\make"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\make"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\make.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlaps.cpp b/libs/geometry/test/algorithms/overlaps.cpp
new file mode 100644
index 000000000..6226ddd04
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlaps.cpp
@@ -0,0 +1,59 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 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_overlaps.hpp>
+
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+
+template <typename P>
+void test_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);
+}
+
+
+
+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/overlaps.vcproj b/libs/geometry/test/algorithms/overlaps.vcproj
new file mode 100644
index 000000000..06a51367f
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlaps.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="overlaps"
+ ProjectGUID="{30C37854-9ED6-4C1E-97FB-BF8637BD5811}"
+ RootNamespace="overlaps"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\overlaps"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NONDLL;_CRT_SECURE_NO_WARNINGS"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\overlaps"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NONDLL;_CRT_SECURE_NO_WARNINGS"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\overlaps.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/Jamfile.v2 b/libs/geometry/test/algorithms/overlay/Jamfile.v2
new file mode 100644
index 000000000..acd298a0c
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/Jamfile.v2
@@ -0,0 +1,21 @@
+# 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-algorithms-overlay
+ :
+ [ run assemble.cpp ]
+ [ run ccw_traverse.cpp ]
+ [ run get_turn_info.cpp ]
+ [ run get_turns.cpp ]
+ [ run relative_order.cpp ]
+ [ run select_rings.cpp ]
+ [ run self_intersection_points.cpp ]
+ [ run traverse.cpp ]
+ ;
diff --git a/libs/geometry/test/algorithms/overlay/assemble.cpp b/libs/geometry/test/algorithms/overlay/assemble.cpp
new file mode 100644
index 000000000..f63e3b5ac
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/assemble.cpp
@@ -0,0 +1,199 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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 <iostream>
+#include <iomanip>
+#include <string>
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/foreach.hpp>
+
+#include <boost/geometry/algorithms/correct.hpp>
+#include <boost/geometry/algorithms/intersection.hpp>
+#include <boost/geometry/algorithms/union.hpp>
+#include <boost/geometry/algorithms/difference.hpp>
+#include <boost/geometry/algorithms/intersects.hpp>
+#include <boost/geometry/algorithms/within.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/io/wkt/write.hpp>
+
+
+
+#if defined(TEST_WITH_SVG)
+# include <boost/geometry/io/svg/svg_mapper.hpp>
+#endif
+
+template <typename Geometry>
+inline void test_assemble(std::string const& id, Geometry const& p, Geometry const& q, char operation = 'i')
+{
+
+ std::vector<Geometry> u, i, d1, d2;
+ bg::detail::union_::union_insert<Geometry>(p, q, std::back_inserter(u));
+ bg::detail::intersection::intersection_insert<Geometry>(p, q, std::back_inserter(i));
+ bg::detail::difference::difference_insert<Geometry>(p, q, std::back_inserter(d1));
+ bg::detail::difference::difference_insert<Geometry>(q, p, std::back_inserter(d2));
+
+ if (operation == 'i')
+ {
+ typedef typename bg::default_area_result<Geometry>::type type;
+ type area_p = bg::area(p);
+ type area_q = bg::area(q);
+
+ type area_i = 0, area_u = 0, area_d1 = 0, area_d2 = 0;
+
+ BOOST_FOREACH(Geometry const& g, u)
+ {
+ area_u += bg::area(g);
+ }
+ BOOST_FOREACH(Geometry const& g, i)
+ {
+ area_i += bg::area(g);
+ }
+ BOOST_FOREACH(Geometry const& g, d1)
+ {
+ area_d1 += bg::area(g);
+ }
+ BOOST_FOREACH(Geometry const& g, d2)
+ {
+ area_d2 += bg::area(g);
+ }
+
+
+ type diff = (area_p + area_q) - area_u - area_i;
+ type diff_d1 = (area_u - area_q) - area_d1;
+ type diff_d2 = (area_u - area_p) - area_d2;
+
+ BOOST_CHECK_CLOSE(diff, 0.0, 0.001);
+
+ // Gives small deviations on gcc:
+ // difference{0.001%} between diff_d1{1.1102230246251565e-016} and 0.0{0} exceeds 0.001%
+ //BOOST_CHECK_CLOSE(diff_d1, 0.0, 0.001);
+ //BOOST_CHECK_CLOSE(diff_d2, 0.0, 0.001);
+
+ bool ok = abs(diff) < 0.001
+ || abs(diff_d1) < 0.001
+ || abs(diff_d2) < 0.001;
+
+ BOOST_CHECK_MESSAGE(ok,
+ id << " diff: "
+ << diff << " d1: "
+ << diff_d1 << " d2: "
+ << diff_d2);
+ }
+
+#if defined(TEST_WITH_SVG)
+ {
+ std::ostringstream filename;
+ filename << "assemble_" << id << "_" << operation << ".svg";
+ std::ofstream svg(filename.str().c_str());
+
+ bg::svg_mapper<typename bg::point_type<Geometry>::type> mapper(svg, 500, 500);
+ mapper.add(p);
+ mapper.add(q);
+ mapper.map(p, "fill-opacity:0.3;fill:rgb(51,51,153);stroke:rgb(51,51,153);stroke-width:3");
+ mapper.map(q, "fill-opacity:0.5;fill:rgb(153,204,0);stroke:rgb(153,204,0);stroke-width:3");
+ std::string linestyle = "opacity:0.7;fill:none;stroke-opacity:1;stroke-miterlimit:4;";
+
+ std::vector<Geometry> const& v = operation == 'i' ? i
+ : operation == 'u' ? u
+ : operation == 'd' ? d1
+ : d2
+ ;
+
+ BOOST_FOREACH(Geometry const& geometry, v)
+ {
+ mapper.map(geometry,
+ linestyle + "stroke-width:3;stroke-linejoin:round;stroke-linecap:square;stroke-dasharray:12,12;stroke:rgb(255,0,0);");
+ }
+ }
+#endif
+}
+
+template <typename Polygon>
+inline bool int_ok(Polygon const& poly)
+{
+
+ typename bg::point_type<Polygon>::type const& pi =
+ bg::interior_rings(poly)[0].front();
+
+ return bg::within(pi, bg::exterior_ring(poly));
+}
+
+
+template <typename T>
+void generate()
+{
+
+ static std::string exteriors[4] = {
+ "(0 0,0 10,10 10,10 0,0 0)",
+ "(1 1,1 9,8 9,8 1,1 1)",
+ "(2 0.5, 0.5 2,0.5 8,2 9.5,6 9.5,8.5 8,8.5 2,7 0.5,2 0.5)",
+ "(3 3,3 7,6 7,6 3,3 3)"
+ };
+ static std::string interiors[4] = {
+ "(2 2,2 8,7 8,7 2,2 2)",
+ "(8.5 1,8.5 2,9.5 2,9.5 1,8.5 1)",
+ "(4 4,4 5,5 5,5 4,4 4)",
+ "(6 4,6 5,9 5,9 4,6 4)"
+ };
+ for (int pe = 0; pe < 4; pe++)
+ {
+ for (int qe = 0; qe < 4; qe++)
+ {
+ for (int pi = 0; pi < 4; pi++)
+ {
+ for (int qi = 0; qi < 4; qi++)
+ {
+ std::string ps = "POLYGON(" + exteriors[pe] + "," + interiors[pi] + ")";
+ std::string qs = "POLYGON(" + exteriors[qe] + "," + interiors[qi] + ")";
+
+ typedef bg::model::d2::point_xy<T> point_type;
+ bg::model::polygon<point_type> p, q;
+ bg::read_wkt(ps, p);
+ bg::read_wkt(qs, q);
+ bg::correct(p);
+ bg::correct(q);
+ if (! bg::intersects(p)
+ && ! bg::intersects(q)
+ && int_ok(p)
+ && int_ok(q)
+ )
+ {
+ std::ostringstream out;
+ out << pe << qe << pi << qi;
+ test_assemble(out.str(), p, q);
+
+#if defined(TEST_WITH_SVG)
+ test_assemble(out.str(), p, q, 'u');
+ test_assemble(out.str(), p, q, 'd');
+ test_assemble(out.str(), p, q, 'r');
+#endif
+ }
+ }
+ }
+ }
+ }
+}
+
+
+#if ! defined(GEOMETRY_TEST_MULTI)
+int test_main(int, char* [])
+{
+ generate<double>();
+ return 0;
+}
+#endif
diff --git a/libs/geometry/test/algorithms/overlay/assemble.vcproj b/libs/geometry/test/algorithms/overlay/assemble.vcproj
new file mode 100644
index 000000000..335b08ab7
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/assemble.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="assemble"
+ ProjectGUID="{306E829F-ACEC-42D5-B1D4-2531B2F56EA3}"
+ RootNamespace="assemble"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\assemble"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\assemble"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\assemble.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/ccw_traverse.cpp b/libs/geometry/test/algorithms/overlay/ccw_traverse.cpp
new file mode 100644
index 000000000..bc7341b18
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/ccw_traverse.cpp
@@ -0,0 +1,346 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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 <fstream>
+#include <iostream>
+#include <iomanip>
+
+#include <boost/foreach.hpp>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/polygon.hpp>
+#include <boost/geometry/io/wkt/wkt.hpp>
+
+#if defined(TEST_WITH_SVG)
+# include <boost/geometry/io/svg/svg_mapper.hpp>
+#endif
+
+#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
+
+#include <algorithms/overlay/overlay_cases.hpp>
+
+template <typename Geometry>
+struct rev : boost::mpl::if_c<bg::point_order<Geometry>::value == bg::counterclockwise, boost::true_type, boost::false_type>::type
+{};
+
+template <typename Geometry1, typename Geometry2>
+inline typename bg::coordinate_type<Geometry1>::type intersect(Geometry1 const& g1, Geometry2 const& g2, std::string const& name,
+ bg::detail::overlay::operation_type op)
+{
+ typedef typename bg::strategy::side::services::default_strategy
+ <
+ typename bg::cs_tag<Geometry1>::type
+ >::type side_strategy_type;
+
+
+ typedef bg::detail::overlay::traversal_turn_info
+ <
+ typename bg::point_type<Geometry1>::type
+ > turn_info;
+ std::vector<turn_info> turns;
+
+ bg::detail::get_turns::no_interrupt_policy policy;
+ bg::get_turns
+ <
+ rev<Geometry1>::value,
+ rev<Geometry2>::value,
+ bg::detail::overlay::calculate_distance_policy
+ >(g1, g2, turns, policy);
+
+ bg::enrich_intersection_points<rev<Geometry1>::value, rev<Geometry2>::value >(turns, bg::detail::overlay::operation_intersection,
+ g1, g2, side_strategy_type());
+
+ typedef bg::model::ring<typename bg::point_type<Geometry1>::type> ring_type;
+ typedef std::deque<ring_type> out_vector;
+ out_vector v;
+
+ bg::detail::overlay::traverse
+ <
+ rev<Geometry1>::value, rev<Geometry2>::value,
+ Geometry1, Geometry2
+ >::apply(g1, g2, op, turns, v);
+
+ typename bg::coordinate_type<Geometry1>::type result = 0.0;
+ BOOST_FOREACH(ring_type& ring, v)
+ {
+ result += bg::area(ring);
+ }
+
+#if defined(TEST_WITH_SVG)
+ {
+ std::ostringstream filename;
+ filename
+ << name << "_"
+ << (op == bg::detail::overlay::operation_intersection ? "i" : "u")
+ << "_" << (rev<Geometry1>::value ? "ccw" : "cw")
+ << "_" << (rev<Geometry2>::value ? "ccw" : "cw")
+ << ".svg";
+
+ std::ofstream svg(filename.str().c_str());
+
+ bg::svg_mapper<typename bg::point_type<Geometry1>::type> mapper(svg, 500, 500);
+ mapper.add(g1);
+ mapper.add(g2);
+
+ // Input shapes in green/blue
+ mapper.map(g1, "fill-opacity:0.5;fill:rgb(153,204,0);"
+ "stroke:rgb(153,204,0);stroke-width:3");
+ mapper.map(g2, "fill-opacity:0.3;fill:rgb(51,51,153);"
+ "stroke:rgb(51,51,153);stroke-width:3");
+
+ // Traversal rings in magenta/light yellow fill
+ BOOST_FOREACH(ring_type const& ring, v)
+ {
+ mapper.map(ring, "fill-opacity:0.3;stroke-opacity:0.4;fill:rgb(255,255,0);"
+ "stroke:rgb(255,0,255);stroke-width:8");
+ }
+
+
+ // turn points in orange, + enrichment/traversal info
+
+ // Simple map to avoid two texts at same place (note that can still overlap!)
+ std::map<std::pair<int, int>, int> offsets;
+ int index = 0;
+ int const lineheight = 10;
+ int const margin = 5;
+
+ BOOST_FOREACH(turn_info const& turn, turns)
+ {
+ mapper.map(turn.point, "fill:rgb(255,128,0);"
+ "stroke:rgb(0,0,0);stroke-width:1", 3);
+
+ {
+ // Map characteristics
+ // Create a rounded off point
+ std::pair<int, int> p
+ = std::make_pair(
+ boost::numeric_cast<int>(0.5 + 10 * bg::get<0>(turn.point)),
+ boost::numeric_cast<int>(0.5 + 10 * bg::get<1>(turn.point))
+ );
+ std::string style = "fill:rgb(0,0,0);font-family:Arial;font-size:10px";
+
+ std::ostringstream out;
+ out << index
+ << ": " << bg::method_char(turn.method)
+ << std::endl
+ << "op: " << bg::operation_char(turn.operations[0].operation)
+ << " / " << bg::operation_char(turn.operations[1].operation)
+ << (turn.is_discarded() ? " (discarded) " : turn.blocked() ? " (blocked)" : "")
+ << std::endl;
+
+ if (turn.operations[0].enriched.next_ip_index != -1)
+ {
+ out << "ip: " << turn.operations[0].enriched.next_ip_index;
+ }
+ else
+ {
+ out << "vx: " << turn.operations[0].enriched.travels_to_vertex_index;
+ }
+ out << " ";
+ if (turn.operations[1].enriched.next_ip_index != -1)
+ {
+ out << "ip: " << turn.operations[1].enriched.next_ip_index;
+ }
+ else
+ {
+ out << "vx: " << turn.operations[1].enriched.travels_to_vertex_index;
+ }
+
+ out << std::endl;
+
+ out
+
+ << std::setprecision(3)
+ << "dist: " << turn.operations[0].enriched.distance
+ << " / " << turn.operations[1].enriched.distance
+ << std::endl;
+
+ offsets[p] += lineheight;
+ int offset = offsets[p];
+ offsets[p] += lineheight * 5;
+ mapper.text(turn.point, out.str(), style, margin, offset, lineheight);
+ }
+ index++;
+ }
+ }
+#endif
+
+ return result;
+}
+
+template <typename Geometry1, typename Geometry2>
+inline typename bg::coordinate_type<Geometry1>::type intersect(std::string const& wkt1, std::string const& wkt2, std::string const& name,
+ bg::detail::overlay::operation_type op)
+{
+ Geometry1 geometry1;
+ Geometry2 geometry2;
+ bg::read_wkt(wkt1, geometry1);
+ bg::read_wkt(wkt2, geometry2);
+
+ // Reverse if necessary: adapt to cw/ccw
+ bg::correct(geometry1);
+ bg::correct(geometry2);
+
+ return intersect(geometry1, geometry2, name, op);
+}
+
+template <typename T>
+inline void test_polygon(std::string const& wkt1, std::string const& wkt2, std::string const& name)
+{
+ typedef bg::model::d2::point_xy<T> point;
+ typedef bg::model::polygon<point> clock;
+ typedef bg::model::polygon<point, false> counter;
+
+ namespace ov = bg::detail::overlay;
+ T area1 = intersect<clock, clock>(wkt1, wkt2, name, ov::operation_intersection);
+ T area2 = intersect<counter, counter>(wkt1, wkt2, name, ov::operation_intersection);
+ T area3 = intersect<clock, counter>(wkt1, wkt2, name, ov::operation_intersection);
+ T area4 = intersect<counter, clock>(wkt1, wkt2, name, ov::operation_intersection);
+ BOOST_CHECK_CLOSE(area1, area2, 0.001);
+ BOOST_CHECK_CLOSE(area3, area4, 0.001);
+ BOOST_CHECK_CLOSE(area1, area3, 0.001);
+ BOOST_CHECK_CLOSE(area2, area4, 0.001);
+
+ area1 = intersect<clock, clock>(wkt1, wkt2, name, ov::operation_union);
+ area2 = intersect<counter, counter>(wkt1, wkt2, name, ov::operation_union);
+ area3 = intersect<clock, counter>(wkt1, wkt2, name, ov::operation_union);
+ area4 = intersect<counter, clock>(wkt1, wkt2, name, ov::operation_union);
+ BOOST_CHECK_CLOSE(area1, area2, 0.001);
+ BOOST_CHECK_CLOSE(area3, area4, 0.001);
+ BOOST_CHECK_CLOSE(area1, area3, 0.001);
+ BOOST_CHECK_CLOSE(area2, area4, 0.001);
+}
+
+template <typename T>
+inline void test_box_polygon(std::string const& wkt1, std::string const& wkt2, std::string const& name)
+{
+ typedef bg::model::d2::point_xy<T> point;
+ typedef bg::model::box<point> box;
+ typedef bg::model::polygon<point> clock;
+ typedef bg::model::polygon<point, false> counter;
+
+ namespace ov = bg::detail::overlay;
+ T area1 = intersect<box, clock>(wkt1, wkt2, name + "_bp", ov::operation_intersection);
+ T area2 = intersect<box, counter>(wkt1, wkt2, name + "_bp", ov::operation_intersection);
+ T area3 = intersect<clock, box>(wkt2, wkt1, name + "_pb", ov::operation_intersection);
+ T area4 = intersect<counter, box>(wkt2, wkt1, name + "_pb", ov::operation_intersection);
+ BOOST_CHECK_CLOSE(area1, area2, 0.001);
+ BOOST_CHECK_CLOSE(area3, area4, 0.001);
+ BOOST_CHECK_CLOSE(area1, area3, 0.001);
+ BOOST_CHECK_CLOSE(area2, area4, 0.001);
+
+ area1 = intersect<box, clock>(wkt1, wkt2, name + "_bp", ov::operation_union);
+ area2 = intersect<box, counter>(wkt1, wkt2, name + "_bp", ov::operation_union);
+ area3 = intersect<clock, box>(wkt2, wkt1, name + "_pb", ov::operation_union);
+ area4 = intersect<counter, box>(wkt2, wkt1, name + "_pb", ov::operation_union);
+ BOOST_CHECK_CLOSE(area1, area2, 0.001);
+ BOOST_CHECK_CLOSE(area3, area4, 0.001);
+ BOOST_CHECK_CLOSE(area1, area3, 0.001);
+ BOOST_CHECK_CLOSE(area2, area4, 0.001);
+}
+
+int test_main(int, char* [])
+{
+ //bool const ig = true;
+ test_polygon<double>(case_1[0], case_1[1], "c1");
+ test_polygon<double>(case_2[0], case_2[1], "c2");
+ test_polygon<double>(case_3[0], case_3[1], "c3");
+ test_polygon<double>(case_4[0], case_4[1], "c4");
+ test_polygon<double>(case_5[0], case_5[1], "c5");
+ test_polygon<double>(case_6[0], case_6[1], "c6");
+ test_polygon<double>(case_7[0], case_7[1], "c7");
+ test_polygon<double>(case_8[0], case_8[1], "c8");
+ test_polygon<double>(case_9[0], case_9[1], "c9" /*, ig */);
+
+
+ test_polygon<double>(case_10[0], case_10[1], "c10");
+ test_polygon<double>(case_11[0], case_11[1], "c11");
+ test_polygon<double>(case_12[0], case_12[1], "c12");
+ test_polygon<double>(case_13[0], case_13[1], "c13");
+ test_polygon<double>(case_14[0], case_14[1], "c14");
+ test_polygon<double>(case_15[0], case_15[1], "c15");
+ test_polygon<double>(case_16[0], case_16[1], "c16");
+ test_polygon<double>(case_17[0], case_17[1], "c17");
+ test_polygon<double>(case_18[0], case_18[1], "c18");
+ test_polygon<double>(case_19[0], case_19[1], "c19");
+ test_polygon<double>(case_20[0], case_20[1], "c20");
+ test_polygon<double>(case_21[0], case_21[1], "c21");
+ test_polygon<double>(case_22[0], case_22[1], "c22" /*, ig */);
+ test_polygon<double>(case_23[0], case_23[1], "c23");
+ test_polygon<double>(case_24[0], case_24[1], "c24");
+ test_polygon<double>(case_25[0], case_25[1], "c25" /*, ig */);
+ test_polygon<double>(case_26[0], case_26[1], "c26" /*, ig */);
+ test_polygon<double>(case_27[0], case_27[1], "c27");
+ test_polygon<double>(case_28[0], case_28[1], "c28");
+ test_polygon<double>(case_29[0], case_29[1], "c29");
+ test_polygon<double>(case_30[0], case_30[1], "c30");
+ test_polygon<double>(case_31[0], case_31[1], "c31" /*, ig */);
+ test_polygon<double>(case_32[0], case_32[1], "c32" /*, ig */);
+ test_polygon<double>(case_33[0], case_33[1], "c33" /*, ig */);
+ test_polygon<double>(case_34[0], case_34[1], "c34");
+ test_polygon<double>(case_35[0], case_35[1], "c35");
+ test_polygon<double>(case_36[0], case_36[1], "c36" /*, ig */);
+ test_polygon<double>(case_37[0], case_37[1], "c37" /*, ig */);
+ test_polygon<double>(case_38[0], case_38[1], "c38" /*, ig */);
+ test_polygon<double>(case_39[0], case_39[1], "c39");
+ test_polygon<double>(case_40[0], case_40[1], "c40" /*, ig */);
+ test_polygon<double>(case_41[0], case_41[1], "c41");
+ test_polygon<double>(case_42[0], case_42[1], "c42");
+ //test_polygon<double>(case_43[0], case_43[1], "c43", inv);
+ test_polygon<double>(case_44[0], case_44[1], "c44");
+ test_polygon<double>(case_45[0], case_45[1], "c45");
+ //test_polygon<double>(case_46[0], case_46[1], "c46", inv);
+ //test_polygon<double>(case_47[0], case_47[1], "c47" /*, ig */);
+ //test_polygon<double>(case_48[0], case_48[1], "c48");
+ test_polygon<double>(case_49[0], case_49[1], "c49");
+ test_polygon<double>(case_50[0], case_50[1], "c50");
+ test_polygon<double>(case_51[0], case_51[1], "c51");
+ test_polygon<double>(case_52[0], case_52[1], "c52" /*, ig */);
+ test_polygon<double>(case_53[0], case_53[1], "c53");
+ // Invalid ones / overlaying intersection points / self tangencies
+ //test_polygon<double>(case_54[0], case_54[1], "c54");
+ //test_polygon<double>(case_55[0], case_55[1], "c55");
+ //test_polygon<double>(case_56[0], case_56[1], "c56");
+ //test_polygon<double>(case_57[0], case_57[1], "c57" /*, ig */);
+ //test_polygon<double>(case_58[0], case_58[1], "c58");
+ //test_polygon<double>(case_59[0], case_59[1], "c59");
+
+ test_polygon<double>(pie_16_4_12[0], pie_16_4_12[1], "pie_16_4_12");
+ test_polygon<double>(pie_23_21_12_500[0], pie_23_21_12_500[1], "pie_23_21_12_500");
+ test_polygon<double>(pie_23_23_3_2000[0], pie_23_23_3_2000[1], "pie_23_23_3_2000");
+ test_polygon<double>(pie_23_16_16[0], pie_23_16_16[1], "pie_23_16_16");
+ test_polygon<double>(pie_16_2_15_0[0], pie_16_2_15_0[1], "pie_16_2_15_0");
+ test_polygon<double>(pie_4_13_15[0], pie_4_13_15[1], "pie_4_13_15");
+ test_polygon<double>(pie_20_20_7_100[0], pie_20_20_7_100[1], "pie_20_20_7_100");
+
+ test_polygon<double>(hv_1[0], hv_1[1], "hv1");
+ test_polygon<double>(hv_2[0], hv_2[1], "hv2");
+ test_polygon<double>(hv_3[0], hv_3[1], "hv3");
+ test_polygon<double>(hv_4[0], hv_4[1], "hv4");
+ test_polygon<double>(hv_5[0], hv_5[1], "hv5");
+ test_polygon<double>(hv_6[0], hv_6[1], "hv6");
+ test_polygon<double>(hv_7[0], hv_7[1], "hv7");
+ test_polygon<double>(dz_1[0], dz_1[1], "dz_1");
+ test_polygon<double>(dz_2[0], dz_2[1], "dz_2");
+ test_polygon<double>(dz_3[0], dz_3[1], "dz_3");
+
+ test_box_polygon<double>("POLYGON((1 1,4 4))", case_1[0], "bp1");
+
+ {
+ static std::string example_box = "POLYGON((1.5 1.5, 4.5 2.5))";
+ static std::string example_ring =
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3))";
+ test_box_polygon<double>(example_box, example_ring, "bp2");
+ }
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/overlay/ccw_traverse.vcproj b/libs/geometry/test/algorithms/overlay/ccw_traverse.vcproj
new file mode 100644
index 000000000..fc373c847
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/ccw_traverse.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="ccw_traverse"
+ ProjectGUID="{BA789719-B2FC-405A-9258-E9E4ABCE1791}"
+ RootNamespace="ccw_traverse"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\ccw_traverse"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\ccw_traverse"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\ccw_traverse.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/dissolver.cpp b/libs/geometry/test/algorithms/overlay/dissolver.cpp
new file mode 100644
index 000000000..41f4c60f7
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/dissolver.cpp
@@ -0,0 +1,219 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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 <iostream>
+#include <string>
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/detail/overlay/dissolver.hpp>
+
+#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 <test_common/test_point.hpp>
+
+
+//#define TEST_WITH_SVG
+#if defined(TEST_WITH_SVG)
+# include <boost/geometry/io/svg/svg_mapper.hpp>
+# include <boost/geometry/io/svg/write_svg_multi.hpp>
+#endif
+
+// Collection might be a multi-geometry, or std::vector<ring>
+template <typename GeometryOut, typename Collection, typename T>
+void test_dissolve_plusmin(std::string const& caseid, Collection const& input,
+ T const& expected_positive_area,
+ T const& expected_negative_area)
+{
+ typedef typename boost::range_value<GeometryOut>::type geometry_type;
+ typedef typename bg::point_type<geometry_type>::type point_type;
+
+
+ GeometryOut output;
+ bg::dissolver(input, output);
+
+ T zero = T();
+ T positive_area = T();
+ T negative_area = T();
+
+ BOOST_FOREACH(geometry_type const& geometry, output)
+ {
+ T a = bg::area(geometry);
+ if (a > zero)
+ {
+ positive_area += a;
+ }
+ else
+ {
+ negative_area += a;
+ }
+ }
+
+ BOOST_CHECK_CLOSE(positive_area, expected_positive_area, 0.001);
+ BOOST_CHECK_CLOSE(negative_area, expected_negative_area, 0.001);
+
+
+#if defined(TEST_WITH_SVG)
+ {
+ std::ostringstream filename;
+ filename << "dissolve_plusmin_"
+ << caseid << ".svg";
+
+ std::ofstream svg(filename.str().c_str());
+
+ bg::svg_mapper<point_type> mapper(svg, 500, 500);
+
+ typedef typename boost::range_value<Collection>::type value_type;
+ BOOST_FOREACH(value_type const& geometry, input)
+ {
+ mapper.add(geometry);
+ }
+
+ BOOST_FOREACH(value_type const& geometry, input)
+ {
+ mapper.map(geometry,
+ "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:0.5");
+ }
+ BOOST_FOREACH(geometry_type const& geometry, output)
+ {
+ mapper.map(geometry,
+ bg::area(geometry) > 0
+ ? "opacity:0.5;fill:none;stroke:rgb(255,0,0);stroke-width:5"
+ : "opacity:0.5;fill:none;stroke:rgb(0,0,255);stroke-width:5"
+ );
+ }
+ }
+#endif
+
+}
+
+template <typename MultiPolygon, typename T>
+void test_geometry(std::string const& caseid, std::string const& wkt,
+ T const& expected_positive_area,
+ T const& expected_negative_area = T())
+{
+
+ MultiPolygon multi_polygon;
+ bg::read_wkt(wkt, multi_polygon);
+
+ // Test std::vector<Polygon> (= multi_polygon)
+ test_dissolve_plusmin<MultiPolygon>(caseid, multi_polygon,
+ expected_positive_area,
+ expected_negative_area);
+
+ // Test std::vector<ring>
+ {
+ typedef typename boost::range_value<MultiPolygon>::type polygon_type;
+ typedef typename bg::ring_type<MultiPolygon>::type ring_type;
+ std::vector<ring_type> rings;
+ BOOST_FOREACH(polygon_type const& polygon, multi_polygon)
+ {
+ rings.push_back(bg::exterior_ring(polygon));
+ }
+
+ test_dissolve_plusmin<MultiPolygon>(caseid + "_rings", rings,
+ expected_positive_area,
+ expected_negative_area);
+ }
+
+ // Test different combinations
+#define BOOST_GEOMETRY_TEST_PERMUTATIONS
+#ifdef BOOST_GEOMETRY_TEST_PERMUTATIONS
+
+ int n = multi_polygon.size();
+
+ // test them in all orders
+ std::vector<int> indices;
+ for (int i = 0; i < n; i++)
+ {
+ indices.push_back(i);
+ }
+ int permutation = 0;
+ do
+ {
+ std::ostringstream out;
+ out << caseid;
+ MultiPolygon multi_polygon2;
+ for (int i = 0; i < n; i++)
+ {
+ int index = indices[i];
+ out << "_" << index;
+ multi_polygon2.push_back(multi_polygon[index]);
+ }
+ test_dissolve_plusmin<MultiPolygon>(out.str(), multi_polygon2, expected_positive_area,
+ expected_negative_area);
+ } while (std::next_permutation(indices.begin(), indices.end()));
+#endif
+}
+
+template <typename Point>
+void test_all()
+{
+ typedef bg::model::polygon<Point> polygon;
+ typedef bg::model::multi_polygon<polygon> multi_polygon;
+
+ test_geometry<multi_polygon>("simplex_one",
+ "MULTIPOLYGON(((0 0,1 4,4 1,0 0)))",
+ 7.5);
+
+ test_geometry<multi_polygon>("simplex_two",
+ "MULTIPOLYGON(((0 0,1 4,4 1,0 0)),((2 2,3 6,6 3,2 2)))",
+ 14.7);
+ test_geometry<multi_polygon>("simplex_three",
+ "MULTIPOLYGON(((0 0,1 4,4 1,0 0)),((2 2,3 6,6 3,2 2)),((3 4,5 6,6 2,3 4)))",
+ 16.7945);
+ test_geometry<multi_polygon>("simplex_four",
+ "MULTIPOLYGON(((0 0,1 4,4 1,0 0)),((2 2,3 6,6 3,2 2)),((3 4,5 6,6 2,3 4)),((5 5,7 7,8 4,5 5)))",
+ 20.7581);
+
+ // disjoint
+ test_geometry<multi_polygon>("simplex_disjoint",
+ "MULTIPOLYGON(((0 0,1 4,4 1,0 0)),((1 6,2 10,5 7,1 6)),((3 4,5 6,6 2,3 4)),((6 5,8 7,9 4,6 5)))",
+ 24.0);
+
+ // new hole of four
+ test_geometry<multi_polygon>("new_hole",
+ "MULTIPOLYGON(((0 0,1 4,4 1,0 0)),((2 2,3 6,6 3,2 2)),((3 4,5 6,6 2,3 4)),((3 1,5 4,8 4,3 1)))",
+ 19.5206);
+
+ // intersection of positive/negative ring
+ test_geometry<multi_polygon>("plus_min_one",
+ "MULTIPOLYGON(((0 0,1 4,4 1,0 0)),((2 2,6 3,3 6,2 2)))",
+ 7.5, -7.2);
+
+ // negative ring within a positive ring
+ test_geometry<multi_polygon>("plus_min_one_within",
+ "MULTIPOLYGON(((0 0,1 7,7 3,0 0)),((1 2,4 4,2 5,1 2)))",
+ 23.0, -3.5);
+
+ // from buffer
+ test_geometry<multi_polygon>("from_buffer_1",
+ "MULTIPOLYGON(((2.4 3.03431,1.71716 3.71716,2.4 4,2.4 3.03431))"
+ ",((2.4 1.96569,2.4 1,1.71716 1.28284,2.4 1.96569))"
+ ",((2.93431 2.5,2.4 3.03431,2.4 1.96569,2.93431 2.5))"
+ ",((3.06569 2.5,3 2.43431,2.93431 2.5,3 2.56569,3.06569 2.5))"
+ ",((-0.4 5.4,4.4 5.4,4.4 3.83431,3.06569 2.5,4.4 1.16569,4.4 -0.4,-0.4 -0.4,-0.4 5.4)))"
+ ,
+ 26.0596168239, -0.2854871761);
+
+}
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<double> >();
+ return 0;
+}
+
+
diff --git a/libs/geometry/test/algorithms/overlay/dissolver.vcproj b/libs/geometry/test/algorithms/overlay/dissolver.vcproj
new file mode 100644
index 000000000..c3c9d4bf0
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/dissolver.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="dissolver"
+ ProjectGUID="{6CCB145C-C682-4B9F-8672-6D04DB5C76DD}"
+ RootNamespace="dissolver"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\dissolver"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\dissolver"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\dissolver.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/enrich_intersection_points.cpp b/libs/geometry/test/algorithms/overlay/enrich_intersection_points.cpp
new file mode 100644
index 000000000..5c37a4be5
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/enrich_intersection_points.cpp
@@ -0,0 +1,186 @@
+// 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.
+
+// 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 <iostream>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/intersection.hpp>
+
+//#include <boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp>
+//#include <boost/geometry/algorithms/detail/overlay/merge_intersection_points.hpp>
+#include <boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+#define GEOMETRY_TEST_OVERLAY_NOT_REVERSED
+
+#include <overlay_common.hpp>
+
+#include <boost/algorithm/string/replace.hpp>
+
+
+#if defined(TEST_WITH_SVG)
+# include <boost/geometry/io/svg/svg_mapper.hpp>
+#endif
+
+struct test_enrich_intersection_points
+{
+ static inline std::string dir(int d)
+ {
+ return d == 0 ? "-" : (d == 1 ? "L" : "R");
+ }
+
+ template <typename G1, typename G2>
+ static void apply(std::string const& id,
+ boost::tuple<int, std::string> const& expected_count_and_center,
+ G1 const& g1, G2 const& g2, double precision)
+ {
+ //std::cout << "#" << id << std::endl;
+
+ typedef bg::detail::intersection::intersection_point
+ <typename bg::point_type<G2>::type> ip;
+ typedef typename boost::range_const_iterator<std::vector<ip> >::type iterator;
+ std::vector<ip> ips;
+
+ bg::get_intersection_points(g1, g2, ips);
+ bg::merge_intersection_points(ips);
+ bg::enrich_intersection_points(ips, true);
+
+ std::ostringstream out;
+ out << std::setprecision(2);
+
+ bool first = true;
+ for (iterator it = boost::begin(ips); it != boost::end(ips); ++it, first = false)
+ {
+ out << (first ? "" : ",");
+ for (unsigned int i = 0; i < it->info.size(); i++)
+ {
+ out << dir(it->info[i].direction);
+ }
+ }
+ int n = boost::size(ips);
+ //std::cout << n << " " << out.str() << std::endl;
+ BOOST_CHECK_EQUAL(expected_count_and_center.get<0>(), n);
+ BOOST_CHECK_EQUAL(expected_count_and_center.get<1>(), out.str());
+
+
+
+#if defined(TEST_WITH_SVG)
+ {
+ std::ostringstream filename;
+ filename << "enrich_ip" << id << ".svg";
+
+ std::ofstream svg(filename.str().c_str());
+
+ bg::svg_mapper<typename bg::point_type<G2>::type> mapper(svg, 500, 500);
+ mapper.add(g1);
+ mapper.add(g2);
+
+ mapper.map(g1, "fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1");
+ mapper.map(g2, "opacity:0.8;fill:rgb(0,0,255);stroke:rgb(0,0,0);stroke-width:1");
+
+ for (iterator it = boost::begin(ips); it != boost::end(ips); ++it)
+ {
+ mapper.map(it->point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1");
+ }
+ }
+#endif
+ }
+};
+
+
+int test_main(int, char* [])
+{
+ std::vector<boost::tuple<int, std::string> > expected;
+
+ /*
+ TODO Will be refactored
+
+ // NOTE: the order is sometimes not really important, in GCC it is sometimes
+ // different from here...
+
+
+ // 1-6
+ expected.push_back(boost::make_tuple(6, "RL,LR,LR,RL,RL,LR"));
+ expected.push_back(boost::make_tuple(8, "RL,LR,LR,RL,RL,LR,LR,RL"));
+ expected.push_back(boost::make_tuple(4, "RLRR,RRRL,RRRL,RRRL"));
+ expected.push_back(boost::make_tuple(12, "RL,LR,RL,LR,LR,RL,RL,LR,LR,RL,LR,RL"));
+ expected.push_back(boost::make_tuple(17, "LR,RL,LR,RRLR,RL,LR,RL,RL,LR,LR,RL,LR,RL,RL,LR,RL,LR"));
+ expected.push_back(boost::make_tuple(2, "--RR,LR"));
+
+ // 7-12
+ expected.push_back(boost::make_tuple(2, "LL,LL"));
+ expected.push_back(boost::make_tuple(2, "RL--,LL--"));
+ expected.push_back(boost::make_tuple(1, "RLLL"));
+ expected.push_back(boost::make_tuple(2, "RL--,LL--"));
+ expected.push_back(boost::make_tuple(1, "RRLR"));
+ expected.push_back(boost::make_tuple(8, "RL,LR,RL,LR,RL,LR,RL,LR"));
+
+ // 13-18
+ expected.push_back(boost::make_tuple(2, "LL--,LL--"));
+ expected.push_back(boost::make_tuple(2, "RL--,LL--"));
+ expected.push_back(boost::make_tuple(2, "RL--,LL--"));
+ expected.push_back(boost::make_tuple(2, "LL,--RL"));
+ expected.push_back(boost::make_tuple(2, "RR--,--LR"));
+ expected.push_back(boost::make_tuple(2, "RR--,--LR"));
+
+ // 19-24
+ expected.push_back(boost::make_tuple(2, "LL,LL"));
+ expected.push_back(boost::make_tuple(0, ""));
+ expected.push_back(boost::make_tuple(0, ""));
+ expected.push_back(boost::make_tuple(1, "RLLLRRLR"));
+ expected.push_back(boost::make_tuple(2, "RL,RLRRRRLR"));
+ expected.push_back(boost::make_tuple(1, "LRRRRRLR"));
+
+ // 25-30
+ expected.push_back(boost::make_tuple(1, "LRRRLLRL"));
+ expected.push_back(boost::make_tuple(1, "LRLLLLLR"));
+ expected.push_back(boost::make_tuple(2, "LR,LRRRRRRL"));
+ expected.push_back(boost::make_tuple(2, "LR,LRLLRRLR"));
+ expected.push_back(boost::make_tuple(2, "RL,LRRRLLLR"));
+ expected.push_back(boost::make_tuple(2, "LR,LRLLLLRL"));
+
+ // 31-36
+ expected.push_back(boost::make_tuple(1, "--LLLL--"));
+ expected.push_back(boost::make_tuple(1, "LR--LLRL"));
+ expected.push_back(boost::make_tuple(1, "LRLLLL--"));
+ expected.push_back(boost::make_tuple(2, "LR,LRLLRR--"));
+ expected.push_back(boost::make_tuple(1, "LRLLRRLR"));
+ expected.push_back(boost::make_tuple(3, "RL,LR,RLLLRRLR"));
+
+ // 37-42
+ expected.push_back(boost::make_tuple(3, "LRRRRRLR,RL,LR"));
+ expected.push_back(boost::make_tuple(3, "LR--RRRL,LR,RL"));
+ expected.push_back(boost::make_tuple(3, "RL,LR,LRRRRRRL"));
+
+ // 43-48
+ expected.push_back(boost::make_tuple(4, "LR,RL,RL,LR"));
+
+ // 49
+ expected.push_back(boost::make_tuple(16, "--RL,RRLR,RRLR,RL,LLRL,RLLLRRLR,RR--,--LR,RLRR,--LL,RL--,RL,RRRL,RL,LR,RRRLRRRL"));
+
+ // 101
+ expected.push_back(boost::make_tuple(3, "RL,LR,RL"));
+
+ // ticket#17
+ expected.push_back(boost::make_tuple(6, "LR,RL,LR,RL,RL,LR"));
+
+ //test_all<bg::model::d2::point_xy<float>, test_enrich_intersection_points>(expected);
+ test_all<bg::model::d2::point_xy<double>, test_enrich_intersection_points>(expected);
+ //test_all<boost::tuple<double, double>, test_enrich_intersection_points>(expected);
+
+ */
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/overlay/enrich_intersection_points.vcproj b/libs/geometry/test/algorithms/overlay/enrich_intersection_points.vcproj
new file mode 100644
index 000000000..8880fb1f3
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/enrich_intersection_points.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="enrich_intersection_points"
+ ProjectGUID="{20FE798A-E4EE-4C87-A988-7317E774D28A}"
+ RootNamespace="enrich_intersection_points"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\enrich_intersection_points"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\enrich_intersection_points"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\enrich_intersection_points.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/get_turn_info.cpp b/libs/geometry/test/algorithms/overlay/get_turn_info.cpp
new file mode 100644
index 000000000..979252e4d
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/get_turn_info.cpp
@@ -0,0 +1,859 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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 <iostream>
+
+#include <geometry_test_common.hpp>
+
+
+#include <boost/foreach.hpp>
+
+#include <boost/geometry/algorithms/intersection.hpp>
+
+#include <boost/geometry/algorithms/detail/overlay/get_turn_info.hpp>
+#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+#if defined(TEST_WITH_SVG)
+# include <boost/geometry/io/svg/svg_mapper.hpp>
+#endif
+
+
+
+template <typename P, typename T>
+void test_with_point(std::string const& caseid,
+ T pi_x, T pi_y, T pj_x, T pj_y, T pk_x, T pk_y,
+ T qi_x, T qi_y, T qj_x, T qj_y, T qk_x, T qk_y,
+ bg::detail::overlay::method_type expected_method,
+ T ip_x, T ip_y,
+ std::string const& expected,
+ T ip_x2, T ip_y2)
+{
+ P pi = bg::make<P>(pi_x, pi_y);
+ P pj = bg::make<P>(pj_x, pj_y);
+ P pk = bg::make<P>(pk_x, pk_y);
+ P qi = bg::make<P>(qi_x, qi_y);
+ P qj = bg::make<P>(qj_x, qj_y);
+ P qk = bg::make<P>(qk_x, qk_y);
+
+
+ typedef bg::detail::overlay::turn_info<P> turn_info;
+ typedef std::vector<turn_info> tp_vector;
+ turn_info model;
+ tp_vector info;
+ bg::detail::overlay::get_turn_info
+ <
+ P, P, turn_info,
+ bg::detail::overlay::assign_null_policy
+ >::apply(pi, pj, pk, qi, qj, qk,
+ model, std::back_inserter(info));
+
+
+ if (info.size() == 0)
+ {
+ BOOST_CHECK_EQUAL(expected_method,
+ bg::detail::overlay::method_none);
+ }
+
+ std::string detected;
+ std::string method;
+ for (typename tp_vector::const_iterator it = info.begin(); it != info.end(); ++it)
+ {
+ for (int t = 0; t < 2; t++)
+ {
+ detected += bg::operation_char(it->operations[t].operation);
+ method += bg::method_char(it->method);
+ }
+ }
+
+
+ /*
+ std::cout << caseid
+ << (caseid.find("_") == std::string::npos ? " " : "")
+ << " " << method
+ << " " << detected
+ << " " << order
+ << std::endl;
+ */
+
+
+ BOOST_CHECK_EQUAL(detected, expected);
+
+ if (! info.empty())
+ {
+ BOOST_CHECK_EQUAL(info[0].method, expected_method);
+ BOOST_CHECK_CLOSE(bg::get<0>(info[0].point), ip_x, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(info[0].point), ip_y, 0.001);
+
+ if (info.size() > 1)
+ {
+ BOOST_CHECK_EQUAL(info.size(), 2u);
+ BOOST_CHECK_EQUAL(info[1].method, expected_method);
+ BOOST_CHECK_CLOSE(bg::get<0>(info[1].point), ip_x2, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(info[1].point), ip_y2, 0.001);
+ }
+ }
+
+#if defined(TEST_WITH_SVG)
+ {
+ std::ostringstream filename;
+ filename << "get_turn_info_" << caseid
+ << "_" << string_from_type<typename bg::coordinate_type<P>::type>::name()
+ << ".svg";
+
+ std::ofstream svg(filename.str().c_str());
+
+ bg::svg_mapper<P> mapper(svg, 500, 500);
+ mapper.add(bg::make<P>(0, 0));
+ mapper.add(bg::make<P>(10, 10));
+
+ bg::model::linestring<P> p; p.push_back(pi); p.push_back(pj); p.push_back(pk);
+ bg::model::linestring<P> q; q.push_back(qi); q.push_back(qj); q.push_back(qk);
+ mapper.map(p, "opacity:0.8;stroke:rgb(0,192,0);stroke-width:3");
+ mapper.map(q, "opacity:0.8;stroke:rgb(0,0,255);stroke-width:3");
+
+ std::string style = ";font-family='Verdana';font-weight:bold";
+ std::string align = ";text-anchor:end;text-align:end";
+ int offset = 8;
+
+ mapper.text(pi, "pi", "fill:rgb(0,192,0)" + style, offset, offset);
+ mapper.text(pj, "pj", "fill:rgb(0,192,0)" + style, offset, offset);
+ mapper.text(pk, "pk", "fill:rgb(0,192,0)" + style, offset, offset);
+
+ mapper.text(qi, "qi", "fill:rgb(0,0,255)" + style + align, -offset, offset);
+ mapper.text(qj, "qj", "fill:rgb(0,0,255)" + style + align, -offset, offset);
+ mapper.text(qk, "qk", "fill:rgb(0,0,255)" + style + align, -offset, offset);
+
+
+ int factor = 1; // second info, if any, will go left by factor -1
+ int ch = '1';
+ for (typename tp_vector::const_iterator it = info.begin();
+ it != info.end();
+ ++it, factor *= -1, ch++)
+ {
+ bool at_j = it->method == bg::detail::overlay::method_crosses;
+ std::string op;
+ op += bg::operation_char(it->operations[0].operation);
+ align = ";text-anchor:middle;text-align:center";
+ mapper.text(at_j ? pj : pk, op, "fill:rgb(255,128,0)" + style + align, offset * factor, -offset);
+
+ op.clear();
+ op += bg::operation_char(it->operations[1].operation);
+ mapper.text(at_j ? qj : qk, op, "fill:rgb(255,128,0)" + style + align, offset * factor, -offset);
+
+ // Map intersection point + method
+ mapper.map(it->point, "opacity:0.8;fill:rgb(255,0,0);stroke:rgb(0,0,100);stroke-width:1");
+
+ op.clear();
+ op += bg::method_char(it->method);
+ if (info.size() != 1)
+ {
+ op += ch;
+ op += " p:"; op += bg::operation_char(it->operations[0].operation);
+ op += " q:"; op += bg::operation_char(it->operations[1].operation);
+ }
+ mapper.text(it->point, op, "fill:rgb(255,0,0)" + style, offset, -offset);
+ }
+ }
+#endif
+
+}
+
+template <typename P, typename T>
+void test_both(std::string const& caseid,
+ T pi_x, T pi_y, T pj_x, T pj_y, T pk_x, T pk_y,
+ T qi_x, T qi_y, T qj_x, T qj_y, T qk_x, T qk_y,
+ bg::detail::overlay::method_type method
+ = bg::detail::overlay::method_none,
+ T ip_x = -1, T ip_y = -1,
+ std::string const& expected = "",
+ T ip_x2 = -1, T ip_y2 = -1)
+{
+ test_with_point<P, double>(caseid,
+ pi_x, pi_y, pj_x, pj_y, pk_x, pk_y,
+ qi_x, qi_y, qj_x, qj_y, qk_x, qk_y,
+ method, ip_x, ip_y, expected, ip_x2, ip_y2);
+
+ //return;
+
+ std::string reverse;
+ for (int i = expected.size() - 1; i >= 0; i--)
+ {
+ reverse += expected[i];
+ }
+ if (ip_x2 >= 0 && ip_y2 >= 0)
+ {
+ std::swap(ip_x, ip_x2);
+ std::swap(ip_y, ip_y2);
+ }
+
+ 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);
+}
+
+
+template <typename P>
+void test_all()
+{
+ using namespace bg::detail::overlay;
+
+ // See powerpoint "doc/testcases/get_turn_info.ppt"
+
+
+ // ------------------------------------------------------------------------
+ // "Real" intersections ("i"), or, crossing
+ // ------------------------------------------------------------------------
+ test_both<P, double>("il1",
+ 5, 1, 5, 6, 7, 8, // p
+ 3, 3, 7, 5, 8, 3, // q
+ method_crosses, 5, 4, "ui");
+
+ test_both<P, double>("il2",
+ 5, 1, 5, 6, 7, 8, // p
+ 3, 5, 7, 5, 3, 3, // q
+ method_crosses, 5, 5, "ui");
+
+ test_both<P, double>("il3",
+ 5, 1, 5, 6, 7, 8, // p
+ 3, 3, 7, 5, 3, 5, // q
+ method_crosses, 5, 4, "ui");
+
+ test_both<P, double>("il4",
+ 5, 1, 5, 6, 7, 8, // p
+ 3, 3, 7, 5, 4, 8, // q
+ method_crosses, 5, 4, "ui");
+
+ test_both<P, double>("ir1",
+ 5, 1, 5, 6, 7, 8, // p
+ 7, 5, 3, 3, 2, 5, // q
+ method_crosses, 5, 4, "iu");
+
+
+ // ------------------------------------------------------------------------
+ // TOUCH INTERIOR or touch in the middle ("m")
+ // ------------------------------------------------------------------------
+ test_both<P, double>("ml1",
+ 5, 1, 5, 6, 7, 8, // p
+ 3, 3, 5, 4, 7, 3, // q
+ method_touch_interior, 5, 4, "ui");
+
+ test_both<P, double>("ml2",
+ 5, 1, 5, 6, 7, 8, // p
+ 3, 3, 5, 4, 3, 6, // q
+ method_touch_interior, 5, 4, "iu");
+
+ test_both<P, double>("ml3",
+ 5, 1, 5, 6, 7, 8, // p
+ 3, 6, 5, 4, 3, 3, // q
+ method_touch_interior, 5, 4, "uu");
+
+ test_both<P, double>("mr1",
+ 5, 1, 5, 6, 7, 8, // p
+ 7, 3, 5, 4, 3, 3, // q
+ method_touch_interior, 5, 4, "iu");
+
+ test_both<P, double>("mr2",
+ 5, 1, 5, 6, 7, 8, // p
+ 7, 3, 5, 4, 7, 6, // q
+ method_touch_interior, 5, 4, "ui");
+
+ test_both<P, double>("mr3",
+ 5, 1, 5, 6, 7, 8, // p
+ 7, 6, 5, 4, 7, 3, // q
+ method_touch_interior, 5, 4, "ii");
+
+ test_both<P, double>("mcl",
+ 5, 1, 5, 6, 7, 8, // p
+ 3, 2, 5, 3, 5, 5, // q
+ method_touch_interior, 5, 3, "cc");
+
+ test_both<P, double>("mcr",
+ 5, 1, 5, 6, 7, 8, // p
+ 7, 2, 5, 3, 5, 5, // q
+ method_touch_interior, 5, 3, "cc");
+
+ test_both<P, double>("mclo",
+ 5, 1, 5, 6, 7, 8, // p
+ 3, 4, 5, 5, 5, 3, // q
+ method_touch_interior, 5, 5, "ux");
+
+ test_both<P, double>("mcro",
+ 5, 1, 5, 6, 7, 8, // p
+ 7, 4, 5, 5, 5, 3, // q
+ method_touch_interior, 5, 5, "ix");
+
+ // ------------------------------------------------------------------------
+ // COLLINEAR
+ // ------------------------------------------------------------------------
+ test_both<P, double>("cll1",
+ 5, 1, 5, 6, 3, 8, // p
+ 5, 5, 5, 7, 3, 8, // q
+ method_collinear, 5, 6, "ui");
+ test_both<P, double>("cll2",
+ 5, 1, 5, 6, 3, 8, // p
+ 5, 3, 5, 5, 3, 6, // q
+ method_collinear, 5, 5, "iu");
+ test_both<P, double>("clr1",
+ 5, 1, 5, 6, 3, 8, // p
+ 5, 5, 5, 7, 6, 8, // q
+ method_collinear, 5, 6, "ui");
+ test_both<P, double>("clr2",
+ 5, 1, 5, 6, 3, 8, // p
+ 5, 3, 5, 5, 6, 6, // q
+ method_collinear, 5, 5, "ui");
+
+ test_both<P, double>("crl1",
+ 5, 1, 5, 6, 7, 8, // p
+ 5, 5, 5, 7, 3, 8, // q
+ method_collinear, 5, 6, "iu");
+ test_both<P, double>("crl2",
+ 5, 1, 5, 6, 7, 8, // p
+ 5, 3, 5, 5, 3, 6, // q
+ method_collinear, 5, 5, "iu");
+ test_both<P, double>("crr1",
+ 5, 1, 5, 6, 7, 8, // p
+ 5, 5, 5, 7, 6, 8, // q
+ method_collinear, 5, 6, "iu");
+ test_both<P, double>("crr2",
+ 5, 1, 5, 6, 7, 8, // p
+ 5, 3, 5, 5, 6, 6, // q
+ method_collinear, 5, 5, "ui");
+
+ test_both<P, double>("ccx1",
+ 5, 1, 5, 6, 5, 8, // p
+ 5, 5, 5, 7, 3, 8, // q
+ method_collinear, 5, 6, "cc");
+ test_both<P, double>("cxc1",
+ 5, 1, 5, 6, 7, 8, // p
+ 5, 3, 5, 5, 5, 7, // q
+ method_collinear, 5, 5, "cc");
+
+ // Bug in case #54 of "overlay_cases.hpp"
+ test_both<P, double>("c_bug1",
+ 5, 0, 2, 0, 2, 2, // p
+ 4, 0, 1, 0, 1, 2, // q
+ method_collinear, 2, 0, "iu");
+
+
+ // ------------------------------------------------------------------------
+ // COLLINEAR OPPOSITE
+ // ------------------------------------------------------------------------
+
+ test_both<P, double>("clo1",
+ 5, 2, 5, 6, 3, 8, // p
+ 5, 7, 5, 5, 3, 3, // q
+ method_collinear, 5, 6, "ixxu", 5, 5);
+ test_both<P, double>("clo2",
+ 5, 2, 5, 6, 3, 8, // p
+ 5, 7, 5, 5, 5, 2, // q
+ method_collinear, 5, 6, "ix");
+ // actually "xxix", xx is skipped everywhere
+ test_both<P, double>("clo3",
+ 5, 2, 5, 6, 3, 8, // p
+ 5, 7, 5, 5, 7, 3, // q
+ method_collinear, 5, 6, "ixxi", 5, 5);
+
+ test_both<P, double>("cco1",
+ 5, 2, 5, 6, 5, 8, // p
+ 5, 7, 5, 5, 3, 3, // q
+ method_collinear, 5, 5, "xu"); // "xuxx"
+ test_both<P, double>("cco2",
+ 5, 2, 5, 6, 5, 8, // p
+ 5, 7, 5, 5, 5, 2); // q "xxxx"
+ test_both<P, double>("cco3",
+ 5, 2, 5, 6, 5, 8, // p
+ 5, 7, 5, 5, 7, 3, // q
+ method_collinear, 5, 5, "xi"); // "xixx"
+
+
+ test_both<P, double>("cro1",
+ 5, 2, 5, 6, 7, 8, // p
+ 5, 7, 5, 5, 3, 3, // q
+ method_collinear, 5, 6, "uxxu", 5, 5);
+ test_both<P, double>("cro2",
+ 5, 2, 5, 6, 7, 8, // p
+ 5, 7, 5, 5, 5, 2, // q
+ method_collinear, 5, 6, "ux"); // "xxux"
+ test_both<P, double>("cro3",
+ 5, 2, 5, 6, 7, 8, // p
+ 5, 7, 5, 5, 7, 3, // q
+ method_collinear, 5, 6, "uxxi", 5, 5);
+
+ test_both<P, double>("cxo1",
+ 5, 2, 5, 6, 3, 8, // p
+ 5, 5, 5, 3, 3, 1, // q
+ method_collinear, 5, 3, "xu");
+ test_both<P, double>("cxo2",
+ 5, 2, 5, 6, 3, 8, // p
+ 5, 5, 5, 3, 5, 0); // q "xx"
+ test_both<P, double>("cxo3",
+ 5, 2, 5, 6, 3, 8, // p
+ 5, 5, 5, 3, 7, 1, // q
+ method_collinear, 5, 3, "xi");
+
+ test_both<P, double>("cxo4",
+ 5, 2, 5, 6, 3, 8, // p
+ 5, 7, 5, 1, 3, 0, // q
+ method_collinear, 5, 6, "ix");
+ test_both<P, double>("cxo5",
+ 5, 2, 5, 6, 5, 8, // p
+ 5, 7, 5, 1, 3, 0); // q "xx"
+ test_both<P, double>("cxo6",
+ 5, 2, 5, 6, 7, 8, // p
+ 5, 7, 5, 1, 3, 0, // q
+ method_collinear, 5, 6, "ux");
+
+
+ // Verify
+ test_both<P, double>("cvo1",
+ 5, 3, 5, 7, 7, 9, // p
+ 5, 5, 5, 3, 3, 1 // q
+ );
+ test_both<P, double>("cvo2",
+ 5, 3, 5, 7, 7, 9, // p
+ 5, 4, 5, 2, 3, 0 // q
+ );
+
+
+ // ------------------------------------------------------------------------
+ // TOUCH - both same
+ // ------------------------------------------------------------------------
+ // Both left, Q turns right
+ test_both<P, double>("blr1",
+ 5, 1, 5, 6, 4, 4, // p
+ 3, 7, 5, 6, 3, 5, // q
+ method_touch, 5, 6, "ui");
+ test_both<P, double>("blr2",
+ 5, 1, 5, 6, 1, 4, // p
+ 3, 7, 5, 6, 3, 5, // q
+ method_touch, 5, 6, "cc");
+ test_both<P, double>("blr3",
+ 5, 1, 5, 6, 3, 6, // p
+ 3, 7, 5, 6, 3, 5, // q
+ method_touch, 5, 6, "iu");
+ test_both<P, double>("blr4",
+ 5, 1, 5, 6, 1, 8, // p
+ 3, 7, 5, 6, 3, 5, // q
+ method_touch, 5, 6, "xu");
+ test_both<P, double>("blr5",
+ 5, 1, 5, 6, 4, 8, // p
+ 3, 7, 5, 6, 3, 5, // q
+ method_touch, 5, 6, "uu");
+ test_both<P, double>("blr6",
+ 5, 1, 5, 6, 6, 4, // p
+ 3, 7, 5, 6, 3, 5, // q
+ method_touch, 5, 6, "uu");
+
+ test_both<P, double>("blr7",
+ 5, 1, 5, 6, 3, 6, // p
+ 3, 7, 5, 6, 5, 3, // q
+ method_touch, 5, 6, "ix");
+ test_both<P, double>("blr8",
+ 5, 1, 5, 6, 3, 6, // p
+ 3, 6, 5, 6, 5, 3, // q
+ method_touch, 5, 6, "xx");
+ test_both<P, double>("blr9",
+ 5, 1, 5, 6, 3, 6, // p
+ 3, 5, 5, 6, 5, 3, // q
+ method_touch, 5, 6, "ux");
+
+ // Variants
+ test_both<P, double>("blr7-a",
+ 5, 1, 5, 6, 3, 6, // p
+ 5, 8, 5, 6, 5, 3, // q
+ method_touch, 5, 6, "ix");
+ test_both<P, double>("blr7-b", // in fact NOT "both-left"
+ 5, 1, 5, 6, 3, 6, // p
+ 6, 8, 5, 6, 5, 3, // q
+ method_touch, 5, 6, "ix");
+
+ // To check if "collinear-check" on other side
+ // does not apply to this side
+ test_both<P, double>("blr6-c1",
+ 5, 1, 5, 6, 7, 5, // p
+ 3, 7, 5, 6, 3, 5, // q
+ method_touch, 5, 6, "uu");
+ test_both<P, double>("blr6-c2",
+ 5, 1, 5, 6, 7, 7, // p
+ 3, 7, 5, 6, 3, 5, // q
+ method_touch, 5, 6, "uu");
+
+
+
+ // Both right, Q turns right
+ test_both<P, double>("brr1",
+ 5, 1, 5, 6, 6, 4, // p
+ 7, 5, 5, 6, 7, 7, // q
+ method_touch, 5, 6, "uu");
+ test_both<P, double>("brr2",
+ 5, 1, 5, 6, 9, 4, // p
+ 7, 5, 5, 6, 7, 7, // q
+ method_touch, 5, 6, "xu");
+ test_both<P, double>("brr3",
+ 5, 1, 5, 6, 7, 6, // p
+ 7, 5, 5, 6, 7, 7, // q
+ method_touch, 5, 6, "iu");
+ test_both<P, double>("brr4",
+ 5, 1, 5, 6, 9, 8, // p
+ 7, 5, 5, 6, 7, 7, // q
+ method_touch, 5, 6, "cc");
+ test_both<P, double>("brr5",
+ 5, 1, 5, 6, 6, 8, // p
+ 7, 5, 5, 6, 7, 7, // q
+ method_touch, 5, 6, "ui");
+ test_both<P, double>("brr6",
+ 5, 1, 5, 6, 4, 4, // p
+ 7, 5, 5, 6, 7, 7, // q
+ method_touch, 5, 6, "ui");
+
+ // Both right, Q turns left
+ test_both<P, double>("brl1",
+ 5, 1, 5, 6, 6, 4, // p
+ 7, 7, 5, 6, 7, 5, // q
+ method_touch, 5, 6, "iu");
+ test_both<P, double>("brl2",
+ 5, 1, 5, 6, 9, 4, // p
+ 7, 7, 5, 6, 7, 5, // q
+ method_touch, 5, 6, "cc");
+ test_both<P, double>("brl3",
+ 5, 1, 5, 6, 7, 6, // p
+ 7, 7, 5, 6, 7, 5, // q
+ method_touch, 5, 6, "ui");
+ test_both<P, double>("brl4",
+ 5, 1, 5, 6, 9, 8, // p
+ 7, 7, 5, 6, 7, 5, // q
+ method_touch, 5, 6, "xi");
+ test_both<P, double>("brl5",
+ 5, 1, 5, 6, 6, 8, // p
+ 7, 7, 5, 6, 7, 5, // q
+ method_touch, 5, 6, "ii");
+ test_both<P, double>("brl6",
+ 5, 1, 5, 6, 4, 4, // p
+ 7, 7, 5, 6, 7, 5, // q
+ method_touch, 5, 6, "ii");
+ test_both<P, double>("brl7",
+ 5, 1, 5, 6, 7, 6, // p
+ 7, 7, 5, 6, 5, 3, // q
+ method_touch, 5, 6, "ux");
+ test_both<P, double>("brl8",
+ 5, 1, 5, 6, 7, 6, // p
+ 7, 6, 5, 6, 5, 3, // q
+ method_touch, 5, 6, "xx");
+ test_both<P, double>("brl9",
+ 5, 1, 5, 6, 7, 6, // p
+ 7, 5, 5, 6, 5, 3, // q
+ method_touch, 5, 6, "ix");
+
+ // Variants
+ test_both<P, double>("brl7-a",
+ 5, 1, 5, 6, 7, 6, // p
+ 5, 8, 5, 6, 5, 3, // q
+ method_touch, 5, 6, "ux");
+ test_both<P, double>("brl7-b", // in fact NOT "both right"
+ 5, 1, 5, 6, 7, 6, // p
+ 4, 8, 5, 6, 5, 3, // q
+ method_touch, 5, 6, "ux");
+
+
+
+ // Both left, Q turns left
+ test_both<P, double>("bll1",
+ 5, 1, 5, 6, 4, 4, // p
+ 3, 5, 5, 6, 3, 7, // q
+ method_touch, 5, 6, "ii");
+ test_both<P, double>("bll2",
+ 5, 1, 5, 6, 1, 4, // p
+ 3, 5, 5, 6, 3, 7, // q
+ method_touch, 5, 6, "xi");
+ test_both<P, double>("bll3",
+ 5, 1, 5, 6, 3, 6, // p
+ 3, 5, 5, 6, 3, 7, // q
+ method_touch, 5, 6, "ui");
+ test_both<P, double>("bll4",
+ 5, 1, 5, 6, 1, 8, // p
+ 3, 5, 5, 6, 3, 7, // q
+ method_touch, 5, 6, "cc");
+ test_both<P, double>("bll5",
+ 5, 1, 5, 6, 4, 8, // p
+ 3, 5, 5, 6, 3, 7, // q
+ method_touch, 5, 6, "iu");
+ test_both<P, double>("bll6",
+ 5, 1, 5, 6, 6, 4, // p
+ 3, 5, 5, 6, 3, 7, // q
+ method_touch, 5, 6, "iu");
+
+ // TOUCH - COLLINEAR + one side
+ // Collinear/left, Q turns right
+ test_both<P, double>("t-clr1",
+ 5, 1, 5, 6, 4, 4, // p
+ 5, 8, 5, 6, 3, 5, // q
+ method_touch, 5, 6, "ui");
+ test_both<P, double>("t-clr2",
+ 5, 1, 5, 6, 1, 4, // p
+ 5, 8, 5, 6, 3, 5, // q
+ method_touch, 5, 6, "cc");
+ test_both<P, double>("t-clr3",
+ 5, 1, 5, 6, 3, 6, // p
+ 5, 8, 5, 6, 3, 5, // q
+ method_touch, 5, 6, "iu");
+ test_both<P, double>("t-clr4",
+ 5, 1, 5, 6, 5, 8, // p
+ 5, 8, 5, 6, 3, 5, // q
+ method_touch, 5, 6, "xu");
+ // 5 n.a.
+ test_both<P, double>("t-clr6",
+ 5, 1, 5, 6, 6, 4, // p
+ 5, 8, 5, 6, 3, 5, // q
+ method_touch, 5, 6, "uu");
+
+ // Collinear/right, Q turns right
+ test_both<P, double>("t-crr1",
+ 5, 1, 5, 6, 6, 4, // p
+ 7, 5, 5, 6, 5, 8, // q
+ method_touch, 5, 6, "uu");
+ test_both<P, double>("t-crr2",
+ 5, 1, 5, 6, 9, 4, // p
+ 7, 5, 5, 6, 5, 8, // q
+ method_touch, 5, 6, "xu");
+ test_both<P, double>("t-crr3",
+ 5, 1, 5, 6, 7, 6, // p
+ 7, 5, 5, 6, 5, 8, // q
+ method_touch, 5, 6, "iu");
+ test_both<P, double>("t-crr4",
+ 5, 1, 5, 6, 5, 9, // p
+ 7, 5, 5, 6, 5, 8, // q
+ method_touch, 5, 6, "cc");
+ // 5 n.a.
+ test_both<P, double>("t-crr6",
+ 5, 1, 5, 6, 4, 4, // p
+ 7, 5, 5, 6, 5, 8, // q
+ method_touch, 5, 6, "ui");
+
+ // Collinear/right, Q turns left
+ test_both<P, double>("t-crl1",
+ 5, 1, 5, 6, 6, 4, // p
+ 5, 7, 5, 6, 7, 5, // q
+ method_touch, 5, 6, "iu");
+ test_both<P, double>("t-crl2",
+ 5, 1, 5, 6, 9, 4, // p
+ 5, 7, 5, 6, 7, 5, // q
+ method_touch, 5, 6, "cc");
+ test_both<P, double>("t-crl3",
+ 5, 1, 5, 6, 7, 6, // p
+ 5, 7, 5, 6, 7, 5, // q
+ method_touch, 5, 6, "ui");
+ test_both<P, double>("t-crl4",
+ 5, 1, 5, 6, 5, 8, // p
+ 5, 7, 5, 6, 7, 5, // q
+ method_touch, 5, 6, "xi");
+ // 5 n.a.
+ test_both<P, double>("t-crl6",
+ 5, 1, 5, 6, 4, 4, // p
+ 5, 7, 5, 6, 7, 5, // q
+ method_touch, 5, 6, "ii");
+
+ // Collinear/left, Q turns left
+ test_both<P, double>("t-cll1",
+ 5, 1, 5, 6, 4, 4, // p
+ 3, 5, 5, 6, 5, 8, // q
+ method_touch, 5, 6, "ii");
+ test_both<P, double>("t-cll2",
+ 5, 1, 5, 6, 1, 4, // p
+ 3, 5, 5, 6, 5, 8, // q
+ method_touch, 5, 6, "xi");
+ test_both<P, double>("t-cll3",
+ 5, 1, 5, 6, 3, 6, // p
+ 3, 5, 5, 6, 5, 8, // q
+ method_touch, 5, 6, "ui");
+ test_both<P, double>("t-cll4",
+ 5, 1, 5, 6, 5, 9, // p
+ 3, 5, 5, 6, 5, 8, // q
+ method_touch, 5, 6, "cc");
+ // 5 n.a.
+ test_both<P, double>("t-cll6",
+ 5, 1, 5, 6, 6, 4, // p
+ 3, 5, 5, 6, 5, 8, // q
+ method_touch, 5, 6, "iu");
+
+ // Left to right
+ test_both<P, double>("lr1",
+ 5, 1, 5, 6, 3, 3, // p
+ 1, 5, 5, 6, 9, 5, // q
+ method_touch, 5, 6, "ii");
+ test_both<P, double>("lr2",
+ 5, 1, 5, 6, 1, 5, // p
+ 1, 5, 5, 6, 9, 5, // q
+ method_touch, 5, 6, "xi");
+ test_both<P, double>("lr3",
+ 5, 1, 5, 6, 4, 8, // p
+ 1, 5, 5, 6, 9, 5, // q
+ method_touch, 5, 6, "ui");
+ test_both<P, double>("lr4",
+ 5, 1, 5, 6, 9, 5, // p
+ 1, 5, 5, 6, 9, 5, // q
+ method_touch, 5, 6, "cc");
+ test_both<P, double>("lr5",
+ 5, 1, 5, 6, 7, 3, // p
+ 1, 5, 5, 6, 9, 5, // q
+ method_touch, 5, 6, "iu");
+ // otherwise case more thoroughly
+ test_both<P, double>("lr3a",
+ 5, 1, 5, 6, 1, 6, // p
+ 1, 5, 5, 6, 9, 5, // q
+ method_touch, 5, 6, "ui");
+ test_both<P, double>("lr3b",
+ 5, 1, 5, 6, 5, 10, // p
+ 1, 5, 5, 6, 9, 5, // q
+ method_touch, 5, 6, "ui");
+ test_both<P, double>("lr3c",
+ 5, 1, 5, 6, 8, 9, // p
+ 1, 5, 5, 6, 9, 5, // q
+ method_touch, 5, 6, "ui");
+ test_both<P, double>("lr3d",
+ 5, 1, 5, 6, 9, 7, // p
+ 1, 5, 5, 6, 9, 5, // q
+ method_touch, 5, 6, "ui");
+ test_both<P, double>("lr3e",
+ 5, 1, 5, 6, 9, 6, // p
+ 1, 5, 5, 6, 9, 5, // q
+ method_touch, 5, 6, "ui");
+
+ // Right to left
+ test_both<P, double>("rl1",
+ 5, 1, 5, 6, 3, 3, // p
+ 9, 5, 5, 6, 1, 5, // q
+ method_touch, 5, 6, "ui");
+ test_both<P, double>("rl2",
+ 5, 1, 5, 6, 1, 5, // p
+ 9, 5, 5, 6, 1, 5, // q
+ method_touch, 5, 6, "cc");
+ test_both<P, double>("rl3",
+ 5, 1, 5, 6, 4, 8, // p
+ 9, 5, 5, 6, 1, 5, // q
+ method_touch, 5, 6, "iu");
+ test_both<P, double>("rl4",
+ 5, 1, 5, 6, 9, 5, // p
+ 9, 5, 5, 6, 1, 5, // q
+ method_touch, 5, 6, "xu");
+ test_both<P, double>("rl5",
+ 5, 1, 5, 6, 7, 3, // p
+ 9, 5, 5, 6, 1, 5, // q
+ method_touch, 5, 6, "uu");
+
+ // Equal (p1/q1 are equal)
+ test_both<P, double>("ebl1",
+ 5, 1, 5, 6, 3, 4, // p
+ 5, 1, 5, 6, 3, 8, // q
+ method_equal, 5, 6, "ui");
+ test_both<P, double>("ebl2",
+ 5, 1, 5, 6, 3, 8, // p
+ 5, 1, 5, 6, 3, 4, // q
+ method_equal, 5, 6, "iu");
+ test_both<P, double>("ebl3",
+ 5, 1, 5, 6, 3, 8, // p
+ 5, 1, 5, 6, 3, 8, // q
+ method_equal, 5, 6, "cc");
+
+ test_both<P, double>("ebl3-c1",
+ 5, 1, 5, 6, 10, 1, // p
+ 5, 1, 5, 6, 3, 8, // q
+ method_equal, 5, 6, "iu");
+
+ test_both<P, double>("ebr1",
+ 5, 1, 5, 6, 7, 4, // p
+ 5, 1, 5, 6, 7, 8, // q
+ method_equal, 5, 6, "iu");
+ test_both<P, double>("ebr2",
+ 5, 1, 5, 6, 7, 8, // p
+ 5, 1, 5, 6, 7, 4, // q
+ method_equal, 5, 6, "ui");
+ test_both<P, double>("ebr3",
+ 5, 1, 5, 6, 7, 8, // p
+ 5, 1, 5, 6, 7, 8, // q
+ method_equal, 5, 6, "cc");
+
+ test_both<P, double>("ebr3-c1",
+ 5, 1, 5, 6, 0, 1, // p
+ 5, 1, 5, 6, 7, 8, // q
+ method_equal, 5, 6, "ui");
+
+ test_both<P, double>("elr1",
+ 5, 1, 5, 6, 7, 8, // p
+ 5, 1, 5, 6, 3, 8, // q
+ method_equal, 5, 6, "iu");
+ test_both<P, double>("elr2",
+ 5, 1, 5, 6, 3, 8, // p
+ 5, 1, 5, 6, 7, 8, // q
+ method_equal, 5, 6, "ui");
+ test_both<P, double>("ec1",
+ 5, 1, 5, 6, 5, 8, // p
+ 5, 1, 5, 6, 5, 8, // q
+ method_equal, 5, 6, "cc");
+ test_both<P, double>("ec2",
+ 5, 1, 5, 6, 5, 8, // p
+ 5, 1, 5, 6, 5, 7, // q
+ method_equal, 5, 6, "cc");
+
+ test_both<P, double>("snl-1",
+ 0, 3, 2, 3, 4, 3, // p
+ 4, 3, 2, 3, 0, 3, // q
+ method_touch, 2, 3, "xx");
+
+ // BSG 2012-05-26 to be decided what's the problem here and what it tests...
+ // Anyway, test results are not filled out.
+ //test_both<P, double>("issue_buffer_mill",
+ // 5.1983614873206241 , 6.7259025813913107 , 5.0499999999999998 , 6.4291796067500622 , 5.1983614873206241 , 6.7259025813913107, // p
+ // 5.0499999999999998 , 6.4291796067500622 , 5.0499999999999998 , 6.4291796067500622 , 5.1983614873206241 , 6.7259025813913107, // q
+ // method_collinear, 2, 0, "tt");
+
+}
+
+
+/***
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+
+template <typename G>
+void test2(G const& geometry)
+{
+ typedef typename bg::point_type<G>::type P;
+ typedef typename bg::tag<G>::type T;
+ typedef typename bg::tag<P>::type PT;
+ std::cout << typeid(G).name() << std::endl;
+ std::cout << typeid(T).name() << std::endl;
+ std::cout << typeid(P).name() << std::endl;
+ std::cout << typeid(PT).name() << std::endl;
+
+
+ std::cout << bg::length(geometry) << std::endl;
+
+ typedef bg::model::point<float, 3, bg::cs::cartesian> P2;
+ bg::model::linestring<P2> out;
+ bg::strategy::transform::scale_transformer<float[3], P2> scaler(5);
+ bg::transform(geometry, out, scaler);
+ std::cout << bg::dsv(out) << std::endl;
+}
+
+void test_f3()
+{
+ float vertices[][3] = {
+ {-1, -1, 1}, {1, -1, 1}, {1, 1, 1}, {-1, 1, 1},
+ {-1, -1, -1}, {1, -1, -1}, {1, 1, -1}, {-1, 1, -1}
+ };
+ test2(vertices);
+}
+***/
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<double> >();
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/overlay/get_turn_info.vcproj b/libs/geometry/test/algorithms/overlay/get_turn_info.vcproj
new file mode 100644
index 000000000..22bf1d1bd
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/get_turn_info.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="get_turn_info"
+ ProjectGUID="{8D98821A-5033-4616-9AF4-2AEAA42D8456}"
+ RootNamespace="get_turn_info"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\get_turn_info"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\get_turn_info"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\get_turn_info.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/get_turn_info.xls b/libs/geometry/test/algorithms/overlay/get_turn_info.xls
new file mode 100644
index 000000000..facd118e4
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/get_turn_info.xls
Binary files differ
diff --git a/libs/geometry/test/algorithms/overlay/get_turns.cpp b/libs/geometry/test/algorithms/overlay/get_turns.cpp
new file mode 100644
index 000000000..ccada3485
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/get_turns.cpp
@@ -0,0 +1,385 @@
+// 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.
+
+// 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 <iostream>
+#include <iomanip>
+
+#include <geometry_test_common.hpp>
+
+#define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
+
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/algorithms/correct.hpp>
+#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
+
+#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/io/wkt/write.hpp>
+
+#if defined(TEST_WITH_SVG)
+# include <boost/geometry/io/svg/svg_mapper.hpp>
+#endif
+
+#include <algorithms/overlay/overlay_cases.hpp>
+
+
+
+
+// To test that "get_turns" can be called using additional information
+template <typename P>
+struct my_turn_op : public bg::detail::overlay::turn_operation
+{
+};
+
+namespace detail
+{
+
+struct test_get_turns
+{
+ template<typename G1, typename G2>
+ static void apply(std::string const& id,
+ std::size_t expected_count,
+ G1 const& g1, G2 const& g2, double precision)
+ {
+ typedef bg::detail::overlay::turn_info
+ <
+ typename bg::point_type<G2>::type
+ > turn_info;
+ std::vector<turn_info> turns;
+
+ bg::detail::get_turns::no_interrupt_policy policy;
+ bg::get_turns<false, false, bg::detail::overlay::assign_null_policy>(g1, g2, turns, policy);
+
+ BOOST_CHECK_MESSAGE(
+ expected_count == boost::size(turns),
+ "get_turns: " << id
+ << " #turns expected: " << expected_count
+ << " detected: " << boost::size(turns)
+ << " type: " << string_from_type
+ <typename bg::coordinate_type<G1>::type>::name()
+ );
+
+#if defined(TEST_WITH_SVG)
+ {
+ typedef typename bg::coordinate_type<G1>::type coordinate_type;
+ std::map<std::pair<coordinate_type, coordinate_type>, int> offsets;
+ std::ostringstream filename;
+ filename << "get_turns_" << id
+ << "_" << string_from_type<typename bg::coordinate_type<G1>::type>::name()
+ << ".svg";
+
+ std::ofstream svg(filename.str().c_str());
+
+ bg::svg_mapper<typename bg::point_type<G2>::type> mapper(svg, 500, 500);
+ mapper.add(g1);
+ mapper.add(g2);
+
+ // Input shapes in green/blue
+ mapper.map(g1, "fill-opacity:0.5;fill:rgb(153,204,0);"
+ "stroke:rgb(153,204,0);stroke-width:3");
+ mapper.map(g2, "fill-opacity:0.3;fill:rgb(51,51,153);"
+ "stroke:rgb(51,51,153);stroke-width:3");
+
+ int index = 0;
+ BOOST_FOREACH(turn_info const& turn, turns)
+ {
+ mapper.map(turn.point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1");
+
+ // Map characteristics
+ std::pair<coordinate_type, coordinate_type> p
+ = std::make_pair(bg::get<0>(turn.point), bg::get<1>(turn.point));
+
+ {
+ std::ostringstream out;
+ out << index
+ << ": " << 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)" : "")
+ ;
+
+ offsets[p] += 10;
+ int offset = offsets[p];
+ mapper.text(turn.point, out.str(),
+ "fill:rgb(0,0,0);font-family:Arial;font-size:8px",
+ 5, offset);
+ }
+
+ ++index;
+ }
+ }
+#endif
+ }
+};
+
+}
+
+template<typename G1, typename G2>
+struct test_get_turns
+{
+ inline static void apply(std::string const& id, std::size_t expected_count,
+ std::string const& wkt1, std::string const& wkt2,
+ double precision = 0.001)
+ {
+ if (wkt1.empty() || wkt2.empty())
+ {
+ return;
+ }
+
+ G1 g1;
+ bg::read_wkt(wkt1, g1);
+
+ G2 g2;
+ bg::read_wkt(wkt2, g2);
+
+ bg::correct(g1);
+ bg::correct(g2);
+
+ // Try the overlay-function in both ways
+ std::string caseid = id;
+ //goto case_reversed;
+
+#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
+ std::cout << std::endl << std::endl << "# " << caseid << std::endl;
+#endif
+ detail::test_get_turns::apply(caseid, expected_count, g1, g2, precision);
+
+#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
+ return;
+#endif
+
+ //case_reversed:
+#if ! defined(BOOST_GEOMETRY_TEST_OVERLAY_NOT_EXCHANGED)
+ caseid = id + "_rev";
+#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
+ std::cout << std::endl << std::endl << "# " << caseid << std::endl;
+#endif
+
+ detail::test_get_turns::apply(caseid, expected_count, g2, g1, precision);
+#endif
+ }
+};
+
+#if ! defined(GEOMETRY_TEST_MULTI)
+template <typename T>
+void test_all()
+{
+ typedef bg::model::point<T, 2, bg::cs::cartesian> P;
+ typedef bg::model::polygon<P> polygon;
+ typedef bg::model::linestring<P> linestring;
+ typedef bg::model::box<P> box;
+
+ // Expected count, average x, average y
+ typedef boost::tuple<int> Tuple;
+
+#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
+ std::cout << string_from_type<T>::name() << std::endl;
+#endif
+
+
+ // snl
+ /*
+ test_get_turns<polygon, polygon>::apply("snl_2",
+ 5,
+ //snl-1
+ //"POLYGON((182467 605842,182480 605954,182557 605958,182571 605958,182585 605958,182579 605843,182559 605838,182467 605842))",
+ //"POLYGON((182499 605955,182511 605960,182536 605974,182536 605981,182536 606006,182563 606006,182610 605985,182613 605976,182620 605948,182628 605937,182631 605924,182639 605889,182634 605885,182603 605848,182579 605843,182585 605958,182571 605958,182557 605958,182499 605955))");
+ //snl-2
+ //"POLYGON((120812 525783,120845 525792,120821 525842,120789 525826,120818 525849,120831 525854,120875 525875,120887 525881,120887 525881,120920 525834,120920 525834,120811 525772,120789 525826,120812 525783))",
+ //"POLYGON((120789 525826,120812 525783,120845 525792,120821 525842,120789 525826,120818 525849,120831 525854,120875 525875,120923 525836,120811 525772,120789 525826))"
+ //snl-4
+ "POLYGON((184913.4512400339881423860788345336914 606985.779408219968900084495544433594,184912.8999999999941792339086532592773 606987.145999999949708580970764160156,184904.4135310589917935431003570556641 606987.651360383024439215660095214844,184901.847619076987029984593391418457 607014.593436188995838165283203125,184916.3977574919990729540586471557617 607021.060164373018778860569000244141,184927.7147701499925460666418075561523 607008.126435620011761784553527832031,184926.0980706939881201833486557006836 606998.426238880958408117294311523438,184913.4512400339881423860788345336914 606985.779408219968900084495544433594),(184907.5560000000114087015390396118164 607013.300999999977648258209228515625,184905.7820000000065192580223083496094 607009.971999999950639903545379638672,184906.0039999999862629920244216918945 607005.978000000002793967723846435547,184908.4439999999885912984609603881836 606998.876999999978579580783843994141,184912.2149999999965075403451919555664 606994.217999999993480741977691650391,184919.3140000000130385160446166992188 606993.996000000042840838432312011719,184922.4200000000128056854009628295898 606995.770999999949708580970764160156,184925.7470000000030267983675003051758 606998.876999999978579580783843994141,184926.4130000000004656612873077392578 607002.871999999973922967910766601563,184925.7470000000030267983675003051758 607007.753000000026077032089233398438,184922.4200000000128056854009628295898 607012.190999999991618096828460693359,184917.0959999999904539436101913452148 607015.297999999951571226119995117188,184911.7710000000079162418842315673828 607015.297999999951571226119995117188,184907.5560000000114087015390396118164 607013.300999999977648258209228515625))",
+ "POLYGON((184861.1180000010062940418720245361328 606901.158000000054016709327697753906,184893.7870000000111758708953857421875 606898.482999998959712684154510498047,184925.0430000009946525096893310546875 606913.399999998975545167922973632813,184927.1739999990095384418964385986328 606951.758999999961815774440765380859,184912.8999999990046489983797073364258 606987.146000002045184373855590820313,184877.8700000010139774531126022338867 606989.232000001007691025733947753906,184885.1030000000027939677238464355469 607023.773999999975785613059997558594,184899.0579999980109278112649917602539 607022.743000000948086380958557128906,184906.0080000009911600500345230102539 607044.947999999043531715869903564453,184966.4649999999965075403451919555664 607025.020000000018626451492309570313,184968.4420000019890721887350082397461 606961.300000000977888703346252441406,185024.7679999989923089742660522460938 606947.401999998954124748706817626953,185024.5439999999944120645523071289063 606941.354999999981373548507690429688,185027.0069999989937059581279754638672 606937.322999999043531715869903564453,185030.3660000000090803951025009155273 606934.186999998986721038818359375,185035.5159999990137293934822082519531 606933.962999999988824129104614257813,185040.4420000019890721887350082397461 606935.530999999027699232101440429688,185042.905000000988366082310676574707 606939.114999998011626303195953369141,185088.3640000000013969838619232177734 606931.385000001988373696804046630859,185089.1389999990060459822416305541992 607015.508999999961815774440765380859,185095.1999999989930074661970138549805 607011.300000000977888703346252441406,185118.8269999999902211129665374755859 606995.545000002020969986915588378906,185126.813000001013278961181640625 606991.9950000010430812835693359375,185177.7270000019925646483898162841797 606973.798999998951330780982971191406,185181.4820000010076910257339477539063 606966.67599999904632568359375,185193.5709999990067444741725921630859 606977.795000002020969986915588378906,185193.710999998991610482335090637207 606960.300000000977888703346252441406,185189.3520000019925646483898162841797 606779.020000000018626451492309570313,185167.5150000010035000741481781005859 606783.844000000972300767898559570313,185086.9600000010104849934577941894531 606801.241000000038184225559234619141,185011.7069999990053474903106689453125 606817.809000000008381903171539306641,185000 606819.304000001051463186740875244141,184994.0340000019932631403207778930664 606819.793999999994412064552307128906,184976.3979999980074353516101837158203 606819.572000000975094735622406005859,184956.6539999989909119904041290283203 606817.1310000009834766387939453125,184934.9129999990109354257583618164063 606813.136999998008832335472106933594,184893.0969999989902134984731674194336 606804.927000000956468284130096435547,184884.4450000000069849193096160888672 606831.555000000051222741603851318359,184866.9189999999944120645523071289063 606883.480999998981133103370666503906,184861.1180000010062940418720245361328 606901.158000000054016709327697753906),(184907.5560000019904691725969314575195 607013.30099999904632568359375,184905.7820000019855797290802001953125 607009.971999999019317328929901123047,184906.0040000010048970580101013183594 607005.978000000002793967723846435547,184908.4439999980095308274030685424805 606998.876999999978579580783843994141,184912.2149999999965075403451919555664 606994.217999998014420270919799804688,184919.3139999989944044500589370727539 606993.995999998995102941989898681641,184922.420000001991866156458854675293 606995.771000002045184373855590820313,184925.7470000009925570338964462280273 606998.876999999978579580783843994141,184926.4129999990109354257583618164063 607002.872000001021660864353179931641,184925.7470000009925570338964462280273 607007.752999998978339135646820068359,184922.420000001991866156458854675293 607012.190999999991618096828460693359,184917.0960000010090880095958709716797 607015.297999999951571226119995117188,184911.7710000019869767129421234130859 607015.297999999951571226119995117188,184907.5560000019904691725969314575195 607013.30099999904632568359375))"
+ );
+
+
+ return;
+ */
+
+ // 1-6
+ test_get_turns<polygon, polygon>::apply("1", 6, case_1[0], case_1[1]);
+ test_get_turns<polygon, polygon>::apply("2", 8, case_2[0], case_2[1]);
+ test_get_turns<polygon, polygon>::apply("3", 4, case_3[0], case_3[1]);
+ test_get_turns<polygon, polygon>::apply("4", 12, case_4[0], case_4[1]);
+ test_get_turns<polygon, polygon>::apply("5", 17, case_5[0], case_5[1]);
+ test_get_turns<polygon, polygon>::apply("6", 3, case_6[0], case_6[1]);
+
+ // 7-12
+ test_get_turns<polygon, polygon>::apply("7", 2, case_7[0], case_7[1]);
+ test_get_turns<polygon, polygon>::apply("8", 2, case_8[0], case_8[1]);
+ test_get_turns<polygon, polygon>::apply("9", 1, case_9[0], case_9[1]);
+ test_get_turns<polygon, polygon>::apply("10", 3, case_10[0], case_10[1]);
+ test_get_turns<polygon, polygon>::apply("11", 1, case_11[0], case_11[1]);
+ test_get_turns<polygon, polygon>::apply("12", 8, case_12[0], case_12[1]);
+
+ // 13-18
+ test_get_turns<polygon, polygon>::apply("13", 2, case_13[0], case_13[1]);
+ test_get_turns<polygon, polygon>::apply("14", 2, case_14[0], case_14[1]);
+ test_get_turns<polygon, polygon>::apply("15", 2, case_15[0], case_15[1]);
+ test_get_turns<polygon, polygon>::apply("16", 4, case_16[0], case_16[1]);
+ test_get_turns<polygon, polygon>::apply("17", 2, case_17[0], case_17[1]);
+ test_get_turns<polygon, polygon>::apply("18", 4, case_18[0], case_18[1]);
+
+ // 19-24
+ test_get_turns<polygon, polygon>::apply("19", 2, case_19[0], case_19[1]);
+ test_get_turns<polygon, polygon>::apply("20", 3, case_20[0], case_20[1]);
+ test_get_turns<polygon, polygon>::apply("21", 3, case_21[0], case_21[1]);
+ test_get_turns<polygon, polygon>::apply("22", 1, case_22[0], case_22[1]);
+ test_get_turns<polygon, polygon>::apply("23", 2, case_23[0], case_23[1]);
+ test_get_turns<polygon, polygon>::apply("24", 1, case_24[0], case_24[1]);
+
+ // 25-30
+ test_get_turns<polygon, polygon>::apply("25", 1, case_25[0], case_25[1]);
+ test_get_turns<polygon, polygon>::apply("26", 1, case_26[0], case_26[1]);
+ test_get_turns<polygon, polygon>::apply("27", 2, case_27[0], case_27[1]);
+ test_get_turns<polygon, polygon>::apply("28", 2, case_28[0], case_28[1]);
+ test_get_turns<polygon, polygon>::apply("29", 2, case_29[0], case_29[1]);
+ test_get_turns<polygon, polygon>::apply("30", 2, case_30[0], case_30[1]);
+
+ // 31-36
+ test_get_turns<polygon, polygon>::apply("31", 1, case_31[0], case_31[1]);
+ test_get_turns<polygon, polygon>::apply("32", 1, case_32[0], case_32[1]);
+ test_get_turns<polygon, polygon>::apply("33", 1, case_33[0], case_33[1]);
+ test_get_turns<polygon, polygon>::apply("34", 2, case_34[0], case_34[1]);
+ test_get_turns<polygon, polygon>::apply("35", 1, case_35[0], case_35[1]);
+ test_get_turns<polygon, polygon>::apply("36", 3, case_36[0], case_36[1]);
+
+ // 37-42
+ test_get_turns<polygon, polygon>::apply("37", 3, case_37[0], case_37[1]);
+ test_get_turns<polygon, polygon>::apply("38", 3, case_38[0], case_38[1]);
+ test_get_turns<polygon, polygon>::apply("39", 4, case_39[0], case_39[1]);
+ test_get_turns<polygon, polygon>::apply("40", 3, case_40[0], case_40[1]);
+ test_get_turns<polygon, polygon>::apply("41", 5, case_41[0], case_41[1]);
+ test_get_turns<polygon, polygon>::apply("42", 5, case_42[0], case_42[1]);
+
+ // 43-48
+ test_get_turns<polygon, polygon>::apply("43", 4, case_43[0], case_43[1]);
+ test_get_turns<polygon, polygon>::apply("44", 4, case_44[0], case_44[1]);
+ test_get_turns<polygon, polygon>::apply("45", 4, case_45[0], case_45[1]);
+ test_get_turns<polygon, polygon>::apply("46", 4, case_46[0], case_46[1]);
+ test_get_turns<polygon, polygon>::apply("47", 5, case_47[0], case_47[1]);
+
+ // 49-54
+ test_get_turns<polygon, polygon>::apply("50", 4, case_50[0], case_50[1]);
+ test_get_turns<polygon, polygon>::apply("51", 3, case_51[0], case_51[1]);
+ test_get_turns<polygon, polygon>::apply("52", 8, case_52[0], case_52[1]);
+ // A touching point interior/ring exterior/ring can be represented in two ways:
+ test_get_turns<polygon, polygon>::apply("53a", 4, case_53[0], case_53[1]);
+ test_get_turns<polygon, polygon>::apply("53b", 4, case_53[0], case_53[2]);
+ test_get_turns<polygon, polygon>::apply("54aa", 13, case_54[0], case_54[2]);
+ test_get_turns<polygon, polygon>::apply("54ab", 13, case_54[0], case_54[3]);
+ test_get_turns<polygon, polygon>::apply("54ba", 13, case_54[1], case_54[2]);
+ test_get_turns<polygon, polygon>::apply("54bb", 13, case_54[1], case_54[3]);
+
+ test_get_turns<polygon, polygon>::apply("55", 12, case_55[0], case_55[1]);
+ test_get_turns<polygon, polygon>::apply("56", 9, case_56[0], case_56[1]);
+
+
+ // other
+ test_get_turns<polygon, polygon>::apply("many_situations", 31, case_many_situations[0], case_many_situations[1]);
+
+
+ // ticket#17
+ test_get_turns<polygon, box>::apply("ticket_17", 6, ticket_17[0], ticket_17[1]);
+
+ // GGL-mailing list
+ test_get_turns<polygon, polygon>::apply("ggl_list_20110306_javier",
+ 4,
+ ggl_list_20110306_javier[0], ggl_list_20110306_javier[1]);
+
+#ifdef _MSC_VER // gcc returns 14 for float
+ // test_get_turns<polygon, polygon>::apply("ggl_list_20110716_enrico",
+ // 13,
+ // ggl_list_20110716_enrico[0], ggl_list_20110716_enrico[1]);
+
+#endif
+
+ // pies
+ test_get_turns<polygon, polygon>::apply("pie_23_16_16", 3, pie_23_16_16[0], pie_23_16_16[1]);
+ test_get_turns<polygon, polygon>::apply("pie_16_4_12", 2, pie_16_4_12[0], pie_16_4_12[1]);
+ test_get_turns<polygon, polygon>::apply("pie_4_13_15", 3, pie_4_13_15[0], pie_4_13_15[1]);
+ test_get_turns<polygon, polygon>::apply("pie_16_2_15_0", 2, pie_16_2_15_0[0], pie_16_2_15_0[1]);
+ test_get_turns<polygon, polygon>::apply("pie_20_20_7_100", 3, pie_20_20_7_100[0], pie_20_20_7_100[1]);
+ test_get_turns<polygon, polygon>::apply("pie_23_23_3_2000", 5, pie_23_23_3_2000[0], pie_23_23_3_2000[1]);
+
+
+ // line-line
+ test_get_turns<linestring, linestring>::apply("lineline1", 3, line_line1[0], line_line1[1]);
+
+ // line-polygon
+ test_get_turns<linestring, polygon>::apply("line_poly1", 4, line_line1[0], case_1[1]);
+ test_get_turns<linestring, polygon>::apply("line_poly2", 4, line_line1[1], case_1[0]);
+ test_get_turns<polygon, linestring>::apply("poly_line", 4, case_1[1], line_line1[0]);
+}
+
+
+template <typename T>
+void test_ccw()
+{
+ typedef bg::model::point<T, 2, bg::cs::cartesian> P;
+ typedef bg::model::polygon<P, false, true> polygon;
+ typedef boost::tuple<int> Tuple;
+
+
+ test_get_turns<polygon, polygon>::apply("ccw_1",
+ 6,
+ ccw_case_1[0], ccw_case_1[1]);
+
+ test_get_turns<polygon, polygon>::apply("ccw_9",
+ 1,
+ case_9[0], case_9[1]);
+
+}
+
+template <typename T>
+void test_open()
+{
+ typedef bg::model::point<T, 2, bg::cs::cartesian> P;
+ typedef bg::model::polygon<P, true, false> polygon;
+ typedef boost::tuple<int> Tuple;
+
+ test_get_turns<polygon, polygon>::apply("open_1",
+ 6,
+ open_case_1[0], open_case_1[1]);
+
+ test_get_turns<polygon, polygon>::apply("open_9",
+ 1,
+ open_case_9[0], open_case_9[1]);
+}
+
+
+
+int test_main(int, char* [])
+{
+ test_all<float>();
+ test_all<double>();
+ test_ccw<double>();
+ test_open<double>();
+
+#if ! defined(_MSC_VER)
+ test_all<long double>();
+#endif
+
+#if defined(HAVE_TTMATH)
+ test_all<ttmath_big>();
+#endif
+ return 0;
+}
+
+#endif
diff --git a/libs/geometry/test/algorithms/overlay/get_turns.vcproj b/libs/geometry/test/algorithms/overlay/get_turns.vcproj
new file mode 100644
index 000000000..8f1b41c0b
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/get_turns.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="get_turns"
+ ProjectGUID="{B63116BF-0F0C-4374-A6CE-77061FBC34FF}"
+ RootNamespace="get_turns"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\get_turns"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\get_turns"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\get_turns.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/merge_intersection_points.vcproj b/libs/geometry/test/algorithms/overlay/merge_intersection_points.vcproj
new file mode 100644
index 000000000..00afc97f9
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/merge_intersection_points.vcproj
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="merge_intersection_points"
+ ProjectGUID="{EB8223BB-6989-4AC8-A72E-4E076FE04547}"
+ RootNamespace="merge_intersection_points"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\merge_intersection_points"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\merge_intersection_points"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\merge_intersection_points.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/overlay.sln b/libs/geometry/test/algorithms/overlay/overlay.sln
new file mode 100644
index 000000000..9bbaff6f2
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/overlay.sln
@@ -0,0 +1,61 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "traverse", "traverse.vcproj", "{6260214E-DB6F-4934-ADF7-DD2B1666171B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "self_intersection_points", "self_intersection_points.vcproj", "{06B6DCBB-AEDA-49FA-81D9-EA8959958EFC}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "get_turn_info", "get_turn_info.vcproj", "{8D98821A-5033-4616-9AF4-2AEAA42D8456}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "get_turns", "get_turns.vcproj", "{B63116BF-0F0C-4374-A6CE-77061FBC34FF}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "relative_order", "relative_order.vcproj", "{4C012342-116A-4E5E-9869-90389D5BBEBD}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assemble", "assemble.vcproj", "{306E829F-ACEC-42D5-B1D4-2531B2F56EA3}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ccw_traverse", "ccw_traverse.vcproj", "{BA789719-B2FC-405A-9258-E9E4ABCE1791}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "select_rings", "select_rings.vcproj", "{029117F7-1D6A-4A05-9FB7-93E09751C909}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {6260214E-DB6F-4934-ADF7-DD2B1666171B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {6260214E-DB6F-4934-ADF7-DD2B1666171B}.Debug|Win32.Build.0 = Debug|Win32
+ {6260214E-DB6F-4934-ADF7-DD2B1666171B}.Release|Win32.ActiveCfg = Release|Win32
+ {6260214E-DB6F-4934-ADF7-DD2B1666171B}.Release|Win32.Build.0 = Release|Win32
+ {06B6DCBB-AEDA-49FA-81D9-EA8959958EFC}.Debug|Win32.ActiveCfg = Debug|Win32
+ {06B6DCBB-AEDA-49FA-81D9-EA8959958EFC}.Debug|Win32.Build.0 = Debug|Win32
+ {06B6DCBB-AEDA-49FA-81D9-EA8959958EFC}.Release|Win32.ActiveCfg = Release|Win32
+ {06B6DCBB-AEDA-49FA-81D9-EA8959958EFC}.Release|Win32.Build.0 = Release|Win32
+ {8D98821A-5033-4616-9AF4-2AEAA42D8456}.Debug|Win32.ActiveCfg = Debug|Win32
+ {8D98821A-5033-4616-9AF4-2AEAA42D8456}.Debug|Win32.Build.0 = Debug|Win32
+ {8D98821A-5033-4616-9AF4-2AEAA42D8456}.Release|Win32.ActiveCfg = Release|Win32
+ {8D98821A-5033-4616-9AF4-2AEAA42D8456}.Release|Win32.Build.0 = Release|Win32
+ {B63116BF-0F0C-4374-A6CE-77061FBC34FF}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B63116BF-0F0C-4374-A6CE-77061FBC34FF}.Debug|Win32.Build.0 = Debug|Win32
+ {B63116BF-0F0C-4374-A6CE-77061FBC34FF}.Release|Win32.ActiveCfg = Release|Win32
+ {B63116BF-0F0C-4374-A6CE-77061FBC34FF}.Release|Win32.Build.0 = Release|Win32
+ {4C012342-116A-4E5E-9869-90389D5BBEBD}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4C012342-116A-4E5E-9869-90389D5BBEBD}.Debug|Win32.Build.0 = Debug|Win32
+ {4C012342-116A-4E5E-9869-90389D5BBEBD}.Release|Win32.ActiveCfg = Release|Win32
+ {4C012342-116A-4E5E-9869-90389D5BBEBD}.Release|Win32.Build.0 = Release|Win32
+ {306E829F-ACEC-42D5-B1D4-2531B2F56EA3}.Debug|Win32.ActiveCfg = Debug|Win32
+ {306E829F-ACEC-42D5-B1D4-2531B2F56EA3}.Debug|Win32.Build.0 = Debug|Win32
+ {306E829F-ACEC-42D5-B1D4-2531B2F56EA3}.Release|Win32.ActiveCfg = Release|Win32
+ {306E829F-ACEC-42D5-B1D4-2531B2F56EA3}.Release|Win32.Build.0 = Release|Win32
+ {BA789719-B2FC-405A-9258-E9E4ABCE1791}.Debug|Win32.ActiveCfg = Debug|Win32
+ {BA789719-B2FC-405A-9258-E9E4ABCE1791}.Debug|Win32.Build.0 = Debug|Win32
+ {BA789719-B2FC-405A-9258-E9E4ABCE1791}.Release|Win32.ActiveCfg = Release|Win32
+ {BA789719-B2FC-405A-9258-E9E4ABCE1791}.Release|Win32.Build.0 = Release|Win32
+ {029117F7-1D6A-4A05-9FB7-93E09751C909}.Debug|Win32.ActiveCfg = Debug|Win32
+ {029117F7-1D6A-4A05-9FB7-93E09751C909}.Debug|Win32.Build.0 = Debug|Win32
+ {029117F7-1D6A-4A05-9FB7-93E09751C909}.Release|Win32.ActiveCfg = Release|Win32
+ {029117F7-1D6A-4A05-9FB7-93E09751C909}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/algorithms/overlay/overlay_cases.hpp b/libs/geometry/test/algorithms/overlay/overlay_cases.hpp
new file mode 100644
index 000000000..c3e4f356c
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/overlay_cases.hpp
@@ -0,0 +1,711 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+//
+// Copyright (c) 2007-2012 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_OVERLAY_CASES_HPP
+#define BOOST_GEOMETRY_TEST_OVERLAY_CASES_HPP
+
+#include <string>
+
+// See powerpoint
+
+static std::string case_1[2] = {
+ "POLYGON((0 1,2 5,5 3,0 1))",
+ "POLYGON((3 0,0 3,4 5,3 0))" };
+
+static std::string ccw_case_1[2] = {
+ "POLYGON((0 1,5 3,2 5,0 1))",
+ "POLYGON((3 0,4 5,0 3,3 0))" };
+
+static std::string open_case_1[2] = {
+ "POLYGON((0 1,2 5,5 3))",
+ "POLYGON((3 0,0 3,4 5))" };
+
+
+static std::string case_2[2] = {
+ "POLYGON((0 2,2 5,5 3,3 0,0 2))",
+ "POLYGON((0 4,4 5,5 1,1 0,0 4))" };
+
+static std::string case_3[2] = {
+ "POLYGON((1 2,2 4,4 3,3 1,1 2))",
+ "POLYGON((1 1,1 4,4 4,4 1,1 1))" };
+
+
+static std::string case_4[2] = {
+ "POLYGON((0 2,2 5,5 3,3 0,0 2))",
+ "POLYGON((0 4,4 5,5 1,1 0,0 4),(1 1,2 1,2 2,1 2,1 1),(3 3,4 3,4 4,3 4,3 3))" };
+
+static std::string case_5[2] = {
+ "POLYGON((0 4,1 5,2.5 4,3.5 5,5 4,4 3,5 2,4 1,3.5 0,3 1,2.5 0,2 1,1.5 0,1 3.5,0.25 3,1 2.5,0 2,0 4))",
+ "POLYGON((0.5 0.5,0.5 4.5,4.5 4.5,4.5 0.5,0.5 0.5))"
+ };
+
+static std::string case_6[2] = {
+ "POLYGON((0 1,2 5,5 2,0 1))",
+ "POLYGON((1 3,2 5,5 2,1 3))" };
+
+static std::string case_7[2] = {
+ "POLYGON((0 1,1 3,5 2,0 1))",
+ "POLYGON((1 3,2 5,5 2,1 3))" };
+
+static std::string case_8[2] = {
+ "POLYGON((0 0,0 4,4 0,0 0))",
+ "POLYGON((1 3,4 4,3 1,1 3))" };
+
+static std::string case_9[2] = {
+ "POLYGON((0 0,0 4,4 0,0 0))",
+ "POLYGON((2 2,2 4,5 4,2 2))" };
+
+static std::string ccw_case_9[2] = {
+ "POLYGON((0 0,4 0,0 4,0 0))",
+ "POLYGON((2 2,5 4,2 4,2 2))" };
+
+static std::string open_case_9[2] = {
+ "POLYGON((0 0,0 4,4 0))",
+ "POLYGON((2 2,2 4,5 4))" };
+
+static std::string case_10[2] = {
+ "POLYGON((0 0,2 4,4 0,0 0))",
+ "POLYGON((1 2,2 5,3 2,2 4,1 2))" };
+
+static std::string case_11[2] = {
+ "POLYGON((0 0,0 4,4 0,0 0))",
+ "POLYGON((1 2,2 2,2 1,1 1))" };
+
+static std::string case_12[2] = {
+ "POLYGON((0 1,1 4,2 2,3 4,4 1,0 1))",
+ "POLYGON((0 3,2 4,4 3,0 3))" };
+
+static std::string case_13[2] = {
+ "POLYGON((0 1,1 2,3 0,0 1))",
+ "POLYGON((0 3,2 3,2 1,0 3))" };
+
+static std::string case_14[2] = {
+ "POLYGON((0 0,0 4,2 2,4 0,0 0))",
+ "POLYGON((1 3,4 4,3 1,1 3))" };
+
+static std::string case_15[2] = {
+ "POLYGON((0 0,0 4,1.5 2.5,2.5 1.5,4 0,0 0))",
+ "POLYGON((1 3,4 4,3 1,1 3))" };
+
+static std::string case_16[2] = {
+ "POLYGON((1 2,3 4,2 1,1 2))",
+ "POLYGON((1 0,1 2,2 1,3 4,2 3,3 5,4 0,1 0))" };
+
+static std::string case_17[2] = {
+ "POLYGON((0 0,0 4,4 0,0 0))",
+ "POLYGON((1 1,1 3,3 1,1 1))" };
+
+static std::string case_18[2] = {
+ "POLYGON((0 0,0 4,1.5 2.5,2.5 1.5,4 0,0 0))",
+ "POLYGON((1 1,1 3,3 1,1 1))" };
+
+static std::string case_19[2] = {
+ "POLYGON((2 0,1 3,5 2,2 0))",
+ "POLYGON((1 3,2 5,5 2,1 3))" };
+
+static std::string case_20[2] = {
+ "POLYGON((2 0,1 3,5 2,2 0))",
+ "POLYGON((2 0,1 3,5 2,2 0))" };
+
+static std::string case_21[2] = {
+ "POLYGON((1 0,0 5,5 2,1 0),(2 1,3 2,1 3,2 1))",
+ "POLYGON((2 1,1 3,3 2,2 1))" };
+
+static std::string case_22[2] = {
+ "POLYGON((1 0,0 3,4 2,1 0))",
+ "POLYGON((2 4,5 5,4 2,2 4))" };
+
+static std::string case_23[2] = {
+ "POLYGON((1 0,0 3,4 2,1 0))",
+ "POLYGON((3 3,4 2,1 1,3 3))" };
+
+static std::string case_24[2] = {
+ "POLYGON((1 0,0 3,4 2,1 0))",
+ "POLYGON((2 2,4 2,1 1,2 2))" };
+
+static std::string case_25[2] = {
+ "POLYGON((1 0,0 3,4 2,1 0))",
+ "POLYGON((3 1,4 2,5 0,3 1))" };
+
+static std::string case_26[2] = {
+ "POLYGON((1 0,0 3,4 2,1 0))",
+ "POLYGON((3 1,4 2,5 4,4 0,3 1))" };
+
+static std::string case_27[2] = {
+ "POLYGON((1 0,0 3,4 2,1 0))",
+ "POLYGON((1 1,4 2,5 0,1 1))" };
+
+static std::string case_28[2] = {
+ "POLYGON((1 0,0 3,4 2,1 0))",
+ "POLYGON((1 1,4 2,5 4,5 0,1 1))" };
+
+static std::string case_29[2] = {
+ "POLYGON((1 0,0 3,4 2,1 0))",
+ "POLYGON((4 4,5 1,4 2,1 1,4 4))" };
+
+static std::string case_30[2] = {
+ "POLYGON((1 0,0 3,2 2,3 3,1 0))",
+ "POLYGON((1 2,2 2,2 4,4 3,3 1,1 2))" };
+
+static std::string case_31[2] = {
+ "POLYGON((0 0,0 3,2 2,0 0))",
+ "POLYGON((4 1,2 2,3 3,4 1))" };
+
+static std::string case_32[2] = {
+ "POLYGON((0 0,0 3,2 2,0 0))",
+ "POLYGON((4 1,3 0,2 2,4 1))" };
+
+static std::string case_33[2] = {
+ "POLYGON((0 0,0 3,2 2,0 0))",
+ "POLYGON((3 3,3 0,2 2,3 3))" };
+
+static std::string case_34[2] = {
+ "POLYGON((2 0,0 3,4 2,2 0))",
+ "POLYGON((2 1,4 2,5 3,4 1,2 1))" };
+
+static std::string case_35[2] = {
+ "POLYGON((1 0,0 3,5 3,4 2,5 1,1 0))",
+ "POLYGON((2 2,4 2,4 1,2 2))" };
+
+static std::string case_36[2] = {
+ "POLYGON((1 0,0 3,4 2,1 0))",
+ "POLYGON((1 5,5 5,4 2,3 3,2 1,1 2,1 5))" };
+
+static std::string case_37[2] = {
+ "POLYGON((4 0,2 2,5 5,4 0))",
+ "POLYGON((0 2,4 3,2 2,4 1,0 2))" };
+
+static std::string case_38[2] = {
+ "POLYGON((4 0,3 3,2 2,4 5,5 2,4 0))",
+ "POLYGON((1 1,1 3,4 4,3 3,4 2,1 1))" };
+
+static std::string case_39[2] = {
+ "POLYGON((0 4,4 8,7 7,8 4,5 3,4 0,0 4))",
+ "POLYGON((0 4,4 8,5 5,8 4,7 1,4 0,0 4))" };
+
+static std::string case_40[2] = {
+ "POLYGON((0 1,1 2,2 1,3 2,4 1,5 2,4 0,2 0,0 1))",
+ "POLYGON((0 3,2 4,4 4,5 2,4 3,3 2,2 3,1 2,0 3))" };
+
+static std::string case_41[2] = {
+ "POLYGON((3 1,1 4,3 3.5,5 3,3 1))",
+ "POLYGON((3 1,1 4,5 3,4 2,3 1))" };
+
+static std::string case_42[2] = {
+ "POLYGON((3 1,1 4,3 3.5,5 3,5 3,3 1))",
+ "POLYGON((3 1,1 4,1 4,5 3,4 2,3 1))" };
+
+// keyholing
+static std::string case_43[2] = {
+ "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))",
+ "POLYGON((1.5 1.5,1.5 2.5,2.5 2.5,2.5 1.5,1.5 1.5))" };
+// self-tangency
+
+static std::string case_44[2] = {
+ "POLYGON((0 0,0 3,3 3,3 2,0 1.5,3 1,3 0,0 0))",
+ "POLYGON((1 1,1 2,2 2,2 1,1 1))" };
+// self-intersection
+
+static std::string case_45[2] = {
+ "POLYGON((0.5 0,0.5 3,3 3,3 2,0 1.5,3 1,3 0,0.5 0))",
+ "POLYGON((1 1,1 2,2 2,2 1,1 1))" };
+// self-tangent
+
+static std::string case_46[2] = {
+ "POLYGON((2 0,2 3,5 3,5 2,2 1.5,5 1,5 0,2 0))",
+ "POLYGON((1.5 1,1.5 2,2.5 2,2.5 1,1.5 1))" };
+// self-tangent
+
+static std::string case_47[2] = {
+ "POLYGON((2.5 0,2.5 3,5 3,5 2,2 1.5,5 1,5 0,2.5 0))",
+ "POLYGON((2 1,2 2,3 2,3 1,2 1))" };
+
+static std::string case_49[2] = {
+ "POLYGON((1 0,1 1,2 2,3 3,4 3,4 0,1 0))",
+ "POLYGON((0 2,2 5,5 2,5 0,2 0,2 2,0 2))" };
+
+
+// 50, collinear opposite
+static std::string case_50[2] = {
+ "POLYGON((0 0,0 3,2 3,4 3,4 0,0 0))",
+ "POLYGON((0 3,0 5,5 5,5 0,4 0,4 3,2 3,0 3))" };
+
+// 51, fit
+static std::string case_51[2] = {
+ "POLYGON((0 0,0 5,5 5,5 0,0 0),(4 1,3 4,1 2,4 1))",
+ "POLYGON((1 2,3 4,4 1,1 2))" };
+
+// 52, partially equal, touching each other
+static std::string case_52[2] = {
+ "POLYGON((0 0,1 4,3 1,4 4,1 4,5 5,5 0,0 0))",
+ "POLYGON((0 0,1 4,3 1,4 4,1 4,5 5,4 1,0 0))" };
+
+// 53, wrapping a box, self-touching
+static std::string case_53[3] = {
+ "POLYGON((2 2,2 3,3 3,3 2,2 2))",
+ // ST self-tangent ext. ring, ST_IsValid=false
+ "POLYGON((0 2,0 5,5 5,5 0,2 0,2 2,3 2,3 1,4 1,4 4,1 4,1 3,2 3,2 2,0 2))",
+ // IET tangent ext/int ring, ST_IsValid=true
+ "POLYGON((0 2,0 5,5 5,5 0,2 0,2 2,0 2),(1 3,2 3,2 2,3 2,3 1,4 1,4 4,1 4,1 3))"
+ };
+
+static std::string case_54[4] = {
+ // ST: self-tangent ext. ring
+ "POLYGON((2 2,2 3,4 3,4 0,1 0,1 2,2 2,2 1,3 1,3 2,2 2))",
+ // IET: tangent ext/int ring
+ "POLYGON((2 2,2 3,4 3,4 0,1 0,1 2,2 2),(2 1,3 1,3 2,2 2,2 1))",
+ // other like in case53
+ case_53[1], // ST
+ case_53[2] // IET
+ };
+
+static std::string case_55[4] = {
+ // ST: self-tangent ext. ring
+ "POLYGON((2 2,3 3,4 3,4 0,1 0,1 1,2 2,2 1,3 1,3 2,2 2))",
+ // IET: tangent ext/int ring
+ "POLYGON((2 2,3 3,4 3,4 0,1 0,1 1,2 2),(2 1,3 1,3 2,2 2,2 1))",
+ // ST: self-tangent ext. ring
+ "POLYGON((0 2,0 5,5 5,5 0,2 0,2 2,3 1,4 1,4 4,1 4,1 3,2 2,0 2))" ,
+ // IET: tangent ext/int ring
+ "POLYGON((0 2,0 5,5 5,5 0,2 0,2 2,0 2),(1 3,2 2,3 1,4 1,4 4,1 4,1 3))"
+
+ // B, not a 4-fold intersection
+ //"POLYGON((2 2,3 3,4 3,4 0,1 0,1 1,2 2),(2 1,3 1,3 2,2.0 1.9,2 1))",
+ //"POLYGON((0 2,0 5,5 5,5 0,2 0,2 2,0 2),(1 3,2.1 2.1,3 1,4 1,4 4,1 4,1 3))"
+ // C, not a 4-fold intersection,
+ //"POLYGON((2 2,3 3,4 3,4 0,1 0,1 1,2 2),(2 1,3 1,3 2,2.0 1.9,2 1))",
+ //"POLYGON((0 2,0 5,5 5,5 0,2 0,2 2,0 2),(1 3,1.9 1.9,3 1,4 1,4 4,1 4,1 3))"
+ };
+
+static std::string case_56[2] = {
+ "POLYGON((0 0,0 1,2 3,3 0,4 2,5 0,0 0))",
+ //"POLYGON((0 -1,0 1,2 3,3 0,4 2,5 -1,0 -1))",
+ //"POLYGON((0 1,0 4,5 4,5 0,3 0,4 1,4 3,2 3,2 1,3 0,0 0))"
+ "POLYGON((1 0,1 4,5 4,5 0,3 0,4 1,4 3,2 3,2 1,3 0,1 0))"
+ };
+
+static std::string case_57[2] = {
+ case_56[0],
+ //"POLYGON((0 2,4 5,5 1,0 2))"
+ //"POLYGON((0 -1,0 1,2 3,3 0,4 2,5 -1,0 -1))",
+ //"POLYGON((0 0,0 1,2 3,3 0,4 2,6 0,0 0))",
+ "POLYGON((0 0,4 5,5 0,0 0))"
+ };
+
+// Case 58, either one ring with self-tangencies defining holes,
+// or three inner rings tangent to outer ring
+static std::string case_58[3] = {
+ "POLYGON((3 3,3 4,4 4,4 3,3 3))",
+ // ST: self-tangent
+ "POLYGON((0 2,0 5,4 4,1 4,1 3,4 4,2 3,2 2,4 4,3 2,4 2,4 4,5 0,0 2))",
+ // IET: inner/ext tangency
+ "POLYGON((0 2,0 5,4 4,5 0,0 2),(4 4,1 4,1 3,4 4),(4 4,2 3,2 2,4 4),(4 4,3 2,4 2,4 4))"
+ };
+
+static std::string case_59[3] = {
+ "POLYGON((0.5 3,3.5 3.5,3 0.5,2 2,0.5 3))",
+ case_53[1], // ST: self-tangent
+ case_53[2] // IET: inner/ext tangency
+ };
+static std::string case_60[3] = {
+ "POLYGON((1 3,5 5,3 1,1 3))",
+ case_53[1], // ST: self-tangent
+ case_53[2] // IET: inner/ext tangency
+ };
+
+// 60-..., actually there are multi-polygons but expressed here using self-tangencies
+static std::string case_61[2] = {
+ "POLYGON((1 1,1 2,2 2,2 3,3 3,3 2,2 2,2 1,1 1))",
+ "POLYGON((1 2,1 3,2 3,2 4,3 4,3 3,2 3,2 2,1 2))"
+ };
+
+// 62..69 TODO, most are multi but can be expressed by self-tangent-polygon as well
+
+static std::string case_70[2] = {
+ "POLYGON((1 0,1 3,4 3,4 0,1 0),(2 1,3 1,3 2,2 2,2 1))",
+ "POLYGON((1 0,1 2,4 2,4 0,3 0,3 1,2 1,2 0,1 0))"
+ };
+
+static std::string case_71[2] = {
+ "POLYGON((0 0,0 3,1 3,1 1,3 1,3 2,2 2,2 3,3 3,3 2,4 2,4 0,0 0))",
+ "POLYGON((0 2,0 3,3 3,3 2,0 2))"
+ };
+
+static std::string case_72[2] = {
+ "POLYGON((0 3,4 4,3 0,3 3,2 1,1 2,3 3,0 3))",
+ "POLYGON((0 0,1 4,3 3,4 1,0 0))"
+ };
+
+static std::string case_79[2] = {
+ "POLYGON((0 0,0 5,5 5,5 3,2 3,2 2,5 2,5 0,0 0))",
+ "POLYGON((0 0,0 5,5 5,5 0,2 0,2 2,1 2,1 0,0 0))"
+ };
+
+static std::string case_many_situations[2] = {
+ "POLYGON((2 6,2 14,10 18,18 14,18 6,16 5,14 4,12 3,10 2,8 3,6 4,4 5,2 6))",
+ "POLYGON((2 6,2 7,2 8,2 9,2 10,2 11,2 12,1 14"
+ ",4 14,4 15,7 15,7 18,8 17,9 20,10 18"
+ ",10 15.5,11 17.5,12 17,11 15,12 14.5,13 16.5,14 18.5,15 18,14 16,15 15.5,16 17.5,18 14"
+ ",19 13,17 11,19 9,19 7"
+ ",17 5,16 5,15 4.5,13 3.5,11 2.5,10 2"
+ ",8 3,6 4,4 5,2 6))" };
+
+static std::string collinear_overlaps[2] = {
+ "POLYGON((0 2,0 4,2 4,2 5,0 5,0 7,2 7,2 8,6 8,6 7,8 7,8 5,6 5,6 4,8 4,8 2,6 2,6 1,2 1,2 2,0 2))",
+ "POLYGON((3 0,3 2,1 2,1 3,3 3,3 4,1 4,1 5,3 5,3 6,1 6,1 7,3 7,3 9,5 9,5 7,7 7,7 6,5 6,5 5,7 5,7 4,5 4,5 3,7 3,7 2,5 2,5 0,3 0))" };
+
+
+static std::string line_line1[2] = {
+ "LINESTRING(0 1,2 5,5 3)", "LINESTRING(3 0,0 3,4 5)"};
+
+
+
+// Pies
+static std::string pie_23_16_16[2] = {
+ "POLYGON((2500 2500,2500 3875,2855 3828,3187 3690,3472 3472,3690 3187,3828 2855,3875 2500,3828 2144,3690 1812,3472 1527,3187 1309,2855 1171,2499 1125,2144 1171,1812 1309,1527 1527,1309 1812,1171 2144,1125 2499,1171 2855,1309 3187,1527 3472,1812 3690,2500 2500))",
+ "POLYGON((2500 2500,1525 1937,1413 2208,1375 2499,1413 2791,1525 3062,1704 3295,1937 3474,2208 3586,2499 3625,2791 3586,3062 3474,3295 3295,3474 3062,3586 2791,3625 2500,3586 2208,2500 2500))"
+ };
+
+static std::string pie_16_4_12[2] = {
+ "POLYGON((2500 2500,2500 3875,2855 3828,3187 3690,3472 3472,3690 3187,3828 2855,3875 2500,3828 2144,3690 1812,3472 1527,3187 1309,2855 1171,2499 1125,2144 1171,1812 1309,1527 1527,2500 2500))",
+ "POLYGON((2500 2500,2500 1375,2208 1413,1937 1525,1704 1704,2500 2500))"
+ };
+
+static std::string pie_4_13_15[2] = {
+ "POLYGON((2500 2500,2500 3875,2855 3828,3187 3690,3472 3472,2500 2500))",
+ "POLYGON((2500 2500,1704 1704,1525 1937,1413 2208,1375 2499,1413 2791,1525 3062,1704 3295,1937 3474,2208 3586,2499 3625,2791 3586,3062 3474,3295 3295,2500 2500))"
+ };
+
+static std::string pie_16_2_15_0[2] = {
+ "POLYGON((2500 2500,2500 3875,2855 3828,3187 3690,3472 3472,3690 3187,3828 2855,3875 2500,3828 2144,3690 1812,3472 1527,3187 1309,2855 1171,2499 1125,2144 1171,1812 1309,1527 1527,2500 2500))",
+ "POLYGON((2500 2500,1704 1704,1525 1937,2500 2500))"
+ };
+
+
+// Shifted pies
+static std::string pie_20_20_7_100[2] = {
+ "POLYGON((2500 2500,2500 3875,2855 3828,3187 3690,3472 3472,3690 3187,3828 2855,3875 2500,3828 2144,3690 1812,3472 1527,3187 1309,2855 1171,2499 1125,2144 1171,1812 1309,1527 1527,1309 1812,1171 2144,1125 2499,1171 2855,2500 2500))",
+ "POLYGON((2500 2600,3586 2308,3474 2037,3295 1804,3062 1625,2791 1513,2499 1475,2208 1513,1937 1625,1704 1804,1525 2037,1413 2308,1375 2600,1413 2891,1525 3162,1704 3395,1937 3574,2208 3686,2499 3725,2791 3686,3062 3574,2500 2600))"
+ };
+
+static std::string pie_23_23_3_2000[2] = {
+ "POLYGON((2500 2500,2500 3875,2855 3828,3187 3690,3472 3472,3690 3187,3828 2855,3875 2500,3828 2144,3690 1812,3472 1527,3187 1309,2855 1171,2499 1125,2144 1171,1812 1309,1527 1527,1309 1812,1171 2144,1125 2499,1171 2855,1309 3187,1527 3472,1812 3690,2500 2500))",
+ "POLYGON((2500 3500,3295 4295,3474 4062,3586 3791,3625 3500,3586 3208,3474 2937,3295 2704,3062 2525,2791 2413,2499 2375,2208 2413,1937 2525,1704 2704,1525 2937,1413 3208,1375 3500,1413 3791,1525 4062,1704 4295,1937 4474,2208 4586,2499 4625,2791 4586,2500 3500))"
+ };
+
+static std::string pie_23_21_12_500[2] = {
+ "POLYGON((2500 2500,2500 3875,2855 3828,3187 3690,3472 3472,3690 3187,3828 2855,3875 2500,3828 2144,3690 1812,3472 1527,3187 1309,2855 1171,2499 1125,2144 1171,1812 1309,1527 1527,1309 1812,1171 2144,1125 2499,1171 2855,1309 3187,1527 3472,1812 3690,2500 2500))",
+ "POLYGON((2500 3000,2500 1875,2208 1913,1937 2025,1704 2204,1525 2437,1413 2708,1375 3000,1413 3291,1525 3562,1704 3795,1937 3974,2208 4086,2499 4125,2791 4086,3062 3974,3295 3795,3474 3562,3586 3291,3625 3000,3586 2708,3474 2437,2500 3000))"
+ };
+
+// Self-tangent pies (but as single-polygon, this one is NOT VALID and (therefore) (currently) NOT WORKING)
+static std::string pie_5_12_12_0_7s[2] =
+{
+ "POLYGON((2500 2500,2500 3875,2855 3828,3187 3690,3472 3472,3690 3187,2500 2500))",
+ "POLYGON((2500 2500,2500 1375,2208 1413,1937 1525,1704 1704,1525 1937,1413 2208,1375 2500,1413 2791,1525 3062,1704 3295,1937 3474,2208 3586,2500 2500,2791 3586,3062 3474,3295 3295,3474 3062,3586 2791,3625 2500,3586 2208,2500 2500))"
+};
+
+
+// Cases coming from High volume (hv) tests
+static std::string hv_1[2] = {
+ "POLYGON((24.995166778564453 50.011310577392578,46.630809783935547 37.494682312011719,46.661380767822266 12.499360084533691,25.003841400146484 0.020658308640122414,3.3419711589813232 12.491842269897461,3.3638687133789062 37.487174987792969,24.995166778564453 50.011310577392578))",
+ "POLYGON((25.025228500366211 49.992599487304688,46.6719970703125 37.482185363769531,46.631874084472656 12.480358123779297,24.974153518676758 -0.011088892817497253,3.3419976234436035 12.524576187133789,3.3529467582702637 37.526435852050781,25.025228500366211 49.992599487304688))"
+ };
+
+static std::string hv_2[2] = {
+ "POLYGON((24.988700866699219 49.986705780029297,46.643772125244141 37.5079345703125,46.645118713378906 12.514699935913086,25.010652542114258 0.00024537215358577669,3.3652000427246094 12.495694160461426,3.3445985317230225 37.488922119140625,24.988700866699219 49.986705780029297))",
+ "POLYGON((24.993022918701172 49.977996826171875,46.643772125244141 37.503200531005859,46.634654998779297 12.51569938659668,25.005790710449219 0.0029967525042593479,3.3705389499664307 12.504646301269531,3.348651647567749 37.492141723632812,24.993022918701172 49.977996826171875))"
+ };
+
+static std::string hv_3[2] = {
+ "POLYGON((25.007728576660156 49.988899230957031,46.667163848876953 37.501667022705078,46.637229919433594 12.500443458557129,24.993251800537109 -0.01356174610555172,3.3565254211425781 12.512973785400391,3.3410670757293701 37.514209747314453,25.007728576660156 49.988899230957031))",
+ "POLYGON((24.998353958129883 49.993511199951172,46.659591674804688 37.507373809814453,46.646518707275391 12.505118370056152,25.002584457397461 -0.0109936548396945,3.3565335273742676 12.501456260681152,3.3392288684844971 37.503707885742188,24.998353958129883 49.993511199951172))"
+ };
+
+static std::string hv_4[2] = {
+ "POLYGON((25.009130477905273 50.022209167480469,46.670387268066406 37.500617980957031,46.666873931884766 12.480625152587891,24.992231369018555 -0.017777863889932632,3.3260366916656494 12.495262145996094,3.3394229412078857 37.515254974365234,25.009130477905273 50.022209167480469))",
+ "POLYGON((25.00263786315918 50.019630432128906,46.669231414794922 37.507579803466797,46.666202545166016 12.487733840942383,24.997152328491211 -0.020060751587152481,3.3308455944061279 12.492485046386719,3.3333024978637695 37.5123291015625,25.00263786315918 50.019630432128906))"
+ };
+
+static std::string hv_5[2] = {
+ "POLYGON((24.987522125244141 49.997768402099609,46.643741607666016 37.509471893310547,46.654956817626953 12.510490417480469,25.011669158935547 -0.00019846600480377674,3.3563058376312256 12.489578247070313,3.3433761596679687 37.488559722900391,24.987522125244141 49.997768402099609))",
+ "POLYGON((25.005760192871094 50.008182525634766,46.648590087890625 37.491542816162109,46.655918121337891 12.489977836608887,24.994773864746094 0.0050580352544784546,3.3391191959381104 12.499494552612305,3.3574333190917969 37.501052856445312,25.005760192871094 50.008182525634766))"
+ };
+
+static std::string hv_6[2] = {
+ "POLYGON((25.011470794677734 50.017532348632813,42.678981781005859 42.661365509033203,50.017532348632813 24.986530303955078,42.661365509033203 7.3190178871154785,24.986530303955078 -0.019533095881342888,7.3190178871154785 7.336634635925293,-0.019533095881342888 25.011470794677734,7.336634635925293 42.678981781005859,25.011470794677734 50.017532348632813))",
+ "POLYGON((25.002880096435547 50.013965606689453,46.671913146972656 37.507381439208984,46.660655975341797 12.488155364990234,24.9951171875 -0.024483053013682365,3.3334629535675049 12.494877815246582,3.3299689292907715 37.514102935791016,25.002880096435547 50.013965606689453))"
+ };
+
+static std::string hv_7[2] = {
+ "POLYGON((24.983684539794922 49.995647430419922,46.643482208251953 37.513137817382813,46.654392242431641 12.51393985748291,25.014318466186523 -0.0027416276279836893,3.3589246273040771 12.487411499023438,3.3391971588134766 37.486602783203125,24.983684539794922 49.995647430419922))",
+ "POLYGON((24.990163803100586 49.9993896484375,46.655281066894531 37.512466430664062,46.654388427734375 12.506458282470703,25.007841110229492 -0.012621366418898106,3.3524465560913086 12.491152763366699,3.3338801860809326 37.497154235839844,24.990163803100586 49.9993896484375))"
+ };
+
+static std::string dz_1[2] = {
+ "POLYGON((30.526203155517578 56.781166076660156,38.987510681152344 58.710700988769531,41.042613983154297 50.279010772705078,48.390048980712891 45.660350799560547,43.881126403808594 38.245067596435547,45.810657501220703 29.783760070800781,37.378971099853516 27.728654861450195,32.760307312011719 20.381219863891602,25.345026016235352 24.890144348144531,16.883718490600586 22.960611343383789,14.828612327575684 31.392299652099609,7.481177806854248 36.010959625244141,11.990103721618652 43.426242828369141,10.060568809509277 51.887550354003906,18.492258071899414 53.942657470703125,23.110919952392578 61.290092468261719,30.526203155517578 56.781166076660156))",
+ "POLYGON((12.580197334289551 33.274467468261719,14.852641105651855 24.577714920043945,21.524574279785156 30.601236343383789,18.734457015991211 22.056488037109375,27.603805541992188 23.51667594909668,20.636968612670898 17.836828231811523,28.887777328491211 14.270085334777832,19.956142425537109 13.258448600769043,24.968837738037109 5.7971897125244141,16.908138275146484 9.7749528884887695,17.091224670410156 0.78807485103607178,12.460672378540039 8.4923257827758789,7.7560214996337891 0.83309894800186157,8.0257854461669922 9.8177928924560547,-0.072908863425254822 5.9179673194885254,5.0115232467651367 13.330527305603027,-3.9099369049072266 14.42827033996582,4.3748917579650879 17.915260314941406,-2.5368332862854004 23.662046432495117,6.3180174827575684 22.116373062133789,3.6104514598846436 30.687637329101563,10.223971366882324 24.600040435791016,12.580197334289551 33.274467468261719))"
+ };
+
+static std::string dz_2[2] = {
+ "POLYGON((24.587966918945313 61.027225494384766,32.1783447265625 62.988296508789063,34.655326843261719 55.550270080566406,41.730445861816406 52.173538208007812,38.846851348876953 44.883510589599609,42.096187591552734 37.748981475830078,35.201282501220703 34.018035888671875,33.104434967041016 26.46403694152832,25.42442512512207 28.037921905517578,18.962528228759766 23.599054336547852,14.090974807739258 29.741334915161133,6.2876262664794922 30.494592666625977,6.5039811134338379 38.331226348876953,1.0104535818099976 43.924152374267578,6.2134823799133301 49.788291931152344,5.6002583503723145 57.603889465332031,13.355405807495117 58.751640319824219,17.909420013427734 65.132911682128906,24.587966918945313 61.027225494384766))",
+ "POLYGON((43.551433563232422 47.905071258544922,46.384872436523438 39.57366943359375,53.589195251464844 44.627212524414063,50.984420776367188 36.221515655517578,59.783241271972656 36.075325012207031,52.735191345214844 30.806018829345703,59.767654418945313 25.51593017578125,50.968441009521484 25.395713806152344,53.548389434814453 16.982362747192383,46.359016418457031 22.057153701782227,43.500991821289063 13.734155654907227,40.667552947998047 22.065553665161133,33.463230133056641 17.012012481689453,36.068000793457031 25.417709350585938,27.269184112548828 25.563901901245117,34.317234039306641 30.833206176757812,27.284770965576172 36.123294830322266,36.083980560302734 36.243511199951172,33.504035949707031 44.6568603515625,40.693408966064453 39.582073211669922,43.551433563232422 47.905071258544922))"
+ };
+
+static std::string dz_3[2] = {
+ "POLYGON((20.813335418701172 73.060707092285156,22.815366744995117 61.968788146972656,31.383756637573242 69.291458129882813,28.001794815063477 58.539661407470703,38.991741180419922 61.041633605957031,31.000555038452148 53.093067169189453,41.894393920898437 50.201171875,31.124666213989258 46.876754760742188,39.426750183105469 39.253490447998047,28.345697402954102 41.314804077148438,32.154121398925781 30.706569671630859,23.300275802612305 37.681396484375,21.742572784423828 26.518407821655273,17.144247055053711 36.808895111083984,10.5772705078125 27.648460388183594,11.287883758544922 38.897186279296875,1.2160475254058838 33.837848663330078,7.0728073120117187 43.467861175537109,-4.1965517997741699 43.668655395507812,5.4646410942077637 49.473834991455078,-4.4205660820007324 54.888763427734375,6.8317971229553223 55.539215087890625,0.59532338380813599 64.927780151367187,10.861076354980469 60.274494171142578,9.7020368576049805 71.485885620117188,16.629419326782227 62.594875335693359,20.813335418701172 73.060707092285156))",
+ "POLYGON((1.6459450721740723 46.720386505126953,10.693820953369141 61.892372131347656,7.2385158538818359 44.568569183349609,23.921955108642578 50.3751220703125,10.139513969421387 39.325347900390625,26.652151107788086 33.049518585205078,8.9915294647216797 33.444084167480469,17.606916427612305 18.02239990234375,4.3317174911499023 29.676681518554687,1.0186206102371216 12.32512378692627,-1.6595441102981567 29.785955429077148,-15.35089111328125 18.623508453369141,-6.1788778305053711 33.720771789550781,-23.842140197753906 33.970470428466797,-7.1116366386413574 39.639987945556641,-20.481979370117188 51.184993743896484,-4.0213727951049805 44.773937225341797,-6.8426628112792969 62.212215423583984,1.6459450721740723 46.720386505126953))"
+ };
+
+static std::string dz_4[2] = {
+ "POLYGON((36.179050445556641 50.613166809082031,40.804176330566406 39.819438934326172,52.211421966552734 42.607097625732422,48.816398620605469 31.365650177001953,59.346733093261719 26.168684005737305,49.520126342773438 19.73951530456543,54.246284484863281 8.9896402359008789,42.586078643798828 10.381030082702637,39.296642303466797 -0.89176815748214722,31.258771896362305 7.6691346168518066,21.492900848388672 1.1480809450149536,20.83837890625 12.87275505065918,9.1656351089477539 14.154719352722168,16.200717926025391 23.557058334350586,8.0829076766967773 32.042194366455078,19.515800476074219 34.722743988037109,18.751338958740234 46.440761566162109,29.232465744018555 41.145256042480469,36.179050445556641 50.613166809082031))",
+ "POLYGON((20.486696243286133 60.650150299072266,24.282432556152344 49.304500579833984,34.362251281738281 55.748767852783203,30.764263153076172 44.3388671875,42.706855773925781 43.627620697021484,33.089447021484375 36.511661529541016,42.333145141601563 28.916570663452148,30.369846343994141 28.81260871887207,33.383872985839844 17.234743118286133,23.644252777099609 24.182485580444336,19.277351379394531 13.044195175170898,15.48161506652832 24.389842987060547,5.40179443359375 17.945577621459961,8.9997835159301758 29.355476379394531,-2.9428071975708008 30.06672477722168,6.6745977401733398 37.182682037353516,-2.5690991878509521 44.777774810791016,9.394200325012207 44.881736755371094,6.3801741600036621 56.459602355957031,16.119794845581055 49.511859893798828,20.486696243286133 60.650150299072266))"
+ };
+
+
+// ticket_17 is keyholed, so has a hole formed by an deliberate intersection
+// This will fail the intersection/traversal process
+static std::string ticket_17[2] = {
+ "POLYGON ((-122.28139163 37.37319149,-122.28100699 37.37273669,-122.28002186 37.37303123,-122.27979681 37.37290072,-122.28007349 37.37240493,-122.27977334 37.37220360,-122.27819720 37.37288580,-122.27714184 37.37275161,-122.27678628 37.37253167,-122.27766437 37.37180973,-122.27804382 37.37121453,-122.27687664 37.37101354,-122.27645829 37.37203386,-122.27604423 37.37249110,-122.27632234 37.37343339,-122.27760980 37.37391082,-122.27812478 37.37800320,-122.26117222 37.39121007,-122.25572289 37.39566631,-122.25547269 37.39564971,-122.25366304 37.39552993,-122.24919976 37.39580268,-122.24417933 37.39366907,-122.24051443 37.39094143,-122.23246277 37.38100418,-122.23606766 37.38141338,-122.24001587 37.37738940,-122.23666848 37.37609347,-122.23057450 37.37882170,-122.22679803 37.37807143,-122.22525727 37.37448817,-122.22523229 37.37443000,-122.23083199 37.37609347,-122.23033486 37.37777891,-122.23169030 37.37732117,-122.23229178 37.37709687,-122.23237761 37.37631249,-122.23297776 37.37438834,-122.23872850 37.37165986,-122.24044511 37.36934068,-122.24671067 37.36865847,-122.24825570 37.36981819,-122.25151719 37.36947713,-122.25357721 37.36756706,-122.26001451 37.36579354,-122.25615213 37.36545239,-122.25486458 37.36245083,-122.25357721 37.36108651,-122.25194642 37.36013139,-122.24885652 37.35958557,-122.24911401 37.35849399,-122.25357721 37.35808470,-122.25675286 37.35897159,-122.25855539 37.35753887,-122.26181687 37.35828939,-122.26713837 37.35897159,-122.26782510 37.36108651,-122.26662339 37.36456559,-122.27288911 37.36722601,-122.27366159 37.36531602,-122.27168740 37.36470213,-122.27391900 37.36374701,-122.27074326 37.36245083,-122.27134408 37.35951742,-122.27426240 37.36135926,-122.27709482 37.36115474,-122.27966974 37.36231438,-122.27958391 37.36463382,-122.27572152 37.36463382,-122.27563569 37.36524779,-122.27700899 37.36593000,-122.27709482 37.36763529,-122.27554978 37.36838573,-122.27667254 37.36931478,-122.27677932 37.36932073,-122.27769362 37.36853987,-122.27942490 37.36830803,-122.28178776 37.36677917,-122.28509559 37.36443500,-122.28845129 37.36413744,-122.29194403 37.36695946,-122.29382577 37.36726817,-122.29600414 37.36898512,-122.29733083 37.36995398,-122.29593239 37.37141436,-122.29416649 37.37075898,-122.29325026 37.37108436,-122.29652910 37.37311697,-122.29584237 37.37374461,-122.29537583 37.37573372,-122.29487677 37.37752502,-122.30923212 37.37593011,-122.31122484 37.38230086,-122.31467994 37.38092472,-122.31715663 37.38252181,-122.32307970 37.38166978,-122.31985618 37.37667694,-122.32210304 37.37580220,-122.32581446 37.37589532,-122.32401730 37.37331839,-122.32960417 37.37189020,-122.33465527 37.37331906,-122.33425328 37.37623680,-122.33620676 37.37726132,-122.33397986 37.37822382,-122.33358918 37.38036590,-122.33202637 37.37986918,-122.33147954 37.38101784,-122.33394080 37.38198017,-122.33545239 37.38587943,-122.33478058 37.38785697,-122.33386050 37.38723721,-122.33350041 37.38571137,-122.33122003 37.38548891,-122.33140008 37.38650606,-122.33366042 37.38817490,-122.33244019 37.39157602,-122.33298157 37.39419201,-122.33164013 37.39477028,-122.33202017 37.39518351,-122.33358038 37.39499282,-122.33376050 37.39597811,-122.33550067 37.39734478,-122.33556069 37.39481797,-122.33344040 37.39292676,-122.33638094 37.38892189,-122.34240644 37.38852719,-122.34906293 37.38726898,-122.35072321 37.39338769,-122.34910291 37.39445252,-122.34796272 37.39410291,-122.34449043 37.39640534,-122.34500223 37.39729709,-122.34936291 37.39670910,-122.35098322 37.39531066,-122.35364623 37.39554510,-122.35434369 37.39612111,-122.35798429 37.39600988,-122.35768430 37.39478621,-122.36334519 37.39206871,-122.36604726 37.39203267,-122.36778592 37.39335592,-122.36518870 37.40022011,-122.36554552 37.40247752,-122.36370519 37.40331974,-122.36270506 37.40530591,-122.36320512 37.40670418,-122.36149849 37.40851392,-122.36730580 37.41054938,-122.37263720 37.41378932,-122.37161871 37.42076600,-122.36566153 37.42006292,-122.36520547 37.42742106,-122.37165953 37.43661157,-122.35943972 37.44459022,-122.35356359 37.44600810,-122.33792254 37.45796329,-122.35228518 37.47478091,-122.35127080 37.48181199,-122.34867342 37.48487322,-122.34359717 37.48801082,-122.33388431 37.48677650,-122.33142321 37.48429747,-122.32929580 37.48473149,-122.32609609 37.48291144,-122.32344850 37.48228229,-122.31924364 37.48410234,-122.31677299 37.48114051,-122.31431751 37.47848973,-122.31259201 37.47682190,-122.31515972 37.47568196,-122.31691389 37.47360309,-122.31292494 37.46960081,-122.31130153 37.46937743,-122.30889894 37.47124987,-122.30612839 37.47011613,-122.30149630 37.46568378,-122.30064277 37.46363784,-122.29283821 37.45922376,-122.28630141 37.45415497,-122.28883099 37.44629920,-122.28316717 37.44197138,-122.27554148 37.42297597,-122.25597410 37.40553692,-122.25196579 37.40129593,-122.25012043 37.40049143,-122.24823207 37.39897758,-122.24754551 37.39740941,-122.24778582 37.39621607,-122.24934787 37.39599102,-122.25005170 37.39871849,-122.25222328 37.39863668,-122.25342491 37.39737529,-122.25520162 37.39667289,-122.25528737 37.39522726,-122.27747460 37.37809616,-122.27977493 37.37858717,-122.28157729 37.37920106,-122.28322534 37.37952846,-122.28416939 37.38092656,-122.28621223 37.37984219,-122.28638389 37.37613857,-122.28382607 37.37843722,-122.27930278 37.37718220,-122.28196361 37.37652740,-122.28295058 37.37568167,-122.28216101 37.37523148,-122.28114822 37.37543608,-122.27934569 37.37528613,-122.27996369 37.37448121,-122.28104521 37.37454944,-122.28185197 37.37422883,-122.28290767 37.37474038,-122.28376597 37.37467224,-122.28428104 37.37399012,-122.28402346 37.37338989,-122.28610922 37.37364914,-122.28651264 37.37327388,-122.28672722 37.37207343,-122.28628398 37.37205448,-122.28574460 37.37166682,-122.28479711 37.37200981,-122.28327731 37.37137228,-122.28285511 37.37100700,-122.28279409 37.37125669,-122.28315527 37.37173756,-122.28321872 37.37220569,-122.28187007 37.37231918,-122.28193109 37.37294908,-122.28139163 37.37319149))",
+ "BOX(-122.280 37.377,-122.277 37.379)"};
+
+static std::string snl_1[2] = {
+ "POLYGON((184913.4512 606985.7794,184912.9 606987.146,184904.4135 606987.6514,184901.8476 607014.5934,184916.3978 607021.0602,184927.7148 607008.1264,184926.0981 606998.4262,184913.4512 606985.7794),(184907.556 607013.301,184905.782 607009.972,184906.004 607005.978,184908.444 606998.877,184912.215 606994.218,184919.314 606993.996,184922.42 606995.771,184925.747 606998.877,184926.413 607002.872,184925.747 607007.753,184922.42 607012.191,184917.096 607015.298,184911.771 607015.298,184907.556 607013.301))",
+ "POLYGON((184861.118 606901.158,184893.787 606898.483,184925.043 606913.4,184927.174 606951.759,184912.9 606987.146,184877.87 606989.232,184885.103 607023.774,184899.058 607022.743,184906.008 607044.948,184966.465 607025.02,184968.442 606961.3,185024.768 606947.402,185024.544 606941.355,185027.007 606937.323,185030.366 606934.187,185035.516 606933.963,185040.442 606935.531,185042.905 606939.115,185088.364 606931.385,185089.139 607015.509,185095.2 607011.3,185118.827 606995.545,185126.813 606991.995,185177.727 606973.799,185181.482 606966.676,185193.571 606977.795,185193.711 606960.3,185189.352 606779.02,185167.515 606783.844,185086.96 606801.241,185011.707 606817.809,185000 606819.304,184994.034 606819.794,184976.398 606819.572,184956.654 606817.131,184934.913 606813.137,184893.097 606804.927,184884.445 606831.555,184866.919 606883.481,184861.118 606901.158),(184907.556 607013.301,184905.782 607009.972,184906.004 607005.978,184908.444 606998.877,184912.215 606994.218,184919.314 606993.996,184922.42 606995.771,184925.747 606998.877,184926.413 607002.872,184925.747 607007.753,184922.42 607012.191,184917.096 607015.298,184911.771 607015.298,184907.556 607013.301))"};
+
+
+// Isovist (submitted by Brandon during Formal Review)
+static std::string isovist[2] =
+ {
+ "POLYGON((37.29449462890625 1.7902572154998779, 46.296027072709599 -2.4984308554828116, 45.389434814453125 -4.5143837928771973, 47.585065917176543 -6.1314922196594779, 46.523914387974358 -8.5152102535033496, 42.699958801269531 -4.4278755187988281, 42.577877044677734 -4.4900407791137695, 42.577911376953125 -4.4901103973388672, 40.758884429931641 -5.418975830078125, 40.6978759765625 -5.4500408172607422, 41.590042114257813 -7.2021245956420898, 57.297810222148939 -37.546793343968417, 50.974888957147442 -30.277285722290763, 37.140213012695313 1.3446992635726929, 37.000419616699219 1.664225697517395, 37.29449462890625 1.7902572154998779))",
+ "POLYGON((43.644271850585938 0.96149998903274536,43.764598846435547 0.93951499462127686,49.071769542946825 0.61489892713413252,48.43512638981781 -0.81299959072453376,47.830955505371094 -0.69758313894271851,47.263670054709685 -1.784876824891044,46.695858001708984 -1.6093428134918213,45.389434814453125 -4.5143837928771973,47.604561877161387 -6.087697464505224,46.559533858616469 -8.435196445683264,42.699958801269531 -4.4278755187988281,42.577877044677734 -4.4900407791137695,42.577911376953125 -4.4901103973388672,40.758884429931641 -5.418975830078125,40.6978759765625 -5.4500408172607422,41.590042114257813 -7.2021245956420898,57.524304765518266 -37.807195733984784,41.988733475572282 -19.945838749437218,41.821544647216797 -19.211688995361328,40.800632476806641 -17.208097457885742,39.966808319091797 -17.625011444091797,38.823680877685547 -16.296066284179688,37.326129913330078 -17.190576553344727,35.963497161865234 -15.476018905639648,35.656356811523438 -15.66030216217041,34.931102752685547 -16.223842620849609,34.634240447128811 -15.85007183479255,34.886280059814453 -14.120697975158691,34.658355712890625 -13.81736946105957,34.328716278076172 -13.992490768432617,33.598796844482422 -14.546377182006836,33.164891643669634 -14.000060288415174,33.566280364990234 -12.450697898864746,33.339523315429688 -12.147735595703125,32.998821258544922 -12.323249816894531,32.274600982666016 -12.879127502441406,31.682494778186321 -12.133624901803865,32.226280212402344 -10.790698051452637,32.000633239746094 -10.488097190856934,31.669155120849609 -10.653837203979492,30.947774887084961 -11.208560943603516,30.207040612748258 -10.275926149505661,30.896280288696289 -9.1206979751586914,30.670633316040039 -8.8180980682373047,30.339155197143555 -8.9838371276855469,29.619997024536133 -9.5368013381958008,29.135100397190627 -8.9262827849488211,32.718830108642578 -4.3281683921813965,32.708168029785156 -2.3611698150634766,32.708126068115234 -2.3611700534820557,32.708126068115234 -2.3611266613006592,30.501169204711914 -2.3718316555023193,27.069889344709196 -4.2926591211028242,26.472516656201325 -3.5380830513658776,36.954700469970703 1.2597870826721191,37.140213012695313 1.3446992635726929,37.000419616699219 1.664225697517395,37.29449462890625 1.7902572154998779,37.43402099609375 1.470055103302002,51.370888500897557 7.4163459734570729,51.20102152843122 7.1738039562841562,42.721500396728516 3.6584999561309814,42.721500396728516 2.2342472076416016,42.399410247802734 1.4956772327423096,43.644271850585938 0.96149998903274536))"
+ };
+
+static std::string ggl_list_20110306_javier[2] =
+ {
+ "POLYGON((-2 2,2002 2,2002 -2002,-2 -2002,-2 2),(0 -147.00000000000003,0 -2000,2000 -2000,2000 0,104 0,440 -240,400 -280,0 -147.00000000000003))",
+ "POLYGON((359.99000000000001 -280,0 -182,0 -147,400.00999999999999 -280,359.99000000000001 -280))"
+ };
+
+static std::string ggl_list_20110307_javier[2] =
+ {
+ "POLYGON((-2 2, 1842 2, 1842 -2362, -2 -2362, -2 2), (0 0, 0 -2360, 1840 -2360, 1840 0, 0 0))",
+ // "POLYGON((-0.01 -1960, 0 -1960, 0 -1880, 0.01 -1960, -0.01 -1960))"
+ "POLYGON ((-0.01 -1960, 80.01 -1960, 0 -1880, -0.01 -1960))"
+ };
+
+
+static std::string ggl_list_20110627_phillip[2] =
+ {
+ "POLYGON((537.99678544791459 124.30517362077681,437.36539413622404 142.02728895075373,456.33031803043468 249.50296671450121,556.96217263181723 231.78347688272990,537.99678544791459 124.30517362077681))",
+ "POLYGON((437.35 142.03,461.94 281.32,564.5 263.26,539.9 123.97,437.35 142.03))"
+ };
+
+static std::string ggl_list_20110716_enrico[2] =
+ {
+ "POLYGON((1.83691e-014 -300,-259.808 -150,-259.808 150,-5.51073e-014 300,259.808 150,259.808 -150,9.18455e-014 -300,1.83691e-014 -300),(7.65379e-014 -250,216.506 -125,216.506 125,-4.59227e-014 250,-216.506 125,-216.506 -125,1.53076e-014 -250,7.65379e-014 -250))",
+ "POLYGON((1.83691e-014 -300,-259.808 -150,-216.506 -125,-216.506 125,-259.808 150,-5.51073e-014 300,-4.59227e-014 250,216.506 125,259.808 150,259.808 -150,216.506 -125,7.65379e-014 -250,9.18455e-014 -300,1.83691e-014 -300),(6.12303e-014 -200,173.205 -100,173.205 100,-3.67382e-014 200,-173.205 100,-173.205 -100,1.22461e-014 -200,6.12303e-014 -200))"
+ };
+
+
+// Send on ggl-list by Christoph/Angus at 2011-08-19/20
+// This polygon combination fails to union in <float> but do in <double> or <ttmath>
+// It had previosly an error which has been fixed at 2011-08-30
+static std::string ggl_list_20110820_christophe[2] =
+{
+ "POLYGON((17.763942722600319 32.23605727739968,19.192448808558737 30.807551191441263,16.000000000000000 30.000000000000000,17.763942722600319 32.236057277399681))",
+ "POLYGON((0.24806946917841693 26.015444246572663,31.751930530821582 33.984555753427337,32.248069469178418 30.015444246572663,0.24806946917841693 26.015444246572663))"
+};
+
+
+// GEOS "TestOverlay" test.
+// Note that the first one WAS invalid and is made valid using SQL Server 2008 Spatial MakeValid() function
+static std::string geos_1_test_overlay[2] =
+ {
+ // Original: POLYGON((5417148.108 5658342.603,5417139.016 5658338.009,5417126.791 5658331.833,5417116.292 5658327.518,5417112.871 5658325.598,5417110.25 5658324.127,5417106.071 5658321.781,5417104.226 5658320.745,5417093.266 5658315.008,5417091.265 5658313.961,5417085.335 5658310.857,5417060.44 5658326.26,5417064.68 5658327.52,5417088.83 5658336.46,5417088.52 5658337.31,5417102.92 5658342.65,5417103.26 5658341.83,5417111.76 5658345.51,5417121.662 5658349.583,5417121.878 5658349.672,5417125.217 5658351.119,5417131.761 5658353.388,5417137.589 5658356.276,5417142.166 5658359.67,5417146.599 5658364.988,5417151.395 5658370.641,5417150.853 5658371.392,5417152.59741167 5658373.52811061,5417154.92 5658376.37,5417155.18955743 5658376.89699992,5417154.919 5658376.371,5417155.814 5658378.111,5417157.051 5658380.297,5417158.004 5658382.304,5417159.014 5658384.47,5417159.775 5658386.619,5417160.629 5658389.278,5417161.5 5658399.49,5417160.773 5658404.194,5417159.41 5658413.02,5417158.853 5658414.442,5417153.671 5658427.659,5417153.67051161 5658427.6586943,5417153.67 5658427.66,5417152.73 5658427.07,5417149.993 5658436.599,5417148.81 5658439.42,5417149.233 5658439.67,5417148.36 5658440.81,5417146.41 5658446.6,5417144.321 5658453.127,5417144.32092232 5658453.13043826,5417154.59 5658458.01,5417154.99551047 5658455.8409905,5417155.446 5658453.413,5417157.23981414 5658448.75748237,5417157.22660892 5658448.57861162,5417157.22660849 5658448.57860592,5417157.22660865 5658448.57860812,5417157.128 5658447.265,5417157.64950997 5658446.06368023,5417157.64950961 5658446.06368108,5417158.314 5658444.533,5417172.322 5658417.957,5417174.99 5658418.57,5417175.23 5658417.74,5417176.696 5658412.61,5417177.875 5658408.488,5417178.76 5658405.39,5417178.1 5658393.55,5417178.08 5658393.36,5417177.11 5658384.95,5417178.151 5658384.915,5417178.14836289 5658384.91508866,5417178.12 5658384.83,5417177.91415246 5658383.81114117,5417176.927 5658378.944,5417176.603 5658377.341,5417176.73975922 5658378.01762048,5417176.6 5658377.34,5417176.51210558 5658376.89535766,5417176.428 5658376.483,5417175.235 5658370.602,5417171.577 5658362.886,5417170.762 5658360.107,5417168.522 5658357.989,5417166.042 5658355.047,5417164.137 5658352.264,5417162.642 5658351.593,5417160.702 5658350.843,5417160.05417889 5658350.5823586,5417158.82 5658350.09,5417158.82103105 5658350.0862195,5417159.50373263 5658350.36089455,5417158.818 5658350.085,5417159.055 5658349.214,5417155.754 5658347.679,5417156.78066321 5658348.15640928,5417155.7525011 5658347.6811561,5417155.161 5658348.532,5417149.028 5658343.237,5417152.26877967 5658346.03496647,5417149.03 5658343.24,5417148.78133339 5658343.06701453,5417148.108 5658342.603))
+ "POLYGON((5417085.33499 5658310.85699,5417060.44 5658326.26001,5417064.67999 5658327.52002,5417088.82999 5658336.46002,5417088.51999 5658337.31,5417102.92001 5658342.65002,5417103.26001 5658341.83002,5417111.76001 5658345.51001,5417121.66199 5658349.58301,5417121.87799 5658349.672,5417125.21701 5658351.11902,5417131.76099 5658353.388,5417137.58899 5658356.276,5417142.16599 5658359.66998,5417146.599 5658364.98798,5417151.39499 5658370.64099,5417150.853 5658371.39203,5417152.59741 5658373.52814,5417154.92001 5658376.37,5417155.18806 5658376.89407,5417155.814 5658378.11102,5417157.05099 5658380.297,5417158.004 5658382.30402,5417159.01401 5658384.46997,5417159.77499 5658386.61902,5417160.629 5658389.27802,5417161.5 5658399.48999,5417160.77301 5658404.19397,5417159.41 5658413.02002,5417158.853 5658414.44202,5417153.67099 5658427.659,5417153.6705 5658427.65869,5417153.67001 5658427.65997,5417152.73001 5658427.07001,5417149.99301 5658436.599,5417148.81 5658439.41998,5417149.233 5658439.66998,5417148.35999 5658440.81,5417146.41 5658446.59998,5417144.32101 5658453.12701,5417144.32092 5658453.13043,5417154.59 5658458.01001,5417154.99551 5658455.841,5417155.44601 5658453.41302,5417157.23981 5658448.75751,5417157.22662 5658448.57861,5417157.12799 5658447.26501,5417157.64951 5658446.06366,5417158.314 5658444.53302,5417172.32199 5658417.95697,5417174.98999 5658418.57001,5417175.23001 5658417.73999,5417176.69601 5658412.60999,5417177.875 5658408.48798,5417178.76001 5658405.39001,5417178.10001 5658393.54999,5417178.07999 5658393.35999,5417177.10999 5658384.95001,5417178.14837 5658384.91507,5417178.12 5658384.83002,5417177.91415 5658383.81116,5417176.927 5658378.94397,5417176.603 5658377.341,5417176.73975 5658378.01764,5417176.60001 5658377.34003,5417176.51212 5658376.89539,5417176.42801 5658376.48297,5417175.23499 5658370.60199,5417171.577 5658362.88599,5417170.76199 5658360.10699,5417168.522 5658357.98901,5417166.04199 5658355.047,5417164.13699 5658352.26398,5417162.642 5658351.59302,5417160.702 5658350.84302,5417160.05417 5658350.58234,5417158.82001 5658350.09003,5417158.82104 5658350.08625,5417158.81799 5658350.08502,5417159.05499 5658349.21399,5417155.754 5658347.67902,5417156.78067 5658348.15643,5417155.7525 5658347.68115,5417155.16101 5658348.53198,5417149.02802 5658343.237,5417152.26877 5658346.03497,5417149.03 5658343.23999,5417148.78134 5658343.06702,5417148.108 5658342.60303,5417139.01599 5658338.00897,5417126.79099 5658331.83301,5417116.29199 5658327.51801,5417112.871 5658325.59802,5417110.25 5658324.12701,5417106.07101 5658321.78101,5417104.22601 5658320.745,5417093.26599 5658315.008,5417091.26501 5658313.961,5417085.33499 5658310.85699))",
+ "POLYGON((5417148.36 5658440.81,5417146.41 5658446.6,5417144.321 5658453.127,5417144.32092 5658453.13044,5417154.59 5658458.01,5417154.99551 5658455.84099,5417155.446 5658453.413,5417157.23981 5658448.75748,5417157.22661 5658448.57861,5417157.128 5658447.265,5417157.64951 5658446.06368,5417158.31 5658444.53,5417172.32 5658417.96,5417172.32037 5658417.96009,5417172.322 5658417.957,5417174.99 5658418.57,5417175.23 5658417.74,5417176.696 5658412.61,5417177.875 5658408.488,5417178.76 5658405.39,5417178.1 5658393.55,5417178.08 5658393.36,5417177.11 5658384.95,5417178.14836 5658384.91509,5417178.12 5658384.83,5417177.91415 5658383.81114,5417176.927 5658378.944,5417176.73976 5658378.01762,5417176.6 5658377.34,5417176.51211 5658376.89536,5417176.428 5658376.483,5417175.235 5658370.602,5417171.577 5658362.886,5417171.26172 5658361.81094,5417170.76 5658360.11,5417168.52 5658357.99,5417166.04 5658355.05,5417165.25343 5658353.89499,5417164.137 5658352.264,5417162.642 5658351.593,5417160.702 5658350.843,5417160.05418 5658350.58236,5417158.82 5658350.09,5417158.82103 5658350.08622,5417158.818 5658350.085,5417159.055 5658349.214,5417156.78066 5658348.15641,5417155.7525 5658347.68116,5417155.161 5658348.532,5417152.26878 5658346.03497,5417149.03 5658343.24,5417148.78133 5658343.06701,5417148.108 5658342.603,5417139.016 5658338.009,5417126.791 5658331.833,5417121.76604 5658329.76779,5417116.29 5658327.52,5417112.87 5658325.6,5417110.25 5658324.13,5417106.60319 5658322.07976,5417106.071 5658321.781,5417105.81727 5658321.63853,5417104.23 5658320.75,5417093.61267 5658315.18946,5417093.266 5658315.008,5417091.265 5658313.961,5417085.9075 5658311.15667,5417085.34 5658310.86,5417060.44 5658326.26,5417064.68 5658327.52,5417088.83 5658336.46,5417088.52 5658337.31,5417102.92 5658342.65,5417103.26 5658341.83,5417111.76 5658345.51,5417121.66 5658349.58,5417121.88 5658349.67,5417125.22 5658351.12,5417125.33012 5658351.15822,5417131.761 5658353.388,5417137.589 5658356.276,5417139.98755 5658358.0546,5417142.17 5658359.67,5417145.96673 5658364.22951,5417146.599 5658364.988,5417147.11101 5658365.5915,5417151.4 5658370.64,5417151.13021 5658371.0079,5417150.853 5658371.392,5417152.5974 5658373.5281,5417154.92 5658376.37,5417155.18956 5658376.897,5417155.814 5658378.111,5417157.051 5658380.297,5417158.004 5658382.304,5417159.014 5658384.47,5417159.36624 5658385.46469,5417159.78 5658386.62,5417160.63 5658389.28,5417161.5 5658399.49,5417160.773 5658404.194,5417159.41 5658413.02,5417158.853 5658414.442,5417153.671 5658427.659,5417153.67051 5658427.65869,5417153.67 5658427.66,5417152.73 5658427.07,5417149.993 5658436.599,5417148.81 5658439.42,5417149.233 5658439.67,5417148.36 5658440.81))"
+ };
+
+// Coming from "robustness.xml"
+static std::string geos_2[2] =
+ {
+ "POLYGON((742605.987032656 5087763.72510381,742599.903121688 5087760.56016809,742598.666141033 5087762.50894352,742591.100910753 5087758.50480931,742586.861672536 5087766.63211263,742591.417801844 5087769.04526206,742592.428792606 5087767.35034731,742601.541294342 5087772.18101105,742605.987032656 5087763.72510381))",
+ "POLYGON((742601.541294537 5087772.18101068,742592.428792606 5087767.35034731,742589.944404072 5087771.51539701,742583.880455986 5087782.54873438,742582.81550675 5087784.27809355,742583.216887765 5087784.43459684,742582.99081514 5087785.0349637,742592.341351823 5087789.67654,742593.375823205 5087787.7060691,742599.28794443 5087776.4640487,742601.541294537 5087772.18101068))"
+ };
+
+// Coming from "robustness.xml"
+static std::string geos_3[2] =
+ {
+ "POLYGON ((613697.0000000041909516 2369267.9999981997534633, 613797.0000000043073669 2368322.9999981978908181, 613643.0000000041909516 2367807.9999981969594955, 613674.0000000041909516 2367405.9999981969594955, 613400.0000000041909516 2367299.9999981955625117, 613200.0000000040745363 2366813.9999981950968504, 613252.0000000040745363 2366474.9999981927685440, 613094.0000000040745363 2366400.9999981927685440, 612695.0000000039581209 2365506.9999981909058988, 612326.0000000038417056 2365402.9999981909058988, 612145.0000000037252903 2365470.9999981913715601, 612061.0000000037252903 2365967.9999981918372214, 611724.0000000036088750 2366168.9999981927685440, 611334.0000000034924597 2366316.9999981927685440, 610743.0000000033760443 2366221.9999981932342052, 610174.0000000031432137 2366305.9999981927685440, 609973.0000000031432137 2367066.9999981955625117, 609073.0000000027939677 2367938.9999981974251568, 609061.0000000027939677 2368332.9999981974251568, 609151.0000000027939677 2368684.9999981992878020, 608919.0000000027939677 2368811.9999982002191246, 608801.0000000026775524 2369192.9999982002191246, 609161.0000000027939677 2369096.9999982006847858, 609161.0000000027939677 2369509.9999982025474310, 609857.0000000030267984 2369498.9999982011504471, 609762.0000000030267984 2369689.9999982020817697, 610796.0000000033760443 2369794.9999982025474310, 611332.0000000034924597 2370097.9999982025474310, 613149.0000000040745363 2370460.9999982034787536, 613613.0000000041909516 2369720.9999982016161084, 613697.0000000041909516 2369267.9999981997534633))",
+ "POLYGON ((607216.0000000019790605 2370623.9999982002191246, 608128.0000000019790605 2370312.9999982002191246, 608317.0000000030267984 2370101.9999982002191246, 608328.0000000030267984 2369868.9999982002191246, 608644.0000000030267984 2369847.9999982002191246, 608801.0000000030267984 2369192.9999982002191246, 608919.0000000030267984 2368811.9999982002191246, 609151.0000000030267984 2368684.9999982002191246, 609061.0000000030267984 2368332.9999982002191246, 608602.0000000030267984 2368124.9999982002191246, 607980.0000000019790605 2367585.9999982002191246, 607295.0000000019790605 2367062.9999981899745762, 606251.0000000019790605 2366697.9999981899745762, 605456.0000000019790605 2367679.9999982002191246, 605108.0000000019790605 2368377.9999982002191246, 604906.0000000019790605 2369083.9999982002191246, 604191.0000000010477379 2369719.9999982002191246, 604107.0000000010477379 2370057.9999982002191246, 604264.0000000010477379 2370397.9999982002191246, 604141.0000000010477379 2370768.9999982002191246, 604561.0000000010477379 2370448.9999982002191246, 604940.0000000019790605 2370406.9999982002191246, 605460.0000000019790605 2370792.9999982002191246, 605942.0000000019790605 2370945.9999982099980116, 606364.0000000019790605 2370892.9999982002191246, 606881.0000000019790605 2370988.9999982002191246, 607216.0000000019790605 2370623.9999982002191246))"
+ };
+
+// Coming from "TestRobustOverlayFixed.xml"
+static std::string geos_4[2] =
+ {
+ "POLYGON ((545 317, 617 379, 581 321, 545 317))",
+ "POLYGON ((484 290, 558 359, 543 309, 484 290))"
+ };
+
+static std::string ticket_5103[2] =
+ {
+ "POLYGON((-92810838 3618230,-94606872 1822196,-94999302 2214626,-93203268 4010660,-92810838 3618230))",
+ "POLYGON((-95269304 222758,-95260668 419862,-95234760 615696,-95192088 808228,-95132906 996442,-95057214 1178814,-94966028 1354074,-94860110 1520444,-94739968 1676908,-94606618 1822450,-94999048 2214880,-95165164 2033778,-95314770 1838706,-95446850 1631442,-95560388 1413510,-95654368 1186434,-95728282 951992,-95781368 711962,-95813626 468376,-95824294 222758,-95269304 222758))"
+ };
+
+static std::string ticket_7462[2] =
+ {
+ "POLYGON((0 0 , -0.3681253195 0.9297761917 , 2.421203136 2.034152031 , 2.789328575 1.104375958 , 0 0))",
+ "POLYGON((2.76143527 1.093332171 , 2.076887131 1.822299719 , 4.263789177 3.875944376 , 4.948337555 3.146976948 , 2.76143527 1.093332171))"
+ };
+
+
+static std::string ticket_8254[2] =
+ {
+ "POLYGON((0 0,-0.27224111308522275232 0.19250353717521062613,-0.27224111308522275232 0.96219700082478931691,0 1.154700537999999943,0 0))",
+ "POLYGON((-0.27224111308522286334 0.57751061210314269534,-0.27201435369399112885 0.57735026899999997152,-0.27224111308522280783 0.57718992589685735872,-0.27224111308522286334 0.57751061210314269534))"
+ };
+
+static std::string ggl_list_20120229_volker[3] =
+ {
+ "POLYGON((1716 1554,2076 2250,2436 2352,2796 1248,3156 2484,3516 2688,3516 2688,3156 2484,2796 1248,2436 2352,2076 2250, 1716 1554))",
+ "POLYGON((2500 1600,2500 2300,3200 2300,3200 1600,2500 1600))",
+ "POLYGON((1716 1554,2076 2250,2436 2352,2796 1248,3156 2484,3516 2688,3156 2483,2796 1247,2436 2351,2076 2249, 1716 1554))",
+ };
+
+static std::string ggl_list_20120717_volker[2] =
+ {
+ "POLYGON((1031 1056,3232 1056,3232 2856,1031 2856))",
+ "POLYGON((1032 1458,1032 1212,2136 2328,3234 2220,3234 2412,2136 2646))"
+ };
+
+
+static std::string buffer_rt_a[2] =
+ {
+ "POLYGON((1 7,1 8,1.0012 8.04907,1.00482 8.09802,1.01082 8.14673,1.01921 8.19509,1.02997 8.24298,1.04306 8.29028,1.05846 8.33689,1.07612 8.38268,1.09601 8.42756,1.11808 8.4714,1.14227 8.5141,1.16853 8.55557,1.19679 8.5957,1.22699 8.63439,1.25905 8.67156,1.29289 8.70711,1.32844 8.74095,1.36561 8.77301,1.4043 8.80321,1.44443 8.83147,1.4859 8.85773,1.5286 8.88192,1.57244 8.90399,1.61732 8.92388,1.66311 8.94154,1.70972 8.95694,1.75702 8.97003,1.80491 8.98079,1.85327 8.98918,1.90198 8.99518,1.95093 8.9988,2 9,3 9,3.04907 8.9988,3.09802 8.99518,3.14673 8.98918,3.19509 8.98079,3.24298 8.97003,3.29028 8.95694,3.33689 8.94154,3.38268 8.92388,3.42756 8.90399,3.4714 8.88192,3.5141 8.85773,3.55557 8.83147,3.5957 8.80321,3.63439 8.77301,3.67156 8.74095,3.70711 8.70711,3.74095 8.67156,3.77301 8.63439,3.80321 8.5957,3.83147 8.55557,3.85773 8.5141,3.88192 8.4714,3.90399 8.42756,3.92388 8.38268,3.94154 8.33689,3.95694 8.29028,3.97003 8.24298,3.98079 8.19509,3.98918 8.14673,3.99518 8.09802,3.9988 8.04907,4 8,4 7,3.9988 6.95093,3.99518 6.90198,3.98918 6.85327,3.98079 6.80491,3.97003 6.75702,3.95694 6.70972,3.94154 6.66311,3.92388 6.61732,3.90399 6.57244,3.88192 6.5286,3.85773 6.4859,3.83147 6.44443,3.80321 6.4043,3.77301 6.36561,3.74095 6.32844,3.70711 6.29289,3.67156 6.25905,3.63439 6.22699,3.5957 6.19679,3.55557 6.16853,3.5141 6.14227,3.4714 6.11808,3.42756 6.09601,3.38268 6.07612,3.33689 6.05846,3.29028 6.04306,3.24298 6.02997,3.19509 6.01921,3.14673 6.01082,3.09802 6.00482,3.04907 6.0012,3 6,2 6,1.95093 6.0012,1.90198 6.00482,1.85327 6.01082,1.80491 6.01921,1.75702 6.02997,1.70972 6.04306,1.66311 6.05846,1.61732 6.07612,1.57244 6.09601,1.5286 6.11808,1.4859 6.14227,1.44443 6.16853,1.4043 6.19679,1.36561 6.22699,1.32844 6.25905,1.29289 6.29289,1.25905 6.32844,1.22699 6.36561,1.19679 6.4043,1.16853 6.44443,1.14227 6.4859,1.11808 6.5286,1.09601 6.57244,1.07612 6.61732,1.05846 6.66311,1.04306 6.70972,1.02997 6.75702,1.01921 6.80491,1.01082 6.85327,1.00482 6.90198,1.0012 6.95093,1 7))",
+ "POLYGON((3 6,4 6,4.04907 5.9988,4.09802 5.99518,4.14673 5.98918,4.19509 5.98079,4.24298 5.97003,4.29028 5.95694,4.33689 5.94154,4.38268 5.92388,4.42756 5.90399,4.4714 5.88192,4.5141 5.85773,4.55557 5.83147,4.5957 5.80321,4.63439 5.77301,4.67156 5.74095,4.70711 5.70711,4.74095 5.67156,4.77301 5.63439,4.80321 5.5957,4.83147 5.55557,4.85773 5.5141,4.88192 5.4714,4.90399 5.42756,4.92388 5.38268,4.94154 5.33689,4.95694 5.29028,4.97003 5.24298,4.98079 5.19509,4.98918 5.14673,4.99518 5.09802,4.9988 5.04907,5 5,5 4,4.9988 3.95093,4.99518 3.90198,4.98918 3.85327,4.98079 3.80491,4.97003 3.75702,4.95694 3.70972,4.94154 3.66311,4.92388 3.61732,4.90399 3.57244,4.88192 3.5286,4.85773 3.4859,4.83147 3.44443,4.80321 3.4043,4.77301 3.36561,4.74095 3.32844,4.70711 3.29289,4.67156 3.25905,4.63439 3.22699,4.5957 3.19679,4.55557 3.16853,4.5141 3.14227,4.4714 3.11808,4.42756 3.09601,4.38268 3.07612,4.33689 3.05846,4.29028 3.04306,4.24298 3.02997,4.19509 3.01921,4.14673 3.01082,4.09802 3.00482,4.04907 3.0012,4 3,3 3,3 3,2 3,1.95093 3.0012,1.90198 3.00482,1.85327 3.01082,1.80491 3.01921,1.75702 3.02997,1.70972 3.04306,1.66311 3.05846,1.61732 3.07612,1.57244 3.09601,1.5286 3.11808,1.4859 3.14227,1.44443 3.16853,1.4043 3.19679,1.36561 3.22699,1.32844 3.25905,1.29289 3.29289,1.25905 3.32844,1.22699 3.36561,1.19679 3.4043,1.16853 3.44443,1.14227 3.4859,1.11808 3.5286,1.09601 3.57244,1.07612 3.61732,1.05846 3.66311,1.04306 3.70972,1.02997 3.75702,1.01921 3.80491,1.01082 3.85327,1.00482 3.90198,1.0012 3.95093,1 4,1 5,1.0012 5.04907,1.00482 5.09802,1.01082 5.14673,1.01921 5.19509,1.02997 5.24298,1.04306 5.29028,1.05846 5.33689,1.07612 5.38268,1.09601 5.42756,1.11808 5.4714,1.14227 5.5141,1.16853 5.55557,1.19679 5.5957,1.22699 5.63439,1.25905 5.67156,1.29289 5.70711,1.32844 5.74095,1.36561 5.77301,1.4043 5.80321,1.44443 5.83147,1.4859 5.85773,1.5286 5.88192,1.57244 5.90399,1.61732 5.92388,1.66311 5.94154,1.70972 5.95694,1.75702 5.97003,1.80491 5.98079,1.85327 5.98918,1.90198 5.99518,1.95093 5.9988,2 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6,3 6))"
+ };
+
+static std::string buffer_rt_f[2] =
+ {
+ "POLYGON((-0.29999999999999999 6.0000000000000000,-0.29999999999999999 7.0000000000000000,-0.30000000000000027 7.7242640687119302,0.21213203435596423 7.2121320343559638,1.2121320343559643 6.2121320343559638,1.7242640687119293 5.7000000000000002,1.0000000000000000 5.7000000000000002,0.00000000000000000 5.7000000000000002,-0.30000000000000027 5.7000000000000002,-0.29999999999999999 6.0000000000000000))",
+ "POLYGON((1.3000000000000000 9.0000000000000000,1.3000000000000000 8.0000000000000000,1.3000000000000007 7.7000000000000002,1.0000000000000000 7.7000000000000002,0.00000000000000000 7.7000000000000002,-0.29999999999999982 7.7000000000000002,-0.29999999999999999 8.0000000000000000,-0.29999999999999999 9.0000000000000000,-0.29999999999999982 9.3000000000000007,0.00000000000000000 9.3000000000000007,1.0000000000000000 9.3000000000000007,1.3000000000000007 9.3000000000000007,1.3000000000000000 9.0000000000000000))"
+ };
+
+static std::string buffer_rt_g[2] =
+ {
+ "POLYGON((2.0 8.0,2.0 9.0,2.0 10.0,3.0 10.0,4.0 10.0,6.4142135623730958 10.0,4.7071067811865479 8.2928932188134521,3.7071067811865475 7.2928932188134521,2.0 5.5857864376269051,2.0 8.0))",
+ "POLYGON((0.0 6.0,0.0 7.0,0.0 8.0,1.0 8.0,2.0 8.0,4.4142135623730958 8.0,2.7071067811865475 6.2928932188134521,1.7071067811865475 5.2928932188134521,-0.0 3.5857864376269042,0.0 6.0))"
+ };
+
+static std::string buffer_rt_g_boxes[5] =
+ {
+ "POLYGON((0 0,0 4,4 4,4 0,0 0))",
+ "POLYGON((2 2,2 4,6 4,6 2,2 2))",
+ "POLYGON((2 2,2 4,6 4,8 4,8 2,2 2))",
+ "POLYGON((2 2,2 4,6 4,6 6,8 6,8 2,2 2))",
+
+ "POLYGON((0 0,0 4,4 4,4 5,5 5,5 1,4 1,4 0,0 0))"
+ };
+
+// From buffer-robustness-test with segment-intersection "touching" with r ~ 1.16
+static std::string buffer_rt_i[2] =
+ {
+ "POLYGON((1.0 1.0,1.0 2.0,1.0 3.0,2.0 3.0,3.0 3.0,5.4142135623730949 3.0,3.7071067811865475 1.2928932188134525,2.7071067811865475 0.29289321881345254,1.0 -1.4142135623730949,1.0 1.0))",
+ "POLYGON((2.0 2.0,2.0 3.0,2.0 4.0,3.0 4.0,4.0 4.0,6.4142135623730958 4.0,4.7071067811865479 2.2928932188134525,3.7071067811865475 1.2928932188134525,2.0 -0.41421356237309387,2.0 2.0))"
+ };
+
+// Idem, but with a touch-in-the-middle
+static std::string buffer_rt_j[2] =
+ {
+ "POLYGON((1.0 4.0,1.0 5.0,1.0 6.0,2.0 6.0,3.0 6.0,5.4142135623730967 6.0,3.7071067811865475 4.2928932188134521,2.7071067811865475 3.2928932188134525,1.0 1.5857864376269055,1.0 4.0))",
+ "POLYGON((-1.0 2.0,-1.0 3.0,-1.0 4.0,0.00 4.0,1.0 4.0,3.4142135623730949 4.0,1.7071067811865475 2.2928932188134525,0.70710678118654746 1.2928932188134525,-1.0 -0.41421356237309492,-1.0 2.0))"
+ };
+
+// Nearly-collinear (two segments as-if meeting but not really)
+static std::string buffer_rt_l[2] =
+ {
+ "POLYGON((1.0 5.0,1.0 6.0,1.0 8.4142135623730958,2.7071067811865475 6.7071067811865479,3.7071067811865475 5.7071067811865479,5.4142135623730958 4.0,3.0 4.0,2.0 4.0,1.0 4.0,1.0 5.0))",
+ "POLYGON((5.0 1.0,5.0 2.0,5.0 4.4142135623730958,6.7071067811865479 2.7071067811865475,7.7071067811865479 1.7071067811865475,9.4142135623730958 0.00,7.0 0.0,6.0 0.0,5.0 0.0,5.0 1.0))"
+ };
+
+static std::string buffer_rt_m1[2] =
+ {
+ "POLYGON((3.0 2.0,3.0 3.0,3.0 5.4142135623730940,4.7071067811865479 3.7071067811865475,5.7071067811865479 2.7071067811865475,7.4142135623730940 1.0,5.0 1.0,4.0 1.0,3.0 1.0,3.0 2.0))",
+ "POLYGON((0.29289321881345254 2.7071067811865475,1.2928932188134525 3.7071067811865475,3.0 5.4142135623730949,3.0 3.0,3.0 2.0,3.0 1.0,2.0 1.0,1.0 1.0,-1.4142135623730949 1.0,0.29289321881345254 2.7071067811865475))"
+ };
+
+static std::string buffer_rt_m2[2] =
+ {
+ "POLYGON((-0.70710678118654746 3.7071067811865475,0.29289321881345254 4.7071067811865479,2.0 6.4142135623730967,2.0 4.0,2.0 3.0,2.0 2.0,1.0 2.0,0.00 2.0,-2.4142135623730949 2.0,-0.70710678118654746 3.7071067811865475))",
+ "POLYGON((2.2928932188134525 6.7071067811865479,3.2928932188134525 7.7071067811865479,5.0 9.4142135623730958,5.0 7.0,5.0 6.0,5.0 6.0,5.0 5.0,5.0 4.0,4.0 4.0,3.0 4.0,2.0 4.0,2.0 5.0,2.0 6.0,2.0 6.4142135623730958,2.2928932188134525 6.7071067811865479))"
+ };
+
+
+static std::string buffer_rt_n[2] =
+ {
+ "POLYGON((-0.70710678118654746 0.70710678118654746,0.29289321881345254 1.7071067811865475,2.0 3.4142135623730949,2.0 1.0,2.0 0.0,2.0 -1.0,1.0 -1.0,0.00 -1.0,-2.4142135623730949 -1.0,-0.70710678118654746 0.70710678118654746))",
+ "POLYGON((2.2928932188134525 3.7071067811865475,3.2928932188134525 4.7071067811865479,5.0 6.4142135623730958,5.0 4.0,5.0 3.0,5.0 2.0,4.0 2.0,3.0 2.0,0.58578643762690574 2.0,2.2928932188134525 3.7071067811865475))"
+ };
+
+static std::string buffer_rt_q[2] =
+ {
+ "POLYGON((6.0 6.0,7.0 6.0,9.4142135623730958 6.0,7.7071067811865479 4.2928932188134521,6.7071067811865479 3.2928932188134525,6.4142135623730949 3.0,6.0 3.0,5.0 3.0,4.0 3.0,4.0 4.0,4.0 5.0,4.0 6.0,5.0 6.0,6.0 6.0))",
+ "POLYGON((3.0 2.0,3.0 3.0,3.0 4.0,4.0 4.0,5.0 4.0,7.4142135623730958 4.0,5.7071067811865479 2.2928932188134525,4.7071067811865479 1.2928932188134525,3.0 -0.41421356237309581,3.0 2.0))"
+ };
+
+static std::string buffer_rt_r[2] =
+ {
+ "POLYGON((3.7071067811865475 0.29289321881345254,2.7071067811865475 -0.70710678118654746,2.0 -1.4142135623730949,1.2928932188134525 -0.70710678118654746,0.29289321881345254 0.29289321881345254,-0.41421356237309492 1.0,0.29289321881345254 1.7071067811865475,1.2928932188134525 2.7071067811865475,2.0000000000000004 3.4142135623730954,2.7071067811865475 2.7071067811865475,3.7071067811865475 1.7071067811865475,4.4142135623730958 1.0000000000000004,3.7071067811865475 0.29289321881345254))",
+ "POLYGON((5.7071067811865479 2.2928932188134525,4.7071067811865479 1.2928932188134525,4.4142135623730958 1.0,4.0 1.0,3.0 1.0,1.3819660112501053 1.0,2.1055728090000843 2.4472135954999579,3.1055728090000843 4.4472135954999583,3.7260485282911020 5.6881650340819956,4.7071067811865479 4.7071067811865479,5.7071067811865479 3.7071067811865475,6.4142135623730958 3.0,5.7071067811865479 2.2928932188134525))"
+ };
+
+
+static std::string buffer_rt_t[2] =
+ {
+ "POLYGON((0.00000000000000000 3.0,0.00000000000000000 4.0,0.00000000000000000 6.4142135623730958,1.7071067811865475 4.7071067811865479,2.7071067811865475 3.7071067811865475,4.4142135623730940 2.0,2.0 2.0,1.0 2.0,-0.00000000000000000 2.0,0.00000000000000000 3.0))",
+ "POLYGON((1.7071067811865475 3.2928932188134525,0.70710678118654746 2.2928932188134525,-1.0 0.58578643762690508,-1.0 3.0,-1.0 4.0,-1.0 4.0,-1.0 5.0,-1.0 7.4142135623730958,0.70710678118654746 5.7071067811865479,1.7071067811865475 4.7071067811865479,2.4142135623730954 4.0,1.7071067811865475 3.2928932188134525))"
+ };
+
+// Two circles, causing problems in sectionalize. Fixed by adding small buffer
+static std::string buffer_mp1[2] =
+ {
+ "POLYGON((7 5,6.989043790736547 4.790943073464693,6.956295201467611 4.584176618364482,6.902113032590307 4.381966011250105,6.827090915285202 4.1865267138484,6.732050807568878 4,6.618033988749895 3.824429495415054,6.486289650954788 3.661738787282284,6.338261212717717 3.513710349045212,6.175570504584946 3.381966011250105,6 3.267949192431122,5.8134732861516 3.172909084714799,5.618033988749895 3.097886967409693,5.415823381635519 3.043704798532389,5.209056926535308 3.010956209263453,5.000000000000001 3,4.790943073464693 3.010956209263453,4.584176618364483 3.043704798532389,4.381966011250106 3.097886967409693,4.186526713848401 3.172909084714798,4.00 3.267949192431122,3.824429495415055 3.381966011250104,3.661738787282284 3.513710349045211,3.513710349045212 3.661738787282284,3.381966011250105 3.824429495415053,3.267949192431122 4,3.172909084714798 4.1865267138484,3.097886967409693 4.381966011250106,3.043704798532389 4.584176618364483,3.010956209263453 4.790943073464694,3 5.00,3.010956209263453 5.209056926535308,3.043704798532389 5.415823381635521,3.097886967409694 5.618033988749897,3.172909084714799 5.813473286151603,3.267949192431124 6.00,3.381966011250107 6.175570504584949,3.513710349045214 6.338261212717719,3.661738787282286 6.486289650954791,3.824429495415056 6.618033988749897,4.00 6.732050807568879,4.186526713848402 6.827090915285202,4.381966011250107 6.902113032590307,4.584176618364483 6.956295201467611,4.790943073464693 6.989043790736547,5 7,5.209056926535306 6.989043790736547,5.415823381635518 6.956295201467611,5.618033988749893 6.902113032590307,5.813473286151598 6.827090915285202,6.00 6.732050807568879,6.175570504584943 6.618033988749897,6.338261212717713 6.486289650954792,6.486289650954785 6.33826121271772,6.618033988749891 6.175570504584951,6.732050807568874 6.00,6.827090915285199 5.813473286151607,6.902113032590305 5.618033988749902,6.95629520146761 5.415823381635526,6.989043790736545 5.209056926535316,7 5))",
+ "POLYGON((9 7,8.989043790736547 6.790943073464693,8.956295201467611 6.584176618364482,8.902113032590307 6.381966011250105,8.827090915285202 6.1865267138484,8.732050807568877 6,8.618033988749895 5.824429495415053,8.486289650954788 5.661738787282284,8.338261212717717 5.513710349045212,8.175570504584947 5.381966011250105,8 5.267949192431122,7.8134732861516 5.172909084714799,7.618033988749895 5.097886967409693,7.415823381635519 5.043704798532389,7.209056926535308 5.010956209263453,7.000000000000001 5,6.790943073464693 5.010956209263453,6.584176618364483 5.043704798532389,6.381966011250106 5.097886967409693,6.186526713848401 5.172909084714798,6.00 5.267949192431122,5.824429495415055 5.381966011250104,5.661738787282284 5.513710349045211,5.513710349045212 5.661738787282284,5.381966011250105 5.824429495415053,5.267949192431122 6,5.172909084714798 6.1865267138484,5.097886967409693 6.381966011250106,5.043704798532389 6.584176618364483,5.010956209263453 6.790943073464694,5 7.00,5.010956209263453 7.209056926535308,5.043704798532389 7.415823381635521,5.097886967409694 7.618033988749897,5.172909084714799 7.813473286151603,5.267949192431124 8.00,5.381966011250107 8.175570504584949,5.513710349045214 8.338261212717718,5.661738787282286 8.486289650954792,5.824429495415057 8.618033988749897,6.00 8.732050807568879,6.186526713848402 8.827090915285202,6.381966011250107 8.902113032590307,6.584176618364483 8.956295201467611,6.790943073464693 8.989043790736547,7 9,7.209056926535306 8.989043790736547,7.415823381635518 8.956295201467611,7.618033988749893 8.902113032590307,7.813473286151598 8.827090915285202,8.00 8.732050807568879,8.175570504584943 8.618033988749897,8.338261212717713 8.486289650954792,8.486289650954785 8.33826121271772,8.618033988749891 8.17557050458495,8.732050807568875 8.00,8.827090915285199 7.813473286151607,8.902113032590306 7.618033988749902,8.95629520146761 7.415823381635526,8.989043790736545 7.209056926535316,9 7))"
+ };
+
+// Union of two circles, unioned with third circle, having undetected inner polygon
+// This is a robustness issue in get_turn_info, collinear_opposite, fixed by checking consistency
+static std::string buffer_mp2[2] =
+ {
+ "POLYGON((7 8,6.9949042292205075 7.8573216336015355,6.9796428837618656 7.7153703234534294,6.954293731942319 7.5748694208940464,6.918985947228995 7.4365348863171405,6.8738994499995236 7.301071640801803,6.8192639907090369 7.1691699739962269,6.7553579791345113 7.0415020265598862,6.682507065662362 6.9187183650888047,6.6010824818487208 6.8014446669773063,6.5114991487085163 6.6902785321094296,6.4142135623730949 6.5857864376269051,6.3097214678905704 6.4885008512914837,6.1985553330226946 6.3989175181512792,6.0812816349111953 6.317492934337638,5.9584979734401138 6.2446420208654887,5.8308300260037731 6.180736009290964,5.698928359198197 6.1261005500004764,5.5634651136828603 6.081014052771005,5.4251305791059536 6.045706268057681,5.2846296765465715 6.0203571162381344,5.1426783663984654 6.0050957707794925,5.0000000000000009 6,4.8573216336015363 6.0050957707794925,4.7153703234534312 6.0203571162381344,4.5748694208940481 6.045706268057681,4.4365348863171423 6.081014052771005,4.3010716408018048 6.1261005500004764,4.1691699739962287 6.1807360092909622,4.041502026559888 6.2446420208654878,3.9187183650888064 6.3174929343376363,3.8014446669773077 6.3989175181512783,3.6902785321094314 6.4885008512914819,3.5857864376269064 6.5857864376269033,3.4885008512914846 6.6902785321094278,3.3989175181512805 6.8014446669773045,3.3174929343376389 6.9187183650888029,3.2446420208654896 7.0415020265598844,3.180736009290964 7.1691699739962251,3.1261005500004773 7.3010716408018013,3.0810140527710059 7.4365348863171379,3.0457062680576819 7.5748694208940437,3.0203571162381349 7.7153703234534268,3.0050957707794934 7.8573216336015328,3 7.9999999999999973,3.0050957707794925 8.1426783663984619,3.0203571162381344 8.284629676546567,3.0457062680576801 8.4251305791059501,3.0810140527710042 8.5634651136828559,3.1261005500004755 8.6989283591981934,3.1807360092909618 8.8308300260037704,3.2446420208654869 8.9584979734401102,3.3174929343376358 9.0812816349111927,3.398917518151277 9.198555333022691,3.488500851291481 9.3097214678905669,3.5857864376269024 9.4142135623730923,3.6902785321094269 9.5114991487085145,3.8014446669773028 9.601082481848719,3.918718365088802 9.6825070656623602,4.0415020265598844 9.7553579791345104,4.169169973996226 9.819263990709036,4.301071640801803 9.8738994499995236,4.4365348863171405 9.918985947228995,4.5748694208940472 9.9542937319423199,4.7153703234534312 9.9796428837618656,4.8573216336015381 9.9949042292205075,5.0000000000000036 10,5.142678366398469 9.9949042292205075,5.284629676546575 9.9796428837618656,5.425130579105959 9.9542937319423181,5.5634651136828657 9.9189859472289932,5.6989283591982032 9.8738994499995201,5.8308300260037802 9.8192639907090324,5.9584979734401209 9.7553579791345069,6.0812816349112033 9.6825070656623566,6.1985553330227017 9.6010824818487137,6.3097214678905784 9.5114991487085092,6.4142135623731038 9.4142135623730869,6.5114991487085252 9.3097214678905598,6.6010824818487288 9.1985553330226821,6.68250706566237 9.0812816349111838,6.7553579791345184 8.9584979734400996,6.8192639907090431 8.830830026003758,6.873899449999529 8.698928359198181,6.9189859472290003 8.5634651136828417,6.9542937319423235 8.4251305791059359,6.9796428837618683 8.284629676546551,6.9949042292205084 8.1426783663984441,7 8))",
+ "POLYGON((7.281120925915111 9.019979886500282,7.142678366398465 9.005095770779493,7.000000000000001 9,6.857321633601536 9.005095770779493,6.715370323453431 9.020357116238134,6.574869420894048 9.04570626805768,6.436534886317142 9.081014052771005,6.301071640801805 9.126100550000476,6.169169973996229 9.180736009290962,6.041502026559888 9.244642020865488,5.918718365088806 9.317492934337636,5.801444666977307 9.398917518151277,5.690278532109431 9.488500851291482,5.585786437626906 9.585786437626904,5.488500851291485 9.690278532109428,5.398917518151281 9.801444666977304,5.317492934337639 9.918718365088804,5.24464202086549 10.04150202655988,5.180736009290964 10.16916997399622,5.126100550000477 10.3010716408018,5.081014052771006 10.43653488631714,5.045706268057682 10.57486942089405,5.020357116238134 10.71537032345343,5.005095770779493 10.85732163360153,5 11,5.005095770779493 11.14267836639846,5.020357116238134 11.28462967654657,5.04570626805768 11.42513057910595,5.081014052771004 11.56346511368286,5.126100550000476 11.69892835919819,5.180736009290962 11.83083002600377,5.244642020865487 11.95849797344011,5.317492934337636 12.08128163491119,5.398917518151277 12.19855533302269,5.488500851291481 12.30972146789057,5.585786437626902 12.41421356237309,5.690278532109427 12.51149914870852,5.801444666977303 12.60108248184872,5.918718365088802 12.68250706566236,6.041502026559884 12.75535797913451,6.169169973996226 12.81926399070904,6.301071640801803 12.87389944999952,6.436534886317141 12.918985947229,6.574869420894047 12.95429373194232,6.715370323453431 12.97964288376187,6.857321633601538 12.99490422922051,7.000000000000004 13,7.142678366398469 12.99490422922051,7.284629676546575 12.97964288376187,7.425130579105959 12.95429373194232,7.563465113682866 12.91898594722899,7.698928359198203 12.87389944999952,7.83083002600378 12.81926399070903,7.958497973440121 12.75535797913451,8.081281634911203 12.68250706566236,8.198555333022702 12.60108248184871,8.309721467890579 12.51149914870851,8.414213562373103 12.41421356237309,8.511499148708525 12.30972146789056,8.60108248184873 12.19855533302268,8.682507065662371 12.08128163491118,8.755357979134519 11.9584979734401,8.819263990709043 11.83083002600376,8.873899449999529 11.69892835919818,8.918985947229 11.56346511368284,8.954293731942324 11.42513057910594,8.979642883761869 11.28462967654655,8.994904229220509 11.14267836639844,9 11,8.994904229220508 10.85732163360154,8.979642883761866 10.71537032345343,8.954293731942318 10.57486942089405,8.918985947228995 10.43653488631714,8.873899449999524 10.3010716408018,8.819263990709036 10.16916997399623,8.755357979134512 10.04150202655989,8.718879074084889 9.980020113499718,8.857321633601538 9.994904229220508,9.000000000000004 10,9.142678366398469 9.994904229220508,9.284629676546576 9.979642883761866,9.425130579105959 9.954293731942318,9.563465113682865 9.918985947228993,9.698928359198204 9.87389944999952,9.830830026003779 9.819263990709032,9.958497973440121 9.755357979134507,10.0812816349112 9.682507065662357,10.1985553330227 9.601082481848714,10.30972146789058 9.511499148708509,10.4142135623731 9.414213562373087,10.51149914870853 9.30972146789056,10.60108248184873 9.198555333022682,10.68250706566237 9.081281634911184,10.75535797913452 8.9584979734401,10.81926399070904 8.830830026003758,10.87389944999953 8.698928359198181,10.918985947229 8.563465113682842,10.95429373194232 8.425130579105936,10.97964288376187 8.284629676546551,10.99490422922051 8.142678366398444,11 8,10.99490422922051 7.857321633601536,10.97964288376187 7.715370323453429,10.95429373194232 7.574869420894046,10.918985947229 7.436534886317141,10.87389944999952 7.301071640801803,10.81926399070904 7.169169973996227,10.75535797913451 7.041502026559886,10.68250706566236 6.918718365088805,10.60108248184872 6.801444666977306,10.51149914870852 6.69027853210943,10.4142135623731 6.585786437626905,10.30972146789057 6.488500851291484,10.1985553330227 6.398917518151279,10.0812816349112 6.317492934337638,9.958497973440114 6.244642020865489,9.830830026003774 6.180736009290964,9.698928359198197 6.126100550000476,9.56346511368286 6.081014052771005,9.425130579105954 6.045706268057681,9.284629676546571 6.020357116238134,9.142678366398465 6.005095770779493,9.000000000000002 6,8.857321633601536 6.005095770779493,8.715370323453431 6.020357116238134,8.574869420894048 6.045706268057681,8.436534886317142 6.081014052771005,8.301071640801805 6.126100550000476,8.169169973996228 6.180736009290962,8.041502026559888 6.244642020865488,7.918718365088806 6.317492934337636,7.801444666977307 6.398917518151278,7.690278532109431 6.488500851291482,7.585786437626906 6.585786437626903,7.488500851291485 6.690278532109428,7.398917518151281 6.801444666977305,7.317492934337639 6.918718365088803,7.24464202086549 7.041502026559884,7.180736009290964 7.169169973996225,7.126100550000477 7.301071640801801,7.081014052771006 7.436534886317138,7.045706268057682 7.574869420894044,7.020357116238134 7.715370323453427,7.005095770779493 7.857321633601533,7 7.999999999999997,7.005095770779493 8.142678366398462,7.020357116238134 8.284629676546567,7.04570626805768 8.42513057910595,7.081014052771004 8.563465113682856,7.126100550000476 8.698928359198193,7.180736009290962 8.83083002600377,7.244642020865487 8.95849797344011,7.281120925915111 9.019979886500282))"
+ };
+
+static std::string collinear_opposite_right[2] =
+ {
+ "POLYGON((7 6,7 8,8 9,8 5,7 6))",
+ "POLYGON((5.9 5.9,5.9 10.1,7 9,7 7,5.9 5.9))"
+ };
+
+static std::string collinear_opposite_left[2] =
+ {
+ "POLYGON((7 6,7 8,6 9,8 11,8 5,7 6))",
+ "POLYGON((5 7,7 9,7 7,9 5,8 4,5 7))"
+ };
+
+static std::string collinear_opposite_straight[2] =
+ {
+ "POLYGON((7 6,7 8,7 9,8 8,8 7,7 6))",
+ "POLYGON((6 6,6 9,7 10,7 7,7 5,6 6))"
+ };
+
+
+#endif // BOOST_GEOMETRY_TEST_OVERLAY_CASES_HPP
diff --git a/libs/geometry/test/algorithms/overlay/overlay_common.hpp b/libs/geometry/test/algorithms/overlay/overlay_common.hpp
new file mode 100644
index 000000000..01fd109e5
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/overlay_common.hpp
@@ -0,0 +1,464 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2012 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)
+
+
+#ifndef BOOST_GEOMETRY_TEST_OVERLAY_COMMON_HPP
+#define BOOST_GEOMETRY_TEST_OVERLAY_COMMON_HPP
+
+
+#if defined(_MSC_VER)
+// We deliberately mix float/double's here so turn off warning
+#pragma warning( disable : 4244 )
+
+#endif // defined(_MSC_VER)
+
+
+
+#include <boost/geometry/algorithms/correct.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/io/wkt/write.hpp>
+
+
+#if defined(TEST_WITH_SVG)
+# include <boost/geometry/io/svg/svg_mapper.hpp>
+#endif
+
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian);
+
+
+
+template <typename G1, typename G2, typename Functor, typename T>
+void test_overlay(std::string const& id, T const& expected,
+ std::string const& wkt1, std::string const& wkt2,
+ double precision = 0.001)
+{
+ if (wkt1.empty() || wkt2.empty())
+ {
+ return;
+ }
+
+ G1 g1;
+ bg::read_wkt(wkt1, g1);
+
+ G2 g2;
+ bg::read_wkt(wkt2, g2);
+
+ bg::correct(g1);
+ bg::correct(g2);
+
+ //std::cout << bg::wkt(g1) << std::endl;
+ //std::cout << bg::wkt(g2) << std::endl;
+
+ // Try the overlay-function in both ways
+ std::string caseid = id;
+//goto case_reversed;
+
+#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
+ std::cout << std::endl << std::endl << "# " << caseid << std::endl;
+#endif
+ Functor::template apply(caseid, expected, g1, g2, precision);
+
+#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
+ return;
+#endif
+
+//case_reversed:
+#if ! defined(BOOST_GEOMETRY_TEST_OVERLAY_NOT_EXCHANGED)
+ caseid = id + "_rev";
+#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
+ std::cout << std::endl << std::endl << "# " << caseid << std::endl;
+#endif
+
+ Functor::template apply(caseid, expected, g2, g1, precision);
+#endif
+}
+
+
+#if ! defined(BOOST_GEOMETRY_TEST_MULTI)
+
+template <typename P, typename Functor, typename T>
+void test_all(std::vector<T> const& expected)
+{
+ typedef bg::model::polygon<P> polygon;
+ typedef bg::model::linestring<P> linestring;
+ typedef bg::model::box<P> box;
+
+ // compilation test only, will not output
+ //test_overlay<box, polygon, Functor>("", "", "", "");
+ typename boost::range_const_iterator<std::vector<T> >::type iterator
+ = boost::begin(expected);
+
+
+#ifndef ONLY_CASE_BRANDON
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("1", *iterator,
+ "POLYGON((0 1,2 5,5 3,0 1))",
+ "POLYGON((3 0,0 3,4 5,3 0))");
+ iterator++;
+
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("2", *iterator,
+ "POLYGON((0 2,2 5,5 3,3 0,0 2))",
+ "POLYGON((0 4,4 5,5 1,1 0,0 4))");
+ iterator++;
+
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("3", *iterator,
+ "POLYGON((1 2,2 4,4 3,3 1,1 2))",
+ "POLYGON((1 1,1 4,4 4,4 1,1 1))");
+ test_overlay<polygon, box, Functor>("3b", *iterator,
+ "POLYGON((1 2,2 4,4 3,3 1,1 2))",
+ "BOX(1 1,4 4)");
+ iterator++;
+
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("4", *iterator,
+ "POLYGON((0 2,2 5,5 3,3 0,0 2))",
+ "POLYGON((0 4,4 5,5 1,1 0,0 4),(1 1,2 1,2 2,1 2,1 1),(3 3,4 3,4 4,3 4,3 3))");
+ iterator++;
+
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("5", *iterator,
+ "POLYGON((0 4,1 5,2.5 4,3.5 5,5 4,4 3,5 2,4 1,3.5 0,3 1,2.5 0,2 1,1.5 0,1 3.5,0.25 3,1 2.5,0 2,0 4))",
+ "POLYGON((0.5 0.5,0.5 4.5,4.5 4.5,4.5 0.5,0.5 0.5))"
+ );
+ test_overlay<polygon, box, Functor>("5b", *iterator,
+ "POLYGON((0 4,1 5,2.5 4,3.5 5,5 4,4 3,5 2,4 1,3.5 0,3 1,2.5 0,2 1,1.5 0,1 3.5,0.25 3,1 2.5,0 2,0 4))",
+ "BOX(0.5 0.5,4.5 4.5)"
+ );
+ iterator++;
+
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("6", *iterator,
+ "POLYGON((0 1,2 5,5 2,0 1))",
+ "POLYGON((1 3,2 5,5 2,1 3))");
+ iterator++;
+
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("7", *iterator,
+ "POLYGON((0 1,1 3,5 2,0 1))",
+ "POLYGON((1 3,2 5,5 2,1 3))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("8", *iterator,
+ "POLYGON((0 0,0 4,4 0,0 0))",
+ "POLYGON((1 3,4 4,3 1,1 3))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("9", *iterator,
+ "POLYGON((0 0,0 4,4 0,0 0))",
+ "POLYGON((2 2,2 4,5 4,2 2))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("10", *iterator,
+ "POLYGON((0 0,2 4,4 0,0 0))",
+ "POLYGON((1 2,2 5,3 2,2 4,1 2))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("11", *iterator,
+ "POLYGON((0 0,0 4,4 0,0 0))",
+ "POLYGON((1 2,2 2,2 1,1 1))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("12", *iterator,
+ "POLYGON((0 1,1 4,2 2,3 4,4 1,0 1))",
+ "POLYGON((0 3,2 4,4 3,0 3))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("13", *iterator,
+ "POLYGON((0 1,1 2,3 0,0 1))",
+ "POLYGON((0 3,2 3,2 1,0 3))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("14", *iterator,
+ "POLYGON((0 0,0 4,2 2,4 0,0 0))",
+ "POLYGON((1 3,4 4,3 1,1 3))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("15", *iterator,
+ "POLYGON((0 0,0 4,1.5 2.5,2.5 1.5,4 0,0 0))",
+ "POLYGON((1 3,4 4,3 1,1 3))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("16", *iterator,
+ "POLYGON((1 2,3 4,2 1,1 2))",
+ "POLYGON((1 0,1 2,2 1,3 4,2 3,3 5,4 0,1 0))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("17", *iterator,
+ "POLYGON((0 0,0 4,4 0,0 0))",
+ "POLYGON((1 1,1 3,3 1,1 1))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("18", *iterator,
+ "POLYGON((0 0,0 4,1.5 2.5,2.5 1.5,4 0,0 0))",
+ "POLYGON((1 1,1 3,3 1,1 1))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("19", *iterator,
+ "POLYGON((2 0,1 3,5 2,2 0))",
+ "POLYGON((1 3,2 5,5 2,1 3))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("20", *iterator,
+ "POLYGON((2 0,1 3,5 2,2 0))",
+ "POLYGON((2 0,1 3,5 2,2 0))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("21", *iterator,
+ "POLYGON((1 0,0 5,5 2,1 0),(2 1,3 2,1 3,2 1))",
+ "POLYGON((2 1,1 3,3 2,2 1))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("22", *iterator,
+ "POLYGON((1 0,0 3,4 2,1 0))",
+ "POLYGON((2 4,5 5,4 2,2 4))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("23", *iterator,
+ "POLYGON((1 0,0 3,4 2,1 0))",
+ "POLYGON((3 3,4 2,1 1,3 3))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("24", *iterator,
+ "POLYGON((1 0,0 3,4 2,1 0))",
+ "POLYGON((2 2,4 2,1 1,2 2))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("25", *iterator,
+ "POLYGON((1 0,0 3,4 2,1 0))",
+ "POLYGON((3 1,4 2,5 0,3 1))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("26", *iterator,
+ "POLYGON((1 0,0 3,4 2,1 0))",
+ "POLYGON((3 1,4 2,5 4,4 0,3 1))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("27", *iterator,
+ "POLYGON((1 0,0 3,4 2,1 0))",
+ "POLYGON((1 1,4 2,5 0,1 1))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("28", *iterator,
+ "POLYGON((1 0,0 3,4 2,1 0))",
+ "POLYGON((1 1,4 2,5 4,5 0,1 1))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("29", *iterator,
+ "POLYGON((1 0,0 3,4 2,1 0))",
+ "POLYGON((4 4,5 1,4 2,1 1,4 4))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("30", *iterator,
+ "POLYGON((1 0,0 3,2 2,3 3,1 0))",
+ "POLYGON((1 2,2 2,2 4,4 3,3 1,1 2))");
+ iterator++;
+
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("31", *iterator,
+ "POLYGON((0 0,0 3,2 2,0 0))",
+ "POLYGON((4 1,2 2,3 3,4 1))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("32", *iterator,
+ "POLYGON((0 0,0 3,2 2,0 0))",
+ "POLYGON((4 1,3 0,2 2,4 1))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("33", *iterator,
+ "POLYGON((0 0,0 3,2 2,0 0))",
+ "POLYGON((3 3,3 0,2 2,3 3))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("34", *iterator,
+ "POLYGON((2 0,0 3,4 2,2 0))",
+ "POLYGON((2 1,4 2,5 3,4 1,2 1))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("35", *iterator,
+ "POLYGON((1 0,0 3,5 3,4 2,5 1,1 0))",
+ "POLYGON((2 2,4 2,4 1,2 2))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("36", *iterator,
+ "POLYGON((1 0,0 3,4 2,1 0))",
+ "POLYGON((1 5,5 5,4 2,3 3,2 1,1 2,1 5))");
+ iterator++;
+
+ // 37,38 in PPT but not yet implemented
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("37", *iterator,
+ "POLYGON((4 0,2 2,5 5,4 0))",
+ "POLYGON((0 2,4 3,2 2,4 1,0 2))");
+ iterator++;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("38", *iterator,
+ "POLYGON((4 0,3 3,2 2,4 5,5 2,4 0))",
+ "POLYGON((1 1,1 3,4 4,3 3,4 2,1 1))");
+ iterator++;
+
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("39", *iterator,
+ "POLYGON((0 4,4 8,7 7,8 4,5 3,4 0,0 4))",
+ "POLYGON((0 4,4 8,5 5,8 4,7 1,4 0,0 4))");
+ iterator++;
+
+ // keyholing
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("43", *iterator,
+ "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))",
+ "POLYGON((1.5 1.5,1.5 2.5,2.5 2.5,2.5 1.5,1.5 1.5))");
+ iterator++;
+
+ // self-tangency
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("44", *iterator,
+ "POLYGON((0 0,0 3,3 3,3 2,0 1.5,3 1,3 0,0 0))",
+ "POLYGON((1 1,1 2,2 2,2 1,1 1))");
+ iterator++;
+
+ // self-intersection
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("45", *iterator,
+ "POLYGON((0.5 0,0.5 3,3 3,3 2,0 1.5,3 1,3 0,0.5 0))",
+ "POLYGON((1 1,1 2,2 2,2 1,1 1))");
+ iterator++;
+
+ // self-tangent
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("46", *iterator,
+ "POLYGON((2 0,2 3,5 3,5 2,2 1.5,5 1,5 0,2 0))",
+ "POLYGON((1.5 1,1.5 2,2.5 2,2.5 1,1.5 1))");
+ iterator++;
+
+ // self-tangent
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("47", *iterator,
+ "POLYGON((2.5 0,2.5 3,5 3,5 2,2 1.5,5 1,5 0,2.5 0))",
+ "POLYGON((2 1,2 2,3 2,3 1,2 1))");
+ iterator++;
+
+
+ // 49, all
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<polygon, polygon, Functor, T>("49", *iterator,
+ "POLYGON((2 6,2 14,10 18,18 14,18 6,16 5,14 4,12 3,10 2,8 3,6 4,4 5,2 6))",
+ "POLYGON((2 6,2 7,2 8,2 9,2 10,2 11,2 12,1 14"
+ ",4 14,4 15,7 15,7 18,8 17,9 20,10 18"
+ ",10 15.5,11 17.5,12 17,11 15,12 14.5,13 16.5,14 18.5,15 18,14 16,15 15.5,16 17.5,18 14"
+ ",19 13,17 11,19 9,19 7"
+ ",17 5,16 5,15 4.5,13 3.5,11 2.5,10 2"
+ ",8 3,6 4,4 5,2 6))");
+ iterator++;
+
+
+ // ticket #17
+ BOOST_ASSERT(iterator != boost::end(expected));
+ std::string const ticket17 = "POLYGON ((-122.28139163 37.37319149,-122.28100699 37.37273669,-122.28002186 37.37303123,-122.27979681 37.37290072,-122.28007349 37.37240493,-122.27977334 37.37220360,-122.27819720 37.37288580,-122.27714184 37.37275161,-122.27678628 37.37253167,-122.27766437 37.37180973,-122.27804382 37.37121453,-122.27687664 37.37101354,-122.27645829 37.37203386,-122.27604423 37.37249110,-122.27632234 37.37343339,-122.27760980 37.37391082,-122.27812478 37.37800320,-122.26117222 37.39121007,-122.25572289 37.39566631,-122.25547269 37.39564971,-122.25366304 37.39552993,-122.24919976 37.39580268,-122.24417933 37.39366907,-122.24051443 37.39094143,-122.23246277 37.38100418,-122.23606766 37.38141338,-122.24001587 37.37738940,-122.23666848 37.37609347,-122.23057450 37.37882170,-122.22679803 37.37807143,-122.22525727 37.37448817,-122.22523229 37.37443000,-122.23083199 37.37609347,-122.23033486 37.37777891,-122.23169030 37.37732117,-122.23229178 37.37709687,-122.23237761 37.37631249,-122.23297776 37.37438834,-122.23872850 37.37165986,-122.24044511 37.36934068,-122.24671067 37.36865847,-122.24825570 37.36981819,-122.25151719 37.36947713,-122.25357721 37.36756706,-122.26001451 37.36579354,-122.25615213 37.36545239,-122.25486458 37.36245083,-122.25357721 37.36108651,-122.25194642 37.36013139,-122.24885652 37.35958557,-122.24911401 37.35849399,-122.25357721 37.35808470,-122.25675286 37.35897159,-122.25855539 37.35753887,-122.26181687 37.35828939,-122.26713837 37.35897159,-122.26782510 37.36108651,-122.26662339 37.36456559,-122.27288911 37.36722601,-122.27366159 37.36531602,-122.27168740 37.36470213,-122.27391900 37.36374701,-122.27074326 37.36245083,-122.27134408 37.35951742,-122.27426240 37.36135926,-122.27709482 37.36115474,-122.27966974 37.36231438,-122.27958391 37.36463382,-122.27572152 37.36463382,-122.27563569 37.36524779,-122.27700899 37.36593000,-122.27709482 37.36763529,-122.27554978 37.36838573,-122.27667254 37.36931478,-122.27677932 37.36932073,-122.27769362 37.36853987,-122.27942490 37.36830803,-122.28178776 37.36677917,-122.28509559 37.36443500,-122.28845129 37.36413744,-122.29194403 37.36695946,-122.29382577 37.36726817,-122.29600414 37.36898512,-122.29733083 37.36995398,-122.29593239 37.37141436,-122.29416649 37.37075898,-122.29325026 37.37108436,-122.29652910 37.37311697,-122.29584237 37.37374461,-122.29537583 37.37573372,-122.29487677 37.37752502,-122.30923212 37.37593011,-122.31122484 37.38230086,-122.31467994 37.38092472,-122.31715663 37.38252181,-122.32307970 37.38166978,-122.31985618 37.37667694,-122.32210304 37.37580220,-122.32581446 37.37589532,-122.32401730 37.37331839,-122.32960417 37.37189020,-122.33465527 37.37331906,-122.33425328 37.37623680,-122.33620676 37.37726132,-122.33397986 37.37822382,-122.33358918 37.38036590,-122.33202637 37.37986918,-122.33147954 37.38101784,-122.33394080 37.38198017,-122.33545239 37.38587943,-122.33478058 37.38785697,-122.33386050 37.38723721,-122.33350041 37.38571137,-122.33122003 37.38548891,-122.33140008 37.38650606,-122.33366042 37.38817490,-122.33244019 37.39157602,-122.33298157 37.39419201,-122.33164013 37.39477028,-122.33202017 37.39518351,-122.33358038 37.39499282,-122.33376050 37.39597811,-122.33550067 37.39734478,-122.33556069 37.39481797,-122.33344040 37.39292676,-122.33638094 37.38892189,-122.34240644 37.38852719,-122.34906293 37.38726898,-122.35072321 37.39338769,-122.34910291 37.39445252,-122.34796272 37.39410291,-122.34449043 37.39640534,-122.34500223 37.39729709,-122.34936291 37.39670910,-122.35098322 37.39531066,-122.35364623 37.39554510,-122.35434369 37.39612111,-122.35798429 37.39600988,-122.35768430 37.39478621,-122.36334519 37.39206871,-122.36604726 37.39203267,-122.36778592 37.39335592,-122.36518870 37.40022011,-122.36554552 37.40247752,-122.36370519 37.40331974,-122.36270506 37.40530591,-122.36320512 37.40670418,-122.36149849 37.40851392,-122.36730580 37.41054938,-122.37263720 37.41378932,-122.37161871 37.42076600,-122.36566153 37.42006292,-122.36520547 37.42742106,-122.37165953 37.43661157,-122.35943972 37.44459022,-122.35356359 37.44600810,-122.33792254 37.45796329,-122.35228518 37.47478091,-122.35127080 37.48181199,-122.34867342 37.48487322,-122.34359717 37.48801082,-122.33388431 37.48677650,-122.33142321 37.48429747,-122.32929580 37.48473149,-122.32609609 37.48291144,-122.32344850 37.48228229,-122.31924364 37.48410234,-122.31677299 37.48114051,-122.31431751 37.47848973,-122.31259201 37.47682190,-122.31515972 37.47568196,-122.31691389 37.47360309,-122.31292494 37.46960081,-122.31130153 37.46937743,-122.30889894 37.47124987,-122.30612839 37.47011613,-122.30149630 37.46568378,-122.30064277 37.46363784,-122.29283821 37.45922376,-122.28630141 37.45415497,-122.28883099 37.44629920,-122.28316717 37.44197138,-122.27554148 37.42297597,-122.25597410 37.40553692,-122.25196579 37.40129593,-122.25012043 37.40049143,-122.24823207 37.39897758,-122.24754551 37.39740941,-122.24778582 37.39621607,-122.24934787 37.39599102,-122.25005170 37.39871849,-122.25222328 37.39863668,-122.25342491 37.39737529,-122.25520162 37.39667289,-122.25528737 37.39522726,-122.27747460 37.37809616,-122.27977493 37.37858717,-122.28157729 37.37920106,-122.28322534 37.37952846,-122.28416939 37.38092656,-122.28621223 37.37984219,-122.28638389 37.37613857,-122.28382607 37.37843722,-122.27930278 37.37718220,-122.28196361 37.37652740,-122.28295058 37.37568167,-122.28216101 37.37523148,-122.28114822 37.37543608,-122.27934569 37.37528613,-122.27996369 37.37448121,-122.28104521 37.37454944,-122.28185197 37.37422883,-122.28290767 37.37474038,-122.28376597 37.37467224,-122.28428104 37.37399012,-122.28402346 37.37338989,-122.28610922 37.37364914,-122.28651264 37.37327388,-122.28672722 37.37207343,-122.28628398 37.37205448,-122.28574460 37.37166682,-122.28479711 37.37200981,-122.28327731 37.37137228,-122.28285511 37.37100700,-122.28279409 37.37125669,-122.28315527 37.37173756,-122.28321872 37.37220569,-122.28187007 37.37231918,-122.28193109 37.37294908,-122.28139163 37.37319149))";
+ //test_overlay<polygon, polygon, Functor, T>("44", *iterator, ticket17, "POLYGON((-122.297 37.368, -122.297 37.413, -122.242 37.413, -122.242 37.368, -122.297 37.368))");
+ //test_overlay<polygon, box, Functor>("44b", *iterator, ticket17, "BOX(-122.297 37.368,-122.242 37.413)");
+ test_overlay<polygon, box, Functor>("ticket_17", *iterator, ticket17, "BOX(-122.280 37.377,-122.277 37.379)");
+ iterator++;
+
+#endif
+
+ // Boost.List case Brandon
+ BOOST_ASSERT(iterator != boost::end(expected));
+ {
+ std::string p5 = "POLYGON((37.29449462890625 1.7902572154998779,37.000419616699219 1.664225697517395,37.140213012695313 1.3446992635726929,50.974888957147442 -30.277285722290763,57.297810222148939 -37.546793343968417,41.590042114257813 -7.2021245956420898,40.6978759765625 -5.4500408172607422,40.758884429931641 -5.418975830078125,42.577911376953125 -4.4901103973388672,42.577877044677734 -4.4900407791137695,42.699958801269531 -4.4278755187988281,46.523914387974358 -8.5152102535033496,47.585065917176543 -6.1314922196594779,45.389434814453125 -4.5143837928771973,46.296027072709599 -2.4984308554828116,37.43402099609375 1.470055103302002,37.29449462890625 1.7902572154998779))";
+ std::string p6 = "POLYGON((42.399410247802734 1.4956772327423096,42.721500396728516 2.2342472076416016,42.721500396728516 3.6584999561309814,51.20102152843122 7.1738039562841562,51.370888500897557 7.4163459734570729,37.43402099609375 1.470055103302002,37.29449462890625 1.7902572154998779,37.000419616699219 1.664225697517395,37.140213012695313 1.3446992635726929,36.954700469970703 1.2597870826721191,26.472516656201325 -3.5380830513658776,27.069889344709196 -4.2926591211028242,30.501169204711914 -2.3718316555023193,32.708126068115234 -2.3611266613006592,32.708126068115234 -2.3611700534820557,32.708168029785156 -2.3611698150634766,32.718830108642578 -4.3281683921813965,29.135100397190627 -8.9262827849488211,29.619997024536133 -9.5368013381958008,30.339155197143555 -8.9838371276855469,30.670633316040039 -8.8180980682373047,30.896280288696289 -9.1206979751586914,30.207040612748258 -10.275926149505661,30.947774887084961 -11.208560943603516,31.669155120849609 -10.653837203979492,32.000633239746094 -10.488097190856934,32.226280212402344 -10.790698051452637,31.682494778186321 -12.133624901803865,32.274600982666016 -12.879127502441406,32.998821258544922 -12.323249816894531,33.339523315429688 -12.147735595703125,33.566280364990234 -12.450697898864746,33.164891643669634 -14.000060288415174,33.598796844482422 -14.546377182006836,34.328716278076172 -13.992490768432617,34.658355712890625 -13.81736946105957,34.886280059814453 -14.120697975158691,34.634240447128811 -15.85007183479255,34.931102752685547 -16.223842620849609,35.656356811523438 -15.66030216217041,35.963497161865234 -15.476018905639648,37.326129913330078 -17.190576553344727,38.823680877685547 -16.296066284179688,39.966808319091797 -17.625011444091797,40.800632476806641 -17.208097457885742,41.821544647216797 -19.211688995361328,41.988733475572282 -19.945838749437218,57.524304765518266 -37.807195733984784,41.590042114257813 -7.2021245956420898,40.6978759765625 -5.4500408172607422,40.758884429931641 -5.418975830078125,42.577911376953125 -4.4901103973388672,42.577877044677734 -4.4900407791137695,42.699958801269531 -4.4278755187988281,46.559533858616469 -8.435196445683264,47.604561877161387 -6.087697464505224,45.389434814453125 -4.5143837928771973,46.695858001708984 -1.6093428134918213,47.263670054709685 -1.784876824891044,47.830955505371094 -0.69758313894271851,48.43512638981781 -0.81299959072453376,49.071769542946825 0.61489892713413252,43.764598846435547 0.93951499462127686,43.644271850585938 0.96149998903274536,42.399410247802734 1.4956772327423096))";
+ test_overlay<polygon, polygon, Functor>("isovist", *iterator, p5, p6);
+ }
+ iterator++;
+
+
+ return;
+
+
+#if ! defined(NO_LINESTRING_INTERSECTION)
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<linestring, linestring, Functor, T>("100", *iterator,
+ "LINESTRING(0 1,2 5,5 3)",
+ "LINESTRING(3 0,0 3,4 5)");
+#endif
+
+
+
+/*
+
+ test_overlay<box, polygon, Functor>(11, "box(1.5 1.5, 4.5 2.5)",
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3))");
+ test_overlay<box, polygon, Functor>(21, "box(1.5 1.5, 4.5 2.5)",
+ "POLYGON((3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2))");
+ test_overlay<box, polygon, Functor>(12, "box(1.5 1.5, 4.5 2.5)",
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,5.3 2.5,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3))");
+ test_overlay<box, polygon, Functor>(13, "box(1.5 1.5, 4.5 2.5)",
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,4.5 2.5,4.5 1.2,4.9 0.8,2.9 0.7,2 1.3))");
+ test_overlay<box, polygon, Functor>(23, "box(1.5 1.5, 4.5 2.5)",
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,4.5 2.5,4.5 2.3,5.0 2.3,5.0 2.1,4.5 2.1,4.5 1.9,4.0 1.9,4.5 1.2,4.9 0.8,2.9 0.7,2 1.3))");
+
+ test_overlay<box, polygon, Functor>(14, "box(1.5 1.5, 4.5 2.5)",
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,4.5 1.2,2.9 0.7,2 1.3))");
+
+ test_overlay<box, polygon, Functor>(15, "box(1.5 1.5, 4.5 2.5)",
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.0 3.0,5.0 2.0,2.9 0.7,2 1.3))");
+
+ test_overlay<box, polygon, Functor>(16, "box(0 0, 3 3)",
+ "POLYGON((2 2, 1 4, 2 4, 3 3, 2 2))");
+
+ test_overlay<box, polygon, Functor>(19, "box(115041.10 471900.10, 118334.60 474523.40)",
+ "POLYGON ((115483.40 474533.40, 116549.40 474059.20, 117199.90 473762.50, 117204.90 473659.50, 118339.40 472796.90, 118334.50 472757.90, 118315.10 472604.00, 118344.60 472520.90, 118277.90 472419.10, 118071.40 472536.80, 118071.40 472536.80, 117943.10 472287.70, 117744.90 472248.40, 117708.00 472034.50, 117481.90 472056.90, 117481.90 472056.90, 117272.30 471890.10, 117077.90 472161.20, 116146.60 473054.50, 115031.10 473603.30, 115483.40 474533.40))");
+*/
+}
+#endif
+
+#endif // BOOST_GEOMETRY_TEST_OVERLAY_COMMON_HPP
diff --git a/libs/geometry/test/algorithms/overlay/relative_order.cpp b/libs/geometry/test/algorithms/overlay/relative_order.cpp
new file mode 100644
index 000000000..18c51e2b3
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/relative_order.cpp
@@ -0,0 +1,207 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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 <iostream>
+
+#include <geometry_test_common.hpp>
+
+
+#include <boost/foreach.hpp>
+
+#include <boost/geometry/algorithms/intersection.hpp>
+
+#include <boost/geometry/algorithms/detail/overlay/get_turn_info.hpp>
+#include <boost/geometry/algorithms/detail/overlay/get_relative_order.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+
+#if defined(TEST_WITH_SVG)
+# include <boost/geometry/io/svg/svg_mapper.hpp>
+#endif
+
+
+template <typename P, typename T>
+void test_with_point(std::string const& caseid,
+ T pi_x, T pi_y, T pj_x, T pj_y,
+ T ri_x, T ri_y, T rj_x, T rj_y,
+ T si_x, T si_y, T sj_x, T sj_y,
+ int expected_order)
+{
+ P pi = bg::make<P>(pi_x, pi_y);
+ P pj = bg::make<P>(pj_x, pj_y);
+ P ri = bg::make<P>(ri_x, ri_y);
+ P rj = bg::make<P>(rj_x, rj_y);
+ P si = bg::make<P>(si_x, si_y);
+ P sj = bg::make<P>(sj_x, sj_y);
+
+ int order = bg::detail::overlay::get_relative_order<P>::apply(pi, pj, ri, rj, si, sj);
+
+ BOOST_CHECK_EQUAL(order, expected_order);
+
+
+
+
+ /*
+ std::cout << caseid
+ << (caseid.find("_") == std::string::npos ? " " : "")
+ << " " << method
+ << " " << detected
+ << " " << order
+ << std::endl;
+ */
+
+
+
+/*#if defined(TEST_WITH_SVG)
+ {
+ std::ostringstream filename;
+ filename << "get_turn_info_" << caseid
+ << "_" << string_from_type<typename bg::coordinate_type<P>::type>::name()
+ << ".svg";
+
+ std::ofstream svg(filename.str().c_str());
+
+ bg::svg_mapper<P> mapper(svg, 500, 500);
+ mapper.add(bg::make<P>(0, 0));
+ mapper.add(bg::make<P>(10, 10));
+
+ bg::model::linestring<P> p; p.push_back(pi); p.push_back(pj); p.push_back(pk);
+ bg::model::linestring<P> q; q.push_back(qi); q.push_back(qj); q.push_back(qk);
+ mapper.map(p, "opacity:0.8;stroke:rgb(0,192,0);stroke-width:3");
+ mapper.map(q, "opacity:0.8;stroke:rgb(0,0,255);stroke-width:3");
+
+ std::string style = ";font-family='Verdana';font-weight:bold";
+ std::string align = ";text-anchor:end;text-align:end";
+ int offset = 8;
+
+ mapper.text(pi, "pi", "fill:rgb(0,192,0)" + style, offset, offset);
+ mapper.text(pj, "pj", "fill:rgb(0,192,0)" + style, offset, offset);
+ mapper.text(pk, "pk", "fill:rgb(0,192,0)" + style, offset, offset);
+
+ mapper.text(qi, "qi", "fill:rgb(0,0,255)" + style + align, -offset, offset);
+ mapper.text(qj, "qj", "fill:rgb(0,0,255)" + style + align, -offset, offset);
+ mapper.text(qk, "qk", "fill:rgb(0,0,255)" + style + align, -offset, offset);
+
+
+ int factor = 1; // second info, if any, will go left by factor -1
+ int ch = '1';
+ for (typename tp_vector::const_iterator it = info.begin();
+ it != info.end();
+ ++it, factor *= -1, ch++)
+ {
+ bool at_j = it->method == bg::detail::overlay::method_crosses;
+ std::string op;
+ op += operation_char(it->operations[0].operation);
+ align = ";text-anchor:middle;text-align:center";
+ mapper.text(at_j ? pj : pk, op, "fill:rgb(255,128,0)" + style + align, offset * factor, -offset);
+
+ op.clear();
+ op += operation_char(it->operations[1].operation);
+ mapper.text(at_j ? qj : qk, op, "fill:rgb(255,128,0)" + style + align, offset * factor, -offset);
+
+ // Map intersection point + method
+ mapper.map(it->point, "opacity:0.8;fill:rgb(255,0,0);stroke:rgb(0,0,100);stroke-width:1");
+
+ op.clear();
+ op += method_char(it->method);
+ if (info.size() != 1)
+ {
+ op += ch;
+ op += " p:"; op += operation_char(it->operations[0].operation);
+ op += " q:"; op += operation_char(it->operations[1].operation);
+ }
+ mapper.text(it->point, op, "fill:rgb(255,0,0)" + style, offset, -offset);
+ }
+ }
+#endif
+*/
+}
+
+
+
+template <typename P>
+void test_all()
+{
+ test_with_point<P, double>("OLR1",
+ 5, 1, 5, 8, // p
+ 3, 5, 7, 5, // r
+ 3, 3, 7, 2, // s
+ 1);
+ test_with_point<P, double>("OLR2",
+ 5, 1, 5, 8, // p
+ 3, 5, 7, 5, // r
+ 3, 7, 7, 6, // s
+ -1);
+ test_with_point<P, double>("OLR3",
+ 5, 1, 5, 8, // p
+ 3, 5, 7, 5, // r
+ 4, 2, 9, 6, // s
+ 1);
+ test_with_point<P, double>("OLR4",
+ 5, 1, 5, 8, // p
+ 3, 5, 7, 5, // r
+ 3, 8, 9, 4, // s
+ -1);
+ test_with_point<P, double>("OLR5",
+ 5, 1, 5, 8, // p
+ 3, 5, 7, 5, // r
+ 4, 2, 8, 6, // s
+ 1);
+ test_with_point<P, double>("OLR6",
+ 5, 1, 5, 8, // p
+ 3, 5, 7, 5, // r
+ 3, 7, 9, 4, // s
+ -1);
+ test_with_point<P, double>("OLR7",
+ 5, 1, 5, 8, // p
+ 3, 5, 7, 5, // r
+ 1, 4, 7, 7, // s
+ -1);
+ test_with_point<P, double>("OLR8",
+ 5, 1, 5, 8, // p
+ 3, 5, 7, 5, // r
+ 1, 6, 7, 3, // s
+ 1);
+
+
+ test_with_point<P, double>("OD1",
+ 5, 1, 5, 8, // p
+ 3, 5, 7, 5, // r
+ 7, 2, 3, 3, // s
+ 1);
+
+ test_with_point<P, double>("OD9",
+ 5, 1, 5, 8, // p
+ 3, 5, 7, 5, // r
+ 7, 5, 3, 3, // s
+ 1);
+ test_with_point<P, double>("OD10",
+ 5, 1, 5, 8, // p
+ 3, 5, 7, 5, // r
+ 7, 5, 3, 7, // s
+ -1);
+ test_with_point<P, double>("OD11",
+ 5, 1, 5, 8, // p
+ 7, 5, 3, 5, // r
+ 3, 5, 7, 7, // s
+ -1);
+ test_with_point<P, double>("OD12",
+ 5, 1, 5, 8, // p
+ 7, 5, 3, 5, // r
+ 3, 5, 7, 3, // s
+ 1);
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<double> >();
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/overlay/relative_order.vcproj b/libs/geometry/test/algorithms/overlay/relative_order.vcproj
new file mode 100644
index 000000000..eb577fafe
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/relative_order.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="relative_order"
+ ProjectGUID="{4C012342-116A-4E5E-9869-90389D5BBEBD}"
+ RootNamespace="relative_order"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\relative_order"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\relative_order"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\relative_order.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/robustness/interior_triangles.cpp b/libs/geometry/test/algorithms/overlay/robustness/interior_triangles.cpp
new file mode 100644
index 000000000..5dee530b9
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/robustness/interior_triangles.cpp
@@ -0,0 +1,163 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2009-2012 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 <iostream>
+#include <sstream>
+#include <fstream>
+#include <iomanip>
+#include <string>
+
+#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
+#define BOOST_GEOMETRY_NO_BOOST_TEST
+#define BOOST_GEOMETRY_TIME_OVERLAY
+
+#include <test_overlay_p_q.hpp>
+
+#include <boost/program_options.hpp>
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/variate_generator.hpp>
+#include <boost/timer.hpp>
+
+template <typename Polygon>
+inline void make_polygon(Polygon& polygon, int count_x, int count_y, int index, int offset)
+{
+ typedef typename bg::point_type<Polygon>::type point_type;
+ bg::exterior_ring(polygon).push_back(point_type(0, 0));
+ bg::exterior_ring(polygon).push_back(point_type(0, count_y * 10));
+ bg::exterior_ring(polygon).push_back(point_type(count_x * 10 + 10, count_y * 10));
+ bg::exterior_ring(polygon).push_back(point_type(count_x * 10 + 10, 0));
+ bg::exterior_ring(polygon).push_back(point_type(0, 0));
+
+ for(int j = 0; j < count_x; ++j)
+ {
+ for(int k = 0; k < count_y; ++k)
+ {
+ polygon.inners().push_back(Polygon::inner_container_type::value_type());
+ polygon.inners().back().push_back(point_type(offset + j * 10 + 1, k * 10 + 1));
+ polygon.inners().back().push_back(point_type(offset + j * 10 + 7, k * 10 + 5 + index));
+ polygon.inners().back().push_back(point_type(offset + j * 10 + 5 + index, k * 10 + 7));
+ polygon.inners().back().push_back(point_type(offset + j * 10 + 1, k * 10 + 1));
+ }
+ }
+ bg::correct(polygon);
+}
+
+
+
+template <typename Polygon>
+void test_star_comb(int count_x, int count_y, int offset, p_q_settings const& settings)
+{
+ Polygon p, q;
+
+ make_polygon(p, count_x, count_y, 0, 0);
+ make_polygon(q, count_x, count_y, 1, offset);
+
+ std::ostringstream out;
+ out << "interior_triangles";
+ test_overlay_p_q
+ <
+ Polygon,
+ typename bg::coordinate_type<Polygon>::type
+ >(out.str(), p, q, settings);
+}
+
+
+template <typename T, bool Clockwise, bool Closed>
+void test_all(int count, int count_x, int count_y, int offset, p_q_settings const& settings)
+{
+ boost::timer t;
+
+ typedef bg::model::polygon
+ <
+ bg::model::d2::point_xy<T>, Clockwise, Closed
+ > polygon;
+
+
+ int index = 0;
+ for(int i = 0; i < count; i++)
+ {
+ test_star_comb<polygon>(count_x, count_y, offset, settings);
+ }
+ std::cout
+ << " type: " << string_from_type<T>::name()
+ << " time: " << t.elapsed() << std::endl;
+}
+
+int main(int argc, char** argv)
+{
+ try
+ {
+ namespace po = boost::program_options;
+ po::options_description description("=== interior_triangles ===\nAllowed options");
+
+ int offset = 0;
+ int count = 1;
+ int count_x = 10;
+ int count_y = 10;
+ bool ccw = false;
+ bool open = false;
+ p_q_settings settings;
+
+ description.add_options()
+ ("help", "Help message")
+ ("count", po::value<int>(&count)->default_value(1), "Number of tests")
+ ("count_x", po::value<int>(&count_x)->default_value(10), "Triangle count in x-direction")
+ ("count_y", po::value<int>(&count_y)->default_value(10), "Triangle count in y-direction")
+ ("offset", po::value<int>(&offset)->default_value(0), "Offset of second triangle in x-direction")
+ ("diff", po::value<bool>(&settings.also_difference)->default_value(false), "Include testing on difference")
+ ("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
+ ("open", po::value<bool>(&open)->default_value(false), "Open polygons")
+ ("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
+ ("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
+ ;
+
+ po::variables_map varmap;
+ po::store(po::parse_command_line(argc, argv, description), varmap);
+ po::notify(varmap);
+
+ if (varmap.count("help"))
+ {
+ std::cout << description << std::endl;
+ return 1;
+ }
+
+ if (ccw && open)
+ {
+ test_all<double, false, false>(count, count_x, count_y, offset, settings);
+ }
+ else if (ccw)
+ {
+ test_all<double, false, true>(count, count_x, count_y, offset, settings);
+ }
+ else if (open)
+ {
+ test_all<double, true, false>(count, count_x, count_y, offset, settings);
+ }
+ else
+ {
+ test_all<double, true, true>(count, count_x, count_y, offset, settings);
+ }
+
+#if defined(HAVE_TTMATH)
+ // test_all<ttmath_big, true, true>(seed, count, max, svg, level);
+#endif
+ }
+ catch(std::exception const& e)
+ {
+ std::cout << "Exception " << e.what() << std::endl;
+ }
+ catch(...)
+ {
+ std::cout << "Other exception" << std::endl;
+ }
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/overlay/robustness/interior_triangles.vcproj b/libs/geometry/test/algorithms/overlay/robustness/interior_triangles.vcproj
new file mode 100644
index 000000000..831514b3e
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/robustness/interior_triangles.vcproj
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="interior_triangles"
+ ProjectGUID="{7583C2E3-AD74-4C34-8E94-9162F641B215}"
+ RootNamespace="interior_triangles"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\interior_triangles"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../../..;."
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="2"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalLibraryDirectories=""
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\interior_triangles"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../../..;."
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="program options"
+ >
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\cmdline.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\config_file.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\convert.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\options_description.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\parsers.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\positional_options.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\split.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\utf8_codecvt_facet.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\value_semantic.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\variables_map.cpp"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\interior_triangles.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.cpp b/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.cpp
new file mode 100644
index 000000000..dce301c12
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.cpp
@@ -0,0 +1,300 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2009-2012 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)
+
+
+#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
+#define BOOST_GEOMETRY_NO_BOOST_TEST
+
+#include <test_overlay_p_q.hpp>
+
+#include <boost/program_options.hpp>
+#include <boost/timer.hpp>
+
+template <typename Polygon>
+inline void make_pie(Polygon& polygon,
+ int count, int offset, int offset_y, double factor1, int total_segment_count = 36)
+{
+ typedef typename bg::point_type<Polygon>::type p;
+ typedef typename bg::select_most_precise
+ <
+ typename bg::coordinate_type<Polygon>::type,
+ long double
+ >::type coordinate_type;
+
+ // Create pie
+ coordinate_type cx = 2500.0;
+ coordinate_type cy = 2500.0 + offset_y;
+
+ bg::exterior_ring(polygon).push_back(bg::make<p>(int(cx), int(cy)));
+
+ coordinate_type const dx = 5000.0;
+ coordinate_type const dy = 5000.0;
+
+ coordinate_type const half = 0.5;
+ coordinate_type const two = 2.0;
+
+ coordinate_type const a = coordinate_type(factor1) * half * dx;
+ coordinate_type const b = coordinate_type(factor1) * half * dy;
+
+ coordinate_type const pi = boost::math::constants::pi<long double>();
+ coordinate_type const delta = pi * two / total_segment_count;
+ coordinate_type angle = coordinate_type(offset) * delta;
+ for (int i = 0; i < count; i++, angle += delta)
+ {
+ coordinate_type const s = sin(angle);
+ coordinate_type const c = cos(angle);
+ coordinate_type const x = cx + a * s;
+ coordinate_type const y = cy + b * c;
+ bg::exterior_ring(polygon).push_back(bg::make<p>(int(x), int(y)));
+ }
+ bg::exterior_ring(polygon).push_back(bg::make<p>(int(cx), int(cy)));
+ bg::correct(polygon);
+}
+
+
+/*
+sql server
+
+TWO INNERS
+1a) select geometry::STGeomFromText('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,5 5,4 6,4 4),(6 6,5 5,6 4,6 6)) ', 0).STIsValid(); -> valid
+same:
+1b) POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,5 5,6 4,6 6,5 5,4 6,4 4)) -> valid
+
+I-E tangency IET
+2a) select geometry::STGeomFromText('POLYGON((0 0,0 10,10 10,10 0,0 0),(5 0,6 1,4 1,5 0))', 0).STIsValid(); -> valid
+same by Self tangency ST
+2b) select geometry::STGeomFromText('POLYGON((0 0,0 10,10 10,10 0,5 0,6 1,4 1,5 0, 0 0))', 0).STIsValid(); -> valid
+
+Two inners all tangent
+3a) POLYGON((0 0,0 10,10 10,10 0,0 0),(5 0,6 1,4 1,5 0),(5 1,6 2,4 2,5 1)) -> valid
+
+postgis:
+1a) select ST_IsValid(ST_GeomFromText('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,5 5,4 6,4 4),(6 6,5 5,6 4,6 6))', 0)); -> valid
+1b) POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,5 5,6 4,6 6,5 5,4 6,4 4)) -> NOT valid
+
+2a) POLYGON((0 0,0 10,10 10,10 0,0 0),(5 0,6 1,4 1,5 0)) -> valid
+2b) POLYGON((0 0,0 10,10 10,10 0,5 0,6 1,4 1,5 0, 0 0)) -> NOT valid (?)
+
+3a) POLYGON((0 0,0 10,10 10,10 0,0 0),(5 0,6 1,4 1,5 0),(5 1,6 2,4 2,5 1)) -> valid
+
+
+*/
+
+template <typename Polygon>
+inline void holify(Polygon& polygon)
+{
+ typedef typename bg::point_type<Polygon>::type point_type;
+
+ Polygon p;
+ bg::exterior_ring(p).push_back(bg::make<point_type>(0, 0));
+ bg::exterior_ring(p).push_back(bg::make<point_type>(0, 5000));
+ bg::exterior_ring(p).push_back(bg::make<point_type>(5000, 5000));
+ bg::exterior_ring(p).push_back(bg::make<point_type>(5000, 0));
+ bg::exterior_ring(p).push_back(bg::make<point_type>(0, 0));
+ bg::interior_rings(p).push_back(bg::exterior_ring(polygon));
+ bg::correct(p);
+
+ polygon = p;
+}
+
+template <typename MultiPolygon>
+inline void holify_multi(MultiPolygon& multi_polygon)
+{
+ typedef typename bg::point_type<MultiPolygon>::type point_type;
+
+ typename boost::range_value<MultiPolygon>::type p;
+
+ bg::exterior_ring(p).push_back(bg::make<point_type>(0, 0));
+ bg::exterior_ring(p).push_back(bg::make<point_type>(0, 5000));
+ bg::exterior_ring(p).push_back(bg::make<point_type>(5000, 5000));
+ bg::exterior_ring(p).push_back(bg::make<point_type>(5000, 0));
+ bg::exterior_ring(p).push_back(bg::make<point_type>(0, 0));
+
+ for (int i = 0; i < multi_polygon.size(); i++)
+ {
+ bg::interior_rings(p).push_back(bg::exterior_ring(multi_polygon[i]));
+ }
+
+ bg::correct(p);
+
+ multi_polygon.clear();
+ multi_polygon.push_back(p);
+}
+
+
+
+template <typename T, bool Clockwise, bool Closed>
+void test_pie(int total_segment_count, T factor_p, T factor_q,
+ bool multi, bool single_selftangent, p_q_settings const& settings)
+{
+ boost::timer t;
+ typedef bg::model::d2::point_xy<T> point_type;
+ typedef bg::model::polygon<point_type, Clockwise, Closed> polygon;
+ typedef bg::model::multi_polygon<polygon> multi_polygon;
+
+ int good_count = 0;
+ int bad_count = 0;
+
+ for (int a = 2; a < total_segment_count; a++)
+ {
+ polygon p;
+ make_pie(p, a, 0, 0, factor_p, total_segment_count);
+
+ //holify(p);
+
+ for (int b = 2; b < total_segment_count; b++)
+ {
+ for (int offset = 1; offset < total_segment_count; offset++)
+ {
+ //for (int y = 0; y <= 2500; y += 500)
+ int y = 0;
+ {
+ polygon q;
+ make_pie(q, b, offset, y, factor_q, total_segment_count);
+
+ if (! multi)
+ {
+ //holify(q);
+
+ std::ostringstream out;
+ out << "pie_" << a << "_" << b << "_" << offset << "_" << y;
+ if (test_overlay_p_q<polygon, T>(out.str(), p, q, settings))
+ {
+ good_count++;
+ }
+ else
+ {
+ bad_count++;
+ }
+ }
+ else
+ {
+ int left = total_segment_count - b - 2;
+ //std::cout << a << " " << b << " " << left << std::endl;
+ for (int c = 2; c < left; c++)
+ {
+ polygon q2;
+ make_pie(q2, c, offset + b + 1, y, factor_q, total_segment_count);
+
+ std::ostringstream out;
+ out << "pie_" << a << "_" << b << "_" << offset << "_" << y
+ << "_" << c
+ ;
+
+ bool good = false;
+
+ // Represent as either multi-polygon, or as single-self-touching-polygon (INVALID)
+ if (single_selftangent)
+ {
+ polygon q1 = q;
+ for (unsigned int i = 1; i < q2.outer().size(); i++)
+ {
+ q1.outer().push_back(q2.outer()[i]);
+ }
+ //holify(q1);
+ good = test_overlay_p_q<polygon, T>(out.str(), p, q1, settings);
+ }
+ else
+ {
+ multi_polygon mq;
+ mq.push_back(q);
+ mq.push_back(q2);
+ //holify_multi(mq);
+ good = test_overlay_p_q<polygon, T>(out.str(), p, mq, settings);
+ }
+
+ if (good)
+ {
+ good_count++;
+ }
+ else
+ {
+ bad_count++;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ std::cout
+ << "Time: " << t.elapsed() << std::endl
+ << "Good: " << good_count << std::endl
+ << "Bad: " << bad_count << std::endl;
+}
+
+
+template <typename T, bool Clockwise, bool Closed>
+void test_all(bool multi, bool single_selftangent, p_q_settings const& settings)
+{
+ test_pie<T, Clockwise, Closed>(24, 0.55, 0.45, multi, single_selftangent, settings);
+}
+
+int main(int argc, char** argv)
+{
+ try
+ {
+ namespace po = boost::program_options;
+ po::options_description description("=== intersection_pies ===\nAllowed options");
+
+ p_q_settings settings;
+ bool multi = false;
+ bool ccw = false;
+ bool open = false;
+ bool single_selftangent = false; // keep false, true does not work!
+
+ description.add_options()
+ ("help", "Help message")
+ ("multi", po::value<bool>(&multi)->default_value(false), "Multiple tangencies at one point")
+ ("diff", po::value<bool>(&settings.also_difference)->default_value(false), "Include testing on difference")
+ ("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
+ ("open", po::value<bool>(&open)->default_value(false), "Open polygons")
+ ("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
+ ("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
+ ;
+
+ po::variables_map varmap;
+ po::store(po::parse_command_line(argc, argv, description), varmap);
+ po::notify(varmap);
+
+ if (varmap.count("help"))
+ {
+ std::cout << description << std::endl;
+ return 1;
+ }
+
+ // template par's are: CoordinateType, Clockwise, Closed
+ if (ccw && open)
+ {
+ test_all<double, false, false>(multi, single_selftangent, settings);
+ }
+ else if (ccw)
+ {
+ test_all<double, false, true>(multi, single_selftangent, settings);
+ }
+ else if (open)
+ {
+ test_all<double, true, false>(multi, single_selftangent, settings);
+ }
+ else
+ {
+ test_all<double, true, true>(multi, single_selftangent, settings);
+ }
+ //test_all<long double>();
+ }
+ catch(std::exception const& e)
+ {
+ std::cout << "Exception " << e.what() << std::endl;
+ }
+ catch(...)
+ {
+ std::cout << "Other exception" << std::endl;
+ }
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.vcproj b/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.vcproj
new file mode 100644
index 000000000..1ead5e8e9
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.vcproj
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="intersection_pies"
+ ProjectGUID="{24D92478-7C66-4DD5-A501-30A3D4376E4F}"
+ RootNamespace="intersection_pies"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\intersection_pies"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../../..;."
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalLibraryDirectories="&quot;C:\gmp\gmp-dynamic&quot;"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\intersection_pies"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../../..;."
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalLibraryDirectories=""
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="program options"
+ >
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\cmdline.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\config_file.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\convert.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\options_description.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\parsers.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\positional_options.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\split.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\utf8_codecvt_facet.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\value_semantic.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\variables_map.cpp"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\intersection_pies.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/robustness/intersection_stars.cpp b/libs/geometry/test/algorithms/overlay/robustness/intersection_stars.cpp
new file mode 100644
index 000000000..5858d1d5a
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/robustness/intersection_stars.cpp
@@ -0,0 +1,182 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2009-2012 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 <iostream>
+#include <string>
+
+#define BOOST_GEOMETRY_NO_BOOST_TEST
+
+
+#include <test_overlay_p_q.hpp>
+
+#include <boost/program_options.hpp>
+#include <boost/timer.hpp>
+
+template <typename Polygon>
+inline void make_star(Polygon& polygon,
+ int count, double factor1, double factor2, long double offset = 0)
+{
+ typedef typename bg::point_type<Polygon>::type p;
+ typedef typename bg::select_most_precise
+ <
+ typename bg::coordinate_type<Polygon>::type,
+ long double
+ >::type coordinate_type;
+
+ // Create star
+ coordinate_type cx = 25.0;
+ coordinate_type cy = 25.0;
+
+ coordinate_type dx = 50.0;
+ coordinate_type dy = 50.0;
+
+ coordinate_type half = 0.5;
+ coordinate_type two = 2.0;
+
+ coordinate_type a1 = coordinate_type(factor1) * half * dx;
+ coordinate_type b1 = coordinate_type(factor1) * half * dy;
+ coordinate_type a2 = coordinate_type(factor2) * half * dx;
+ coordinate_type b2 = coordinate_type(factor2) * half * dy;
+
+ coordinate_type pi = boost::math::constants::pi<long double>();
+ coordinate_type delta = pi * two / coordinate_type(count - 1);
+ coordinate_type angle = coordinate_type(offset) * delta;
+ for (int i = 0; i < count - 1; i++, angle += delta)
+ {
+ bool even = i % 2 == 0;
+ coordinate_type s = sin(angle);
+ coordinate_type c = cos(angle);
+ coordinate_type x = cx + (even ? a1 : a2) * s;
+ coordinate_type y = cy + (even ? b1 : b2) * c;
+ bg::exterior_ring(polygon).push_back(bg::make<p>(x, y));
+
+ }
+ bg::exterior_ring(polygon).push_back(bg::exterior_ring(polygon).front());
+}
+
+
+template <typename T, typename CalculationType>
+void test_star(int count, int min_points, int max_points, T rotation, p_q_settings const& settings)
+{
+ boost::timer t;
+ typedef bg::model::d2::point_xy<T> point_type;
+ typedef bg::model::polygon<point_type> polygon;
+
+ int n = 0;
+ for (int c = 0; c < count; c++)
+ {
+ for (int i = min_points; i <= max_points; i++)
+ {
+ std::ostringstream out;
+ out << "_" << string_from_type<T>::name() << "_"
+ << string_from_type<CalculationType>::name() << "_"
+ << i << "_int";
+
+ polygon p;
+ make_star(p, i * 2 + 1, 0.5, 1.0);
+ polygon q;
+ make_star(q, i * 2 + 1, 0.5, 1.0, rotation);
+
+ if (! test_overlay_p_q
+ <
+ polygon,
+ CalculationType
+ >(out.str(), p, q, settings))
+ {
+ return;
+ }
+ n++;
+ }
+ }
+ std::cout
+ << "polygons: " << n
+ << " type: " << string_from_type<T>::name()
+ << " time: " << t.elapsed() << std::endl;
+}
+
+template <typename T, typename CalculationType>
+void test_type(int count, int min_points, int max_points, T rotation, p_q_settings const& settings)
+{
+ test_star<T, CalculationType>(count, min_points, max_points, rotation, settings);
+}
+
+template <typename T>
+void test_all(std::string const& type, int count, int min_points, int max_points, T rotation, p_q_settings settings)
+{
+ if (type == "float")
+ {
+ settings.tolerance = 1.0e-3;
+ test_type<float, float>(count, min_points, max_points, rotation, settings);
+ }
+ else if (type == "double")
+ {
+ test_type<double, double>(count, min_points, max_points, rotation, settings);
+ }
+#if defined(HAVE_TTMATH)
+ else if (type == "ttmath")
+ {
+ test_type<ttmath_big, ttmath_big>(count, min_points, max_points, rotation, settings);
+ }
+#endif
+}
+
+int main(int argc, char** argv)
+{
+ try
+ {
+ namespace po = boost::program_options;
+ po::options_description description("=== recursive_polygons ===\nAllowed options");
+
+ int count = 1;
+ //int seed = static_cast<unsigned int>(std::time(0));
+ std::string type = "float";
+ int min_points = 9;
+ int max_points = 9;
+ bool ccw = false;
+ bool open = false;
+ double rotation = 1.0e-13;
+ p_q_settings settings;
+
+ description.add_options()
+ ("help", "Help message")
+ //("seed", po::value<int>(&seed), "Initialization seed for random generator")
+ ("count", po::value<int>(&count)->default_value(1), "Number of tests")
+ ("diff", po::value<bool>(&settings.also_difference)->default_value(false), "Include testing on difference")
+ ("min_points", po::value<int>(&min_points)->default_value(9), "Minimum number of points")
+ ("max_points", po::value<int>(&max_points)->default_value(9), "Maximum number of points")
+ ("rotation", po::value<double>(&rotation)->default_value(1.0e-13), "Rotation angle")
+ ("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
+ ("open", po::value<bool>(&open)->default_value(false), "Open polygons")
+ ("type", po::value<std::string>(&type)->default_value("float"), "Type (float,double)")
+ ("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
+ ("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
+ ;
+
+ po::variables_map varmap;
+ po::store(po::parse_command_line(argc, argv, description), varmap);
+ po::notify(varmap);
+
+ if (varmap.count("help"))
+ {
+ std::cout << description << std::endl;
+ return 1;
+ }
+
+ test_all(type, count, min_points, max_points, rotation, settings);
+ }
+ catch(std::exception const& e)
+ {
+ std::cout << "Exception " << e.what() << std::endl;
+ }
+ catch(...)
+ {
+ std::cout << "Other exception" << std::endl;
+ }
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/overlay/robustness/intersection_stars.vcproj b/libs/geometry/test/algorithms/overlay/robustness/intersection_stars.vcproj
new file mode 100644
index 000000000..5c41db055
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/robustness/intersection_stars.vcproj
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="intersection_stars"
+ ProjectGUID="{A76B81BF-B5B4-4D09-BB81-F235647891DE}"
+ RootNamespace="intersection_stars"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\intersection_stars"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../../..;."
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalLibraryDirectories="&quot;C:\gmp\gmp-dynamic&quot;"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\intersection_stars"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../../..;."
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalLibraryDirectories=""
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="program options"
+ >
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\cmdline.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\config_file.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\convert.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\options_description.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\parsers.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\positional_options.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\split.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\utf8_codecvt_facet.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\value_semantic.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\variables_map.cpp"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\intersection_stars.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/robustness/intersects.cpp b/libs/geometry/test/algorithms/overlay/robustness/intersects.cpp
new file mode 100644
index 000000000..e16caeb03
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/robustness/intersects.cpp
@@ -0,0 +1,174 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2011-2012 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 <iostream>
+#include <sstream>
+#include <fstream>
+#include <iomanip>
+#include <string>
+
+#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
+#define BOOST_GEOMETRY_NO_BOOST_TEST
+//#define BOOST_GEOMETRY_TIME_OVERLAY
+
+#include <test_overlay_p_q.hpp>
+
+#include <boost/program_options.hpp>
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/variate_generator.hpp>
+#include <boost/timer.hpp>
+
+
+template <typename MultiPolygon>
+inline void make_polygon(MultiPolygon& mp, int count_x, int count_y, int index, int width_x)
+{
+ typedef typename bg::point_type<MultiPolygon>::type point_type;
+
+ for(int j = 0; j < count_x; ++j)
+ {
+ for(int k = 0; k < count_y; ++k)
+ {
+ mp.push_back(MultiPolygon::value_type());
+ mp.back().outer().push_back(point_type(width_x + j * 10 + 1, k * 10 + 1));
+ mp.back().outer().push_back(point_type(width_x + j * 10 + width_x, k * 10 + 5 + index));
+ mp.back().outer().push_back(point_type(width_x + j * 10 + 5 + index, k * 10 + 7));
+ mp.back().outer().push_back(point_type(width_x + j * 10 + 1, k * 10 + 1));
+ }
+ }
+}
+
+
+
+template <typename MultiPolygon>
+void test_intersects(int count_x, int count_y, int width_x, p_q_settings const& settings)
+{
+ MultiPolygon mp;
+
+ make_polygon(mp, count_x, count_y, 0, width_x);
+
+ bool const b = bg::intersects(mp);
+ if (b)
+ {
+ std::cout << " YES";
+ }
+
+ if(settings.svg)
+ {
+ typedef typename bg::coordinate_type<MultiPolygon>::type coordinate_type;
+ typedef typename bg::point_type<MultiPolygon>::type point_type;
+ std::ostringstream filename;
+ filename << "intersects_"
+ << string_from_type<coordinate_type>::name()
+ << ".svg";
+
+ std::ofstream svg(filename.str().c_str());
+ bg::svg_mapper<point_type> mapper(svg, 500, 500);
+ mapper.add(mp);
+ mapper.map(mp, "fill-opacity:0.5;fill:rgb(153,204,0);"
+ "stroke:rgb(153,204,0);stroke-width:3");
+ }
+}
+
+
+template <typename T, bool Clockwise, bool Closed>
+void test_all(int count, int count_x, int count_y, int width_x, p_q_settings const& settings)
+{
+ boost::timer t;
+
+ typedef bg::model::polygon
+ <
+ bg::model::d2::point_xy<T>, Clockwise, Closed
+ > polygon;
+ typedef bg::model::multi_polygon
+ <
+ polygon
+ > multi_polygon;
+
+
+ int index = 0;
+ for(int i = 0; i < count; i++)
+ {
+ test_intersects<multi_polygon>(count_x, count_y, width_x, settings);
+ }
+ std::cout
+ << " type: " << string_from_type<T>::name()
+ << " time: " << t.elapsed() << std::endl;
+}
+
+int main(int argc, char** argv)
+{
+ try
+ {
+ namespace po = boost::program_options;
+ po::options_description description("=== intersects ===\nAllowed options");
+
+ int width_x = 7;
+ int count = 1;
+ int count_x = 10;
+ int count_y = 10;
+ bool ccw = false;
+ bool open = false;
+ p_q_settings settings;
+
+ description.add_options()
+ ("help", "Help message")
+ ("count", po::value<int>(&count)->default_value(1), "Number of tests")
+ ("count_x", po::value<int>(&count_x)->default_value(10), "Triangle count in x-direction")
+ ("count_y", po::value<int>(&count_y)->default_value(10), "Triangle count in y-direction")
+ ("width_x", po::value<int>(&width_x)->default_value(7), "Width of triangle in x-direction")
+ ("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
+ ("open", po::value<bool>(&open)->default_value(false), "Open polygons")
+ ("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
+ ("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
+ ;
+
+ po::variables_map varmap;
+ po::store(po::parse_command_line(argc, argv, description), varmap);
+ po::notify(varmap);
+
+ if (varmap.count("help"))
+ {
+ std::cout << description << std::endl;
+ return 1;
+ }
+
+ if (ccw && open)
+ {
+ test_all<double, false, false>(count, count_x, count_y, width_x, settings);
+ }
+ else if (ccw)
+ {
+ test_all<double, false, true>(count, count_x, count_y, width_x, settings);
+ }
+ else if (open)
+ {
+ test_all<double, true, false>(count, count_x, count_y, width_x, settings);
+ }
+ else
+ {
+ test_all<double, true, true>(count, count_x, count_y, width_x, settings);
+ }
+
+#if defined(HAVE_TTMATH)
+ // test_all<ttmath_big, true, true>(seed, count, max, svg, level);
+#endif
+ }
+ catch(std::exception const& e)
+ {
+ std::cout << "Exception " << e.what() << std::endl;
+ }
+ catch(...)
+ {
+ std::cout << "Other exception" << std::endl;
+ }
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/overlay/robustness/intersects.vcproj b/libs/geometry/test/algorithms/overlay/robustness/intersects.vcproj
new file mode 100644
index 000000000..8331792e5
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/robustness/intersects.vcproj
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="intersects"
+ ProjectGUID="{1AC9B120-3ED0-4444-86E5-1916108943C7}"
+ RootNamespace="intersects"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\intersects"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../../..;."
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="2"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalLibraryDirectories=""
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\intersects"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../../..;."
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="program options"
+ >
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\cmdline.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\config_file.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\convert.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\options_description.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\parsers.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\positional_options.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\split.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\utf8_codecvt_facet.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\value_semantic.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\variables_map.cpp"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\intersects.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.cpp b/libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.cpp
new file mode 100644
index 000000000..2dca58bbc
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.cpp
@@ -0,0 +1,252 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2009-2012 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)
+
+#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
+#define BOOST_GEOMETRY_NO_BOOST_TEST
+
+
+#include <test_overlay_p_q.hpp>
+
+#include <boost/program_options.hpp>
+#include <boost/timer.hpp>
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/variate_generator.hpp>
+
+
+struct star_params
+{
+ int count; // points of ellipse, not of star
+ double factor_1;
+ double factor_2;
+ double center_x;
+ double center_y;
+ double rotation;
+ star_params(int c, double f1, double f2, double x, double y, double r = 0)
+ : count(c)
+ , factor_1(f1)
+ , factor_2(f2)
+ , center_x(x)
+ , center_y(y)
+ , rotation(r)
+ {}
+};
+
+
+
+template <typename Polygon>
+inline void make_star(Polygon& polygon, star_params const& p)
+{
+ typedef typename bg::point_type<Polygon>::type P;
+ typedef typename bg::select_most_precise
+ <
+ typename bg::coordinate_type<Polygon>::type,
+ long double
+ >::type coordinate_type;
+
+ // Create star
+ coordinate_type cx = 25.0;
+ coordinate_type cy = 25.0;
+
+ coordinate_type dx = 50.0;
+ coordinate_type dy = 50.0;
+
+ coordinate_type half = 0.5;
+ coordinate_type two = 2.0;
+
+ coordinate_type a1 = coordinate_type(p.factor_1) * half * dx;
+ coordinate_type b1 = coordinate_type(p.factor_1) * half * dy;
+ coordinate_type a2 = coordinate_type(p.factor_2) * half * dx;
+ coordinate_type b2 = coordinate_type(p.factor_2) * half * dy;
+
+ coordinate_type pi = boost::math::constants::pi<long double>();
+ coordinate_type delta = pi * two / coordinate_type(p.count - 1);
+ coordinate_type angle = coordinate_type(p.rotation) * delta;
+ for (int i = 0; i < p.count - 1; i++, angle += delta)
+ {
+ bool even = i % 2 == 0;
+ coordinate_type s = sin(angle);
+ coordinate_type c = cos(angle);
+ coordinate_type x = p.center_x + cx + (even ? a1 : a2) * s;
+ coordinate_type y = p.center_y + cy + (even ? b1 : b2) * c;
+ bg::exterior_ring(polygon).push_back(bg::make<P>(x, y));
+
+ }
+ bg::exterior_ring(polygon).push_back(bg::exterior_ring(polygon).front());
+ bg::correct(polygon);
+}
+
+
+template <typename T, bool Clockwise, bool Closed>
+void test_star_ellipse(int seed, int index, star_params const& par_p,
+ star_params const& par_q, p_q_settings const& settings)
+{
+ typedef bg::model::d2::point_xy<T> point_type;
+ typedef bg::model::polygon<point_type, Clockwise, Closed> polygon;
+
+ polygon p, q;
+ make_star(p, par_p);
+ make_star(q, par_q);
+
+ std::ostringstream out;
+ out << "rse_" << seed << "_" << index;
+ test_overlay_p_q<polygon, T>(out.str(), p, q, settings);
+}
+
+template <typename T, bool Clockwise, bool Closed>
+void test_type(int seed, int count, p_q_settings const& settings)
+{
+ boost::timer t;
+
+ typedef boost::minstd_rand base_generator_type;
+
+ //boost::uniform_real<> random_factor(0.5, 1.2);
+ //boost::uniform_real<> random_location(-10.0, 10.0);
+ //boost::uniform_int<> random_points(5, 20);
+
+ // This set (next 4 lines) are now solved for the most part
+ // 2009-12-03, 3 or 4 errors in 1000000 calls
+ // 2009-12-07, no errors in 1000000 calls
+ //boost::uniform_real<> random_factor(1.0 - 1e-3, 1.0 + 1e-3);
+ //boost::uniform_real<> random_location(-1e-3, 1e-3);
+ //boost::uniform_real<> random_rotation(-1e-3, 1e-3);
+ //boost::uniform_int<> random_points(3, 3);
+
+ // 2009-12-08, still errors, see notes
+ // 2009-12-09, (probably) solved by order on side
+ // 2010-01-16: solved (no errors in 1000000 calls)
+ //boost::uniform_real<> random_factor(1.0 - 1e-3, 1.0 + 1e-3);
+ //boost::uniform_real<> random_location(-1e-3, -1e-3);
+ //boost::uniform_real<> random_rotation(-1e-3, 1e-3);
+ //boost::uniform_int<> random_points(3, 4);
+
+ // This set (next 4 lines) are now solved ("distance-zero"/"merge iiii" problem)
+ // 2009-12-03: 5,50 -> 2:1 000 000 wrong (2009-12-03)
+ // 2010-01-16: solved (no errors in 10000000 calls)
+ boost::uniform_real<> random_factor(0.3, 1.2);
+ boost::uniform_real<> random_location(-20.0, +20.0); // -25.0, +25.0
+ boost::uniform_real<> random_rotation(0, 0.5);
+ boost::uniform_int<> random_points(5, 15);
+
+ base_generator_type generator(seed);
+
+ boost::variate_generator<base_generator_type&, boost::uniform_real<> >
+ factor_generator(generator, random_factor);
+
+ boost::variate_generator<base_generator_type&, boost::uniform_real<> >
+ location_generator(generator, random_location);
+
+ boost::variate_generator<base_generator_type&, boost::uniform_real<> >
+ rotation_generator(generator, random_rotation);
+
+ boost::variate_generator<base_generator_type&, boost::uniform_int<> >
+ int_generator(generator, random_points);
+
+ for(int i = 0; i < count; i++)
+ {
+ test_star_ellipse<T, Clockwise, Closed>(seed, i + 1,
+ star_params(int_generator() * 2 + 1,
+ factor_generator(), factor_generator(),
+ location_generator(), location_generator(), rotation_generator()),
+ star_params(int_generator() * 2 + 1,
+ factor_generator(), factor_generator(),
+ location_generator(), location_generator(), rotation_generator()),
+ settings);
+ }
+ std::cout
+ << "type: " << string_from_type<T>::name()
+ << " time: " << t.elapsed() << std::endl;
+}
+
+template <bool Clockwise, bool Closed>
+void test_all(std::string const& type, int seed, int count, p_q_settings settings)
+{
+ if (type == "float")
+ {
+ settings.tolerance = 1.0e-3;
+ test_type<float, Clockwise, Closed>(seed, count, settings);
+ }
+ else if (type == "double")
+ {
+ test_type<double, Clockwise, Closed>(seed, count, settings);
+ }
+#if defined(HAVE_TTMATH)
+ else if (type == "ttmath")
+ {
+ test_type<ttmath_big, Clockwise, Closed>(seed, count, settings);
+ }
+#endif
+}
+
+
+int main(int argc, char** argv)
+{
+ try
+ {
+ namespace po = boost::program_options;
+ po::options_description description("=== random_ellipses_stars ===\nAllowed options");
+
+ int count = 1;
+ int seed = static_cast<unsigned int>(std::time(0));
+ std::string type = "float";
+ bool ccw = false;
+ bool open = false;
+ p_q_settings settings;
+
+ description.add_options()
+ ("help", "Help message")
+ ("seed", po::value<int>(&seed), "Initialization seed for random generator")
+ ("count", po::value<int>(&count)->default_value(1), "Number of tests")
+ ("diff", po::value<bool>(&settings.also_difference)->default_value(false), "Include testing on difference")
+ ("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
+ ("open", po::value<bool>(&open)->default_value(false), "Open polygons")
+ ("type", po::value<std::string>(&type)->default_value("float"), "Type (float,double)")
+ ("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
+ ("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
+ ;
+
+ po::variables_map varmap;
+ po::store(po::parse_command_line(argc, argv, description), varmap);
+ po::notify(varmap);
+
+ if (varmap.count("help"))
+ {
+ std::cout << description << std::endl;
+ return 1;
+ }
+
+ if (ccw && open)
+ {
+ test_all<false, false>(type, seed, count, settings);
+ }
+ else if (ccw)
+ {
+ test_all<false, true>(type, seed, count, settings);
+ }
+ else if (open)
+ {
+ test_all<true, false>(type, seed, count, settings);
+ }
+ else
+ {
+ test_all<true, true>(type, seed, count, settings);
+ }
+ }
+ catch(std::exception const& e)
+ {
+ std::cout << "Exception " << e.what() << std::endl;
+ }
+ catch(...)
+ {
+ std::cout << "Other exception" << std::endl;
+ }
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.vcproj b/libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.vcproj
new file mode 100644
index 000000000..6f547c6f7
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.vcproj
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="random_ellipses_stars"
+ ProjectGUID="{C16633DE-83F8-40E3-9915-3B9C872C7B1E}"
+ RootNamespace="random_ellipses_stars"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\random_ellipses_stars"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../../..;../../..;."
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="0"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalLibraryDirectories=""
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\random_ellipses_stars"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../../..;../../..;."
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="program options"
+ >
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\cmdline.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\config_file.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\convert.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\options_description.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\parsers.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\positional_options.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\split.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\utf8_codecvt_facet.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\value_semantic.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\variables_map.cpp"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\random_ellipses_stars.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.cpp b/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.cpp
new file mode 100644
index 000000000..19db1dab3
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.cpp
@@ -0,0 +1,217 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2009-2012 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)
+
+#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
+#define BOOST_GEOMETRY_NO_BOOST_TEST
+
+#include <test_overlay_p_q.hpp>
+
+#include <boost/program_options.hpp>
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/variate_generator.hpp>
+#include <boost/timer.hpp>
+
+
+template <typename Polygon, typename Generator>
+inline void make_polygon(Polygon& polygon, Generator& generator, bool triangular)
+{
+ typedef typename bg::point_type<Polygon>::type point_type;
+ typedef typename bg::coordinate_type<Polygon>::type coordinate_type;
+
+ coordinate_type x, y;
+ x = generator();
+ y = generator();
+
+ typename bg::ring_type<Polygon>::type& ring = bg::exterior_ring(polygon);
+
+ point_type p;
+ bg::set<0>(p, x); bg::set<1>(p, y); ring.push_back(p);
+ bg::set<0>(p, x); bg::set<1>(p, y + 1); ring.push_back(p);
+ bg::set<0>(p, x + 1); bg::set<1>(p, y + 1); ring.push_back(p);
+ bg::set<0>(p, x + 1); bg::set<1>(p, y); ring.push_back(p);
+ bg::set<0>(p, x); bg::set<1>(p, y); ring.push_back(p);
+
+ if (triangular)
+ {
+ // Remove a point depending on generator
+ int c = generator() % 4;
+ if (c >= 1 && c <= 3)
+ {
+ ring.erase(ring.begin() + c);
+ }
+ }
+}
+
+
+
+template <typename MultiPolygon, typename Generator>
+bool test_recursive_boxes(MultiPolygon& result, int& index,
+ Generator& generator,
+ int level, bool triangular, p_q_settings const& settings)
+{
+ MultiPolygon p, q;
+
+ // Generate two boxes
+ if (level == 0)
+ {
+ p.resize(1);
+ q.resize(1);
+ make_polygon(p.front(), generator, triangular);
+ make_polygon(q.front(), generator, triangular);
+ bg::correct(p);
+ bg::correct(q);
+ }
+ else
+ {
+ bg::correct(p);
+ bg::correct(q);
+ if (! test_recursive_boxes(p, index, generator, level - 1, triangular, settings)
+ || ! test_recursive_boxes(q, index, generator, level - 1, triangular, settings))
+ {
+ return false;
+ }
+ }
+
+ typedef typename boost::range_value<MultiPolygon>::type polygon;
+
+ std::ostringstream out;
+ out << "recursive_box_" << index++ << "_" << level;
+
+ if (! test_overlay_p_q
+ <
+ polygon,
+ typename bg::coordinate_type<MultiPolygon>::type
+ >(out.str(), p, q, settings))
+ {
+ return false;
+ }
+
+ MultiPolygon mp;
+ bg::detail::union_::union_insert
+ <
+ polygon
+ >(p, q, std::back_inserter(mp));
+
+ bg::unique(mp);
+ bg::simplify(mp, result, 0.01);
+ bg::correct(mp);
+ return true;
+}
+
+
+template <typename T, bool Clockwise, bool Closed>
+void test_all(int seed, int count, int field_size, int level, bool triangular, p_q_settings const& settings)
+{
+ boost::timer t;
+
+ typedef boost::minstd_rand base_generator_type;
+
+ base_generator_type generator(seed);
+
+ boost::uniform_int<> random_coordinate(0, field_size - 1);
+ boost::variate_generator<base_generator_type&, boost::uniform_int<> >
+ coordinate_generator(generator, random_coordinate);
+
+ typedef bg::model::polygon
+ <
+ bg::model::d2::point_xy<T>, Clockwise, Closed
+ > polygon;
+ typedef bg::model::multi_polygon<polygon> mp;
+
+
+ int index = 0;
+ for(int i = 0; i < count; i++)
+ {
+ mp p;
+ test_recursive_boxes<mp>(p, index, coordinate_generator, level, triangular, settings);
+ }
+ std::cout
+ << "polygons: " << index
+ << " type: " << string_from_type<T>::name()
+ << " time: " << t.elapsed() << std::endl;
+}
+
+int main(int argc, char** argv)
+{
+ try
+ {
+ namespace po = boost::program_options;
+ po::options_description description("=== recursive_polygons ===\nAllowed options");
+
+ int count = 1;
+ int seed = static_cast<unsigned int>(std::time(0));
+ int level = 3;
+ int field_size = 10;
+ bool ccw = false;
+ bool open = false;
+ p_q_settings settings;
+ std::string form = "box";
+
+ description.add_options()
+ ("help", "Help message")
+ ("seed", po::value<int>(&seed), "Initialization seed for random generator")
+ ("count", po::value<int>(&count)->default_value(1), "Number of tests")
+ ("diff", po::value<bool>(&settings.also_difference)->default_value(false), "Include testing on difference")
+ ("level", po::value<int>(&level)->default_value(3), "Level to reach (higher->slower)")
+ ("size", po::value<int>(&field_size)->default_value(10), "Size of the field")
+ ("form", po::value<std::string>(&form)->default_value("box"), "Form of the polygons (box, triangle)")
+ ("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
+ ("open", po::value<bool>(&open)->default_value(false), "Open polygons")
+ ("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
+ ("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
+ ;
+
+ po::variables_map varmap;
+ po::store(po::parse_command_line(argc, argv, description), varmap);
+ po::notify(varmap);
+
+ if (varmap.count("help")
+ || (form != "box" && form != "triangle"))
+ {
+ std::cout << description << std::endl;
+ return 1;
+ }
+
+ bool triangular = form != "box";
+
+
+ if (ccw && open)
+ {
+ test_all<double, false, false>(seed, count, field_size, level, triangular, settings);
+ }
+ else if (ccw)
+ {
+ test_all<double, false, true>(seed, count, field_size, level, triangular, settings);
+ }
+ else if (open)
+ {
+ test_all<double, true, false>(seed, count, field_size, level, triangular, settings);
+ }
+ else
+ {
+ test_all<double, true, true>(seed, count, field_size, level, triangular, settings);
+ }
+
+#if defined(HAVE_TTMATH)
+ // test_all<ttmath_big, true, true>(seed, count, max, svg, level);
+#endif
+ }
+ catch(std::exception const& e)
+ {
+ std::cout << "Exception " << e.what() << std::endl;
+ }
+ catch(...)
+ {
+ std::cout << "Other exception" << std::endl;
+ }
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.vcproj b/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.vcproj
new file mode 100644
index 000000000..b2cc41335
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.vcproj
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="recursive_polygons"
+ ProjectGUID="{E1AA569C-858C-4789-A6FF-5CDFB41C59D7}"
+ RootNamespace="recursive_polygons"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\recursive_polygons"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../../..;."
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="2"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalLibraryDirectories=""
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\recursive_polygons"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../../..;."
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="program options"
+ >
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\cmdline.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\config_file.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\convert.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\options_description.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\parsers.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\positional_options.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\split.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\utf8_codecvt_facet.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\value_semantic.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\variables_map.cpp"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\recursive_polygons.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/robustness/robustness.sln b/libs/geometry/test/algorithms/overlay/robustness/robustness.sln
new file mode 100644
index 000000000..dd6ff8821
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/robustness/robustness.sln
@@ -0,0 +1,55 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "random_ellipses_stars", "random_ellipses_stars.vcproj", "{C16633DE-83F8-40E3-9915-3B9C872C7B1E}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "intersection_stars", "intersection_stars.vcproj", "{A76B81BF-B5B4-4D09-BB81-F235647891DE}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "intersection_pies", "intersection_pies.vcproj", "{24D92478-7C66-4DD5-A501-30A3D4376E4F}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "recursive_polygons", "recursive_polygons.vcproj", "{E1AA569C-858C-4789-A6FF-5CDFB41C59D7}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "star_comb", "star_comb.vcproj", "{6D8C81C1-23CD-469E-8094-E0C01B51E944}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "interior_triangles", "interior_triangles.vcproj", "{7583C2E3-AD74-4C34-8E94-9162F641B215}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "intersects", "intersects.vcproj", "{1AC9B120-3ED0-4444-86E5-1916108943C7}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {C16633DE-83F8-40E3-9915-3B9C872C7B1E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C16633DE-83F8-40E3-9915-3B9C872C7B1E}.Debug|Win32.Build.0 = Debug|Win32
+ {C16633DE-83F8-40E3-9915-3B9C872C7B1E}.Release|Win32.ActiveCfg = Release|Win32
+ {C16633DE-83F8-40E3-9915-3B9C872C7B1E}.Release|Win32.Build.0 = Release|Win32
+ {A76B81BF-B5B4-4D09-BB81-F235647891DE}.Debug|Win32.ActiveCfg = Debug|Win32
+ {A76B81BF-B5B4-4D09-BB81-F235647891DE}.Debug|Win32.Build.0 = Debug|Win32
+ {A76B81BF-B5B4-4D09-BB81-F235647891DE}.Release|Win32.ActiveCfg = Release|Win32
+ {A76B81BF-B5B4-4D09-BB81-F235647891DE}.Release|Win32.Build.0 = Release|Win32
+ {24D92478-7C66-4DD5-A501-30A3D4376E4F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {24D92478-7C66-4DD5-A501-30A3D4376E4F}.Debug|Win32.Build.0 = Debug|Win32
+ {24D92478-7C66-4DD5-A501-30A3D4376E4F}.Release|Win32.ActiveCfg = Release|Win32
+ {24D92478-7C66-4DD5-A501-30A3D4376E4F}.Release|Win32.Build.0 = Release|Win32
+ {E1AA569C-858C-4789-A6FF-5CDFB41C59D7}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E1AA569C-858C-4789-A6FF-5CDFB41C59D7}.Debug|Win32.Build.0 = Debug|Win32
+ {E1AA569C-858C-4789-A6FF-5CDFB41C59D7}.Release|Win32.ActiveCfg = Release|Win32
+ {E1AA569C-858C-4789-A6FF-5CDFB41C59D7}.Release|Win32.Build.0 = Release|Win32
+ {6D8C81C1-23CD-469E-8094-E0C01B51E944}.Debug|Win32.ActiveCfg = Debug|Win32
+ {6D8C81C1-23CD-469E-8094-E0C01B51E944}.Debug|Win32.Build.0 = Debug|Win32
+ {6D8C81C1-23CD-469E-8094-E0C01B51E944}.Release|Win32.ActiveCfg = Release|Win32
+ {6D8C81C1-23CD-469E-8094-E0C01B51E944}.Release|Win32.Build.0 = Release|Win32
+ {7583C2E3-AD74-4C34-8E94-9162F641B215}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7583C2E3-AD74-4C34-8E94-9162F641B215}.Debug|Win32.Build.0 = Debug|Win32
+ {7583C2E3-AD74-4C34-8E94-9162F641B215}.Release|Win32.ActiveCfg = Release|Win32
+ {7583C2E3-AD74-4C34-8E94-9162F641B215}.Release|Win32.Build.0 = Release|Win32
+ {1AC9B120-3ED0-4444-86E5-1916108943C7}.Debug|Win32.ActiveCfg = Debug|Win32
+ {1AC9B120-3ED0-4444-86E5-1916108943C7}.Debug|Win32.Build.0 = Debug|Win32
+ {1AC9B120-3ED0-4444-86E5-1916108943C7}.Release|Win32.ActiveCfg = Release|Win32
+ {1AC9B120-3ED0-4444-86E5-1916108943C7}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/algorithms/overlay/robustness/star_comb.cpp b/libs/geometry/test/algorithms/overlay/robustness/star_comb.cpp
new file mode 100644
index 000000000..8b1269f61
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/robustness/star_comb.cpp
@@ -0,0 +1,146 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2009-2012 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)
+
+
+#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
+#define BOOST_GEOMETRY_NO_BOOST_TEST
+#define BOOST_GEOMETRY_TIME_OVERLAY
+
+
+#include <test_overlay_p_q.hpp>
+
+#include <boost/program_options.hpp>
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/variate_generator.hpp>
+#include <boost/timer.hpp>
+
+#include <star_comb.hpp>
+
+
+template <typename Polygon>
+void add(Polygon& polygon, double x, double y, int)
+{
+ typedef typename boost::geometry::point_type<Polygon>::type p;
+ boost::geometry::exterior_ring(polygon).push_back(boost::geometry::make<p>(x, y));
+}
+
+
+template <typename Polygon>
+void test_star_comb(int star_point_count, int comb_comb_count, double factor1, double factor2, bool do_union, p_q_settings const& settings)
+{
+ Polygon star, comb;
+ make_star(star, add<Polygon>, star_point_count, factor1, factor2);
+ make_comb(comb, add<Polygon>, comb_comb_count);
+
+ std::ostringstream out;
+ out << "star_comb";
+ test_overlay_p_q
+ <
+ Polygon,
+ typename bg::coordinate_type<Polygon>::type
+ >(out.str(), star, comb, settings);
+}
+
+
+template <typename T, bool Clockwise, bool Closed>
+void test_all(int count, int star_point_count, int comb_comb_count, double factor1, double factor2, bool do_union, p_q_settings const& settings)
+{
+ boost::timer t;
+
+ typedef bg::model::polygon
+ <
+ bg::model::d2::point_xy<T>, Clockwise, Closed
+ > polygon;
+
+
+ int index = 0;
+ for(int i = 0; i < count; i++)
+ {
+ test_star_comb<polygon>(star_point_count, comb_comb_count, factor1, factor2, do_union, settings);
+ }
+ std::cout
+ << " type: " << string_from_type<T>::name()
+ << " time: " << t.elapsed() << std::endl;
+}
+
+int main(int argc, char** argv)
+{
+ try
+ {
+ namespace po = boost::program_options;
+ po::options_description description("=== star_comb ===\nAllowed options");
+
+ int count = 1;
+ bool do_union = false;
+ bool ccw = false;
+ bool open = false;
+ double factor1 = 1.1;
+ double factor2 = 0.2;
+ int point_count = 50;
+ p_q_settings settings;
+
+ description.add_options()
+ ("help", "Help message")
+ ("count", po::value<int>(&count)->default_value(1), "Number of tests")
+ ("point_count", po::value<int>(&point_count)->default_value(1), "Number of points in the star")
+ ("diff", po::value<bool>(&settings.also_difference)->default_value(false), "Include testing on difference")
+ ("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
+ ("open", po::value<bool>(&open)->default_value(false), "Open polygons")
+ ("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
+ ("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
+ ;
+
+ po::variables_map varmap;
+ po::store(po::parse_command_line(argc, argv, description), varmap);
+ po::notify(varmap);
+
+ if (varmap.count("help"))
+ {
+ std::cout << description << std::endl;
+ return 1;
+ }
+
+ int star_point_count = point_count * 2 + 1;
+ int comb_comb_count = point_count;
+
+
+ if (ccw && open)
+ {
+ test_all<double, false, false>(count, star_point_count, comb_comb_count, factor1, factor2, do_union, settings);
+ }
+ else if (ccw)
+ {
+ test_all<double, false, true>(count, star_point_count, comb_comb_count, factor1, factor2, do_union, settings);
+ }
+ else if (open)
+ {
+ test_all<double, true, false>(count, star_point_count, comb_comb_count, factor1, factor2, do_union, settings);
+ }
+ else
+ {
+ test_all<double, true, true>(count, star_point_count, comb_comb_count, factor1, factor2, do_union, settings);
+ }
+
+#if defined(HAVE_TTMATH)
+ // test_all<ttmath_big, true, true>(seed, count, max, svg, level);
+#endif
+ }
+ catch(std::exception const& e)
+ {
+ std::cout << "Exception " << e.what() << std::endl;
+ }
+ catch(...)
+ {
+ std::cout << "Other exception" << std::endl;
+ }
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/overlay/robustness/star_comb.hpp b/libs/geometry/test/algorithms/overlay/robustness/star_comb.hpp
new file mode 100644
index 000000000..7019a26d5
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/robustness/star_comb.hpp
@@ -0,0 +1,130 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2009-2012 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_STAR_COMB_HPP
+#define BOOST_GEOMETRY_STAR_COMB_HPP
+
+#include <iostream>
+#include <string>
+#include <vector>
+
+#include <boost/timer.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <boost/math/constants/constants.hpp>
+
+#include <test_overlay_p_q.hpp>
+
+
+template <typename Polygon, typename AddFunctor>
+inline void make_star(Polygon& polygon, AddFunctor functor,
+ int count, double factor1, double factor2,
+ double offset = 0.0,
+ bool close = true,
+ double orientation = 1.0)
+{
+ // Create star
+ double cx = 25.0;
+ double cy = 25.0;
+
+ double dx = 50.0;
+ double dy = 50.0;
+
+ double a1 = factor1 * 0.5 * dx;
+ double b1 = factor1 * 0.5 * dy;
+ double a2 = factor2 * 0.5 * dx;
+ double b2 = factor2 * 0.5 * dy;
+
+ double delta = orientation * boost::math::constants::pi<double>() * 2.0 / (count - 1);
+ double angle = offset * delta;
+ double x0, y0;
+ bool first = true;
+ for (int i = 0; i < count - 1; i++, angle += delta)
+ {
+ bool even = i % 2 == 0;
+ double x = cx + (even ? a1 : a2) * sin(angle);
+ double y = cy + (even ? b1 : b2) * cos(angle);
+ functor(polygon, x, y, i);
+ if (first)
+ {
+ x0 = x;
+ y0 = y;
+ first = false;
+ }
+
+ }
+ if (close)
+ {
+ functor(polygon, x0, y0, count);
+ }
+}
+
+template <typename Vector>
+void ccw_pushback(Vector& vector, double x, double y, int)
+{
+ vector.push_back(boost::make_tuple(x, y));
+}
+
+template <typename Polygon, typename AddFunctor>
+inline void make_comb(Polygon& polygon, AddFunctor functor,
+ int count,
+ bool close = true,
+ bool clockwise = true)
+{
+ int n = 0;
+
+ if (! clockwise)
+ {
+ typedef boost::tuple<double, double> tup;
+ typedef std::vector<tup> vector_type;
+ vector_type vec;
+
+ // Create in clockwise order
+ make_comb(vec, ccw_pushback<vector_type>, count, close, true);
+
+ // Add in reverse
+ // (For GCC 3.4 have it const)
+ vector_type const& v = vec;
+ for (vector_type::const_reverse_iterator
+ it = v.rbegin(); it != v.rend(); ++it)
+ {
+ functor(polygon, it->get<0>(), it->get<1>(), n++);
+ }
+ return;
+ }
+
+ // Create comb
+ functor(polygon, 25.0, 0.0, n++);
+ functor(polygon, 0.0, 25.0, n++);
+ functor(polygon, 25.0, 50.0, n++);
+
+ // Function parameters
+ double diff = (25.0 / (count - 0.5)) / 2.0;
+
+ double b1 = -25.0;
+ double b2 = 25.0 - diff * 2.0;
+
+ double x1 = 50.0, x2 = 25.0;
+
+ for (int i = 0; i < count - 1; i++)
+ {
+ functor(polygon, x1, (x1 + b1), n++); x1 -= diff;
+ functor(polygon, x1, (x1 + b1), n++); x1 -= diff;
+ functor(polygon, x2, (x2 + b2), n++); x2 -= diff;
+ functor(polygon, x2, (x2 + b2), n++); x2 -= diff;
+ }
+ functor(polygon, x1, (x1 + b1), n++);
+
+ if (close)
+ {
+ functor(polygon, 25.0, 0.0, 4);
+ }
+}
+
+
+#endif // BOOST_GEOMETRY_STAR_COMB_HPP
+
diff --git a/libs/geometry/test/algorithms/overlay/robustness/star_comb.vcproj b/libs/geometry/test/algorithms/overlay/robustness/star_comb.vcproj
new file mode 100644
index 000000000..01a30306a
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/robustness/star_comb.vcproj
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="star_comb"
+ ProjectGUID="{6D8C81C1-23CD-469E-8094-E0C01B51E944}"
+ RootNamespace="star_comb"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\star_comb"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../../..;."
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="2"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalLibraryDirectories=""
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\star_comb"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../../..;."
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="program options"
+ >
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\cmdline.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\config_file.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\convert.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\options_description.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\parsers.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\positional_options.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\split.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\utf8_codecvt_facet.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\value_semantic.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\variables_map.cpp"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\star_comb.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/robustness/test_overlay_p_q.hpp b/libs/geometry/test/algorithms/overlay/robustness/test_overlay_p_q.hpp
new file mode 100644
index 000000000..b13084982
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/robustness/test_overlay_p_q.hpp
@@ -0,0 +1,210 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+//
+// Copyright (c) 2009-2012 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_OVERLAY_P_Q_HPP
+#define BOOST_GEOMETRY_TEST_OVERLAY_P_Q_HPP
+
+#include <fstream>
+#include <iomanip>
+
+//#define BOOST_GEOMETRY_ROBUSTNESS_USE_DIFFERENCE
+
+
+#include <geometry_test_common.hpp>
+
+// For mixing int/float
+#if defined(_MSC_VER)
+#pragma warning( disable : 4244 )
+#pragma warning( disable : 4267 )
+#endif
+
+
+#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>
+#include <boost/geometry/algorithms/intersects.hpp>
+#include <boost/geometry/algorithms/touches.hpp>
+
+struct p_q_settings
+{
+ bool svg;
+ bool also_difference;
+ bool wkt;
+ double tolerance;
+
+ p_q_settings()
+ : svg(false)
+ , also_difference(false)
+ , wkt(false)
+ , tolerance(1.0e-6)
+ {}
+};
+
+template <typename Geometry>
+inline typename bg::default_area_result<Geometry>::type p_q_area(Geometry const& g)
+{
+ try
+ {
+ return bg::area(g);
+ }
+ catch(bg::empty_input_exception const&)
+ {
+ return 0;
+ }
+}
+
+template <typename OutputType, typename CalculationType, typename G1, typename G2>
+static bool test_overlay_p_q(std::string const& caseid,
+ G1 const& p, G2 const& q,
+ p_q_settings const& settings)
+{
+ bool result = true;
+
+ typedef typename bg::coordinate_type<G1>::type coordinate_type;
+ typedef typename bg::point_type<G1>::type point_type;
+
+ bg::model::multi_polygon<OutputType> out_i, out_u, out_d, out_d2;
+
+ CalculationType area_p = p_q_area(p);
+ CalculationType area_q = p_q_area(q);
+ CalculationType area_d1 = 0, area_d2 = 0;
+
+ bg::intersection(p, q, out_i);
+ CalculationType area_i = p_q_area(out_i);
+
+ bg::union_(p, q, out_u);
+ CalculationType area_u = p_q_area(out_u);
+
+ double sum = (area_p + area_q) - area_u - area_i;
+
+ bool wrong = std::abs(sum) > settings.tolerance;
+
+ if (settings.also_difference)
+ {
+ bg::difference(p, q, out_d);
+ bg::difference(q, p, out_d2);
+ area_d1 = p_q_area(out_d);
+ area_d2 = p_q_area(out_d2);
+ double sum_d1 = (area_u - area_q) - area_d1;
+ double sum_d2 = (area_u - area_p) - area_d2;
+ bool wrong_d1 = std::abs(sum_d1) > settings.tolerance;
+ bool wrong_d2 = std::abs(sum_d2) > settings.tolerance;
+
+ if (wrong_d1 || wrong_d2)
+ {
+ wrong = true;
+ }
+ }
+
+ if (true)
+ {
+ if ((area_i > 0 && bg::touches(p, q))
+ || (area_i <= 0 && bg::intersects(p, q) && ! bg::touches(p, q)))
+ {
+ std::cout << "Wrong 'touch'! "
+ << " Intersection area: " << area_i
+ << " Touch gives: " << std::boolalpha << bg::touches(p, q)
+ << std::endl;
+ wrong = true;
+ }
+ }
+
+ bool svg = settings.svg;
+
+ if (wrong || settings.wkt)
+ {
+ if (wrong)
+ {
+ result = false;
+ svg = true;
+ }
+ bg::unique(out_i);
+ bg::unique(out_u);
+
+ std::cout
+ << "type: " << string_from_type<CalculationType>::name()
+ << " id: " << caseid
+ << " area i: " << area_i
+ << " area u: " << area_u
+ << " area p: " << area_p
+ << " area q: " << area_q
+ << " sum: " << sum;
+
+ if (settings.also_difference)
+ {
+ std::cout
+ << " area d1: " << area_d1
+ << " area d2: " << area_d2;
+ }
+ std::cout
+ << std::endl
+ << std::setprecision(9)
+ << " p: " << bg::wkt(p) << std::endl
+ << " q: " << bg::wkt(q) << std::endl
+ << " i: " << bg::wkt(out_i) << std::endl
+ << " u: " << bg::wkt(out_u) << std::endl
+ ;
+
+ }
+
+ if(svg)
+ {
+ std::ostringstream filename;
+ filename << "overlay_" << caseid << "_"
+ << string_from_type<coordinate_type>::name()
+ << string_from_type<CalculationType>::name()
+ << ".svg";
+
+ std::ofstream svg(filename.str().c_str());
+
+ bg::svg_mapper<point_type> mapper(svg, 500, 500);
+
+ mapper.add(p);
+ mapper.add(q);
+
+ // Input shapes in green/blue
+ mapper.map(p, "fill-opacity:0.5;fill:rgb(153,204,0);"
+ "stroke:rgb(153,204,0);stroke-width:3");
+ mapper.map(q, "fill-opacity:0.3;fill:rgb(51,51,153);"
+ "stroke:rgb(51,51,153);stroke-width:3");
+
+ if (settings.also_difference)
+ {
+ for (BOOST_AUTO(it, out_d.begin()); it != out_d.end(); ++it)
+ {
+ mapper.map(*it,
+ "opacity:0.8;fill:none;stroke:rgb(255,128,0);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round");
+ }
+ for (BOOST_AUTO(it, out_d2.begin()); it != out_d2.end(); ++it)
+ {
+ mapper.map(*it,
+ "opacity:0.8;fill:none;stroke:rgb(255,0,255);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round");
+ }
+ }
+ else
+ {
+ for (BOOST_AUTO(it, out_i.begin()); it != out_i.end(); ++it)
+ {
+ mapper.map(*it, "fill-opacity:0.1;stroke-opacity:0.4;fill:rgb(255,0,0);"
+ "stroke:rgb(255,0,0);stroke-width:4");
+ }
+ for (BOOST_AUTO(it, out_u.begin()); it != out_u.end(); ++it)
+ {
+ mapper.map(*it, "fill-opacity:0.1;stroke-opacity:0.4;fill:rgb(255,0,0);"
+ "stroke:rgb(255,0,255);stroke-width:4");
+ }
+ }
+ }
+ return result;
+}
+
+#endif // BOOST_GEOMETRY_TEST_OVERLAY_P_Q_HPP
diff --git a/libs/geometry/test/algorithms/overlay/select_rings.cpp b/libs/geometry/test/algorithms/overlay/select_rings.cpp
new file mode 100644
index 000000000..4d81336c8
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/select_rings.cpp
@@ -0,0 +1,130 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 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 <algorithms/test_overlay.hpp>
+
+#include <boost/range/algorithm/copy.hpp>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/algorithms/detail/overlay/select_rings.hpp>
+#include <boost/geometry/algorithms/detail/overlay/assign_parents.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/polygon.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+
+#include <boost/assign/list_of.hpp>
+#include <boost/foreach.hpp>
+#include <boost/tuple/tuple.hpp>
+
+
+
+template
+<
+ typename Geometry1,
+ typename Geometry2,
+ bg::overlay_type OverlayType,
+ typename RingIdVector,
+ typename WithinVector
+>
+void test_geometry(std::string const& wkt1, std::string const& wkt2,
+ RingIdVector const& expected_ids,
+ WithinVector const& expected_withins)
+{
+ typedef bg::detail::overlay::ring_properties<typename bg::point_type<Geometry1>::type> properties;
+
+ Geometry1 geometry1;
+ Geometry2 geometry2;
+
+ bg::read_wkt(wkt1, geometry1);
+ bg::read_wkt(wkt2, geometry2);
+
+ typedef std::map<bg::ring_identifier, properties> map_type;
+ map_type selected;
+ std::map<bg::ring_identifier, int> empty;
+
+ bg::detail::overlay::select_rings<OverlayType>(geometry1, geometry2, empty, selected, true);
+
+ BOOST_CHECK_EQUAL(selected.size(), expected_ids.size());
+ BOOST_CHECK_EQUAL(selected.size(), expected_withins.size());
+
+ if (selected.size() <= expected_ids.size())
+ {
+ BOOST_AUTO(eit, expected_ids.begin());
+ BOOST_AUTO(wit, expected_withins.begin());
+ for(typename map_type::const_iterator it = selected.begin(); it != selected.end(); ++it, ++eit, ++wit)
+ {
+ bg::ring_identifier const ring_id = it->first;
+ BOOST_CHECK_EQUAL(ring_id.source_index, eit->source_index);
+ BOOST_CHECK_EQUAL(ring_id.multi_index, eit->multi_index);
+ BOOST_CHECK_EQUAL(ring_id.ring_index, eit->ring_index);
+ BOOST_CHECK_EQUAL(it->second.within_code, *wit);
+ }
+ }
+}
+
+
+
+
+template <typename P>
+void test_all()
+{
+ // Point in correct clockwise ring -> should return true
+ typedef bg::ring_identifier rid;
+
+ test_geometry<bg::model::polygon<P>, bg::model::polygon<P>, bg::overlay_union>(
+ winded[0], winded[1],
+ boost::assign::list_of
+ (rid(0,-1,-1))
+ (rid(0,-1, 0))
+ (rid(0,-1, 1))
+ (rid(0,-1, 3))
+ (rid(1,-1, 1))
+ (rid(1,-1, 2)),
+
+ boost::assign::list_of
+ (-1)
+ (-1)
+ (-1)
+ (-1)
+ (-1)
+ (-1)
+ );
+
+ //boost::assign::tuple_list_of(0,-1,-1,-1)(0,-1,0,-1)(0,-1,1,-1)(0,-1,3,-1)(1,-1,1,-1)(1,-1,2,-1));
+
+ test_geometry<bg::model::polygon<P>, bg::model::polygon<P>, bg::overlay_intersection>(
+ winded[0], winded[1],
+ boost::assign::list_of
+ (rid(0,-1, 2))
+ (rid(1,-1,-1))
+ (rid(1,-1, 0))
+ (rid(1,-1, 3)),
+
+ boost::assign::list_of
+ (1)
+ (1)
+ (1)
+ (1)
+ );
+
+
+ //boost::assign::tuple_list_of(0,-1,2,1)(1,-1,-1,1)(1,-1,0,1)(1,-1,3,1));
+}
+
+
+
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/overlay/select_rings.vcproj b/libs/geometry/test/algorithms/overlay/select_rings.vcproj
new file mode 100644
index 000000000..5706311fc
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/select_rings.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="select_rings"
+ ProjectGUID="{029117F7-1D6A-4A05-9FB7-93E09751C909}"
+ RootNamespace="select_rings"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\select_rings"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../../../../..;../..;../../../../../boost/geometry/extensions/contrib/ttmath"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\select_rings"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=".;../../../../..;../..;../../../../../boost/geometry/extensions/contrib/ttmath"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\select_rings.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/self_intersection_points.cpp b/libs/geometry/test/algorithms/overlay/self_intersection_points.cpp
new file mode 100644
index 000000000..91ee4bb34
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/self_intersection_points.cpp
@@ -0,0 +1,247 @@
+// 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.
+
+// 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 <iostream>
+#include <iomanip>
+#include <string>
+
+#include <geometry_test_common.hpp>
+
+
+#include <boost/geometry/algorithms/intersection.hpp>
+#include <boost/geometry/algorithms/intersects.hpp>
+//#include <boost/geometry/algorithms/detail/overlay/self_intersection_points.hpp>
+#include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/polygon.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/io/wkt/write.hpp>
+
+#include <algorithms/overlay/overlay_cases.hpp>
+
+
+#if defined(TEST_WITH_SVG)
+# include <boost/geometry/io/svg/svg_mapper.hpp>
+#endif
+
+
+struct test_self_intersection_points
+{
+ template <typename Geometry>
+ static void apply(std::string const& id,
+ boost::tuple<int, double, double> const& expected_count_and_center,
+ Geometry const& geometry, double precision)
+ {
+
+ typedef bg::detail::overlay::turn_info
+ <
+ typename bg::point_type<Geometry>::type
+ > turn_info;
+
+ std::vector<turn_info> turns;
+
+ ///bg::get_intersection_points(geometry, turns);
+
+ bg::detail::self_get_turn_points::no_interrupt_policy policy;
+ bg::self_turns
+ <
+ bg::detail::overlay::assign_null_policy
+ >(geometry, turns, policy);
+
+
+ typedef typename bg::coordinate_type<Geometry>::type ct;
+ ct zero = ct();
+ ct x = zero, y = zero;
+ BOOST_FOREACH(turn_info const& turn, turns)
+ {
+ x += bg::get<0>(turn.point);
+ y += bg::get<1>(turn.point);
+ }
+ int n = boost::size(turns);
+ if (n > 0)
+ {
+ x /= n;
+ y /= n;
+ }
+ /*std::cout << std::setprecision(8) << x << ", " << y << " "
+ << expected_count_and_center.get<1>()
+ << " " << expected_count_and_center.get<2>()
+ << std::endl;
+ */
+
+ BOOST_CHECK_EQUAL(expected_count_and_center.get<0>(), n);
+ //BOOST_CHECK_CLOSE(expected_count_and_center.get<1>(), x, precision);
+ //BOOST_CHECK_CLOSE(expected_count_and_center.get<2>(), y, precision);
+
+ if (n > 0)
+ {
+ BOOST_CHECK_EQUAL(bg::intersects(geometry), true);
+ }
+
+
+#if defined(TEST_WITH_SVG)
+ {
+ std::ostringstream filename;
+ filename << "self_ip" << id << ".svg";
+
+ std::ofstream svg(filename.str().c_str());
+
+ bg::svg_mapper<typename bg::point_type<Geometry>::type> mapper(svg, 500, 500);
+ mapper.add(geometry);
+
+ mapper.map(geometry, "fill:rgb(255,255,128);stroke:rgb(0,0,0);stroke-width:1");
+
+ BOOST_FOREACH(turn_info const& turn, turns)
+ {
+ mapper.map(turn.point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1");
+ }
+ }
+#endif
+ }
+};
+
+
+template <typename Geometry, typename T>
+void test_self_overlay(std::string const& id, T const& expected,
+ std::string const& wkt, double precision = 0.001)
+{
+ if (wkt.empty())
+ {
+ return;
+ }
+
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+
+ std::string caseid = id;
+
+#ifdef GEOMETRY_DEBUG_INTERSECTION
+ std::cout << std::endl << std::endl << "# " << caseid << std::endl;
+#endif
+ test_self_intersection_points::apply(caseid, expected, geometry, precision);
+}
+
+
+#if ! defined(GEOMETRY_TEST_MULTI)
+
+template <typename P>
+void test_self_all()
+{
+ typedef bg::model::polygon<P> polygon;
+
+ // Just a normal polygon
+ test_self_overlay<polygon>("1", boost::make_tuple(0, 0, 0),
+ "POLYGON((0 0,0 4,1.5 2.5,2.5 1.5,4 0,0 0))");
+
+ // TODO: clean-up and visualize testcases
+
+
+
+ // Self intersecting
+ test_self_overlay<polygon>("2", boost::make_tuple(2, 2.40625, 2.125),
+ "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))");
+
+
+ // Self intersecting in last segment
+
+ test_self_overlay<polygon>("3", boost::make_tuple(1, 2, 2),
+ "POLYGON((0 2,2 4,2 0,4 2,0 2))");
+
+
+ // Self tangent
+
+ test_self_overlay<polygon>("4", boost::make_tuple(1, 2, 4),
+ "POLYGON((0 0,0 4,4 4,4 0,2 4,0 0))");
+
+
+ // Self tangent in corner
+
+ test_self_overlay<polygon>("5", boost::make_tuple(1, 0, 4),
+ "POLYGON((0 0,0 4,4 4,4 0,0 4,2 0,0 0))");
+
+
+ // With spike
+
+ test_self_overlay<polygon>("6", boost::make_tuple(1, 4, 2),
+ "POLYGON((0 0,0 4,4 4,4 2,6 2,4 2,4 0,0 0))");
+
+
+ // Non intersection, but with duplicate
+
+ test_self_overlay<polygon>("d1", boost::make_tuple(0, 0, 0),
+ "POLYGON((0 0,0 4,4 0,4 0,0 0))");
+
+
+ // With many duplicates
+
+ test_self_overlay<polygon>("d2", boost::make_tuple(0, 0, 0),
+ "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))");
+
+
+ // Hole: interior tangent to exterior
+
+ test_self_overlay<polygon>("h1", boost::make_tuple(1, 2, 4),
+ "POLYGON((0 0,0 4,4 4,4 0,0 0),(1 2,2 4,3 2,1 2))");
+
+
+ // Hole: interior intersecting exterior
+
+ test_self_overlay<polygon>("h2", boost::make_tuple(2, 4, 3.5),
+ "POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,1 3,5 4,1 1))");
+
+
+ // Hole: two intersecting holes
+ test_self_overlay<polygon>("h3", boost::make_tuple(2, 2.5, 2.5),
+ "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))");
+
+ // Hole: self-intersecting hole
+ test_self_overlay<polygon>("h4", boost::make_tuple(2, 2.06060606, 2.96969697),
+ "POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,3 3,3 2.5,1 3.5,1.5 3.5,1 1))");
+
+ // Many loops (e.g. as result from buffering)
+ test_self_overlay<polygon>("case_1", boost::make_tuple(6, 0, 0),
+ "POLYGON((1 3,0 9,9 5,1 7,9 8,2 5,10 10,9 2,1 3))");
+
+ test_self_overlay<polygon>("buffer_poly_indentation8_d_r", boost::make_tuple(3, 0, 0),
+ "POLYGON((-0.8 5,-0.799036 5.03925,-0.796148 5.07841,-0.791341 5.11738,-0.784628 5.15607,-0.776025 5.19438,-0.765552 5.23223,-0.753235 5.26951,-0.739104 5.30615,-0.723191 5.34204,-0.705537 5.37712,-0.686183 5.41128,-0.665176 5.44446,-0.642566 5.47656,-0.618408 5.50751,-0.592761 5.53725,-0.537247 5.59276,-0.507515 5.61841,-0.476559 5.64257,-0.444456 5.66518,-0.411282 5.68618,-0.377117 5.70554,-0.342044 5.72319,-0.306147 5.7391,-0.269512 5.75324,-0.232228 5.76555,-0.194384 5.77603,-0.156072 5.78463,-0.117384 5.79134,-0.0784137 5.79615,-0.0392541 5.79904,0 5.8,4 5.8,4.03925 5.79904,4.07841 5.79615,4.11738 5.79134,4.15607 5.78463,4.19438 5.77603,4.23223 5.76555,4.26951 5.75324,4.30615 5.7391,4.34204 5.72319,4.37712 5.70554,4.41128 5.68618,4.44446 5.66518,4.47656 5.64257,4.50751 5.61841,4.53725 5.59276,4.59276 5.53725,4.61841 5.50751,4.64257 5.47656,4.66518 5.44446,4.68618 5.41128,4.70554 5.37712,4.72319 5.34204,4.7391 5.30615,4.75324 5.26951,4.76555 5.23223,4.77603 5.19438,4.78463 5.15607,4.79134 5.11738,4.79615 5.07841,4.79904 5.03925,4.8 5,4.8 4,4.79976 3.98037,4.79904 3.96075,4.79783 3.94115,4.79615 3.92159,4.79398 3.90207,4.79134 3.88262,4.78822 3.86323,4.78463 3.84393,4.78056 3.82472,4.77603 3.80562,4.77102 3.78663,4.76555 3.76777,4.75962 3.74905,4.75324 3.73049,4.74639 3.71208,4.73137 3.67581,4.72319 3.65796,4.71458 3.64031,4.70554 3.62288,4.69607 3.60568,4.68618 3.58872,4.67588 3.572,4.66518 3.55554,4.65407 3.53935,4.64257 3.52344,4.63068 3.50781,4.61841 3.49249,4.60577 3.47746,4.59276 3.46275,4.5794 3.44837,4.56569 3.43431,3.56569 2.43431,3.53725 2.40724,3.50751 2.38159,3.47656 2.35743,3.44446 2.33482,3.41128 2.31382,3.37712 2.29446,3.34204 2.27681,3.30615 2.2609,3.26951 2.24676,3.23223 2.23445,3.19438 2.22397,3.15607 2.21537,3.11738 2.20866,3.07841 2.20385,3.03925 2.20096,2.96075 2.20096,2.92159 2.20385,2.88262 2.20866,2.84393 2.21537,2.80562 2.22397,2.76777 2.23445,2.73049 2.24676,2.69385 2.2609,2.65796 2.27681,2.62288 2.29446,2.58872 2.31382,2.55554 2.33482,2.52344 2.35743,2.49249 2.38159,2.46275 2.40724,2.43431 2.43431,2.8 2.06863,2.8 2.93137,2.43431 2.56569,2.46275 2.59276,2.49249 2.61841,2.52344 2.64257,2.55554 2.66518,2.58872 2.68618,2.62288 2.70554,2.65796 2.72319,2.69385 2.7391,2.73049 2.75324,2.76777 2.76555,2.80562 2.77603,2.84393 2.78463,2.88262 2.79134,2.92159 2.79615,2.96075 2.79904,3.03925 2.79904,3.07841 2.79615,3.11738 2.79134,3.15607 2.78463,3.19438 2.77603,3.23223 2.76555,3.26951 2.75324,3.30615 2.7391,3.34204 2.72319,3.37712 2.70554,3.41128 2.68618,3.44446 2.66518,3.47656 2.64257,3.50751 2.61841,3.53725 2.59276,3.56569 2.56569,4.56569 1.56569,4.5794 1.55163,4.59276 1.53725,4.60577 1.52254,4.61841 1.50751,4.63068 1.49219,4.64257 1.47656,4.65407 1.46065,4.66518 1.44446,4.67588 1.428,4.68618 1.41128,4.69607 1.39432,4.70554 1.37712,4.71458 1.35969,4.72319 1.34204,4.73137 1.32419,4.74639 1.28792,4.75324 1.26951,4.75962 1.25095,4.76555 1.23223,4.77102 1.21337,4.77603 1.19438,4.78056 1.17528,4.78463 1.15607,4.78822 1.13677,4.79134 1.11738,4.79398 1.09793,4.79615 1.07841,4.79783 1.05885,4.79904 1.03925,4.79976 1.01963,4.8 1,4.8 0,4.79904 -0.0392541,4.79615 -0.0784137,4.79134 -0.117384,4.78463 -0.156072,4.77603 -0.194384,4.76555 -0.232228,4.75324 -0.269512,4.7391 -0.306147,4.72319 -0.342044,4.70554 -0.377117,4.68618 -0.411282,4.66518 -0.444456,4.64257 -0.476559,4.61841 -0.507515,4.59276 -0.537247,4.53725 -0.592761,4.50751 -0.618408,4.47656 -0.642566,4.44446 -0.665176,4.41128 -0.686183,4.37712 -0.705537,4.34204 -0.723191,4.30615 -0.739104,4.26951 -0.753235,4.23223 -0.765552,4.19438 -0.776025,4.15607 -0.784628,4.11738 -0.791341,4.07841 -0.796148,4.03925 -0.799036,4 -0.8,0 -0.8,-0.0392541 -0.799036,-0.0784137 -0.796148,-0.117384 -0.791341,-0.156072 -0.784628,-0.194384 -0.776025,-0.232228 -0.765552,-0.269512 -0.753235,-0.306147 -0.739104,-0.342044 -0.723191,-0.377117 -0.705537,-0.411282 -0.686183,-0.444456 -0.665176,-0.476559 -0.642566,-0.507515 -0.618408,-0.537247 -0.592761,-0.592761 -0.537247,-0.618408 -0.507515,-0.642566 -0.476559,-0.665176 -0.444456,-0.686183 -0.411282,-0.705537 -0.377117,-0.723191 -0.342044,-0.739104 -0.306147,-0.753235 -0.269512,-0.765552 -0.232228,-0.776025 -0.194384,-0.784628 -0.156072,-0.791341 -0.117384,-0.796148 -0.0784137,-0.799036 -0.0392541,-0.8 0,-0.8 5))");
+
+ test_self_overlay<polygon>("toolkit_2", boost::make_tuple(12, 0, 0),
+ "POLYGON((170718 605997,170718 605997,170776 606016,170773 606015,170786 606020,170778 606016,170787 606021,170781 606017,170795 606028,170795 606028,170829 606055,170939 606140,170933 605968,170933 605968,170932 605908,170929 605834,170920 605866,170961 605803,170739 605684,170699 605749,170691 605766,170693 605762,170686 605775,170688 605771,170673 605794,170676 605790,170668 605800,170672 605796,170651 605818,170653 605816,170639 605829,170568 605899,170662 605943,170633 605875,170603 605961,170718 605997))");
+
+ // Real-life
+
+ std::string const ticket17 = "POLYGON ((-122.28139163 37.37319149,-122.28100699 37.37273669,-122.28002186 37.37303123,-122.27979681 37.37290072,-122.28007349 37.37240493,-122.27977334 37.37220360,-122.27819720 37.37288580,-122.27714184 37.37275161,-122.27678628 37.37253167,-122.27766437 37.37180973,-122.27804382 37.37121453,-122.27687664 37.37101354,-122.27645829 37.37203386,-122.27604423 37.37249110,-122.27632234 37.37343339,-122.27760980 37.37391082,-122.27812478 37.37800320,-122.26117222 37.39121007,-122.25572289 37.39566631,-122.25547269 37.39564971,-122.25366304 37.39552993,-122.24919976 37.39580268,-122.24417933 37.39366907,-122.24051443 37.39094143,-122.23246277 37.38100418,-122.23606766 37.38141338,-122.24001587 37.37738940,-122.23666848 37.37609347,-122.23057450 37.37882170,-122.22679803 37.37807143,-122.22525727 37.37448817,-122.22523229 37.37443000,-122.23083199 37.37609347,-122.23033486 37.37777891,-122.23169030 37.37732117,-122.23229178 37.37709687,-122.23237761 37.37631249,-122.23297776 37.37438834,-122.23872850 37.37165986,-122.24044511 37.36934068,-122.24671067 37.36865847,-122.24825570 37.36981819,-122.25151719 37.36947713,-122.25357721 37.36756706,-122.26001451 37.36579354,-122.25615213 37.36545239,-122.25486458 37.36245083,-122.25357721 37.36108651,-122.25194642 37.36013139,-122.24885652 37.35958557,-122.24911401 37.35849399,-122.25357721 37.35808470,-122.25675286 37.35897159,-122.25855539 37.35753887,-122.26181687 37.35828939,-122.26713837 37.35897159,-122.26782510 37.36108651,-122.26662339 37.36456559,-122.27288911 37.36722601,-122.27366159 37.36531602,-122.27168740 37.36470213,-122.27391900 37.36374701,-122.27074326 37.36245083,-122.27134408 37.35951742,-122.27426240 37.36135926,-122.27709482 37.36115474,-122.27966974 37.36231438,-122.27958391 37.36463382,-122.27572152 37.36463382,-122.27563569 37.36524779,-122.27700899 37.36593000,-122.27709482 37.36763529,-122.27554978 37.36838573,-122.27667254 37.36931478,-122.27677932 37.36932073,-122.27769362 37.36853987,-122.27942490 37.36830803,-122.28178776 37.36677917,-122.28509559 37.36443500,-122.28845129 37.36413744,-122.29194403 37.36695946,-122.29382577 37.36726817,-122.29600414 37.36898512,-122.29733083 37.36995398,-122.29593239 37.37141436,-122.29416649 37.37075898,-122.29325026 37.37108436,-122.29652910 37.37311697,-122.29584237 37.37374461,-122.29537583 37.37573372,-122.29487677 37.37752502,-122.30923212 37.37593011,-122.31122484 37.38230086,-122.31467994 37.38092472,-122.31715663 37.38252181,-122.32307970 37.38166978,-122.31985618 37.37667694,-122.32210304 37.37580220,-122.32581446 37.37589532,-122.32401730 37.37331839,-122.32960417 37.37189020,-122.33465527 37.37331906,-122.33425328 37.37623680,-122.33620676 37.37726132,-122.33397986 37.37822382,-122.33358918 37.38036590,-122.33202637 37.37986918,-122.33147954 37.38101784,-122.33394080 37.38198017,-122.33545239 37.38587943,-122.33478058 37.38785697,-122.33386050 37.38723721,-122.33350041 37.38571137,-122.33122003 37.38548891,-122.33140008 37.38650606,-122.33366042 37.38817490,-122.33244019 37.39157602,-122.33298157 37.39419201,-122.33164013 37.39477028,-122.33202017 37.39518351,-122.33358038 37.39499282,-122.33376050 37.39597811,-122.33550067 37.39734478,-122.33556069 37.39481797,-122.33344040 37.39292676,-122.33638094 37.38892189,-122.34240644 37.38852719,-122.34906293 37.38726898,-122.35072321 37.39338769,-122.34910291 37.39445252,-122.34796272 37.39410291,-122.34449043 37.39640534,-122.34500223 37.39729709,-122.34936291 37.39670910,-122.35098322 37.39531066,-122.35364623 37.39554510,-122.35434369 37.39612111,-122.35798429 37.39600988,-122.35768430 37.39478621,-122.36334519 37.39206871,-122.36604726 37.39203267,-122.36778592 37.39335592,-122.36518870 37.40022011,-122.36554552 37.40247752,-122.36370519 37.40331974,-122.36270506 37.40530591,-122.36320512 37.40670418,-122.36149849 37.40851392,-122.36730580 37.41054938,-122.37263720 37.41378932,-122.37161871 37.42076600,-122.36566153 37.42006292,-122.36520547 37.42742106,-122.37165953 37.43661157,-122.35943972 37.44459022,-122.35356359 37.44600810,-122.33792254 37.45796329,-122.35228518 37.47478091,-122.35127080 37.48181199,-122.34867342 37.48487322,-122.34359717 37.48801082,-122.33388431 37.48677650,-122.33142321 37.48429747,-122.32929580 37.48473149,-122.32609609 37.48291144,-122.32344850 37.48228229,-122.31924364 37.48410234,-122.31677299 37.48114051,-122.31431751 37.47848973,-122.31259201 37.47682190,-122.31515972 37.47568196,-122.31691389 37.47360309,-122.31292494 37.46960081,-122.31130153 37.46937743,-122.30889894 37.47124987,-122.30612839 37.47011613,-122.30149630 37.46568378,-122.30064277 37.46363784,-122.29283821 37.45922376,-122.28630141 37.45415497,-122.28883099 37.44629920,-122.28316717 37.44197138,-122.27554148 37.42297597,-122.25597410 37.40553692,-122.25196579 37.40129593,-122.25012043 37.40049143,-122.24823207 37.39897758,-122.24754551 37.39740941,-122.24778582 37.39621607,-122.24934787 37.39599102,-122.25005170 37.39871849,-122.25222328 37.39863668,-122.25342491 37.39737529,-122.25520162 37.39667289,-122.25528737 37.39522726,-122.27747460 37.37809616,-122.27977493 37.37858717,-122.28157729 37.37920106,-122.28322534 37.37952846,-122.28416939 37.38092656,-122.28621223 37.37984219,-122.28638389 37.37613857,-122.28382607 37.37843722,-122.27930278 37.37718220,-122.28196361 37.37652740,-122.28295058 37.37568167,-122.28216101 37.37523148,-122.28114822 37.37543608,-122.27934569 37.37528613,-122.27996369 37.37448121,-122.28104521 37.37454944,-122.28185197 37.37422883,-122.28290767 37.37474038,-122.28376597 37.37467224,-122.28428104 37.37399012,-122.28402346 37.37338989,-122.28610922 37.37364914,-122.28651264 37.37327388,-122.28672722 37.37207343,-122.28628398 37.37205448,-122.28574460 37.37166682,-122.28479711 37.37200981,-122.28327731 37.37137228,-122.28285511 37.37100700,-122.28279409 37.37125669,-122.28315527 37.37173756,-122.28321872 37.37220569,-122.28187007 37.37231918,-122.28193109 37.37294908,-122.28139163 37.37319149))";
+ test_self_overlay<polygon>("ticket17", boost::make_tuple(2, 0, 0), ticket17);
+
+ std::string const uscounty_ne = "POLYGON((-72.297814 44.183545,-72.30498 44.183149,-72.306552 44.183668,-72.321587 44.188629,-72.368353 44.204057,-72.362972 44.211115,-72.357354 44.218485,-72.336176 44.246264,-72.333283 44.25006,-72.329737 44.254806,-72.327061 44.258388,-72.316301 44.272583,-72.317394 44.293961,-72.317455 44.295412,-72.317621 44.298382,-72.31757 44.298423,-72.308843 44.30567,-72.308336 44.306161,-72.305947 44.30843,-72.295321 44.31908,-72.292014 44.321754,-72.289771 44.323567,-72.283878 44.32772,-72.282024 44.32927,-72.275139 44.335778,-72.271225 44.339322,-72.269779 44.340275,-72.269584 44.340461,-72.267563 44.343747,-72.255707 44.359532,-72.254273 44.361075,-72.249662 44.367162,-72.249549 44.367339,-72.24832 44.369514,-72.247963 44.369843,-72.245885 44.372717,-72.244210 44.375223,-72.240219 44.380321,-72.24014 44.380422,-72.229086 44.391162,-72.224592 44.39553,-72.224364 44.395751,-72.224549 44.395985,-72.226261 44.398726,-72.225478 44.399979,-72.223603 44.402875,-72.222984 44.403317,-72.222454 44.403753,-72.217109 44.411083,-72.218322 44.411745,-72.218833 44.412134,-72.218904 44.412313,-72.219023 44.412613,-72.219444 44.412803,-72.21963 44.412887,-72.220395 44.413162,-72.220619 44.413527,-72.22215 44.414167,-72.222276 44.414327,-72.222276 44.414784,-72.222565 44.415058,-72.22266 44.415469,-72.222565 44.415583,-72.22282 44.416063,-72.222757 44.416452,-72.222543 44.416596,-72.222247 44.416792,-72.221852 44.416792,-72.221439 44.416564,-72.22084 44.416647,-72.220708 44.416898,-72.221268 44.417736,-72.221378 44.418454,-72.220846 44.418454,-72.220492 44.418406,-72.220095 44.418422,-72.219850 44.418865,-72.220006 44.419292,-72.220514 44.419909,-72.220846 44.420637,-72.220581 44.421159,-72.220824 44.421665,-72.221732 44.42214,-72.222374 44.422757,-72.222971 44.422583,-72.223103 44.422282,-72.223259 44.421981,-72.223923 44.42195,-72.224874 44.421491,-72.22514 44.420827,-72.225557 44.420503,-72.226261 44.420157,-72.226305 44.419869,-72.226807 44.419643,-72.226863 44.419618,-72.227333 44.41927,-72.22776 44.41927,-72.228341 44.419488,-72.22864 44.419675,-72.229199 44.420381,-72.229136 44.421066,-72.228977 44.421181,-72.228945 44.421569,-72.228404 44.421958,-72.228297 44.421996,-72.228021 44.422096,-72.227097 44.422119,-72.226936 44.422302,-72.22649 44.422508,-72.225917 44.422645,-72.224831 44.423217,-72.224068 44.42324,-72.223654 44.423537,-72.223654 44.423717,-72.223654 44.423742,-72.223781 44.42381,-72.223908 44.424587,-72.223924 44.424667,-72.227403 44.426083,-72.228008 44.426329,-72.228662 44.426595,-72.229395 44.426894,-72.230747 44.427231,-72.230971 44.427489,-72.234293 44.428436,-72.236972 44.429199,-72.23719 44.430035,-72.238801 44.430515,-72.24147 44.43131,-72.249962 44.43504,-72.252411 44.436005,-72.255865 44.437305,-72.263358 44.440285,-72.268753 44.442368,-72.277045 44.445563,-72.282573 44.447693,-72.292033 44.451282,-72.299916 44.454331,-72.30082 44.45469,-72.321277 44.462572,-72.325974 44.464436,-72.337127 44.468707,-72.341171 44.470234,-72.348117 44.472931,-72.350859 44.473996,-72.358758 44.477037,-72.371940 44.482113,-72.37455 44.483117,-72.374648 44.483164,-72.374779 44.483225,-72.381115 44.485666,-72.381492 44.485688,-72.392298 44.489866,-72.403342 44.494088,-72.418579 44.499928,-72.418900 44.500046,-72.4255 44.502596,-72.426254 44.502888,-72.434315 44.506098,-72.429847 44.512045,-72.428773 44.513475,-72.421543 44.522929,-72.42088 44.523797,-72.419175 44.524889,-72.416181 44.528756,-72.415673 44.529497,-72.411684 44.534382,-72.403416 44.545482,-72.401901 44.547507,-72.398575 44.553005,-72.396373 44.555888,-72.394723 44.556887,-72.389997 44.563861,-72.38785 44.567083,-72.374786 44.584125,-72.374551 44.584042,-72.374141 44.583887,-72.364296 44.579947,-72.363627 44.579974,-72.362284 44.579484,-72.354192 44.576537,-72.351726 44.575587,-72.346763 44.573679,-72.326173 44.566333,-72.322536 44.56502,-72.312109 44.560996,-72.303198 44.557718,-72.30252 44.557467,-72.299574 44.556334,-72.28218 44.550137,-72.282083 44.550101,-72.280975 44.54965,-72.278823 44.548773,-72.268653 44.544573,-72.268148 44.544564,-72.267242 44.544547,-72.267178 44.544523,-72.266593 44.544303,-72.264975 44.543192,-72.263435 44.542639,-72.263284 44.542541,-72.262964 44.542336,-72.261344 44.544238,-72.259827 44.54559,-72.257865 44.548899,-72.254187 44.554001,-72.249372 44.560675,-72.241644 44.570815,-72.237928 44.576139,-72.237433 44.576818,-72.236396 44.578188,-72.226097 44.591711,-72.224712 44.59373,-72.21978 44.600803,-72.218155 44.602206,-72.210135 44.612594,-72.209324 44.613712,-72.208816 44.614535,-72.207016 44.617438,-72.202901 44.624073,-72.202293 44.625051,-72.199855 44.62841,-72.198157 44.630644,-72.194619 44.635355,-72.193153 44.637354,-72.19052 44.641163,-72.188343 44.644224,-72.184378 44.649871,-72.182172 44.652973,-72.176 44.661598,-72.173651 44.665011,-72.169648 44.67078,-72.165261 44.676857,-72.163971 44.678423,-72.162882 44.679959,-72.158868 44.685588,-72.156736 44.688747,-72.152374 44.694988,-72.150094 44.698355,-72.147612 44.7018,-72.147155 44.702567,-72.146873 44.703032,-72.146226 44.703325,-72.145589 44.702653,-72.141899 44.701438,-72.132779 44.698434,-72.128309 44.696934,-72.124544 44.695638,-72.110654 44.691192,-72.109358 44.690747,-72.088864 44.683714,-72.09305 44.694921,-72.094078 44.697511,-72.094433 44.698327,-72.09461 44.698776,-72.094955 44.699515,-72.095146 44.700011,-72.099952 44.712285,-72.100813 44.714476,-72.101332 44.715715,-72.101783 44.717146,-72.108368 44.733658,-72.114503 44.749624,-72.091369 44.738322,-72.083693 44.734606,-72.061312 44.723479,-72.039137 44.7125,-72.036351 44.711121,-72.02562 44.705812,-72.024818 44.705401,-72.012503 44.698821,-72.010696 44.699614,-72.007273 44.70299,-72.006749 44.703702,-72.005453 44.70441,-72.004999 44.704665,-72.002948 44.706065,-72.002574 44.706344,-71.998947 44.710903,-71.9954 44.715164,-71.995032 44.715247,-71.989775 44.720625,-71.988815 44.721224,-71.981344 44.728822,-71.98093 44.729224,-71.977211 44.732588,-71.976089 44.733763,-71.974770 44.735186,-71.974591 44.73538,-71.973434 44.736503,-71.97039 44.73946,-71.959927 44.749625,-71.958846 44.750086,-71.950606 44.758585,-71.950276 44.758952,-71.943595 44.765337,-71.939936 44.769032,-71.930968 44.765049,-71.928756 44.762738,-71.921857 44.759843,-71.902374 44.750318,-71.882733 44.740608,-71.882573 44.740269,-71.881573 44.739354,-71.876888 44.736935,-71.875148 44.736035,-71.874539 44.735721,-71.858381 44.72766,-71.837294 44.716637,-71.83775 44.716201,-71.852267 44.702366,-71.856071 44.69874,-71.856484 44.698345,-71.87445 44.681027,-71.881231 44.674373,-71.882862 44.67311,-71.883675 44.67175,-71.88436 44.671401,-71.885978 44.669571,-71.888314 44.667829,-71.890624 44.665594,-71.891007 44.664845,-71.898726 44.657917,-71.902653 44.654205,-71.910085 44.64718,-71.910282 44.647038,-71.907401 44.645283,-71.894791 44.638722,-71.89426 44.638626,-71.892962 44.637931,-71.874538 44.628066,-71.86852 44.625053,-71.848306 44.614173,-71.848221 44.614129,-71.842803 44.611203,-71.842732 44.611165,-71.843021 44.610884,-71.856079 44.597255,-71.856286 44.59707,-71.874003 44.580903,-71.874537 44.580409,-71.898111 44.557857,-71.89867 44.557286,-71.908656 44.54708,-71.884835 44.524403,-71.884487 44.524048,-71.874412 44.51323,-71.871838 44.510637,-71.871760 44.51054,-71.861209 44.500056,-71.856636 44.496178,-71.8567 44.496122,-71.874535 44.480282,-71.885627 44.470472,-71.891883 44.464859,-71.893164 44.46383,-71.903342 44.454655,-71.903549 44.454476,-71.912995 44.450245,-71.921348 44.446484,-71.922164 44.44623,-71.925058 44.444914,-71.926307 44.44418,-71.933287 44.441174,-71.91481 44.423081,-71.90842 44.416928,-71.905891 44.414322,-71.898406 44.407105,-71.897962 44.406696,-71.897325 44.406109,-71.886305 44.395364,-71.874506 44.383831,-71.867904 44.377301,-71.865579 44.374962,-71.858643 44.368062,-71.849854 44.359674,-71.847478 44.357361,-71.844776 44.354732,-71.841775 44.351811,-71.840508 44.350578,-71.837656 44.347801,-71.838072 44.347593,-71.83875 44.34721,-71.839767 44.346579,-71.840775 44.345795,-71.84159 44.3453,-71.842483 44.344757,-71.843283 44.34444,-71.844319 44.344204,-71.845288 44.343871,-71.845882 44.343666,-71.846346 44.343506,-71.848005 44.342766,-71.849099 44.342345,-71.849899 44.341978,-71.851118 44.341405,-71.85184 44.341143,-71.852628 44.340873,-71.85355 44.340717,-71.854404 44.340617,-71.855257 44.340589,-71.85619 44.340522,-71.857168 44.340463,-71.858155 44.340363,-71.859166 44.340369,-71.859940 44.340357,-71.860974 44.340282,-71.861941 44.340109,-71.86265 44.33992,-71.863291 44.339778,-71.863719 44.339644,-71.864485 44.339374,-71.865196 44.339071,-71.865895 44.338801,-71.866458 44.338514,-71.866753 44.338322,-71.867509 44.337964,-71.868253 44.337638,-71.869120 44.337288,-71.869616 44.337129,-71.869909 44.336962,-71.870573 44.336804,-71.871203 44.336686,-71.871488 44.336689,-71.871833 44.336641,-71.872472 44.336628,-71.873009 44.336736,-71.873713 44.336973,-71.874326 44.337195,-71.874535 44.337123,-71.874997 44.337226,-71.875514 44.337266,-71.875863 44.33737,-71.876122 44.337482,-71.8762 44.337539,-71.87629 44.337651,-71.876313 44.337732,-71.876324 44.337844,-71.876324 44.337925,-71.876358 44.338054,-71.876403 44.338167,-71.876448 44.338287,-71.876583 44.338424,-71.876685 44.338512,-71.876731 44.338548,-71.876973 44.338572,-71.877493 44.338615,-71.877628 44.338623,-71.877965 44.338719"
+ ",-71.878695 44.338964,-71.879896 44.339367,-71.880546 44.339559,-71.880962 44.33976,-71.881154 44.33988,-71.881895 44.340209,-71.883973 44.341228,-71.884917 44.341717,-71.885044 44.341794,-71.887531 44.3426,-71.888182 44.342807,-71.888483 44.342846,-71.888866 44.342916,-71.88893 44.342938,-71.888994 44.342945,-71.889404 44.343039,-71.889893 44.343174,-71.890324 44.343274,-71.890332 44.343272,-71.890380 44.343255,-71.890408 44.343246,-71.890456 44.343228,-71.890548 44.343209,-71.890644 44.343192,-71.890739 44.343177,-71.890844 44.343173,-71.890926 44.343201,-71.891373 44.343335,-71.892197 44.343693,-71.894326 44.344591,-71.895856 44.345209,-71.898726 44.346251,-71.900162 44.346722,-71.902332 44.347499,-71.903115 44.347694,-71.905036 44.348154,-71.906001 44.348239,-71.906909 44.348284,-71.917008 44.346714,-71.917434 44.346535,-71.918748 44.345555,-71.921314 44.343835,-71.921459 44.343739,-71.924607 44.342252,-71.925088 44.342024,-71.926666 44.340286,-71.928041 44.338516,-71.929109 44.337577,-71.932138 44.336541,-71.935395 44.33577,-71.936773 44.335684,-71.939049 44.335843,-71.942442 44.336805,-71.943365 44.337188,-71.944254 44.337643,-71.945162 44.337744,-71.952593 44.337689,-71.956516 44.337632,-71.958119 44.337544,-71.959965 44.337013,-71.961822 44.336634,-71.963133 44.336556,-71.972572 44.336781,-71.973300 44.336777,-71.977175 44.337518,-71.977971 44.33757,-71.979505 44.337354,-71.980559 44.337486,-71.98112 44.3375,-71.984281 44.336414,-71.984617 44.336243,-71.984729 44.335882,-71.986483 44.331218,-71.987862 44.330081,-71.988305 44.329768,-71.989058 44.329561,-71.992446 44.328548,-71.993662 44.327611,-71.999448 44.325595,-72.000793 44.325295,-72.001221 44.325234,-72.001792 44.325079,-72.002314 44.324871,-72.003547 44.324397,-72.00485 44.324054,-72.005532 44.323829,-72.00676 44.323357,-72.009976 44.321951,-72.012172 44.321408,-72.014543 44.321032,-72.015936 44.320849,-72.01913 44.320383,-72.019577 44.320498,-72.019801 44.32052,-72.019908 44.320683,-72.020149 44.320818,-72.021041 44.320887,-72.021994 44.321184,-72.025782 44.322054,-72.028201 44.322375,-72.029061 44.322398,-72.029698 44.32217,-72.031322 44.320936,-72.031959 44.320662,-72.033136 44.320365,-72.033137 44.319543,-72.033773 44.317989,-72.033806 44.317349,-72.033678 44.316823,-72.03317 44.31632,-72.032341 44.315752,-72.031937 44.315475,-72.031802 44.315383,-72.031739 44.314652,-72.031549 44.313966,-72.031708 44.313007,-72.032218 44.311955,-72.032505 44.310653,-72.032444 44.307134,-72.032316 44.306677,-72.032541 44.303752,-72.032955 44.302701,-72.033464 44.301878,-72.034324 44.300941,-72.03487 44.300512,-72.035660 44.29989,-72.03633 44.298634,-72.03703 44.297834,-72.039003 44.296463,-72.039836 44.296087,-72.040117 44.295962,-72.040543 44.295876,-72.041609 44.295665,-72.041856 44.29565,-72.043202 44.295579,-72.043775 44.295608,-72.044546 44.294969,-72.044926 44.294636,-72.045137 44.29391,-72.045265 44.293198,-72.045745 44.292448,-72.046302 44.291983,-72.047349 44.291581,-72.048216 44.291404,-72.049472 44.291186,-72.051541 44.290889,-72.053355 44.290501,-72.054046 44.289971,-72.055002 44.288945,-72.055964 44.288162,-72.056078 44.287893,-72.056409 44.287618,-72.057273 44.287163,-72.05888 44.28624,-72.059957 44.284767,-72.062298 44.281754,-72.065434 44.277235,-72.066464 44.275093,-72.067774 44.270976,-72.066464 44.268331,-72.065949 44.268666,-72.064544 44.267997,-72.062671 44.269336,-72.060846 44.269972,-72.05874 44.270005,-72.058646 44.269269,-72.059395 44.268365,-72.05888 44.266926,-72.059113 44.265787,-72.058553 44.265285,-72.059021 44.265018,-72.059581 44.264315,-72.059535 44.265687,-72.060378 44.264951,-72.061173 44.263377,-72.061033 44.26244,-72.060333 44.261643,-72.060398 44.261463,-72.060723 44.261313,-72.061173 44.261258,-72.061495 44.260726,-72.06156 44.260621,-72.061542 44.26047,-72.060878 44.260436,-72.060518 44.260284,-72.060307 44.259961,-72.060259 44.259789,-72.060163 44.259766,-72.060194 44.257778,-72.060099 44.257595,-72.059838 44.256295,-72.059782 44.256018,-72.059523 44.255798,-72.059432 44.255721,-72.059018 44.255013,-72.058161 44.253916,-72.058224 44.253823,-72.058033 44.253664,-72.05708 44.252064,-72.056889 44.251859,-72.055694 44.250061,-72.055641 44.249649,-72.055515 44.249615,-72.055483 44.24912,-72.055134 44.248435,-72.054276 44.247703,-72.05399 44.246926,-72.051002 44.244892,-72.050112 44.244046,-72.049604 44.243292,-72.048999 44.242058,-72.04846 44.241212,-72.04792 44.239498,-72.047889 44.238493,-72.048621 44.237145,-72.050209 44.235066,-72.050656 44.233581,-72.052118 44.229856,-72.052469 44.229239,-72.052532 44.228805,-72.053264 44.227114,-72.053581 44.22604,-72.053995 44.224028,-72.0539 44.222703,-72.053614 44.221081,-72.053518 44.221035,-72.053518 44.220852,-72.053423 44.220784,-72.053423 44.220601,-72.053328 44.220487,-72.053328 44.220327,-72.053043 44.219732,-72.052662 44.218841,-72.052966 44.217794,-72.053232 44.216876,-72.05495 44.213677,-72.055903 44.212694,-72.056952 44.212169,-72.058605 44.211803,-72.058954 44.211597,-72.059716 44.210752,-72.060067 44.209998,-72.060067 44.209816,-72.058987 44.208512,-72.058605 44.208215,-72.058542 44.208032,-72.05886 44.207667,-72.058987 44.207164,-72.058906 44.20701,-72.058796 44.206798,-72.058066 44.206067,-72.058194 44.204907,-72.058287 44.204056,-72.058987 44.202114,-72.059564 44.201223,-72.059614 44.201144,-72.059669 44.201061,-72.060067 44.200446,-72.060543 44.200012,-72.062035 44.199074,-72.063560 44.198457,-72.064005 44.198069,-72.064577 44.196949,-72.064608 44.196058,-72.064608 44.195692,-72.06499 44.194801,-72.065213 44.194115,-72.065403 44.192607,-72.066102 44.19039,-72.066166 44.189773,-72.065911 44.189293,-72.065085 44.188631,-72.064285 44.187888,-72.06299 44.186688,-72.061337 44.184951,-72.05956 44.182666,-72.059116 44.181912,-72.058956 44.18182,-72.057496 44.179444,-72.056987 44.178096,-72.056861 44.178027,-72.056862 44.177822,-72.056798 44.17773,-72.056798 44.177433,-72.056575 44.176679,-72.056480 44.176633,-72.05629 44.175742,-72.054734 44.173114,-72.054227 44.172108,-72.054005 44.170646,-72.05391 44.170577,-72.053783 44.169869,-72.053021 44.167903,-72.052196 44.166921,-72.051655 44.166463,-72.050575 44.165961,-72.049179 44.165138,-72.048925 44.164795,-72.048799 44.164498,-72.048672 44.164452,-72.048639 44.164201,-72.048418 44.163926,-72.048355 44.163058,-72.048101 44.162144,-72.047592 44.161801,-72.047022 44.161595,-72.046133 44.161549,-72.043244 44.161869,-72.042830 44.161754,-72.042386 44.161343,-72.042386 44.160817,-72.042672 44.160292,-72.043785 44.158852,-72.044102 44.158121,-72.044039 44.157435,-72.043785 44.157047,-72.0435 44.156841,-72.042801 44.156613,-72.042103 44.15659,-72.041119 44.156864,-72.040167 44.157023,-72.039594 44.156749,-72.039245 44.156703,-72.039150 44.156498,-72.03988 44.155932,-72.039976 44.155858,-72.040082 44.155749,-72.040737 44.155972,-72.041923 44.156312,-72.042043 44.156349,-72.042801 44.156613,-72.044676 44.157097,-72.044884 44.157151,-72.045078 44.157206,-72.045767 44.157401,-72.046234 44.157563,-72.047344 44.157836,-72.048554 44.158134,-72.058602 44.160893,-72.065528 44.162794,-72.066594 44.163099,-72.070984 44.164364,-72.083157 44.167671,-72.083344 44.167722,-72.083451 44.167775,-72.087279 44.168733,-72.091724 44.16998,-72.092625 44.170284,-72.097954 44.171765,-72.100237 44.172391,-72.100809 44.172548,-72.100996 44.172599,-72.101265 44.172673,-72.10189 44.172759,-72.102047 44.172803,-72.105729 44.173842,-72.109921 44.175046,-72.110927 44.175333,-72.116790 44.176949,-72.122705 44.178552,-72.124310 44.179174,-72.133395 44.181725,-72.138984 44.183365,-72.139194 44.183494,-72.139466 44.183503,-72.140796 44.183868,-72.151283 44.186773,-72.166147 44.190938,-72.16836 44.191508,-72.17026 44.192053,-72.171978 44.19207,-72.174381 44.192183,-72.175395 44.192186,-72.187153 44.191379,-72.190945 44.191111,-72.191322 44.191101,-72.192686 44.190957,-72.199012 44.190573,-72.204065 44.190303,-72.209594 44.190003,-72.210965 44.189741,-72.221076 44.189175,-72.229408 44.188625,-72.237321 44.188057,-72.238117 44.188023,-72.24954 44.187528,-72.271323 44.185807,-72.282972 44.184887,-72.297814 44.183545))";
+ test_self_overlay<polygon>("uscounty_ne", boost::make_tuple(1, 0, 0), uscounty_ne);
+
+
+
+}
+#endif
+
+
+#if ! defined(GEOMETRY_TEST_MULTI)
+int test_main(int, char* [])
+{
+ test_self_all<bg::model::d2::point_xy<double> >();
+ return 0;
+}
+#endif
diff --git a/libs/geometry/test/algorithms/overlay/self_intersection_points.vcproj b/libs/geometry/test/algorithms/overlay/self_intersection_points.vcproj
new file mode 100644
index 000000000..a4cdb8049
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/self_intersection_points.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="self_intersection_points"
+ ProjectGUID="{06B6DCBB-AEDA-49FA-81D9-EA8959958EFC}"
+ RootNamespace="self_intersection_points"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\self_intersection_points"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\self_intersection_points"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\self_intersection_points.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/split_rings.cpp b/libs/geometry/test/algorithms/overlay/split_rings.cpp
new file mode 100644
index 000000000..00cf9f85b
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/split_rings.cpp
@@ -0,0 +1,155 @@
+// 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.
+
+// 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 <iostream>
+#include <iomanip>
+#include <string>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/detail/overlay/split_rings.hpp>
+#include <boost/geometry/algorithms/area.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/io/wkt/write.hpp>
+
+
+#if defined(TEST_WITH_SVG)
+# include <boost/geometry/io/svg/svg_mapper.hpp>
+#endif
+
+
+struct test_split_rings
+{
+ template <typename Geometry>
+ static void apply(std::string const& id,
+ Geometry const& geometry,
+ int expected_ring_count,
+ double precision)
+ {
+
+ typedef typename bg::ring_type<Geometry>::type ring_type;
+ std::vector<ring_type> rings;
+ bg::split_rings(geometry, rings);
+
+ BOOST_CHECK_EQUAL(rings.size(), expected_ring_count);
+
+
+#if defined(TEST_WITH_SVG)
+ {
+ std::ostringstream filename;
+ filename << "split_rings_" << id << ".svg";
+
+ std::ofstream svg(filename.str().c_str());
+
+ bg::svg_mapper<typename bg::point_type<Geometry>::type> mapper(svg, 500, 500);
+ mapper.add(geometry);
+
+ mapper.map(geometry, "fill:rgb(255,255,128);stroke:rgb(0,0,0);stroke-width:1");
+
+ BOOST_FOREACH(ring_type const& ring, rings)
+ {
+ std::string style = "opacity:0.6;fill:rgb";
+ std::string color = bg::area(ring) > 0 ? "(255,0,0)" : "(0,0,255)";
+ mapper.map(ring, style + color + ";stroke:rgb(128,128,128);stroke-width:3");
+ }
+ }
+#endif
+ }
+};
+
+
+template <typename Geometry>
+void test_geometry(std::string const& caseid,
+ std::string const& wkt,
+ int expected_ring_count, double precision = 0.001)
+{
+ if (wkt.empty())
+ {
+ return;
+ }
+
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+
+ test_split_rings::apply(caseid, geometry, expected_ring_count, precision);
+}
+
+
+#if ! defined(GEOMETRY_TEST_MULTI)
+
+template <typename P>
+void test_self_all()
+{
+ typedef bg::model::polygon<P> polygon;
+
+ // Simplex
+
+ test_geometry<polygon>("1", "POLYGON((0 0,0 10,10 10,5 2,5 8,10 0,0 0))", 2);
+
+
+ // // Many loops (e.g. as result from buffering)
+ test_geometry<polygon>("many_loops",
+ "POLYGON((1 3,0 9,9 5,1 7,9 8,2 5,10 10,9 2,1 3))", 3);
+
+
+ // From "mill" (flower)
+ test_geometry<polygon>("2",
+ "POLYGON((5 6.10557,3.64223 8.82111,4.28284 8.71716,2.28284 6.71716,2.17889 7.35777,4.89443 6,2.17889 4.64223,2.28284 5.28284,4.28284 3.28284,3.62547 3.14045,5 6.10557))",
+ 5);
+
+ test_geometry<polygon>("3",
+ "POLYGON((0.6 10.4,9.4 10.4,9.4 -0.4,7.59 -0.4,4.59 5.33667,4.25383 5.6797,2.67526 4.89042,4.28284 3.28284,3.62547 3.14045,5.15 7.20587,5.15 -0.4,0.6 -0.4,0.6 10.4))",
+ 4);
+
+ test_geometry<polygon>("4",
+ "POLYGON((0.6 10.4,9.4 10.4,9.4 -0.4,4.59 -0.4,4.59 5.5,4.70431 5.22003,3.93716 6.00284,5 7.06569,6.06284 6.00284,5.29569 5.22003,5.41 5.5,5.41 0.01,5.01 0.41,5.25 0.41,4.85 0.01,4.85 7.20587,6.37453 3.14045,5.71716 3.28284,7.71716 5.28284,7.82111 4.64223,5.10557 6,7.82111 7.35777,7.71716 6.71716,5.71716 8.71716,6.35777 8.82111,5 6.10557,3.64223 8.82111,4.28284 8.71716,2.28284 6.71716,2.17889 7.35777,4.89443 6,2.17889 4.64223,2.28284 5.28284,4.28284 3.28284,3.62547 3.14045,5.15 7.20587,5.15 -0.4,0.6 -0.4,0.6 10.4))",
+ 21);
+
+
+ // Split at end-point
+ test_geometry<polygon>("end1", "POLYGON((0 -1,0 10,10 10,10 0,-1 0,0 -1))", 2);
+ test_geometry<polygon>("end2", "POLYGON((0 -1,0 10,11 10,11 11,10 11,10 0,-1 0,0 -1))", 3);
+ test_geometry<polygon>("end3", "POLYGON((0 -1,0 10,11 10,11 12,12 12,12 11,10 11,10 0,-1 0,0 -1))", 4);
+
+ // Common boundaries
+ test_geometry<polygon>("common1", "POLYGON((0 0,0 10,10 10,10 0,15 0,15 5,10 5,10 0,0 0))", 2);
+
+
+ /*
+ // From us counties
+ test_geometry<polygon>("us_counties_1",
+ "POLYGON((-111.5261116995073 41.22069282150765,-111.5217628285303 41.22035416591237,-111.5169320292328 41.22267065617934,-111.5202664326763 41.22008222445458,-111.524706358225 41.21912313459525,-111.5275767689257 41.2191200646373,-111.5313115885788 41.21977799763464,-111.5361319416122 41.22230930953956,-111.5390149025386 41.22669307111289,-111.5389640868764 41.22665820699549,-111.5405314519348 41.226478917027,-111.5432483336679 41.22674131537675,-111.5420873870024 41.22669699246593,-111.5468899132279 41.22714783689431,-111.5460245791811 41.22698484329734,-111.549259355884 41.2274477430645,-111.5577408755315 41.22811342877968,-111.5617324131657 41.22965779857636,-111.5622074202574 41.22994756325099,-111.5670818828246 41.22909494401993,-111.5692718200805 41.22891062885189,-111.5728540853548 41.22873442382645,-111.5760492668632 41.22941962741943,-111.5791498048043 41.22837886418323,-111.5837423095737 41.22837646600842,-111.5873509885199 41.22912252997033,-111.5905502098084 41.23037015657303,-111.5905738976172 41.23038614536871,-111.5911014306057 41.23028197627109,-111.5941112302391 41.22824505355918,-111.595808135602 41.22727811489068,-111.5980905931322 41.22548836332129,-111.5989075933465 41.22473873279626,-111.6007963250705 41.22266022435337,-111.6036899443978 41.22086457915817,-111.6058137732627 41.22012887375856,-111.602749721482 41.22196865310281,-111.5997971061567 41.22806209012482,-111.6002070563618 41.23129419775559,-111.6028708561713 41.23528460733029,-111.5994206515041 41.23211047917744,-111.5970021250484 41.22731367405874,-111.5968553199938 41.2213333698604,-111.5978240860405 41.218735705151,-111.59872799008 41.21674091429518,-111.5990118775156 41.21586922673351,-111.5993569133788 41.21346252288525,-111.601620124863 41.20717717448136,-111.6036896381354 41.20413147570312,-111.6066477579892 41.20036520970371,-111.6170938638088 41.19792503997269,-111.6171211409054 41.197912672181,-111.6174792281175 41.19763333099935,-111.6154497071748 41.19990210883104,-111.6145469690724 41.20214793299209,-111.6143872042365 41.20466380077419,-111.6140900270553 41.2012073328748,-111.6150859490031 41.19660529794054,-111.6218436555485 41.19061554473284,-111.6263257242001 41.18915337689279,-111.6371251993805 41.18909914015737,-111.6373680096377 41.18885567474617,-111.6383949129559 41.18739026040299,-111.6411123401382 41.18431339866869,-111.6444453559743 41.18263938395823,-111.6475502757163 41.18131111472079,-111.6480824344513 41.18111660627603,-111.6487261483388 41.18018217910811,-111.6541286582274 41.17582409853807,-111.6607502293818 41.17606808683036,-111.6639928385305 41.17750001069842,-111.6627289991998 41.17881191178137,-111.6627289991998 41.16984763275211,-111.6723147297616 41.17250652017602,-111.6740201607502 41.17050691221176,-111.6809028142628 41.17126673355348,-111.6809650818884 41.17123939654464,-111.6853833520725 41.17029389383428,-111.6898658836949 41.17133338502266,-111.6902209084905 41.17152318556664,-111.6904607105552 41.17152361200778,-111.6937608878567 41.171379538936,-111.6956197940083 41.17208616938441,-111.6993728847585 41.17040839085778,-111.7047507179242 41.17328962730216,-111.705138917194 41.1733253907057,-111.7102826252236 41.17325145150028,-111.7134998796559 41.17582525522811,-111.713857740997 41.1760577731046,-111.7143713164526 41.17626863893947,-111.714718580845 41.17638849963699,-111.7161627293466 41.17641647553787,-111.7235652490785 41.17698889260424,-111.7252956636535 41.18063938630633,-111.7255467374265 41.18070780591805,-111.7276362413481 41.18341443465751,-111.7281195035541 41.18379477216856,-111.7289633137073 41.18400466618191,-111.7322463245943 41.18537474159142,-111.7350417499302 41.18787350954477,-111.7400241492817 41.18920498371762,-111.7403897806728 41.18992392192225,-111.7405871404544 41.18993880963902,-111.7419062185388 41.19156105303389,-111.7441017621743 41.19149230781282,-111.74633522639 41.19326425318707,-111.7521804511058 41.19568179191514,-111.7548256119847 41.2000988714596,-111.7562439764081 41.20369244649578,-111.756385520958 41.20741568356885,-111.7560620666084 41.21002180147129,-111.7557493627381 41.2115435666562,-111.7556682922401 41.21250032230501,-111.7549762228438 41.2083729918014,-111.753021260936 41.20652061558319,-111.7508964302413 41.20557195114677,-111.7490502562344 41.20743627992862,-111.7538043672131 41.20092160586289,-111.7599851908795 41.19974075159288,-111.7535482000425 41.20277936096064,-111.7771999505038 41.20664084862795,-111.7822946483749 41.20868575255317,-111.7890479847428 41.20857546302415,-111.7834053984034 41.21113545825469,-111.8070916837301 41.21164475084303,-111.7983239620671 41.20690941545636,-111.7989057748419 41.20685382060309,-111.7988970680348 41.20685567247974,-111.8003950034205 41.20645434489455,-111.8015510337817 41.20521459774467,-111.8040078302751 41.20352268624269,-111.8051400156104 41.20305119804074,-111.805500030827 41.2024512874073,-111.8087760206539 41.19898729003837,-111.8127632488366 41.19571430853862,-111.8168246456107 41.19449127428283,-111.8226375152909 41.19565019698728,-111.8231921576817 41.19623717584509,-111.8268842679184 41.19390830631116,-111.8294386474025 41.19326999358571,-111.8281081895357 41.1923520714658,-111.83461841217 41.19040911228597,-111.8363820197726 41.18976234820737,-111.8389082690123 41.18928774535946,-111.8407278566805 41.18914288072003,-111.8414848277101 41.18915262958935,-111.8446813084015 41.18866243446734,-111.845959886583 41.18861802620197,-111.8434859428467 41.18901816674433,-111.8524610560402 41.1882713958049,-111.8481595765179 41.18832631814151,-111.8496570501088 41.18779673144824,-111.8533671749084 41.18768855682465,-111.8555901658855 41.18738820608631,-111.8545856366929 41.18543601585669,-111.8575805827953 41.18393299249777,-111.8615394981653 41.18172167621498,-111.8609477242236 41.1754400940934,-111.8606336522941 41.17523901959252,-111.8627856637925 41.16997723323662,-111.8635235797656 41.16904436111794,-111.8633266432236 41.16866453458245,-111.8616523096336 41.16843313106372,-111.8616216864947 41.16843907484764,-111.8576102899319 41.16714259614227,-111.8547179142898 41.16646709783558,-111.849004376199 41.16243082584917,-111.8507419858166 41.16392775774389,-111.8449330541267 41.15938516033442,-111.8453252871628 41.14671969870953,-111.8475090520856 41.14347927334031,-111.8495994494861 41.14184555885641,-111.8555300241724 41.12935093455723,-111.8539570692924 41.12913464596177,-111.8600529353453 41.12732099986341,-111.8628893201463 41.12732099986341,-111.8661516016343 41.12766178921265,-111.8717554038871 41.12781992480323,-111.8727125056091 41.12781941462108,-111.8744250029675 41.12734726013537,-111.8884146775109 41.12740408919985,-111.8910337085167 41.12670722950872,-111.8905605241137 41.12684570910798,-111.9013989090858 41.12571131225988,-111.902772044475 41.12619651923274,-111.9129115072118 41.12403191483529,-111.9147507512154 41.12495153622086,-111.9201178874858 41.12566715447374,-111.9240696750495 41.12855499923182,-111.9276546757843 41.12501918886934,-111.9355598663484 41.12798289437448,-111.9479782385554 41.12689279975358,-111.9529681915247 41.12994221534668,-111.9568859680716 41.13081283226165,-111.9574421207222 41.13136898494051,-111.9640025656762 41.1310956332098,-111.9657332834527 41.1401588859141,-111.9717215703218 41.14239547503718,-111.9730675011477 41.14266466120236,-111.9787329018218 41.14336183402796,-111.9883596218439 41.14364222393152,-111.9931363926252 41.14354196764271,-111.9994051904948 41.14363978973041,-112.0021307818896 41.14345808374524,-112.019489139395 41.14254400074554,-112.0239643318703 41.14234399927284,-112.026875 41.142344,-112.027575 41.142344,-112.0287262996005 41.142444,-112.029675 41.142444,-112.0285706847393 41.14250516265326,-112.0334643259497 41.14254400007785,-112.037275 41.142544,-112.038460765726 41.14254315085275,-112.0431214055661 41.14232416334449,-112.045375 41.142443"
+ ",-112.045875 41.142443,-112.046183 41.142443,-112.046675 41.142443,-112.04701 41.142443,-112.047675 41.142443,-112.048675 41.142443,-112.050775 41.142443,-112.051675 41.142443,-112.0540827641383 41.14234300009903,-112.0612488438362 41.14234300000304,-112.0635234354713 41.14223960918194,-112.0770714181921 41.14244181784342,-112.083276 41.142343,-112.084776 41.142343,-112.0848417657806 41.14234299978541,-112.0924417865876 41.142443,-112.100276 41.142443,-112.103976 41.142443,-112.104114857411 41.14244299996745,-112.1076037688054 41.1425399140815,-112.112793190197 41.14242459354599,-112.1135036272676 41.14254300000501,-112.1226270227682 41.14254300006021,-112.1324270190691 41.142643,-112.1421638167791 41.142643,-112.1506273882427 41.14262237725859,-112.1576209575547 41.16131792925686,-112.152476 41.142743,-112.1733149590181 41.14274300002015,-112.1756526514941 41.14285431862275,-112.1721656863206 41.14330717334865,-112.1790628146085 41.14280884335523,-112.1808690864646 41.1427879609488,-112.1876051371955 41.1429370321104,-112.1984510116649 41.14057456440421,-112.1985386297479 41.14057190901539,-112.2482545857727 41.12928342466068,-112.2585216921568 41.1262568687031,-112.2815023152398 41.11964490348107,-112.3289786112679 41.10733319877986,-112.3533969705625 41.10142824273057,-112.5251560608342 41.05848586571712,-112.4535385157666 41.13192877978023,-112.3829356229766 41.20387761333999,-112.3628222295217 41.22454031797921,-112.3307981858544 41.25696262304565,-112.2578598211629 41.33099951523954,-112.2419961323004 41.34673900002596,-112.201955 41.34674,-112.198854 41.34674,-112.198567 41.34674,-112.197535 41.34674,-112.196755 41.34674,-112.183092 41.34674,-112.182661 41.34674,-112.174135 41.34674,-112.171521 41.34674,-112.164398 41.34674,-112.163765 41.34674,-112.162149 41.34674,-112.160616 41.34674,-112.152812 41.34674,-112.137305 41.34674,-112.133199 41.34674,-112.132112 41.34674,-112.1321083653075 41.34674,-112.1261408632321 41.34735552370944,-112.1210375425564 41.34723915345325,-112.0986867218297 41.34703960146247,-112.0991128873171 41.34703432373578,-112.096676 41.34703999999999,-112.0826884841567 41.34693962919125,-112.0727519042998 41.34683715821147,-112.0659830006501 41.34633201618576,-112.043791 41.346241,-112.038076 41.346241,-112.037476 41.346241,-112.033576 41.346241,-112.032963751752 41.346241,-112.0320859322845 41.34720047709238,-112.0293729847019 41.35158293065583,-112.0225987768525 41.35384099993897,-112.012945949278 41.35384099993896,-112.0051264048585 41.35982065155388,-111.9999931863867 41.35955048219633,-111.9985054002757 41.36093908247315,-111.9886378853145 41.36437975025613,-111.982438239708 41.36699931881362,-111.9768823000155 41.37105942855347,-111.9678461715639 41.3739866250941,-111.964824595067 41.37468391195694,-111.9684577169769 41.3568526391571,-111.9703144346862 41.35837247542384,-111.9717680562695 41.36002125916402,-111.9721806067458 41.36052336335063,-111.9722701353691 41.36056857086819,-111.9756933090284 41.36361139189865,-111.9764686134888 41.3653518489586,-111.9774815061067 41.36631107832983,-111.9784353725122 41.3673490439311,-111.9818608355456 41.36917725269873,-111.9855534354769 41.3760117250587,-111.9850442656137 41.37863404701749,-111.9854221363925 41.37887044147006,-111.977148428119 41.39494967066619,-111.9823464481754 41.39046084615109,-111.9775668170106 41.39635867866395,-111.9772955142989 41.39712343090701,-111.9777832268621 41.39396396792152,-111.9780769108747 41.39453595193084,-111.9779510967016 41.39732368111444,-111.9769673928205 41.40507237141038,-111.9776418373984 41.4063310929224,-111.979249745182 41.40756511192825,-111.9805546890196 41.41174800617959,-111.9821969091629 41.41376647554345,-111.9822412429523 41.41771857136868,-111.9841029081325 41.42395514822981,-111.9758267412905 41.42973332568962,-111.9744143892868 41.43003915215967,-111.974044426735 41.43044369722418,-111.9724487099302 41.43127793250221,-111.9714554951038 41.43218647543674,-111.9705674410934 41.4326839955389,-111.969173938818 41.43455463604666,-111.9691313074541 41.43514229114804,-111.9698532625346 41.44083524341373,-111.9563035057409 41.44387691758892,-111.9528519001313 41.4425035997071,-111.948862688548 41.43996812957263,-111.9436557129119 41.43464132813732,-111.944571811535 41.43108183151026,-111.9453783570838 41.43429662278894,-111.9453292374341 41.43423156460978,-111.9487047416977 41.4370350518674,-111.949293219852 41.43728152821434,-111.946617863753 41.43651233182759,-111.9427973525344 41.43430728368595,-111.9423776809036 41.43367777659645,-111.9419291943176 41.4334303851785,-111.9407777658475 41.43217660903539,-111.9381879763191 41.43031650193143,-111.9382493895579 41.43040002340472,-111.9372011434928 41.42981718018637,-111.934117584732 41.42860635849613,-111.9324487007684 41.4262717701259,-111.9302590931362 41.42612441754618,-111.925590477184 41.4240869309046,-111.9246983708718 41.42340851775217,-111.9216328785657 41.42175106235152,-111.9201304574531 41.41957427158692,-111.9218350345417 41.42105808569211,-111.9265579698133 41.4224674871054,-111.9269374253964 41.42243152261963,-111.92904005315 41.4216476704315,-111.9263529265228 41.42314117163985,-111.9215977648415 41.42317758175992,-111.9196428552148 41.42261319977101,-111.9169146898828 41.42287472206833,-111.9134215054519 41.42473907134696,-111.9126447259132 41.42469479648941,-111.9124490246428 41.42499795177306,-111.9092387641912 41.42755224569281,-111.9052380937632 41.42897848938426,-111.9002628533518 41.42946382895553,-111.8971561379816 41.42889450986716,-111.8960249780191 41.4283771327491,-111.8940193677521 41.42850175875044,-111.8960340763695 41.42767896956915,-111.9024176724123 41.42135665487622,-111.9015750043214 41.42528897612509,-111.8998000296643 41.4285722194028,-111.8966205495849 41.43183063874344,-111.8944406431162 41.43324514380939,-111.8926252959783 41.43414332950123,-111.8916804311569 41.43450204532494,-111.8813854987459 41.43984949127724,-111.880095916456 41.43458669143437,-111.8830979471463 41.43487808596424,-111.8730501071175 41.43221499037259,-111.8646587191902 41.42862291364479,-111.8681104012376 41.41281394982138,-111.8676066232081 41.41192879397556,-111.8662685472666 41.41047503332864,-111.8648360831269 41.40927056113344,-111.8617555367589 41.40987864206158,-111.8571815473483 41.40797796402953,-111.8529378794857 41.40290666028592,-111.8525219677778 41.40333283159944,-111.8527417149485 41.40333718389994,-111.8501119188309 41.40364548567232,-111.8450021686117 41.40306327006346,-111.843627880848 41.40234608708582,-111.8435199095021 41.40231074220579,-111.844881585803 41.40265278843807,-111.8349256853031 41.39920519979233,-111.832436319031 41.39890094762616,-111.8320872552582 41.39798934323525,-111.8361009415533 41.3978803505358,-111.8321021292179 41.40300459287702,-111.8241291143356 41.40167512219369,-111.8217725690825 41.40211299539512,-111.8212955423522 41.40200922486019,-111.8171546776915 41.40329458953078,-111.8125316083106 41.39846505320347,-111.8124294708664 41.39842288523761,-111.8124264284935 41.3984236578345,-111.8108857608745 41.39858652417184"
+ ",-111.809365213452 41.39987879371605,-111.8042760434507 41.4011908453571,-111.8020686543937 41.40053613590567,-111.8039046363505 41.40017458184678,-111.8042635478739 41.39999258459775,-111.7909954737669 41.40089644205416,-111.7929629310693 41.40139132981063,-111.7846743021944 41.40036870539331,-111.7827866126724 41.39571814524774,-111.7815214169703 41.39299863043483,-111.7828920971421 41.39327334027993,-111.7748509130635 41.38743730378992,-111.7752165761997 41.38718480775791,-111.7721697223399 41.38604483298051,-111.7750983614573 41.386555270279,-111.7639414583505 41.38192065911581,-111.761963781468 41.3800412809659,-111.7613108864837 41.37912231691754,-111.7612258742607 41.37910304832786,-111.7591299416527 41.37968085372221,-111.7577907259937 41.37944029328051,-111.7558579035919 41.38022277149841,-111.7512688505652 41.38095536128881,-111.7482174462501 41.37990334283357,-111.7486646160195 41.37996229584262,-111.7501551896196 41.37882469173843,-111.7454941763277 41.38178624311301,-111.7335398767194 41.38465825647904,-111.7344375425085 41.38458725363097,-111.7324914280349 41.38482975996588,-111.7308102203539 41.38492274099217,-111.730258 41.364938,-111.7400445096964 41.37466081033997,-111.7367972666407 41.37827413406988,-111.7369761626924 41.37865937323883,-111.7373499817572 41.38191202877975,-111.7362382343994 41.3896817282629,-111.7318062031051 41.39385726751244,-111.730934876677 41.39610325892399,-111.7281898573264 41.39852698503418,-111.7232992768295 41.40141614738422,-111.7216699706312 41.40155945218662,-111.7235231380814 41.40068052773415,-111.7265750913976 41.3963025736558,-111.7201029932023 41.40005616511778,-111.7177896512755 41.40746098221877,-111.7158070848994 41.41038399195119,-111.715655176932 41.41047706608663,-111.715983156649 41.40463400375688,-111.7204406800612 41.40810070196405,-111.7274933391879 41.41205246687121,-111.7285125917203 41.41467440623902,-111.728522980037 41.41344595317905,-111.7322942449122 41.41795959302958,-111.731896106543 41.42560633754115,-111.7320332087593 41.42926118743524,-111.729957646899 41.43302822141643,-111.7118843501114 41.43114694815002,-111.7140310900979 41.43355552193208,-111.7078739864605 41.43654866026967,-111.6998524797112 41.43271471504839,-111.6986652926243 41.42986102526688,-111.6975120881016 41.42897853603878,-111.6971210984819 41.4282934699863,-111.6961606079428 41.42773075204737,-111.6959864719628 41.42776692740181,-111.6933497690836 41.42989872972967,-111.6930019315523 41.42994586089555,-111.6917153721713 41.43152040923766,-111.6902295574764 41.4326187150197,-111.6857899530101 41.43448702217745,-111.6836120286734 41.43709471482509,-111.6771247652154 41.43723637943522,-111.6779983979918 41.43725697173675,-111.6749495172627 41.43734007411281,-111.6746735498744 41.43741591954125,-111.6720209667629 41.43783594325005,-111.6727109972352 41.43770166372526,-111.6553038799185 41.42796846134614,-111.6559813580971 41.42929086121254,-111.6584331526525 41.4317013458235,-111.6584370945208 41.43170379247909,-111.6526596626538 41.42834717102206,-111.6520987713805 41.42542774863863,-111.651155399945 41.42497098966823,-111.6485038542844 41.42069082966789,-111.6484473142877 41.42048207616851,-111.6481701857523 41.42030165647017,-111.6458111338422 41.41860283437335,-111.6435250708396 41.41556473317775,-111.6434325770253 41.41553749590582,-111.6387074295628 41.41091893071695,-111.6382542875749 41.40697282822121,-111.6430587268327 41.41423110967988,-111.6474946531616 41.41493287990986,-111.6519130312862 41.41196173789954,-111.6533453458041 41.4089750382549,-111.6534670630606 41.40818567942468,-111.6532180676668 41.41233729755218,-111.650141671316 41.41784707703802,-111.6506362105335 41.41721786169201,-111.6483458444573 41.42038505559527,-111.6399883913355 41.42456782419585,-111.6387619333563 41.42531302770971,-111.6372313167869 41.42610278062988,-111.6388772156545 41.42503724999391,-111.6241185051481 41.42565671005583,-111.6292989198989 41.42747881108829,-111.6330212257612 41.42632935426848,-111.6300888540781 41.42874135696512,-111.6258525865511 41.43045665694785,-111.6200937473438 41.43292197700307,-111.6163818162207 41.43227133372919,-111.6139121279047 41.43210192316946,-111.6127778034731 41.431778181874,-111.6100998879303 41.43186873969825,-111.6033371287108 41.42772766687219,-111.6022619251007 41.41977026042356,-111.6042208823911 41.42642276689722,-111.6042547368996 41.42641106290917,-111.608203778722 41.42866129535266,-111.6088030126456 41.42877501302603,-111.6100720883581 41.428785889551,-111.6085308515393 41.42932400636524,-111.606750545072 41.42926095100312,-111.6050156683234 41.42987323575301,-111.6032457428657 41.43066814395039,-111.5990673748855 41.43148472494484,-111.5935002234159 41.43042488220517,-111.5930272861467 41.42998515359408,-111.5930267097009 41.42998503477877,-111.5926383972181 41.42952847560235,-111.5893656740488 41.42939120933852,-111.5879879513229 41.42897465490946,-111.5877655061638 41.42920784693975,-111.5872128087414 41.42998364520915,-111.583805331358 41.43402279679681,-111.5850015607415 41.43257430449172,-111.5682595644039 41.43689127289402,-111.5655580307463 41.43431733658391,-111.5648140723382 41.43437789786282,-111.5588494686844 41.43147389314375,-111.5627733442355 41.43390475163831,-111.5467595603931 41.43097085352397,-111.5435231017314 41.4216909235525,-111.5442217676426 41.42410058028637,-111.5429581915997 41.4198629141784,-111.5415905096045 41.41916883276773,-111.5377466703981 41.42118674271469,-111.4999002636551 41.40754598864975,-111.49992321854 41.41992376877793,-111.5043942337116 41.42316548043323,-111.5074667581468 41.42367669767896,-111.5018577201973 41.42339139933106,-111.498492694593 41.42223736811422,-111.4908347022589 41.41568090530068,-111.4908130094445 41.41544015588016,-111.4899750552739 41.41493216608176,-111.4892746770538 41.41472074332899,-111.4877789754887 41.41479252991904,-111.4780235955907 41.41446855024663,-111.4758343817126 41.4101305233553,-111.4667945916543 41.408008495426,-111.4649303818979 41.39743051733797,-111.4670499026164 41.38880238826368,-111.4675403497742 41.39238946277144,-111.4682693256192 41.3896798556904,-111.468223034458 41.38866896494368,-111.4679524737185 41.3873696044556,-111.467909790308 41.38511421668602,-111.4689252899892 41.3893194192861,-111.4719613794916 41.39260783946975,-111.4773850453548 41.3939272250177,-111.4755047817366 41.39401042247292,-111.4730700536672 41.3936966334367,-111.4707125540257 41.39313997077441,-111.4681148394472 41.39206078401419,-111.4673020106218 41.39150164420799,-111.4650634653196 41.39118921312598,-111.4624398349077 41.3906400254072,-111.4605400175199 41.38972232484358,-111.4570460693707 41.38909801417777,-111.4548503602481 41.38578941112745,-111.4481916270633 41.37903507093495,-111.4538905371506 41.37167946112217,-111.4523110338275 41.37562482145626,-111.453122061191 41.38030214182341,-111.4559274593289 41.38258137778414,-111.4578400905912 41.38326186498487,-111.4580092624499 41.38328010181085,-111.4545500072416 41.38310423553524,-111.453828693243 41.38286176547096,-111.4513917306495 41.38316888047494,-111.4490880680225 41.38286920566615,-111.4458883535083 41.38283562865421,-111.4410455091279 41.38056286130516,-111.4296540092564 41.37759174629597,-111.4330684620716 41.37199485958408,-111.4325288499295 41.37170115977816,-111.433423614824 41.37148481989143,-111.4327514468304 41.37229760229101,-111.4292876194388 41.37329041914894,-111.4279628046368 41.37382224950171,-111.4310504194527 41.37201570165918,-111.4220511206116 41.37680632625185,-111.4132007135549 41.36916475528064,-111.4132556937664 41.36821137521456,-111.410599947015 41.3655167694235,-111.4095467780071 41.35588239586497,-111.4153923235931 41.35080670253447,-111.4157574283901 41.3503345776012,-111.4141595503214 41.35370156318688,-111.4141624489772 41.35339760480722,-111.4115288588478 41.35121628241728"
+ ",-111.4156461230987 41.34027082280225,-111.4156347336163 41.34011622708512,-111.4219171529141 41.33399691991721,-111.4230512496498 41.33351877639811,-111.4246536800136 41.33255158448824,-111.4278802645644 41.3316442458971,-111.4321841269485 41.3326384089827,-111.4310435307007 41.3328305819942,-111.4298921041398 41.33381070679388,-111.4325816436783 41.34640754412428,-111.4305938656625 41.34507358150004,-111.4288086603161 41.342542060306,-111.431481679049 41.34513109369425,-111.4287994278175 41.33815667720043,-111.4278232779227 41.33641772801344,-111.4265560012482 41.33289501968777,-111.4265560012482 41.32617628698502,-111.4272107382647 41.32560778902531,-111.4272178782421 41.32554523388917,-111.4261980734283 41.32225817088516,-111.4304919167739 41.31367048419434,-111.4363369977304 41.31257559725096,-111.4394237666417 41.31270635296883,-111.4394344156974 41.31270409565712,-111.441519161219 41.31236426658026,-111.4381960052264 41.31363247642526,-111.4343497992445 41.31844116068382,-111.4351634377084 41.3136073258965,-111.4398662896243 41.30910418220708,-111.4422468135143 41.30752683142005,-111.44538081134 41.30634785128562,-111.4477252742131 41.30622230681761,-111.4450982072919 41.30679223598104,-111.4415499070308 41.30926911751111,-111.440343520513 41.31155182354399,-111.4451062874178 41.31989072583871,-111.4414187617719 41.31986572481608,-111.4386063431991 41.31574156424257,-111.4372288340086 41.31425825843935,-111.4357467129998 41.3119401785306,-111.4339202494052 41.30822377235391,-111.4336625137004 41.30069611228576,-111.436193501451 41.29832538323529,-111.4342850140522 41.29308194363609,-111.4328391389641 41.29555271021763,-111.4325216530159 41.29665639935071,-111.4347508608123 41.30443260100356,-111.4360586780902 41.30564636670918,-111.4346792471093 41.30464063662748,-111.4254390049755 41.29528237788455,-111.4291302686912 41.29068338555521,-111.4261573074688 41.28463104839097,-111.4370267030589 41.27981638195083,-111.4375558321362 41.27935123578043,-111.4354383430839 41.27995632635503,-111.4416162807751 41.2758529929185,-111.4384076084416 41.27957295063146,-111.4377212864738 41.2850520602332,-111.4381740345049 41.28651100478594,-111.4384610963577 41.28700771059263,-111.4443864706288 41.29120163044556,-111.4392995187362 41.28993258176533,-111.437506253794 41.28634485567613,-111.4356263875061 41.28302577228677,-111.4349277183834 41.27937332380423,-111.4350242056712 41.26951553923891,-111.4419729572562 41.26823923756828,-111.443851402553 41.26628117225569,-111.4466503255125 41.26617791598309,-111.4466539930302 41.26617467737448,-111.4520015669708 41.26396940238351,-111.4535032224145 41.26442883740561,-111.4575335757568 41.26357415147228,-111.4483713214452 41.27007784433943,-111.4479650010794 41.2717768437342,-111.4480273600067 41.27313463677613,-111.4493445602483 41.27659822195652,-111.4478190730863 41.27422750187978,-111.4464117327744 41.26893674882813,-111.4496732569538 41.26159468063268,-111.4543300686382 41.25793771380997,-111.4571410161368 41.2577942766178,-111.4584177002777 41.25730159262817,-111.4553050787541 41.25932963474278,-111.4530081358515 41.26959930131982,-111.4508994156196 41.26371450013092,-111.4541957910179 41.25962837787136,-111.4533513082429 41.25606707336917,-111.4584511900491 41.24989054984832,-111.4611419330649 41.24901272751228,-111.4642296892219 41.2471079915566,-111.466302267792 41.24724208780359,-111.4612041454673 41.25525650795958,-111.4613628730978 41.25711686602586,-111.460012566547 41.25068020785515,-111.4631190491229 41.24557484651866,-111.4668960494423 41.24198842878425,-111.4691669157075 41.2417000374843,-111.4697812813245 41.24112614793989,-111.4746504843807 41.23477980181183,-111.4803977314971 41.23547461817721,-111.4807668379497 41.23549157614718,-111.4821598518453 41.235181287545,-111.4835147362251 41.23397825845257,-111.4913294700869 41.23144137067924,-111.4937928098947 41.23127714842143,-111.4853525806721 41.23734674935701,-111.4851730213113 41.24391252958296,-111.4868064098187 41.24667054274708,-111.4899998360328 41.24898263383229,-111.4827890866642 41.24415984037166,-111.4821185211798 41.23272415759732,-111.4852056387818 41.22855546079995,-111.4871367392634 41.22636620973306,-111.4877302368984 41.22602162842327,-111.4866371991571 41.22728810367443,-111.4862618064053 41.21244302667023,-111.5038439093175 41.21886594606829,-111.5086526752272 41.22023174933462,-111.5093913926803 41.21966687966173,-111.5156021372448 41.21908063181036,-111.5179945315531 41.21978213857661,-111.5200627063573 41.21974916010367,-111.5242768213902 41.22009310457656,-111.5261116995073 41.22069282150765))",
+ 22);
+ */
+
+}
+#endif
+
+
+
+#if ! defined(GEOMETRY_TEST_MULTI)
+int test_main(int, char* [])
+{
+ test_self_all<bg::model::d2::point_xy<double> >();
+ return 0;
+}
+#endif
diff --git a/libs/geometry/test/algorithms/overlay/split_rings.vcproj b/libs/geometry/test/algorithms/overlay/split_rings.vcproj
new file mode 100644
index 000000000..cb9b6bf78
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/split_rings.vcproj
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="split_rings"
+ ProjectGUID="{271231F9-F7DA-4218-8538-0E9DCD688D09}"
+ RootNamespace="split_rings"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\split_rings"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\split_rings"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=".;../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\split_rings.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/traverse.cpp b/libs/geometry/test/algorithms/overlay/traverse.cpp
new file mode 100644
index 000000000..f3705ca03
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/traverse.cpp
@@ -0,0 +1,1030 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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)
+
+#define BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
+//#define BOOST_GEOMETRY_OVERLAY_NO_THROW
+//#define TEST_WITH_SVG
+//#define HAVE_TTMATH
+
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+#include <sstream>
+#include <string>
+
+#include <boost/type_traits/is_same.hpp>
+
+#ifdef HAVE_TTMATH
+# include <boost/geometry/contrib/ttmath_stub.hpp>
+#endif
+
+#include <geometry_test_common.hpp>
+
+
+// #define BOOST_GEOMETRY_DEBUG_ENRICH
+//#define BOOST_GEOMETRY_DEBUG_RELATIVE_ORDER
+
+// #define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
+// #define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
+
+
+#define BOOST_GEOMETRY_TEST_OVERLAY_NOT_EXCHANGED
+
+#ifdef BOOST_GEOMETRY_DEBUG_ENRICH
+# define BOOST_GEOMETRY_DEBUG_IDENTIFIER
+#endif
+
+#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
+#include <boost/geometry/algorithms/detail/overlay/enrichment_info.hpp>
+#include <boost/geometry/algorithms/detail/overlay/traversal_info.hpp>
+#include <boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp>
+
+#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
+#include <boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp>
+#include <boost/geometry/algorithms/detail/overlay/traverse.hpp>
+
+#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
+
+
+#include <boost/geometry/algorithms/area.hpp>
+#include <boost/geometry/algorithms/correct.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/io/wkt/write.hpp>
+
+
+#if defined(TEST_WITH_SVG)
+# include <boost/geometry/io/svg/svg_mapper.hpp>
+#endif
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <algorithms/overlay/overlay_cases.hpp>
+
+static inline std::string operation(int d)
+{
+ return d == 1 ? "union" : "intersection";
+}
+
+namespace detail
+{
+
+template
+<
+ typename G1, typename G2,
+ bg::detail::overlay::operation_type Direction,
+ bool Reverse1, bool Reverse2
+>
+struct test_traverse
+{
+
+ static void apply(std::string const& id,
+ std::size_t expected_count, double expected_area,
+ G1 const& g1, G2 const& g2,
+ double precision)
+ {
+ // DEBUG ONE or FEW CASE(S) ONLY
+ //if (! boost::contains(id, "36") || Direction != 1) return;
+ //if (! boost::contains(id, "iet_") || boost::contains(id, "st")) return;
+ //if (! boost::contains(id, "66") || Direction != 1) return;
+ //if (! boost::contains(id, "92") && ! boost::contains(id, "96") ) return;
+ //if (! (boost::contains(id, "58_st") || boost::contains(id, "59_st") || boost::contains(id, "60_st") || boost::contains(id, "83")) ) return;
+ //if (! (boost::contains(id, "81") || boost::contains(id, "82") || boost::contains(id, "84") || boost::contains(id, "85") || boost::contains(id, "68")) ) return;
+ //if (! (boost::contains(id, "81") || boost::contains(id, "86") || boost::contains(id, "88")) ) return;
+ //if (! boost::contains(id, "58_") || Direction != 1) return;
+ //if (! boost::contains(id, "55") || Direction != 1) return;
+ //if (! boost::contains(id, "55_iet_iet") || Direction != 1) return;
+ //if (! boost::contains(id, "55_st_iet") || Direction != 1) return;
+ //if (! boost::contains(id, "55_iet_st") || Direction != 1) return;
+ //if (! boost::contains(id, "54_st_st") || Direction != 1) return;
+ //if (! boost::contains(id, "54_iet_st") || Direction != 1) return;
+ //if (! (boost::contains(id, "54_") || boost::contains(id, "55_")) || Direction != 1) return;
+ //if (Direction != 1) return;
+ // END DEBUG ONE ...
+
+
+ /*** FOR REVERSING ONLY
+ {
+ // If one or both are invalid (e.g. ccw),
+ // they can be corrected by uncommenting this section
+ G1 cg1 = g1;
+ G2 cg2 = g2;
+ bg::correct(cg1);
+ bg::correct(cg2);
+ std::cout << std::setprecision(12)
+ << bg::wkt(cg1) << std::endl
+ << bg::wkt(cg2) << std::endl;
+ }
+ ***/
+
+#if defined(BOOST_GEOMETRY_DEBUG_OVERLAY) || defined(BOOST_GEOMETRY_DEBUG_ENRICH)
+ bool const ccw =
+ bg::point_order<G1>::value == bg::counterclockwise
+ || bg::point_order<G2>::value == bg::counterclockwise;
+
+ std::cout << std::endl
+ << "TRAVERSE"
+ << " " << id
+ << (ccw ? "_ccw" : "")
+ << " " << string_from_type<typename bg::coordinate_type<G1>::type>::name()
+ << "(" << operation(Direction) << ")" << std::endl;
+
+ //std::cout << bg::area(g1) << " " << bg::area(g2) << std::endl;
+#endif
+
+ typedef typename bg::strategy::side::services::default_strategy
+ <
+ typename bg::cs_tag<G1>::type
+ >::type side_strategy_type;
+
+
+ typedef bg::detail::overlay::traversal_turn_info
+ <
+ typename bg::point_type<G2>::type
+ > turn_info;
+ std::vector<turn_info> turns;
+
+ bg::detail::get_turns::no_interrupt_policy policy;
+ bg::get_turns<Reverse1, Reverse2, bg::detail::overlay::calculate_distance_policy>(g1, g2, turns, policy);
+ bg::enrich_intersection_points<Reverse1, Reverse2>(turns,
+ Direction == 1 ? bg::detail::overlay::operation_union
+ : bg::detail::overlay::operation_intersection,
+ g1, g2, side_strategy_type());
+
+ typedef bg::model::ring<typename bg::point_type<G2>::type> ring_type;
+ typedef std::vector<ring_type> out_vector;
+ out_vector v;
+
+
+ bg::detail::overlay::traverse
+ <
+ Reverse1, Reverse2,
+ G1, G2
+ >::apply(g1, g2, Direction, turns, v);
+
+ // Check number of resulting rings
+ BOOST_CHECK_MESSAGE(expected_count == boost::size(v),
+ "traverse: " << id
+ << " #shapes expected: " << expected_count
+ << " detected: " << boost::size(v)
+ << " type: " << string_from_type
+ <typename bg::coordinate_type<G1>::type>::name()
+ );
+
+ // Check total area of resulting rings
+ typename bg::default_area_result<G1>::type total_area = 0;
+ BOOST_FOREACH(ring_type const& ring, v)
+ {
+ total_area += bg::area(ring);
+ //std::cout << bg::wkt(ring) << std::endl;
+ }
+
+ BOOST_CHECK_CLOSE(expected_area, total_area, precision);
+
+#if defined(TEST_WITH_SVG)
+ {
+ std::ostringstream filename;
+ filename << "traverse_" << operation(Direction)
+ << "_" << id
+ << "_" << string_from_type<typename bg::coordinate_type<G1>::type>::name()
+ << ".svg";
+
+ std::ofstream svg(filename.str().c_str());
+
+ bg::svg_mapper<typename bg::point_type<G2>::type> mapper(svg, 500, 500);
+ mapper.add(g1);
+ mapper.add(g2);
+
+ // Input shapes in green/blue
+ mapper.map(g1, "fill-opacity:0.5;fill:rgb(153,204,0);"
+ "stroke:rgb(153,204,0);stroke-width:3");
+ mapper.map(g2, "fill-opacity:0.3;fill:rgb(51,51,153);"
+ "stroke:rgb(51,51,153);stroke-width:3");
+
+ // Traversal rings in magenta outline/red fill -> over blue/green this gives brown
+ BOOST_FOREACH(ring_type const& ring, v)
+ {
+ mapper.map(ring, "fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,0,0);"
+ "stroke:rgb(255,0,255);stroke-width:8");
+ }
+
+ // turn points in orange, + enrichment/traversal info
+ typedef typename bg::coordinate_type<G1>::type coordinate_type;
+
+ // Simple map to avoid two texts at same place (note that can still overlap!)
+ std::map<std::pair<int, int>, int> offsets;
+ int index = 0;
+ int const margin = 5;
+
+ BOOST_FOREACH(turn_info const& turn, turns)
+ {
+ int lineheight = 10;
+ mapper.map(turn.point, "fill:rgb(255,128,0);"
+ "stroke:rgb(0,0,0);stroke-width:1", 3);
+
+ {
+ coordinate_type half = 0.5;
+ coordinate_type ten = 10;
+ // Map characteristics
+ // Create a rounded off point
+ std::pair<int, int> p
+ = std::make_pair(
+ boost::numeric_cast<int>(half
+ + ten * bg::get<0>(turn.point)),
+ boost::numeric_cast<int>(half
+ + ten * bg::get<1>(turn.point))
+ );
+ std::string style = "fill:rgb(0,0,0);font-family:Arial;font-size:10px";
+
+ if (turn.discarded)
+ {
+ style = "fill:rgb(92,92,92);font-family:Arial;font-size:6px";
+ lineheight = 6;
+ }
+
+ //if (! turn.is_discarded() && ! turn.blocked() && ! turn.both(bg::detail::overlay::operation_union))
+ //if (! turn.discarded)
+ {
+ std::ostringstream out;
+ out << index
+ << ": " << bg::method_char(turn.method)
+ << std::endl
+ << "op: " << bg::operation_char(turn.operations[0].operation)
+ << " / " << bg::operation_char(turn.operations[1].operation)
+ << (turn.is_discarded() ? " (discarded) " : turn.blocked() ? " (blocked)" : "")
+ << std::endl;
+
+ if (turn.operations[0].enriched.next_ip_index != -1)
+ {
+ out << "ip: " << turn.operations[0].enriched.next_ip_index;
+ }
+ else
+ {
+ out << "vx: " << turn.operations[0].enriched.travels_to_vertex_index
+ << " -> ip: " << turn.operations[0].enriched.travels_to_ip_index;
+ }
+ out << " / ";
+ if (turn.operations[1].enriched.next_ip_index != -1)
+ {
+ out << "ip: " << turn.operations[1].enriched.next_ip_index;
+ }
+ else
+ {
+ out << "vx: " << turn.operations[1].enriched.travels_to_vertex_index
+ << " -> ip: " << turn.operations[1].enriched.travels_to_ip_index;
+ }
+
+ out << std::endl;
+
+ /*out
+
+ << std::setprecision(3)
+ << "dist: " << boost::numeric_cast<double>(turn.operations[0].enriched.distance)
+ << " / " << boost::numeric_cast<double>(turn.operations[1].enriched.distance)
+ << std::endl
+ << "vis: " << bg::visited_char(turn.operations[0].visited)
+ << " / " << bg::visited_char(turn.operations[1].visited);
+ */
+
+ /*
+ out << index
+ << ": " << bg::operation_char(turn.operations[0].operation)
+ << " " << bg::operation_char(turn.operations[1].operation)
+ << " (" << bg::method_char(turn.method) << ")"
+ << (turn.ignore() ? " (ignore) " : " ")
+ << std::endl
+
+ << "ip: " << turn.operations[0].enriched.travels_to_ip_index
+ << "/" << turn.operations[1].enriched.travels_to_ip_index;
+
+ if (turn.operations[0].enriched.next_ip_index != -1
+ || turn.operations[1].enriched.next_ip_index != -1)
+ {
+ out << " [" << turn.operations[0].enriched.next_ip_index
+ << "/" << turn.operations[1].enriched.next_ip_index
+ << "]"
+ ;
+ }
+ out << std::endl;
+
+
+ out
+ << "vx:" << turn.operations[0].enriched.travels_to_vertex_index
+ << "/" << turn.operations[1].enriched.travels_to_vertex_index
+ << std::endl
+
+ << std::setprecision(3)
+ << "dist: " << turn.operations[0].enriched.distance
+ << " / " << turn.operations[1].enriched.distance
+ << std::endl
+ */
+
+
+
+ offsets[p] += lineheight;
+ int offset = offsets[p];
+ offsets[p] += lineheight * 3;
+ mapper.text(turn.point, out.str(), style, margin, offset, lineheight);
+ }
+ index++;
+ }
+ }
+ }
+#endif
+ }
+};
+}
+
+template
+<
+ typename G1, typename G2,
+ bg::detail::overlay::operation_type Direction,
+ bool Reverse1 = false,
+ bool Reverse2 = false
+>
+struct test_traverse
+{
+ typedef detail::test_traverse
+ <
+ G1, G2, Direction, Reverse1, Reverse2
+ > detail_test_traverse;
+
+ inline static void apply(std::string const& id, std::size_t expected_count, double expected_area,
+ std::string const& wkt1, std::string const& wkt2,
+ double precision = 0.001)
+ {
+ if (wkt1.empty() || wkt2.empty())
+ {
+ return;
+ }
+
+ G1 g1;
+ bg::read_wkt(wkt1, g1);
+
+ G2 g2;
+ bg::read_wkt(wkt2, g2);
+
+ bg::correct(g1);
+ bg::correct(g2);
+
+ //std::cout << bg::wkt(g1) << std::endl;
+ //std::cout << bg::wkt(g2) << std::endl;
+
+ // Try the overlay-function in both ways
+ std::string caseid = id;
+ //goto case_reversed;
+
+#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
+ std::cout << std::endl << std::endl << "# " << caseid << std::endl;
+#endif
+ detail_test_traverse::apply(caseid, expected_count, expected_area, g1, g2, precision);
+
+#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
+ return;
+#endif
+
+ //case_reversed:
+#if ! defined(BOOST_GEOMETRY_TEST_OVERLAY_NOT_EXCHANGED)
+ caseid = id + "_rev";
+#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
+ std::cout << std::endl << std::endl << "# " << caseid << std::endl;
+#endif
+
+ detail_test_traverse::apply(caseid, expected_count, expected_area, g2, g1, precision);
+#endif
+ }
+};
+
+#if ! defined(BOOST_GEOMETRY_TEST_MULTI)
+template <typename T>
+void test_all(bool test_self_tangencies = true, bool test_mixed = false)
+{
+ using namespace bg::detail::overlay;
+
+ typedef bg::model::point<T, 2, bg::cs::cartesian> P;
+ typedef bg::model::polygon<P> polygon;
+ typedef bg::model::box<P> box;
+
+ // 1-6
+ test_traverse<polygon, polygon, operation_intersection>::apply("1", 1, 5.4736, case_1[0], case_1[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("2", 1, 12.0545, case_2[0], case_2[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("3", 1, 5, case_3[0], case_3[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("4", 1, 10.2212, case_4[0], case_4[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("5", 2, 12.8155, case_5[0], case_5[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("6", 1, 4.5, case_6[0], case_6[1]);
+
+ // 7-12
+ test_traverse<polygon, polygon, operation_intersection>::apply("7", 0, 0, case_7[0], case_7[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("8", 0, 0, case_8[0], case_8[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("9", 0, 0, case_9[0], case_9[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("10", 0, 0, case_10[0], case_10[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("11", 1, 1, case_11[0], case_11[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("12", 2, 0.63333, case_12[0], case_12[1]);
+
+ // 13-18
+ test_traverse<polygon, polygon, operation_intersection>::apply("13", 0, 0, case_13[0], case_13[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("14", 0, 0, case_14[0], case_14[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("15", 0, 0, case_15[0], case_15[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("16", 0, 0, case_16[0], case_16[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("17", 1, 2, case_17[0], case_17[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("18", 1, 2, case_18[0], case_18[1]);
+
+ // 19-24
+ test_traverse<polygon, polygon, operation_intersection>::apply("19", 0, 0, case_19[0], case_19[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("20", 1, 5.5, case_20[0], case_20[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("21", 0, 0, case_21[0], case_21[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("22", 0, 0, case_22[0], case_22[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("23", 1, 1.4, case_23[0], case_23[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("24", 1, 1.0, case_24[0], case_24[1]);
+
+ // 25-30
+ test_traverse<polygon, polygon, operation_intersection>::apply("25", 0, 0, case_25[0], case_25[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("26", 0, 0, case_26[0], case_26[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("27", 1, 0.9545454, case_27[0], case_27[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("28", 1, 0.9545454, case_28[0], case_28[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("29", 1, 1.4, case_29[0], case_29[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("30", 1, 0.5, case_30[0], case_30[1]);
+
+ // 31-36
+ test_traverse<polygon, polygon, operation_intersection>::apply("31", 0, 0, case_31[0], case_31[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("32", 0, 0, case_32[0], case_32[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("33", 0, 0, case_33[0], case_33[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("34", 1, 0.5, case_34[0], case_34[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("35", 1, 1.0, case_35[0], case_35[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("36", 1, 1.625, case_36[0], case_36[1]);
+
+ // 37-42
+ test_traverse<polygon, polygon, operation_intersection>::apply("37", 2, 0.666666, case_37[0], case_37[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("38", 2, 0.971429, case_38[0], case_38[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("39", 1, 24, case_39[0], case_39[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("40", 0, 0, case_40[0], case_40[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("41", 1, 5, case_41[0], case_41[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("42", 1, 5, case_42[0], case_42[1]);
+
+ // 43-48 - invalid polygons
+ //test_traverse<polygon, polygon, operation_intersection>::apply("43", 2, 0.75, case_43[0], case_43[1]);
+ //test_traverse<polygon, polygon, operation_intersection>::apply("44", 1, 44, case_44[0], case_44[1]);
+ //test_traverse<polygon, polygon, operation_intersection>::apply("45", 1, 45, case_45[0], case_45[1]);
+ //test_traverse<polygon, polygon, operation_intersection>::apply("46", 1, 46, case_46[0], case_46[1]);
+ //test_traverse<polygon, polygon, operation_intersection>::apply("47", 1, 47, case_47[0], case_47[1]);
+
+ // 49-54
+
+ test_traverse<polygon, polygon, operation_intersection>::apply("50", 0, 0, case_50[0], case_50[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("51", 0, 0, case_51[0], case_51[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("52", 1, 10.5, case_52[0], case_52[1]);
+ if (test_self_tangencies)
+ {
+ test_traverse<polygon, polygon, operation_intersection>::apply("53_st", 0, 0, case_53[0], case_53[1]);
+ }
+ test_traverse<polygon, polygon, operation_intersection>::apply("53_iet", 0, 0, case_53[0], case_53[2]);
+
+ test_traverse<polygon, polygon, operation_intersection>::apply("54_iet_iet", 1, 2, case_54[1], case_54[3]);
+ if (test_self_tangencies)
+ {
+ test_traverse<polygon, polygon, operation_intersection>::apply("54_st_iet", 1, 2, case_54[0], case_54[3]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("54_iet_st", 1, 2, case_54[1], case_54[2]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("54_st_st", 1, 2, case_54[0], case_54[2]);
+ }
+
+ if (test_self_tangencies)
+ {
+ // 55-60
+ test_traverse<polygon, polygon, operation_intersection>::apply("55_st_st", 1, 2, case_55[0], case_55[2]);
+ }
+
+ test_traverse<polygon, polygon, operation_intersection>::apply("55_st_iet", 1, 2, case_55[0], case_55[3]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("55_iet_st", 1, 2, case_55[1], case_55[2]);
+ if (test_self_tangencies)
+ {
+ test_traverse<polygon, polygon, operation_intersection>::apply("56", 2, 4.5, case_56[0], case_56[1]);
+ }
+ test_traverse<polygon, polygon, operation_intersection>::apply("55_iet_iet", 1, 2, case_55[1], case_55[3]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("57", 2, 5.9705882, case_57[0], case_57[1]);
+
+ if (test_self_tangencies)
+ {
+ test_traverse<polygon, polygon, operation_intersection>::apply("58_st",
+ 2, 0.333333, case_58[0], case_58[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("59_st",
+ 2, 1.5416667, case_59[0], case_59[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("60_st",
+ 3, 2, case_60[0], case_60[1]);
+ }
+ test_traverse<polygon, polygon, operation_intersection>::apply("58_iet",
+ 2, 0.333333, case_58[0], case_58[2]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("59_iet",
+ 2, 1.5416667, case_59[0], case_59[2]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("60_iet",
+ 3, 2, case_60[0], case_60[2]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("61_st",
+ 0, 0, case_61[0], case_61[1]);
+
+ test_traverse<polygon, polygon, operation_intersection>::apply("70",
+ 2, 4, case_70[0], case_70[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("71",
+ 2, 2, case_71[0], case_71[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("72",
+ 3, 2.85, case_72[0], case_72[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("79",
+ 2, 20, case_79[0], case_79[1]);
+
+ // other
+
+
+ // pies (went wrong when not all cases where implemented, especially some collinear (opposite) cases
+ test_traverse<polygon, polygon, operation_intersection>::apply("pie_16_4_12",
+ 1, 491866.5, pie_16_4_12[0], pie_16_4_12[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("pie_23_21_12_500",
+ 2, 2363199.3313, pie_23_21_12_500[0], pie_23_21_12_500[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("pie_23_23_3_2000",
+ 2, 1867779.9349, pie_23_23_3_2000[0], pie_23_23_3_2000[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("pie_23_16_16",
+ 2, 2128893.9555, pie_23_16_16[0], pie_23_16_16[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("pie_16_2_15_0",
+ 0, 0, pie_16_2_15_0[0], pie_16_2_15_0[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("pie_4_13_15",
+ 1, 490887.06678, pie_4_13_15[0], pie_4_13_15[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("pie_20_20_7_100",
+ 2, 2183372.2718, pie_20_20_7_100[0], pie_20_20_7_100[1]);
+
+
+
+ // 1-6
+ test_traverse<polygon, polygon, operation_union>::apply("1", 1, 11.5264, case_1[0], case_1[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("2", 1, 17.9455, case_2[0], case_2[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("3", 1, 9, case_3[0], case_3[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("4", 3, 17.7788, case_4[0], case_4[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("5", 2, 18.4345, case_5[0], case_5[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("6", 1, 9, case_6[0], case_6[1]);
+
+ // 7-12
+ test_traverse<polygon, polygon, operation_union>::apply("7", 1, 9, case_7[0], case_7[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("8", 1, 12, case_8[0], case_8[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("9", 0, 0 /*UU 2, 11*/, case_9[0], case_9[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("10", 1, 9, case_10[0], case_10[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("11", 1, 8, case_11[0], case_11[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("12", 2, 8.36667, case_12[0], case_12[1]);
+
+ // 13-18
+ test_traverse<polygon, polygon, operation_union>::apply("13", 1, 4, case_13[0], case_13[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("14", 1, 12, case_14[0], case_14[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("15", 1, 12, case_15[0], case_15[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("16", 1, 9, case_16[0], case_16[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("17", 1, 8, case_17[0], case_17[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("18", 1, 8, case_18[0], case_18[1]);
+
+ // 19-24
+ test_traverse<polygon, polygon, operation_union>::apply("19", 1, 10, case_19[0], case_19[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("20", 1, 5.5, case_20[0], case_20[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("21", 0, 0, case_21[0], case_21[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("22", 0, 0 /*UU 2, 9.5*/, case_22[0], case_22[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("23", 1, 6.1, case_23[0], case_23[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("24", 1, 5.5, case_24[0], case_24[1]);
+
+ // 25-30
+ test_traverse<polygon, polygon, operation_union>::apply("25", 0, 0 /*UU 2, 7*/, case_25[0], case_25[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("26", 0, 0 /*UU 2, 7.5 */, case_26[0], case_26[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("27", 1, 8.04545, case_27[0], case_27[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("28", 1, 10.04545, case_28[0], case_28[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("29", 1, 8.1, case_29[0], case_29[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("30", 1, 6.5, case_30[0], case_30[1]);
+
+ // 31-36
+ test_traverse<polygon, polygon, operation_union>::apply("31", 0, 0 /*UU 2, 4.5 */, case_31[0], case_31[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("32", 0, 0 /*UU 2, 4.5 */, case_32[0], case_32[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("33", 0, 0 /*UU 2, 4.5 */, case_33[0], case_33[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("34", 1, 6.0, case_34[0], case_34[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("35", 1, 10.5, case_35[0], case_35[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("36", 1 /*UU 2*/, 14.375, case_36[0], case_36[1]);
+
+ // 37-42
+ test_traverse<polygon, polygon, operation_union>::apply("37", 1, 7.33333, case_37[0], case_37[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("38", 1, 9.52857, case_38[0], case_38[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("39", 1, 40.0, case_39[0], case_39[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("40", 0, 0 /*UU 2, 11 */, case_40[0], case_40[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("41", 1, 5, case_41[0], case_41[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("42", 1, 5, case_42[0], case_42[1]);
+
+ // 43-48
+ //test_traverse<polygon, polygon, operation_union>::apply("43", 3, 8.1875, case_43[0], case_43[1]);
+ //test_traverse<polygon, polygon, operation_union>::apply("44", 1, 44, case_44[0], case_44[1]);
+ //test_traverse<polygon, polygon, operation_union>::apply("45", 1, 45, case_45[0], case_45[1]);
+ //test_traverse<polygon, polygon, operation_union>::apply("46", 1, 46, case_46[0], case_46[1]);
+ //test_traverse<polygon, polygon, operation_union>::apply("47", 1, 47, case_47[0], case_47[1]);
+
+ // 49-54
+
+ test_traverse<polygon, polygon, operation_union>::apply("50", 1, 25, case_50[0], case_50[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("51", 0, 0, case_51[0], case_51[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("52", 1, 15.5, case_52[0], case_52[1]);
+ if (test_self_tangencies)
+ {
+ test_traverse<polygon, polygon, operation_union>::apply("53_st", 2, 16, case_53[0], case_53[1]);
+ }
+ test_traverse<polygon, polygon, operation_union>::apply("53_iet",
+ 2, 16, case_53[0], case_53[2]);
+ if (test_self_tangencies)
+ {
+ test_traverse<polygon, polygon, operation_union>::apply("54_st_st", 2, 20, case_54[0], case_54[2]);
+ test_traverse<polygon, polygon, operation_union>::apply("54_st_iet", 2, 20, case_54[0], case_54[3]);
+ test_traverse<polygon, polygon, operation_union>::apply("54_iet_st", 2, 20, case_54[1], case_54[2]);
+ }
+ test_traverse<polygon, polygon, operation_union>::apply("54_iet_iet", 2, 20, case_54[1], case_54[3]);
+
+ if (test_mixed)
+ {
+ test_traverse<polygon, polygon, operation_union>::apply("55_st_iet", 2, 18, case_55[0], case_55[3]);
+ test_traverse<polygon, polygon, operation_union>::apply("55_iet_st", 2, 18, case_55[1], case_55[2]);
+ // moved to mixed
+ test_traverse<polygon, polygon, operation_union>::apply("55_iet_iet", 3, 18, case_55[1], case_55[3]);
+ }
+
+ // 55-60
+ if (test_self_tangencies)
+ {
+ // 55 with both input polygons having self tangencies (st_st) generates 1 correct shape
+ test_traverse<polygon, polygon, operation_union>::apply("55_st_st", 1, 18, case_55[0], case_55[2]);
+ // 55 with one of them self-tangency, other int/ext ring tangency generate 2 correct shapes
+
+ test_traverse<polygon, polygon, operation_union>::apply("56", 2, 14, case_56[0], case_56[1]);
+ }
+ test_traverse<polygon, polygon, operation_union>::apply("57", 1, 14.029412, case_57[0], case_57[1]);
+
+ if (test_self_tangencies)
+ {
+ test_traverse<polygon, polygon, operation_union>::apply("58_st",
+ 4, 12.16666, case_58[0], case_58[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("59_st",
+ 2, 17.208333, case_59[0], case_59[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("60_st",
+ 3, 19, case_60[0], case_60[1]);
+ }
+ test_traverse<polygon, polygon, operation_union>::apply("58_iet",
+ 4, 12.16666, case_58[0], case_58[2]);
+ test_traverse<polygon, polygon, operation_union>::apply("59_iet",
+ 1, -3.791666, // 2, 17.208333), outer ring (ii/ix) is done by ASSEMBLE
+ case_59[0], case_59[2]);
+ test_traverse<polygon, polygon, operation_union>::apply("60_iet",
+ 3, 19, case_60[0], case_60[2]);
+ test_traverse<polygon, polygon, operation_union>::apply("61_st",
+ 1, 4, case_61[0], case_61[1]);
+
+ test_traverse<polygon, polygon, operation_union>::apply("70",
+ 1, 9, case_70[0], case_70[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("71",
+ 2, 9, case_71[0], case_71[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("72",
+ 1, 10.65, case_72[0], case_72[1]);
+
+
+
+ // other
+ test_traverse<polygon, polygon, operation_intersection>::apply("collinear_overlaps",
+ 1, 24,
+ collinear_overlaps[0], collinear_overlaps[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("collinear_overlaps",
+ 1, 50,
+ collinear_overlaps[0], collinear_overlaps[1]);
+
+ test_traverse<polygon, polygon, operation_intersection>::apply("many_situations", 1, 184, case_many_situations[0], case_many_situations[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("many_situations",
+ 1, 207, case_many_situations[0], case_many_situations[1]);
+
+
+ // From "intersection piets", robustness test.
+ // This all went wrong in the past
+ // (when not all cases (get_turns) where implemented,
+ // especially important are some collinear (opposite) cases)
+ test_traverse<polygon, polygon, operation_union>::apply("pie_16_4_12",
+ 1, 3669665.5, pie_16_4_12[0], pie_16_4_12[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("pie_23_21_12_500",
+ 1, 6295516.7185, pie_23_21_12_500[0], pie_23_21_12_500[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("pie_23_23_3_2000",
+ 1, 7118735.0530, pie_23_23_3_2000[0], pie_23_23_3_2000[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("pie_23_16_16",
+ 1, 5710474.5406, pie_23_16_16[0], pie_23_16_16[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("pie_16_2_15_0",
+ 1, 3833641.5, pie_16_2_15_0[0], pie_16_2_15_0[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("pie_4_13_15",
+ 1, 2208122.43322, pie_4_13_15[0], pie_4_13_15[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("pie_20_20_7_100",
+ 1, 5577158.72823, pie_20_20_7_100[0], pie_20_20_7_100[1]);
+
+ /*
+ if (test_not_valid)
+ {
+ test_traverse<polygon, polygon, operation_union>::apply("pie_5_12_12_0_7s",
+ 1, 3271710.48516, pie_5_12_12_0_7s[0], pie_5_12_12_0_7s[1]);
+ }
+ */
+
+ static const bool is_float
+ = boost::is_same<T, float>::value;
+ static const bool is_double
+ = boost::is_same<T, double>::value
+ || boost::is_same<T, long double>::value;
+
+ static const double float_might_deviate_more = is_float ? 0.1 : 0.001; // In some cases up to 1 promille permitted
+
+ // GCC: does not everywhere handle float correctly (in our algorithms)
+ bool const is_float_on_non_msvc =
+#if defined(_MSC_VER)
+ false;
+#else
+ is_float;
+#endif
+
+
+
+ // From "Random Ellipse Stars", robustness test.
+ // This all went wrong in the past
+ // when using Determinant/ra/rb and comparing with 0/1
+ // Solved now by avoiding determinant / using sides
+ // ("hv" means "high volume")
+ {
+ double deviation = is_float ? 0.01 : 0.001;
+ test_traverse<polygon, polygon, operation_union>::apply("hv1", 1, 1624.508688461573, hv_1[0], hv_1[1], deviation);
+ test_traverse<polygon, polygon, operation_intersection>::apply("hv1", 1, 1622.7200125123809, hv_1[0], hv_1[1], deviation);
+
+ test_traverse<polygon, polygon, operation_union>::apply("hv2", 1, 1622.9193392726836, hv_2[0], hv_2[1], deviation);
+ test_traverse<polygon, polygon, operation_intersection>::apply("hv2", 1, 1622.1733591429329, hv_2[0], hv_2[1], deviation);
+
+ test_traverse<polygon, polygon, operation_union>::apply("hv3", 1, 1624.22079205664, hv_3[0], hv_3[1], deviation);
+ test_traverse<polygon, polygon, operation_intersection>::apply("hv3", 1, 1623.8265057282042, hv_3[0], hv_3[1], deviation);
+
+
+ if (! is_float)
+ {
+ test_traverse<polygon, polygon, operation_union>::apply("hv4", 1, 1626.5146964146334, hv_4[0], hv_4[1], deviation);
+ test_traverse<polygon, polygon, operation_intersection>::apply("hv4", 1, 1626.2580370864305, hv_4[0], hv_4[1], deviation);
+ test_traverse<polygon, polygon, operation_union>::apply("hv5", 1, 1624.2158307261871, hv_5[0], hv_5[1], deviation);
+ test_traverse<polygon, polygon, operation_intersection>::apply("hv5", 1, 1623.4506071521519, hv_5[0], hv_5[1], deviation);
+
+ // Case 2009-12-07
+ test_traverse<polygon, polygon, operation_intersection>::apply("hv6", 1, 1604.6318757402121, hv_6[0], hv_6[1], deviation);
+ test_traverse<polygon, polygon, operation_union>::apply("hv6", 1, 1790.091872401327, hv_6[0], hv_6[1], deviation);
+
+ // Case 2009-12-08, needing sorting on side in enrich_intersection_points
+ test_traverse<polygon, polygon, operation_union>::apply("hv7", 1, 1624.5779453641017, hv_7[0], hv_7[1], deviation);
+ test_traverse<polygon, polygon, operation_intersection>::apply("hv7", 1, 1623.6936420295772, hv_7[0], hv_7[1], deviation);
+ }
+ }
+
+ // From "Random Ellipse Stars", robustness test.
+ // This all went wrong in the past when distances (see below) were zero (dz)
+ // "Distance zero", dz, means: the distance between two intersection points
+ // on a same segment is 0, therefore it can't be sorted normally, therefore
+ // the chance is 50% that the segments are not sorted correctly and the wrong
+ // decision is taken.
+ // Solved now (by sorting on sides in those cases)
+ if (! is_float_on_non_msvc)
+ {
+ test_traverse<polygon, polygon, operation_intersection>::apply("dz_1",
+ 3, 16.887537949472005, dz_1[0], dz_1[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("dz_1",
+ 3, 1444.2621305732864, dz_1[0], dz_1[1]);
+
+ test_traverse<polygon, polygon, operation_intersection>::apply("dz_2",
+ 2, 68.678921274288541, dz_2[0], dz_2[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("dz_2",
+ 2, 1505.4202304878663, dz_2[0], dz_2[1]);
+
+ test_traverse<polygon, polygon, operation_intersection>::apply("dz_3",
+ 6, 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]);
+
+ test_traverse<polygon, polygon, operation_intersection>::apply("dz_4",
+ 1, 473.59423868207693, dz_4[0], dz_4[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("dz_4",
+ 1, 1871.6125138873476, dz_4[0], dz_4[1]);
+ }
+
+ // Real-life problems
+
+ // SNL (Subsidiestelsel Natuur & Landschap - verAANnen)
+
+ if (! is_float_on_non_msvc)
+ {
+ test_traverse<polygon, polygon, operation_intersection>::apply("snl-1",
+ 2, 286.996062095888,
+ snl_1[0], snl_1[1],
+ float_might_deviate_more);
+
+ test_traverse<polygon, polygon, operation_union>::apply("snl-1",
+ 2, 51997.5408506132,
+ snl_1[0], snl_1[1],
+ float_might_deviate_more);
+ }
+
+ {
+ test_traverse<polygon, polygon, operation_intersection>::apply("isov",
+ 1, 88.1920, isovist[0], isovist[1],
+ float_might_deviate_more);
+ test_traverse<polygon, polygon, operation_union>::apply("isov",
+ 1, 313.3604, isovist[0], isovist[1],
+ float_might_deviate_more);
+ }
+
+ // GEOS tests
+ if (! is_float)
+ {
+ test_traverse<polygon, polygon, operation_intersection>::apply("geos_1_test_overlay",
+ 1, 3461.02330171138, geos_1_test_overlay[0], geos_1_test_overlay[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("geos_1_test_overlay",
+ 1, 3461.31592235516, geos_1_test_overlay[0], geos_1_test_overlay[1]);
+
+ if (! is_double)
+ {
+ test_traverse<polygon, polygon, operation_intersection>::apply("geos_2",
+ 2, 2.157e-6, // by bg/ttmath; sql server reports: 2.20530228034477E-06
+ geos_2[0], geos_2[1]);
+ }
+ test_traverse<polygon, polygon, operation_union>::apply("geos_2",
+ 1, 350.550662845485,
+ geos_2[0], geos_2[1]);
+ }
+
+ if (! is_float && ! is_double)
+ {
+ test_traverse<polygon, polygon, operation_intersection>::apply("geos_3",
+ 1, 2.484885e-7,
+ geos_3[0], geos_3[1]);
+ }
+
+ if (! is_float_on_non_msvc)
+ {
+ // Sometimes output is reported as 29229056
+ test_traverse<polygon, polygon, operation_union>::apply("geos_3",
+ 1, 29391548.5,
+ geos_3[0], geos_3[1],
+ float_might_deviate_more);
+
+ // Sometimes output is reported as 0.078125
+ test_traverse<polygon, polygon, operation_intersection>::apply("geos_4",
+ 1, 0.0836884926070727,
+ geos_4[0], geos_4[1],
+ float_might_deviate_more);
+ }
+
+ test_traverse<polygon, polygon, operation_union>::apply("geos_4",
+ 1, 2304.41633605957,
+ geos_4[0], geos_4[1]);
+
+ if (! is_float)
+ {
+
+#if defined(_MSC_VER)
+ double const expected = if_typed_tt<T>(3.63794e-17, 0.0);
+ int expected_count = if_typed_tt<T>(1, 0);
+#else
+ double const expected = if_typed<T, long double>(2.77555756156289135106e-17, 0.0);
+ int expected_count = if_typed<T, long double>(1, 0);
+#endif
+
+ // Calculate intersection/union of two triangles. Robustness case.
+ // ttmath can form a very small intersection triangle
+ // (which is even not accomplished by SQL Server/PostGIS)
+ std::string const caseid = "ggl_list_20110820_christophe";
+ test_traverse<polygon, polygon, operation_intersection>::apply(caseid,
+ expected_count, expected,
+ ggl_list_20110820_christophe[0], ggl_list_20110820_christophe[1]);
+ test_traverse<polygon, polygon, operation_union>::apply(caseid,
+ 1, 67.3550722317627,
+ ggl_list_20110820_christophe[0], ggl_list_20110820_christophe[1]);
+ }
+
+ test_traverse<polygon, polygon, operation_union>::apply("buffer_rt_f",
+ 1, 4.60853,
+ buffer_rt_f[0], buffer_rt_f[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply("buffer_rt_f",
+ 1, 0.0002943725152286,
+ buffer_rt_f[0], buffer_rt_f[1], 0.01);
+
+ test_traverse<polygon, polygon, operation_union>::apply("buffer_rt_g",
+ 1, 16.571,
+ buffer_rt_g[0], buffer_rt_g[1]);
+
+ test_traverse<polygon, polygon, operation_union>::apply("buffer_rt_g_boxes1",
+ 1, 20,
+ buffer_rt_g_boxes[0], buffer_rt_g_boxes[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("buffer_rt_g_boxes2",
+ 1, 24,
+ buffer_rt_g_boxes[0], buffer_rt_g_boxes[2]);
+ test_traverse<polygon, polygon, operation_union>::apply("buffer_rt_g_boxes3",
+ 1, 28,
+ buffer_rt_g_boxes[0], buffer_rt_g_boxes[3]);
+
+ test_traverse<polygon, polygon, operation_union>::apply("buffer_rt_g_boxes43",
+ 1, 30,
+ buffer_rt_g_boxes[4], buffer_rt_g_boxes[3]);
+
+
+ if (boost::is_same<T, double>::value)
+ {
+ test_traverse<polygon, polygon, operation_union>::apply("buffer_mp2",
+ 2, 36.7535642, buffer_mp2[0], buffer_mp2[1], 0.01);
+ }
+ test_traverse<polygon, polygon, operation_union>::apply("collinear_opposite_rr",
+ 1, 6.41, collinear_opposite_right[0], collinear_opposite_right[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("collinear_opposite_ll",
+ 1, 11.75, collinear_opposite_left[0], collinear_opposite_left[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("collinear_opposite_ss",
+ 1, 6, collinear_opposite_straight[0], collinear_opposite_straight[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("collinear_opposite_lr",
+ 1, 8.66, collinear_opposite_left[0], collinear_opposite_right[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("collinear_opposite_rl",
+ 1, 9, collinear_opposite_right[0], collinear_opposite_left[1]);
+
+ test_traverse<polygon, polygon, operation_intersection>::apply("ticket_7462", 1, 0.220582, ticket_7462[0], ticket_7462[1]);
+
+#ifdef BOOST_GEOMETRY_OVERLAY_NO_THROW
+ {
+ // NOTE: currently throws (normally)
+ std::string caseid = "ggl_list_20120229_volker";
+ test_traverse<polygon, polygon, operation_union>::apply(caseid,
+ 1, 99,
+ ggl_list_20120229_volker[0], ggl_list_20120229_volker[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply(caseid,
+ 1, 99,
+ ggl_list_20120229_volker[0], ggl_list_20120229_volker[1]);
+ caseid = "ggl_list_20120229_volker_2";
+ test_traverse<polygon, polygon, operation_union>::apply(caseid,
+ 1, 99,
+ ggl_list_20120229_volker[2], ggl_list_20120229_volker[1]);
+ test_traverse<polygon, polygon, operation_intersection>::apply(caseid,
+ 1, 99,
+ ggl_list_20120229_volker[2], ggl_list_20120229_volker[1]);
+ }
+#endif
+}
+
+template <typename T>
+void test_open()
+{
+ using namespace bg::detail::overlay;
+
+ typedef bg::model::polygon
+ <
+ bg::model::point<T, 2, bg::cs::cartesian>,
+ true, false
+ > polygon;
+
+ test_traverse<polygon, polygon, operation_intersection>::apply("open_1", 1, 5.4736,
+ open_case_1[0], open_case_1[1]);
+ test_traverse<polygon, polygon, operation_union>::apply("open_1", 1, 11.5264,
+ open_case_1[0], open_case_1[1]);
+}
+
+
+template <typename T>
+void test_ccw()
+{
+ using namespace bg::detail::overlay;
+
+ typedef bg::model::polygon
+ <
+ bg::model::point<T, 2, bg::cs::cartesian>,
+ false, true
+ > polygon;
+
+ test_traverse<polygon, polygon, operation_intersection, true, true>::apply("ccw_1", 1, 5.4736,
+ ccw_case_1[0], ccw_case_1[1]);
+ test_traverse<polygon, polygon, operation_union, true, true>::apply("ccw_1", 1, 11.5264,
+ ccw_case_1[0], ccw_case_1[1]);
+}
+
+
+
+int test_main(int, char* [])
+{
+#if defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
+ test_all<double>();
+#else
+ test_all<float>();
+ test_all<double>();
+ test_open<double>();
+ test_ccw<double>();
+
+#if ! defined(_MSC_VER)
+ test_all<long double>();
+#endif
+
+#ifdef HAVE_TTMATH
+ test_all<ttmath_big>();
+#endif
+#endif
+
+ return 0;
+ }
+
+#endif
diff --git a/libs/geometry/test/algorithms/overlay/traverse.vcproj b/libs/geometry/test/algorithms/overlay/traverse.vcproj
new file mode 100644
index 000000000..f5c83a551
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/traverse.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="traverse"
+ ProjectGUID="{6260214E-DB6F-4934-ADF7-DD2B1666171B}"
+ RootNamespace="traverse"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\traverse"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../../../../..;../..;../../../../../boost/geometry/extensions/contrib/ttmath"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\traverse"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=".;../../../../..;../..;../../../../../boost/geometry/extensions/contrib/ttmath"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\traverse.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/overlay/traverse_gmp.cpp b/libs/geometry/test/algorithms/overlay/traverse_gmp.cpp
new file mode 100644
index 000000000..46da653d8
--- /dev/null
+++ b/libs/geometry/test/algorithms/overlay/traverse_gmp.cpp
@@ -0,0 +1,209 @@
+// 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.
+
+// 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)
+
+#if defined(_MSC_VER)
+#pragma warning( disable : 4244 )
+#pragma warning( disable : 4267 )
+#endif
+
+//#define GEOMETRY_DEBUG_INTERSECTION
+
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <fstream>
+
+#include <boost/numeric_adaptor/numeric_adaptor.hpp>
+#include <boost/numeric_adaptor/gmp_value_type.hpp>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
+#include <boost/geometry/algorithms/detail/overlay/enrichment_info.hpp>
+#include <boost/geometry/algorithms/detail/overlay/traversal_info.hpp>
+#include <boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp>
+#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
+#include <boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp>
+#include <boost/geometry/algorithms/detail/overlay/traverse.hpp>
+
+
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+
+#define TEST_WITH_SVG
+
+
+#if defined(TEST_WITH_SVG)
+# include <boost/geometry/io/svg/svg_mapper.hpp>
+#endif
+
+
+
+template <typename OutputType, typename G1, typename G2>
+void test_traverse(std::string const& caseid, G1 const& g1, G2 const& g2)
+{
+ typedef bg::detail::intersection::intersection_point
+ <typename bg::point_type<G2>::type> ip;
+ typedef typename boost::range_const_iterator<std::vector<ip> >::type iterator;
+ typedef std::vector<ip> ip_vector;
+ ip_vector ips;
+
+ typedef typename bg::strategy::side::services::default_strategy
+ <
+ typename bg::cs_tag<G1>::type
+ >::type strategy_type;
+
+
+ typedef bg::detail::overlay::traversal_turn_info
+ <
+ typename bg::point_type<G2>::type
+ > turn_info;
+ typedef typename boost::range_iterator<const std::vector<turn_info> >::type iterator;
+ std::vector<turn_info> ips;
+
+ bg::get_turns<false, false, bg::detail::overlay::calculate_distance_policy>(g1, g2, ips);
+ bg::enrich_intersection_points(ips, g1, g2, strategy_type());
+
+ typedef bg::model::ring<typename bg::point_type<G2>::type> ring_type;
+ typedef std::vector<ring_type> out_vector;
+ out_vector v;
+
+
+
+ bg::traverse
+ <
+ strategy_type,
+ ring_type
+ >
+ (
+ g1, g2, -1, ips, std::back_inserter(v)
+ );
+
+
+
+#if defined(TEST_WITH_SVG)
+ {
+ std::ostringstream filename;
+ filename << "intersection_" << caseid << ".svg";
+
+ std::ofstream svg(filename.str().c_str());
+
+ // Trick to have this always LongDouble
+ //typedef bg::model::d2::point_xy<long double> P;
+ typedef typename bg::point_type<G1>::type P;
+ //typename bg::replace_point_type<G1, P>::type rg1;
+ //typename bg::replace_point_type<G2, P>::type rg2;
+
+ bg::svg_mapper<P> mapper(svg, 1000, 800);
+
+ mapper.add(g1);
+ mapper.add(g2);
+
+ // Input shapes in green/blue
+ mapper.map(g1, "opacity:0.8;fill:rgb(0,255,0);"
+ "stroke:rgb(0,0,0);stroke-width:1");
+ mapper.map(g2, "opacity:0.8;fill:rgb(0,0,255);"
+ "stroke:rgb(0,0,0);stroke-width:1");
+
+ // Traversal rings in red
+ for (typename out_vector::const_iterator it = boost::begin(v);
+ it != boost::end(v);
+ ++it)
+ {
+ mapper.map(*it, "fill-opacity:0.1;stroke-opacity:0.9;"
+ "fill:rgb(255,0,0);stroke:rgb(255,0,0);stroke-width:5");
+
+ std::cout << bg::wkt(*it) << std::endl;
+ std::cout << bg::area(*it) << std::endl;
+ }
+
+ // IP's in orange
+ for (iterator it = boost::begin(ips); it != boost::end(ips); ++it)
+ {
+ mapper.map(it->point, "fill:rgb(255,128,0);"
+ "stroke:rgb(0,0,100);stroke-width:1");
+ }
+ }
+#endif
+}
+
+template <typename OutputType, typename G1, typename G2>
+void test_one(std::string const& caseid, std::string const& wkt1, std::string const& wkt2)
+{
+ G1 g1;
+ bg::read_wkt(wkt1, g1);
+
+ G2 g2;
+ bg::read_wkt(wkt2, g2);
+
+ bg::correct(g1);
+ bg::correct(g2);
+ std::cout << "area1 " << bg::area(g1) << " " << " area2: " << bg::area(g2) << std::endl;
+
+ test_traverse<OutputType>(caseid, g1, g2);
+}
+
+
+#if ! defined(GEOMETRY_TEST_MULTI)
+
+template <typename P>
+void test_traverse_gmp(std::string const& caseid)
+{
+ typedef bg::model::polygon<P> polygon;
+ std::cout << typeid(typename bg::coordinate_type<P>::type).name() << std::endl;
+ std::cout << std::setprecision(30) << std::numeric_limits<float>::epsilon() << std::endl;
+ std::cout << std::setprecision(30) << std::numeric_limits<double>::epsilon() << std::endl;
+ std::cout << std::setprecision(30) << std::numeric_limits<long double>::epsilon() << std::endl;
+
+ static std::string brandon[3] =
+ {
+ //37.43402099609375 1.470055103302002,
+ "POLYGON((37.29449462890625 1.7902572154998779,37.000419616699219 1.664225697517395,37.140213012695313 1.3446992635726929,50.974888957147442 -30.277285722290763,57.297810222148939 -37.546793343968417,41.590042114257813 -7.2021245956420898,40.6978759765625 -5.4500408172607422,40.758884429931641 -5.418975830078125,42.577911376953125 -4.4901103973388672,42.577877044677734 -4.4900407791137695,42.699958801269531 -4.4278755187988281,46.523914387974358 -8.5152102535033496,47.585065917176543 -6.1314922196594779,45.389434814453125 -4.5143837928771973,46.296027072709599 -2.4984308554828116,37.29449462890625 1.7902572154998779))",
+ "POLYGON((42.399410247802734 1.4956772327423096,42.721500396728516 2.2342472076416016,42.721500396728516 3.6584999561309814,51.20102152843122 7.1738039562841562,51.370888500897557 7.4163459734570729,37.43402099609375 1.470055103302002,37.29449462890625 1.7902572154998779,37.000419616699219 1.664225697517395,37.140213012695313 1.3446992635726929,36.954700469970703 1.2597870826721191,26.472516656201325 -3.5380830513658776,27.069889344709196 -4.2926591211028242,30.501169204711914 -2.3718316555023193,32.708126068115234 -2.3611266613006592,32.708126068115234 -2.3611700534820557,32.708168029785156 -2.3611698150634766,32.718830108642578 -4.3281683921813965,29.135100397190627 -8.9262827849488211,29.619997024536133 -9.5368013381958008,30.339155197143555 -8.9838371276855469,30.670633316040039 -8.8180980682373047,30.896280288696289 -9.1206979751586914,30.207040612748258 -10.275926149505661,30.947774887084961 -11.208560943603516,31.669155120849609 -10.653837203979492,32.000633239746094 -10.488097190856934,32.226280212402344 -10.790698051452637,31.682494778186321 -12.133624901803865,32.274600982666016 -12.879127502441406,32.998821258544922 -12.323249816894531,33.339523315429688 -12.147735595703125,33.566280364990234 -12.450697898864746,33.164891643669634 -14.000060288415174,33.598796844482422 -14.546377182006836,34.328716278076172 -13.992490768432617,34.658355712890625 -13.81736946105957,34.886280059814453 -14.120697975158691,34.634240447128811 -15.85007183479255,34.931102752685547 -16.223842620849609,35.656356811523438 -15.66030216217041,35.963497161865234 -15.476018905639648,37.326129913330078 -17.190576553344727,38.823680877685547 -16.296066284179688,39.966808319091797 -17.625011444091797,40.800632476806641 -17.208097457885742,41.821544647216797 -19.211688995361328,41.988733475572282 -19.945838749437218,57.524304765518266 -37.807195733984784,41.590042114257813 -7.2021245956420898,40.6978759765625 -5.4500408172607422,40.758884429931641 -5.418975830078125,42.577911376953125 -4.4901103973388672,42.577877044677734 -4.4900407791137695,42.699958801269531 -4.4278755187988281,46.559533858616469 -8.435196445683264,47.604561877161387 -6.087697464505224,45.389434814453125 -4.5143837928771973,46.695858001708984 -1.6093428134918213,47.263670054709685 -1.784876824891044,47.830955505371094 -0.69758313894271851,48.43512638981781 -0.81299959072453376,49.071769542946825 0.61489892713413252,43.764598846435547 0.93951499462127686,43.644271850585938 0.96149998903274536,42.399410247802734 1.4956772327423096))",
+ "POLYGON((43.644271850585938 0.96149998903274536,43.764598846435547 0.93951499462127686,49.071769542946825 0.61489892713413252,48.43512638981781 -0.81299959072453376,47.830955505371094 -0.69758313894271851,47.263670054709685 -1.784876824891044,46.695858001708984 -1.6093428134918213,45.389434814453125 -4.5143837928771973,47.604561877161387 -6.087697464505224,46.559533858616469 -8.435196445683264,42.699958801269531 -4.4278755187988281,42.577877044677734 -4.4900407791137695,42.577911376953125 -4.4901103973388672,40.758884429931641 -5.418975830078125,40.6978759765625 -5.4500408172607422,41.590042114257813 -7.2021245956420898,57.524304765518266 -37.807195733984784,41.988733475572282 -19.945838749437218,41.821544647216797 -19.211688995361328,40.800632476806641 -17.208097457885742,39.966808319091797 -17.625011444091797,38.823680877685547 -16.296066284179688,37.326129913330078 -17.190576553344727,35.963497161865234 -15.476018905639648,35.656356811523438 -15.66030216217041,34.931102752685547 -16.223842620849609,34.634240447128811 -15.85007183479255,34.886280059814453 -14.120697975158691,34.658355712890625 -13.81736946105957,34.328716278076172 -13.992490768432617,33.598796844482422 -14.546377182006836,33.164891643669634 -14.000060288415174,33.566280364990234 -12.450697898864746,33.339523315429688 -12.147735595703125,32.998821258544922 -12.323249816894531,32.274600982666016 -12.879127502441406,31.682494778186321 -12.133624901803865,32.226280212402344 -10.790698051452637,32.000633239746094 -10.488097190856934,31.669155120849609 -10.653837203979492,30.947774887084961 -11.208560943603516,30.207040612748258 -10.275926149505661,30.896280288696289 -9.1206979751586914,30.670633316040039 -8.8180980682373047,30.339155197143555 -8.9838371276855469,29.619997024536133 -9.5368013381958008,29.135100397190627 -8.9262827849488211,32.718830108642578 -4.3281683921813965,32.708168029785156 -2.3611698150634766,32.708126068115234 -2.3611700534820557,32.708126068115234 -2.3611266613006592,30.501169204711914 -2.3718316555023193,27.069889344709196 -4.2926591211028242,26.472516656201325 -3.5380830513658776,36.954700469970703 1.2597870826721191,37.140213012695313 1.3446992635726929,37.000419616699219 1.664225697517395,37.29449462890625 1.7902572154998779,37.43402099609375 1.470055103302002,51.370888500897557 7.4163459734570729,51.20102152843122 7.1738039562841562,42.721500396728516 3.6584999561309814,42.721500396728516 2.2342472076416016,42.399410247802734 1.4956772327423096,43.644271850585938 0.96149998903274536))"
+ };
+
+
+ // Test the FORWARD case
+ test_one<polygon, polygon, polygon>(caseid, brandon[0], brandon[1]);
+}
+#endif
+
+
+
+int main(int argc, char** argv)
+{
+ int mode = (argc > 1) ? atol(argv[1]) : 1;
+ switch(mode)
+ {
+ case 1 :
+ test_traverse_gmp<bg::model::d2::point_xy<float> >("float");
+ break;
+ case 2 :
+ test_traverse_gmp<bg::model::d2::point_xy<double> >("double");
+ break;
+ case 3 :
+ test_traverse_gmp<bg::model::d2::point_xy<long double> >("long double");
+ break;
+ case 4 :
+ #if defined(HAVE_TTMATH)
+ test_traverse_gmp<bg::model::d2::point_xy<ttmath_big> >("ttmath_big");
+ #endif
+ break;
+ }
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/perimeter.cpp b/libs/geometry/test/algorithms/perimeter.cpp
new file mode 100644
index 000000000..54fcd3c57
--- /dev/null
+++ b/libs/geometry/test/algorithms/perimeter.cpp
@@ -0,0 +1,63 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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 <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+#include <algorithms/test_perimeter.hpp>
+
+
+template <typename P>
+void test_all()
+{
+ // 3-4-5 triangle
+ //test_geometry<std::pair<P, P> >("LINESTRING(0 0,3 4)", 5);
+
+ test_geometry<bg::model::ring<P> >(
+ "POLYGON((0 0,0 1,1 1,1 0,0 0))", 4);
+ test_geometry<bg::model::polygon<P> >(
+ "POLYGON((0 0,0 1,1 0,0 0))", 1.0 + 1.0 + sqrt(2.0));
+ test_geometry<bg::model::polygon<P> >(
+ "POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,2 1,2 2,1 2,1 1))", 20);
+}
+
+template <typename P>
+void test_open()
+{
+ typedef bg::model::polygon<P, true, false> open_polygon;
+ test_geometry<open_polygon>("POLYGON((0 0,0 1,1 1,1 0))", 4);
+}
+
+template <typename P>
+void test_empty_input()
+{
+ bg::model::polygon<P> poly_empty;
+ bg::model::ring<P> ring_empty;
+
+ test_empty_input(poly_empty);
+ test_empty_input(ring_empty);
+}
+
+int test_main(int, char* [])
+{
+ //test_all<bg::model::d2::point_xy<int> >();
+ test_all<bg::model::d2::point_xy<float> >();
+ test_all<bg::model::d2::point_xy<double> >();
+
+ test_open<bg::model::d2::point_xy<double> >();
+
+#if defined(HAVE_TTMATH)
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ // test_empty_input<bg::model::d2::point_xy<int> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/perimeter.vcproj b/libs/geometry/test/algorithms/perimeter.vcproj
new file mode 100644
index 000000000..a39d1880f
--- /dev/null
+++ b/libs/geometry/test/algorithms/perimeter.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="perimeter"
+ ProjectGUID="{EFC23FC0-86D3-4C81-A218-26F0D5A4D50B}"
+ RootNamespace="perimeter"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\perimeter"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\perimeter"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\perimeter.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/reverse.cpp b/libs/geometry/test/algorithms/reverse.cpp
new file mode 100644
index 000000000..d74b756c4
--- /dev/null
+++ b/libs/geometry/test/algorithms/reverse.cpp
@@ -0,0 +1,75 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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_reverse.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+#include <test_common/test_point.hpp>
+#include <test_geometries/all_custom_linestring.hpp>
+#include <test_geometries/all_custom_ring.hpp>
+#include <test_geometries/wrapped_boost_array.hpp>
+
+template <typename LineString>
+void test_linestring()
+{
+ // Simplex
+ test_geometry<LineString >(
+ "LINESTRING(0 0,1 1)",
+ "LINESTRING(1 1,0 0)");
+
+ // Three points, middle should stay the same
+ test_geometry<LineString >(
+ "LINESTRING(0 0,1 1,2 2)",
+ "LINESTRING(2 2,1 1,0 0)");
+
+ // Four points
+ test_geometry<LineString >(
+ "LINESTRING(0 0,1 1,2 2,3 3)",
+ "LINESTRING(3 3,2 2,1 1,0 0)");
+}
+
+template <typename Ring>
+void test_ring()
+{
+ test_geometry<Ring>(
+ "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0))",
+ "POLYGON((4 0,2 1,0 2,0 7,4 9,8 7,8 2,4 0))");
+}
+
+template <typename Point>
+void test_all()
+{
+ test_linestring<bg::model::linestring<Point> >();
+ test_linestring<all_custom_linestring<Point> >();
+
+ // Polygon with holes
+ test_geometry<bg::model::polygon<Point> >(
+ "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0),(7 3,7 6,1 6,1 3,4 3,7 3))",
+ "POLYGON((4 0,2 1,0 2,0 7,4 9,8 7,8 2,4 0),(7 3,4 3,1 3,1 6,7 6,7 3))");
+
+ // Check compilation
+ test_geometry<Point>("POINT(0 0)", "POINT(0 0)");
+
+ test_ring<bg::model::ring<Point> >();
+ test_ring<all_custom_ring<Point> >();
+}
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<int> >();
+ 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/reverse.vcproj b/libs/geometry/test/algorithms/reverse.vcproj
new file mode 100644
index 000000000..9f438a8c2
--- /dev/null
+++ b/libs/geometry/test/algorithms/reverse.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="reverse"
+ ProjectGUID="{14B5DFC5-D511-4D8C-A231-EE90A05687E1}"
+ RootNamespace="reverse"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\reverse"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\reverse"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\reverse.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/simplify.cpp b/libs/geometry/test/algorithms/simplify.cpp
new file mode 100644
index 000000000..66c8599c4
--- /dev/null
+++ b/libs/geometry/test/algorithms/simplify.cpp
@@ -0,0 +1,107 @@
+// 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.
+
+// 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 <iterator>
+
+
+#include <algorithms/test_simplify.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+#include <test_geometries/wrapped_boost_array.hpp>
+#include <test_common/test_point.hpp>
+
+
+template <typename P>
+void test_all()
+{
+ test_geometry<bg::model::linestring<P> >(
+ "LINESTRING(0 0,5 5,10 10)",
+ "LINESTRING(0 0,10 10)", 1.0);
+
+ test_geometry<bg::model::linestring<P> >(
+ "LINESTRING(0 0, 5 5, 6 5, 10 10)",
+ "LINESTRING(0 0,10 10)", 1.0);
+
+ test_geometry<bg::model::linestring<P> >(
+ "LINESTRING(0 0,5 5,7 5,10 10)",
+ "LINESTRING(0 0,5 5,7 5,10 10)", 1.0);
+
+ /* TODO fix this
+ test_geometry<test::wrapped_boost_array<P, 10> >(
+ "LINESTRING(0 0,5 5,7 5,10 10)",
+ "LINESTRING(0 0,5 5,7 5,10 10)", 1.0);
+ */
+
+ test_geometry<bg::model::ring<P> >(
+ "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0))",
+ "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,4 0))", 1.0);
+
+ test_geometry<bg::model::polygon<P> >(
+ "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0))",
+ "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,4 0))", 1.0);
+
+ test_geometry<bg::model::polygon<P> >(
+ "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0),(7 3,7 6,1 6,1 3,4 3,7 3))",
+ "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,4 0),(7 3,7 6,1 6,1 3,7 3))", 1.0);
+
+/*
+
+Above can be checked in PostGIS by:
+
+select astext(ST_Simplify(geomfromtext('LINESTRING(0 0, 5 5, 10 10)'),1.0)) as simplified
+union all select astext(ST_Simplify(geomfromtext('LINESTRING(0 0, 5 5, 6 5, 10 10)'),1.0))
+union all select astext(ST_Simplify(geomfromtext('LINESTRING(0 0, 5 5, 7 5, 10 10)'),1.0))
+union all select astext(ST_Simplify(geomfromtext('POLYGON((4 0, 8 2, 8 7, 4 9, 0 7, 0 2, 2 1, 4 0))'),1.0))
+union all select astext(ST_Simplify(geomfromtext('POLYGON((4 0, 8 2, 8 7, 4 9, 0 7, 0 2, 2 1, 4 0),(7 3, 7 6, 1 6, 1 3, 4 3, 7 3))'),1.0))
+*/
+
+ // Just check compilation
+ test_geometry<P>(
+ "POINT(0 0)",
+ "POINT(0 0)", 1.0);
+
+
+ test_geometry<bg::model::ring<P> >(
+ "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0))",
+ "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,4 0))", 1.0);
+}
+
+
+template <typename P>
+void test_spherical()
+{
+ test_geometry<bg::model::linestring<P> >(
+ "LINESTRING(4.1 52.1,4.2 52.2,4.3 52.3)",
+ "LINESTRING(4.1 52.1,4.3 52.3)", 0.01);
+}
+
+
+int test_main(int, char* [])
+{
+ // Integer compiles, but simplify-process fails (due to distances)
+ //test_all<bg::model::d2::point_xy<int> >();
+
+ test_all<bg::model::d2::point_xy<float> >();
+ test_all<bg::model::d2::point_xy<double> >();
+
+ test_spherical<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> > >();
+
+#if defined(HAVE_TTMATH)
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+ test_spherical<bg::model::point<ttmath_big, 2, bg::cs::spherical_equatorial<bg::degree> > >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/simplify.vcproj b/libs/geometry/test/algorithms/simplify.vcproj
new file mode 100644
index 000000000..3193c8abf
--- /dev/null
+++ b/libs/geometry/test/algorithms/simplify.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="simplify"
+ ProjectGUID="{B1760CB8-553B-42AB-B54E-3D0320FF252F}"
+ RootNamespace="simplify"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\simplify"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\simplify"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\simplify.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/test_area.hpp b/libs/geometry/test/algorithms/test_area.hpp
new file mode 100644
index 000000000..394fd1099
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_area.hpp
@@ -0,0 +1,84 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_AREA_HPP
+#define BOOST_GEOMETRY_TEST_AREA_HPP
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/area.hpp>
+#include <boost/geometry/algorithms/correct.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+
+
+template <typename Geometry>
+void test_area(Geometry const& geometry,
+ typename bg::default_area_result<Geometry>::type expected_area)
+{
+ typename bg::default_area_result<Geometry>::type area = bg::area(geometry);
+
+#ifdef GEOMETRY_TEST_DEBUG
+ std::ostringstream out;
+ out << typeid(typename bg::coordinate_type<Geometry>::type).name()
+ << " "
+ << typeid(typename bg::default_area_result<Geometry>::type).name()
+ << " "
+ << "area : " << bg::area(geometry)
+ << std::endl;
+ std::cout << out.str();
+#endif
+
+ BOOST_CHECK_CLOSE(area, expected_area, 0.0001);
+
+ // Test with explicitly defined strategies
+ bg::strategy::area::surveyor
+ <
+ typename bg::point_type<Geometry>::type
+ > strategy1;
+
+ area = bg::area(geometry, strategy1);
+
+ bg::strategy::area::surveyor
+ <
+ typename bg::point_type<Geometry>::type,
+ typename bg::coordinate_type<Geometry>::type
+ > strategy2;
+
+ area = bg::area(geometry, strategy2);
+
+}
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt,
+ typename bg::default_area_result<Geometry>::type expected_area)
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ test_area(geometry, expected_area);
+}
+
+template <typename Geometry>
+void test_empty_input(Geometry const& geometry)
+{
+ try
+ {
+ bg::area(geometry);
+ }
+ catch(bg::empty_input_exception const& )
+ {
+ return;
+ }
+ BOOST_CHECK_MESSAGE(false, "A empty_input_exception should have been thrown" );
+}
+
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_centroid.hpp b/libs/geometry/test/algorithms/test_centroid.hpp
new file mode 100644
index 000000000..2ab584ef6
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_centroid.hpp
@@ -0,0 +1,99 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_CENTROID_HPP
+#define BOOST_GEOMETRY_TEST_CENTROID_HPP
+
+// Test-functionality, shared between single and multi tests
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+#include <boost/geometry/algorithms/centroid.hpp>
+#include <boost/geometry/algorithms/distance.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+
+
+template <std::size_t D>
+struct check_result
+{
+ template <typename Point1, typename Point2>
+ 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);
+ }
+};
+
+template <>
+struct check_result<0>
+{
+ template <typename Point1, typename Point2>
+ static void apply(Point1 const&, Point2 const&)
+ {}
+};
+
+
+template <typename CalculationType, typename Geometry, typename Point>
+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;
+ bg::centroid(geometry, c2,
+ bg::strategy::centroid::bashein_detmer<point_type, point_type, CalculationType>());
+
+ std::cout << typeid(CalculationType).name() << ": " << std::setprecision(20)
+ << bg::get<0>(c2) << " " << bg::get<1>(c2)
+ << " -> difference: " << bg::distance(c1, c2)
+ << 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())
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ typedef typename bg::point_type<Geometry>::type point_type;
+ point_type c1;
+ bg::centroid(geometry, c1);
+ check_result<bg::dimension<Geometry>::type::value>::apply(c1, boost::make_tuple(d1, d2, d3, d4, d5));
+
+#ifdef REPORT_RESULTS
+ std::cout << "normal: " << std::setprecision(20) << bg::get<0>(c1) << " " << bg::get<1>(c1) << std::endl;
+
+ //test_with_other_calculation_type<long long>(geometry, c1);
+ test_with_other_calculation_type<float>(geometry, c1);
+ test_with_other_calculation_type<long double>(geometry, c1);
+#if defined(HAVE_TTMATH)
+ test_with_other_calculation_type<ttmath_big>(geometry, c1);
+#endif
+
+#endif
+}
+
+template <typename Geometry>
+void test_centroid_exception()
+{
+ Geometry geometry;
+ try
+ {
+ typename bg::point_type<Geometry>::type c;
+ bg::centroid(geometry, c);
+ }
+ catch(bg::centroid_exception const& )
+ {
+ return;
+ }
+ BOOST_CHECK_MESSAGE(false, "A centroid_exception should have been thrown" );
+}
+
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_convert.hpp b/libs/geometry/test/algorithms/test_convert.hpp
new file mode 100644
index 000000000..281fdf936
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_convert.hpp
@@ -0,0 +1,69 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_CONVERT_HPP
+#define BOOST_GEOMETRY_TEST_CONVERT_HPP
+
+
+#include <boost/geometry/algorithms/assign.hpp>
+#include <boost/geometry/algorithms/convert.hpp>
+#include <boost/geometry/algorithms/make.hpp>
+#include <boost/geometry/algorithms/num_points.hpp>
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+#include <boost/variant/variant.hpp>
+
+#include <geometry_test_common.hpp>
+
+#include <test_common/test_point.hpp>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+
+template <typename Geometry2, typename Geometry1>
+void check_mixed(Geometry1 const& geometry1, std::string const& expected)
+{
+ Geometry2 geometry2;
+ bg::convert(geometry1, geometry2);
+
+ std::ostringstream out;
+ out << bg::wkt(geometry2);
+ BOOST_CHECK_EQUAL(out.str(), expected);
+}
+
+template <typename Geometry1, typename Geometry2>
+void test_mixed(std::string const& wkt, std::string const& expected)
+{
+ Geometry1 geometry1;
+ bg::read_wkt(wkt, geometry1);
+ check_mixed<Geometry2>(geometry1, expected);
+ check_mixed<Geometry2>(boost::variant<Geometry1>(geometry1), expected);
+}
+
+template <typename Geometry1, typename Geometry2>
+void test_mixed_identical_result(std::string const& wkt)
+{
+ test_mixed<Geometry1, Geometry2>(wkt, wkt);
+ test_mixed<Geometry2, Geometry1>(wkt, wkt);
+}
+
+template <typename Geometry1, typename Geometry2>
+void test_mixed_reversible_result(std::string const& wkt1, std::string const& wkt2)
+{
+ test_mixed<Geometry1, Geometry2>(wkt1, wkt2);
+ test_mixed<Geometry2, Geometry1>(wkt2, wkt1);
+}
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_convex_hull.hpp b/libs/geometry/test/algorithms/test_convex_hull.hpp
new file mode 100644
index 000000000..a6a108a79
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_convex_hull.hpp
@@ -0,0 +1,127 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_CONVEX_HULL_HPP
+#define BOOST_GEOMETRY_TEST_CONVEX_HULL_HPP
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/convex_hull.hpp>
+#include <boost/geometry/algorithms/area.hpp>
+#include <boost/geometry/algorithms/num_points.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/io/wkt/write.hpp>
+
+#include <boost/geometry/geometries/polygon.hpp>
+
+
+template <typename Geometry, typename Hull>
+void test_convex_hull(Geometry const& geometry, Hull const& hull,
+ std::size_t size_original, std::size_t size_hull,
+ double expected_area, bool reverse)
+{
+
+ std::size_t n = bg::num_points(hull);
+
+ BOOST_CHECK_MESSAGE(n == size_hull,
+ "convex hull: " << bg::wkt(geometry)
+ << " -> " << bg::wkt(hull)
+ << " type "
+ << (typeid(typename bg::coordinate_type<Hull>::type).name())
+ << " -> Expected: " << size_hull
+ << " detected: " << n);
+
+
+ // We omit this check as it is not important for the hull algorithm
+ // BOOST_CHECK(bg::num_points(geometry) == size_original);
+
+ typename bg::default_area_result<Geometry>::type ah = bg::area(hull);
+ if (reverse)
+ {
+ ah = -ah;
+ }
+
+//std::cout << "Area: " << bg::area(geometry) << std::endl;
+//std::cout << bg::wkt(hull) << std::endl;
+
+ BOOST_CHECK_CLOSE(ah, expected_area, 0.001);
+}
+
+template <typename Geometry, bool Clockwise>
+void test_geometry_order(std::string const& wkt,
+ std::size_t size_original, std::size_t size_hull,
+ double expected_area)
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+
+ bg::model::polygon
+ <
+ typename bg::point_type<Geometry>::type,
+ Clockwise
+ > hull;
+
+ // Test version with output iterator
+ bg::detail::convex_hull::convex_hull_insert(geometry, std::back_inserter(hull.outer()));
+ test_convex_hull(geometry, hull,
+ size_original, size_hull, expected_area, ! Clockwise);
+
+ // Test version with ring as output
+ bg::clear(hull);
+ bg::convex_hull(geometry, hull.outer());
+ test_convex_hull(geometry, hull, size_original, size_hull, expected_area, false);
+
+ // Test version with polygon as output
+ bg::clear(hull);
+ bg::convex_hull(geometry, hull);
+ test_convex_hull(geometry, hull, size_original, size_hull, expected_area, false);
+
+ // Test version with strategy
+ bg::clear(hull);
+ bg::strategy::convex_hull::graham_andrew
+ <
+ Geometry,
+ typename bg::point_type<Geometry>::type
+ > graham;
+ bg::convex_hull(geometry, hull.outer(), graham);
+ test_convex_hull(geometry, hull, size_original, size_hull, expected_area, false);
+
+ // Test version with output iterator and strategy
+ bg::clear(hull);
+ bg::detail::convex_hull::convex_hull_insert(geometry, std::back_inserter(hull.outer()), graham);
+ test_convex_hull(geometry, hull, size_original, size_hull, expected_area, ! Clockwise);
+}
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt,
+ std::size_t size_original, std::size_t size_hull,
+ double expected_area)
+{
+ test_geometry_order<Geometry, true>(wkt, size_original, size_hull, expected_area);
+ test_geometry_order<Geometry, false>(wkt, size_original, size_hull, expected_area);
+}
+
+template <typename Geometry>
+void test_empty_input()
+{
+ Geometry geometry;
+ bg::model::polygon
+ <
+ typename bg::point_type<Geometry>::type
+ > hull;
+
+ bg::convex_hull(geometry, hull);
+ BOOST_CHECK_MESSAGE(bg::num_points(hull) == 0, "Output convex hull should be empty" );
+}
+
+
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_covered_by.hpp b/libs/geometry/test/algorithms/test_covered_by.hpp
new file mode 100644
index 000000000..efaa6f789
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_covered_by.hpp
@@ -0,0 +1,123 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_COVERED_BY_HPP
+#define BOOST_GEOMETRY_TEST_COVERED_BY_HPP
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/core/ring_type.hpp>
+#include <boost/geometry/algorithms/covered_by.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+#include <boost/geometry/geometries/ring.hpp>
+#include <boost/geometry/geometries/polygon.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+
+
+template <typename Geometry1, typename Geometry2>
+void test_geometry(std::string const& wkt1,
+ std::string const& wkt2, bool expected)
+{
+ Geometry1 geometry1;
+ Geometry2 geometry2;
+
+ bg::read_wkt(wkt1, geometry1);
+ bg::read_wkt(wkt2, geometry2);
+
+ bool detected = bg::covered_by(geometry1, geometry2);
+
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "covered_by: " << wkt1
+ << " in " << wkt2
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+}
+
+/*
+
+template <typename Point, bool Clockwise, bool Closed>
+void test_ordered_ring(std::string const& wkt_point,
+ std::string const& wkt_geometry, bool expected)
+{
+ typedef bg::model::ring<Point, Clockwise, Closed> ring_type;
+ ring_type ring;
+ Point point;
+
+ bg::read_wkt(wkt_geometry, ring);
+ if (! Clockwise)
+ {
+ std::reverse(boost::begin(ring), boost::end(ring));
+ }
+ if (! Closed)
+ {
+ ring.resize(ring.size() - 1);
+ }
+
+ bg::read_wkt(wkt_point, point);
+
+ bool detected = bg::covered_by(point, ring);
+
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "covered_by: " << wkt_point
+ << " in " << wkt_geometry
+ << " -> Expected: " << expected
+ << " detected: " << detected
+ << " clockwise: " << int(Clockwise)
+ << " closed: " << int(Closed)
+ );
+
+ // other strategy (note that this one cannot detect OnBorder
+ // (without modifications)
+
+ bg::strategy::covered_by::franklin<Point> franklin;
+ detected = bg::covered_by(point, ring, franklin);
+ if (! on_border)
+ {
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "covered_by: " << wkt_point
+ << " in " << wkt_geometry
+ << " -> Expected: " << expected
+ << " detected: " << detected
+ << " clockwise: " << int(Clockwise)
+ << " closed: " << int(Closed)
+ );
+ }
+
+
+ bg::strategy::covered_by::crossings_multiply<Point> cm;
+ detected = bg::covered_by(point, ring, cm);
+ if (! on_border)
+ {
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "covered_by: " << wkt_point
+ << " in " << wkt_geometry
+ << " -> Expected: " << expected
+ << " detected: " << detected
+ << " clockwise: " << int(Clockwise)
+ << " closed: " << int(Closed)
+ );
+ }
+}
+
+template <typename Point>
+void test_ring(std::string const& wkt_point,
+ std::string const& wkt_geometry,
+ bool expected)
+{
+ test_ordered_ring<Point, true, true>(wkt_point, wkt_geometry, expected);
+ test_ordered_ring<Point, false, true>(wkt_point, wkt_geometry, expected);
+ test_ordered_ring<Point, true, false>(wkt_point, wkt_geometry, expected);
+ test_ordered_ring<Point, false, false>(wkt_point, wkt_geometry, expected);
+ test_geometry<Point, bg::model::polygon<Point> >(wkt_point, wkt_geometry, expected);
+}
+*/
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_difference.hpp b/libs/geometry/test/algorithms/test_difference.hpp
new file mode 100644
index 000000000..c3e34206d
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_difference.hpp
@@ -0,0 +1,310 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_DIFFERENCE_HPP
+#define BOOST_GEOMETRY_TEST_DIFFERENCE_HPP
+
+#include <fstream>
+#include <iomanip>
+
+#include <boost/foreach.hpp>
+#include <geometry_test_common.hpp>
+
+#include <boost/range/algorithm/copy.hpp>
+
+#include <boost/geometry/algorithms/correct.hpp>
+#include <boost/geometry/algorithms/difference.hpp>
+#include <boost/geometry/algorithms/sym_difference.hpp>
+
+#include <boost/geometry/algorithms/area.hpp>
+#include <boost/geometry/algorithms/length.hpp>
+#include <boost/geometry/algorithms/num_points.hpp>
+
+#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/strategies/strategies.hpp>
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+
+
+#if defined(TEST_WITH_SVG)
+# define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
+# define BOOST_GEOMETRY_DEBUG_IDENTIFIER
+# include <boost/geometry/io/svg/svg_mapper.hpp>
+# include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
+#endif
+
+
+template <typename Output, typename G1, typename G2>
+void difference_output(std::string const& caseid, G1 const& g1, G2 const& g2, Output const& output)
+{
+#if defined(TEST_WITH_SVG)
+ {
+ typedef typename bg::coordinate_type<G1>::type coordinate_type;
+ typedef typename bg::point_type<G1>::type point_type;
+
+ std::ostringstream filename;
+ filename << "difference_"
+ << caseid << "_"
+ << string_from_type<coordinate_type>::name()
+ << ".svg";
+
+ std::ofstream svg(filename.str().c_str());
+
+ bg::svg_mapper<point_type> mapper(svg, 500, 500);
+
+ mapper.add(g1);
+ mapper.add(g2);
+
+ mapper.map(g1, "fill-opacity:0.3;fill:rgb(51,51,153);stroke:rgb(51,51,153);stroke-width:3");
+ mapper.map(g2, "fill-opacity:0.5;fill:rgb(153,204,0);stroke:rgb(153,204,0);stroke-width:3");
+
+
+ for (typename Output::const_iterator it = output.begin(); it != output.end(); ++it)
+ {
+ mapper.map(*it,
+ //sym ? "fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,255,0);stroke:rgb(255,0,255);stroke-width:8" :
+ "fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,0,0);stroke:rgb(255,0,255);stroke-width:8");
+ }
+ }
+#endif
+}
+
+template <typename OutputType, typename G1, typename G2>
+void test_difference(std::string const& caseid, G1 const& g1, G2 const& g2,
+ std::size_t expected_count, int expected_point_count,
+ double expected_area,
+ double percentage = 0.0001,
+ bool sym = false)
+{
+ std::vector<OutputType> clip;
+
+ typedef typename bg::coordinate_type<G1>::type coordinate_type;
+
+ if (sym)
+ {
+ bg::sym_difference(g1, g2, clip);
+ }
+ else
+ {
+ bg::difference(g1, g2, clip);
+ }
+
+ typename bg::default_area_result<G1>::type area = 0;
+ std::size_t n = 0;
+ for (typename std::vector<OutputType>::iterator it = clip.begin();
+ it != clip.end();
+ ++it)
+ {
+ if (expected_point_count >= 0)
+ {
+ n += bg::num_points(*it);
+ }
+
+ area += bg::area(*it);
+ }
+
+ difference_output(caseid, g1, g2, clip);
+
+#ifndef BOOST_GEOMETRY_DEBUG_ASSEMBLE
+ {
+ // Test inserter functionality
+ // Test if inserter returns output-iterator (using Boost.Range copy)
+ std::vector<OutputType> inserted, array_with_one_empty_geometry;
+ array_with_one_empty_geometry.push_back(OutputType());
+ if (sym)
+ {
+ boost::copy(array_with_one_empty_geometry, bg::detail::sym_difference::sym_difference_insert<OutputType>(g1, g2, std::back_inserter(inserted)));
+ }
+ else
+ {
+ boost::copy(array_with_one_empty_geometry, bg::detail::difference::difference_insert<OutputType>(g1, g2, std::back_inserter(inserted)));
+ }
+
+ BOOST_CHECK_EQUAL(boost::size(clip), boost::size(inserted) - 1);
+ }
+#endif
+
+
+
+#if ! defined(BOOST_GEOMETRY_NO_BOOST_TEST)
+ if (expected_point_count >= 0)
+ {
+ BOOST_CHECK_MESSAGE(n == std::size_t(expected_point_count),
+ "difference: " << caseid
+ << " #points expected: " << expected_point_count
+ << " detected: " << n
+ << " type: " << string_from_type<coordinate_type>::name()
+ );
+ }
+
+ if (expected_count > 0)
+ {
+ BOOST_CHECK_MESSAGE(clip.size() == expected_count,
+ "difference: " << caseid
+ << " #outputs expected: " << expected_count
+ << " detected: " << clip.size()
+ << " type: " << string_from_type<coordinate_type>::name()
+ );
+ }
+
+ BOOST_CHECK_CLOSE(area, expected_area, percentage);
+#endif
+
+
+}
+
+
+#ifdef BOOST_GEOMETRY_CHECK_WITH_POSTGIS
+static int counter = 0;
+#endif
+
+
+template <typename OutputType, typename G1, typename G2>
+void test_one(std::string const& caseid,
+ std::string const& wkt1, std::string const& wkt2,
+ std::size_t expected_count1,
+ int expected_point_count1,
+ double expected_area1,
+
+ std::size_t expected_count2,
+ int expected_point_count2,
+ double expected_area2,
+
+ double percentage = 0.0001)
+{
+#ifdef BOOST_GEOMETRY_CHECK_WITH_SQLSERVER
+ std::cout
+ << "-- " << caseid << std::endl
+ << "with qu as (" << std::endl
+ << "select geometry::STGeomFromText('" << wkt1 << "',0) as p," << std::endl
+ << "geometry::STGeomFromText('" << wkt2 << "',0) as q)" << std::endl
+ << "select " << std::endl
+ << " p.STDifference(q).STNumGeometries() as cnt1,p.STDifference(q).STNumPoints() as pcnt1,p.STDifference(q).STArea() as area1," << std::endl
+ << " q.STDifference(p).STNumGeometries() as cnt2,q.STDifference(p).STNumPoints() as pcnt2,q.STDifference(p).STArea() as area2," << std::endl
+ << " p.STDifference(q) as d1,q.STDifference(p) as d2 from qu" << std::endl << std::endl;
+#endif
+
+
+ G1 g1;
+ bg::read_wkt(wkt1, g1);
+
+ G2 g2;
+ bg::read_wkt(wkt2, g2);
+
+ bg::correct(g1);
+ bg::correct(g2);
+
+ test_difference<OutputType>(caseid + "_a", g1, g2,
+ expected_count1, expected_point_count1,
+ expected_area1, percentage);
+#ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE
+ return;
+#endif
+ test_difference<OutputType>(caseid + "_b", g2, g1,
+ expected_count2, expected_point_count2,
+ expected_area2, percentage);
+ test_difference<OutputType>(caseid + "_s", g1, g2,
+ expected_count1 + expected_count2,
+ expected_point_count1 + expected_point_count2,
+ expected_area1 + expected_area2,
+ percentage, true);
+
+
+#ifdef BOOST_GEOMETRY_CHECK_WITH_POSTGIS
+ std::cout
+ << (counter > 0 ? "union " : "")
+ << "select " << counter++
+ << ", '" << caseid << "' as caseid"
+ << ", ST_NumPoints(ST_Difference(ST_GeomFromText('" << wkt1 << "'), "
+ << " ST_GeomFromText('" << wkt2 << "'))) "
+ << ", ST_NumGeometries(ST_Difference(ST_GeomFromText('" << wkt1 << "'), "
+ << " ST_GeomFromText('" << wkt2 << "'))) "
+ << ", ST_Area(ST_Difference(ST_GeomFromText('" << wkt1 << "'), "
+ << " ST_GeomFromText('" << wkt2 << "'))) "
+ //<< ", " << expected_area1 << " as expected_area_a"
+ //<< ", " << expected_count1 << " as expected_count_a"
+ << ", ST_NumPoints(ST_Difference(ST_GeomFromText('" << wkt2 << "'), "
+ << " ST_GeomFromText('" << wkt1 << "'))) "
+ << ", ST_NumGeometries(ST_Difference(ST_GeomFromText('" << wkt2 << "'), "
+ << " ST_GeomFromText('" << wkt1 << "'))) "
+ << ", ST_Area(ST_Difference(ST_GeomFromText('" << wkt2 << "'), "
+ << " ST_GeomFromText('" << wkt1 << "'))) "
+ //<< ", " << expected_area2 << " as expected_area_b"
+ //<< ", " << expected_count2 << " as expected_count_b"
+ << ", ST_NumPoints(ST_SymDifference(ST_GeomFromText('" << wkt1 << "'), "
+ << " ST_GeomFromText('" << wkt2 << "'))) "
+ << ", ST_NumGeometries(ST_SymDifference(ST_GeomFromText('" << wkt1 << "'), "
+ << " ST_GeomFromText('" << wkt2 << "'))) "
+ << ", ST_Area(ST_SymDifference(ST_GeomFromText('" << wkt1 << "'), "
+ << " ST_GeomFromText('" << wkt2 << "'))) "
+ //<< ", " << expected_area1 + expected_area2 << " as expected_area_s"
+ //<< ", " << expected_count1 + expected_count2 << " as expected_count_s"
+ << std::endl;
+#endif
+
+}
+
+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,
+ int expected_point_count,
+ double expected_length)
+{
+ G1 g1;
+ bg::read_wkt(wkt1, g1);
+
+ G2 g2;
+ bg::read_wkt(wkt2, g2);
+
+ bg::correct(g1);
+
+ std::vector<OutputType> pieces;
+ bg::difference(g1, g2, pieces);
+
+ typename bg::default_length_result<G1>::type length = 0;
+ std::size_t n = 0;
+ std::size_t piece_count = 0;
+ for (typename std::vector<OutputType>::iterator it = pieces.begin();
+ it != pieces.end();
+ ++it)
+ {
+ if (expected_point_count >= 0)
+ {
+ n += bg::num_points(*it);
+ }
+ piece_count++;
+ length += bg::length(*it);
+ }
+
+ BOOST_CHECK_MESSAGE(piece_count == expected_count,
+ "difference: " << caseid
+ << " #outputs expected: " << expected_count
+ << " detected: " << pieces.size()
+ );
+
+ if (expected_point_count >= 0)
+ {
+ BOOST_CHECK_EQUAL(n, std::size_t(expected_point_count));
+ }
+
+ BOOST_CHECK_CLOSE(length, expected_length, 0.001);
+
+ std::string lp = "lp_";
+ difference_output(lp + caseid, g1, g2, pieces);
+}
+
+
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_distance.hpp b/libs/geometry/test/algorithms/test_distance.hpp
new file mode 100644
index 000000000..271bdab6e
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_distance.hpp
@@ -0,0 +1,158 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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_DISTANCE_HPP
+#define BOOST_GEOMETRY_TEST_DISTANCE_HPP
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/distance.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+
+
+// Define a custom distance strategy
+// For this one, the "taxicab" distance,
+// see http://en.wikipedia.org/wiki/Taxicab_geometry
+
+// For a point-point-distance operation, one typename Point is enough.
+// For a point-segment-distance operation, there is some magic inside
+// using another point type and casting if necessary. Therefore,
+// two point-types are necessary.
+template <typename P1, typename P2 = P1>
+struct taxicab_distance
+{
+ static inline typename bg::coordinate_type<P1>::type apply(
+ P1 const& p1, P2 const& p2)
+ {
+ using bg::get;
+ using bg::math::abs;
+ return abs(get<0>(p1) - get<1>(p2))
+ + abs(get<1>(p1) - get<1>(p2));
+ }
+};
+
+
+
+namespace boost { namespace geometry { namespace strategy { namespace distance { namespace services
+{
+
+template <typename P1, typename P2>
+struct tag<taxicab_distance<P1, P2> >
+{
+ typedef strategy_tag_distance_point_point type;
+};
+
+
+template <typename P1, typename P2>
+struct return_type<taxicab_distance<P1, P2> >
+{
+ typedef typename coordinate_type<P1>::type type;
+};
+
+
+template<typename P1, typename P2, typename PN1, typename PN2>
+struct similar_type<taxicab_distance<P1, P2>, PN1, PN2>
+{
+ typedef taxicab_distance<PN1, PN2> type;
+};
+
+
+template<typename P1, typename P2, typename PN1, typename PN2>
+struct get_similar<taxicab_distance<P1, P2>, PN1, PN2>
+{
+ static inline typename similar_type
+ <
+ taxicab_distance<P1, P2>, PN1, PN2
+ >::type apply(taxicab_distance<P1, P2> const& )
+ {
+ return taxicab_distance<PN1, PN2>();
+ }
+};
+
+template <typename P1, typename P2>
+struct comparable_type<taxicab_distance<P1, P2> >
+{
+ typedef taxicab_distance<P1, P2> type;
+};
+
+template <typename P1, typename P2>
+struct get_comparable<taxicab_distance<P1, P2> >
+{
+ static inline taxicab_distance<P1, P2> apply(taxicab_distance<P1, P2> const& input)
+ {
+ return input;
+ }
+};
+
+template <typename P1, typename P2>
+struct result_from_distance<taxicab_distance<P1, P2> >
+{
+ template <typename T>
+ static inline typename coordinate_type<P1>::type apply(taxicab_distance<P1, P2> const& , T const& value)
+ {
+ return value;
+ }
+};
+
+
+}}}}} // namespace bg::strategy::distance::services
+
+
+
+
+
+template <typename Geometry1, typename Geometry2>
+void test_distance(Geometry1 const& geometry1,
+ Geometry2 const& geometry2,
+ long double expected_distance)
+{
+ typename bg::default_distance_result<Geometry1>::type distance = bg::distance(geometry1, geometry2);
+
+#ifdef GEOMETRY_TEST_DEBUG
+ std::ostringstream out;
+ out << typeid(typename bg::coordinate_type<Geometry1>::type).name()
+ << std::endl
+ << typeid(typename bg::default_distance_result<Geometry1>::type).name()
+ << std::endl
+ << "distance : " << bg::distance(geometry1, geometry2)
+ << std::endl;
+ std::cout << out.str();
+#endif
+
+ BOOST_CHECK_CLOSE(distance, expected_distance, 0.0001);
+}
+
+
+template <typename Geometry1, typename Geometry2>
+void test_geometry(std::string const& wkt1, std::string const& wkt2, double expected_distance)
+{
+ Geometry1 geometry1;
+ bg::read_wkt(wkt1, geometry1);
+ Geometry2 geometry2;
+ bg::read_wkt(wkt2, geometry2);
+
+ test_distance(geometry1, geometry2, expected_distance);
+}
+
+template <typename Geometry1, typename Geometry2>
+void test_empty_input(Geometry1 const& geometry1, Geometry2 const& geometry2)
+{
+ try
+ {
+ bg::distance(geometry1, geometry2);
+ }
+ catch(bg::empty_input_exception const& )
+ {
+ return;
+ }
+ BOOST_CHECK_MESSAGE(false, "A empty_input_exception should have been thrown" );
+}
+
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_envelope.hpp b/libs/geometry/test/algorithms/test_envelope.hpp
new file mode 100644
index 000000000..3010ef901
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_envelope.hpp
@@ -0,0 +1,107 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_ENVELOPE_HPP
+#define BOOST_GEOMETRY_TEST_ENVELOPE_HPP
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/envelope.hpp>
+#include <boost/geometry/geometries/box.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+
+
+template<typename Box, std::size_t DimensionCount>
+struct check_result
+{};
+
+template <typename Box>
+struct check_result<Box, 2>
+{
+ typedef typename bg::coordinate_type<Box>::type ctype;
+ typedef typename boost::mpl::if_
+ <
+ boost::is_arithmetic<ctype>,
+ double,
+ ctype
+ >::type type;
+
+ static void apply(Box const& b, const type& x1, const type& y1, const type& z1,
+ const type& x2, const type& y2, const type& z2)
+ {
+ BOOST_CHECK_CLOSE((bg::get<bg::min_corner, 0>(b)), x1, 0.001);
+ BOOST_CHECK_CLOSE((bg::get<bg::min_corner, 1>(b)), y1, 0.001);
+
+ BOOST_CHECK_CLOSE((bg::get<bg::max_corner, 0>(b)), x2, 0.001);
+ BOOST_CHECK_CLOSE((bg::get<bg::max_corner, 1>(b)), y2, 0.001);
+ }
+};
+
+template <typename Box>
+struct check_result<Box, 3>
+{
+ typedef typename bg::coordinate_type<Box>::type ctype;
+ typedef typename boost::mpl::if_
+ <
+ boost::is_arithmetic<ctype>,
+ double,
+ ctype
+ >::type type;
+
+ static void apply(Box const& b, const type& x1, const type& y1, const type& z1,
+ const type& x2, const type& y2, const type& z2)
+ {
+ BOOST_CHECK_CLOSE((bg::get<bg::min_corner, 0>(b)), x1, 0.001);
+ BOOST_CHECK_CLOSE((bg::get<bg::min_corner, 1>(b)), y1, 0.001);
+ BOOST_CHECK_CLOSE((bg::get<bg::min_corner, 2>(b)), z1, 0.001);
+
+ BOOST_CHECK_CLOSE((bg::get<bg::max_corner, 0>(b)), x2, 0.001);
+ BOOST_CHECK_CLOSE((bg::get<bg::max_corner, 1>(b)), y2, 0.001);
+ BOOST_CHECK_CLOSE((bg::get<bg::max_corner, 2>(b)), z2, 0.001);
+ }
+};
+
+
+template <typename Geometry, typename T>
+void test_envelope(std::string const& wkt,
+ const T& x1, const T& x2,
+ const T& y1, const T& y2,
+ const T& z1 = 0, const T& z2 = 0)
+{
+ typedef bg::model::box<typename bg::point_type<Geometry>::type > box_type;
+
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ box_type b;
+ bg::envelope(geometry, b);
+
+ check_result<box_type, bg::dimension<Geometry>::type::value>::apply(b, x1, y1, z1, x2, y2, z2);
+}
+
+template <typename Geometry, typename T>
+void test_envelope_strategy(std::string const& wkt,
+ const T& x1, const T& x2,
+ const T& y1, const T& y2,
+ const T& z1 = 0, const T& z2 = 0)
+{
+ typedef bg::model::box<typename bg::point_type<Geometry>::type > box_type;
+
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ box_type b;
+ bg::envelope(geometry, b);
+
+ check_result<box_type, bg::dimension<Geometry>::type::value>::apply(b, x1, y1, z1, x2, y2, z2);
+}
+
+
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_equals.hpp b/libs/geometry/test/algorithms/test_equals.hpp
new file mode 100644
index 000000000..f641a96af
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_equals.hpp
@@ -0,0 +1,58 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_EQUALS_HPP
+#define BOOST_GEOMETRY_TEST_EQUALS_HPP
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/core/ring_type.hpp>
+#include <boost/geometry/algorithms/equals.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/variant/variant.hpp>
+
+
+template <typename Geometry1, typename Geometry2>
+void check_geometry(Geometry1 const& geometry1,
+ Geometry2 const& geometry2,
+ std::string const& caseid,
+ std::string const& wkt1,
+ std::string const& wkt2,
+ bool expected)
+{
+ bool detected = bg::equals(geometry1, geometry2);
+
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "case: " << caseid
+ << " equals: " << wkt1
+ << " to " << wkt2
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+}
+
+
+template <typename Geometry1, typename Geometry2>
+void test_geometry(std::string const& caseid,
+ std::string const& wkt1,
+ std::string const& wkt2, bool expected)
+{
+ Geometry1 geometry1;
+ Geometry2 geometry2;
+
+ bg::read_wkt(wkt1, geometry1);
+ bg::read_wkt(wkt2, geometry2);
+
+ check_geometry(geometry1, geometry2, caseid, wkt1, wkt2, expected);
+ check_geometry(boost::variant<Geometry1>(geometry1), geometry2, caseid, wkt1, wkt2, expected);
+ check_geometry(geometry1, boost::variant<Geometry2>(geometry2), caseid, wkt1, wkt2, expected);
+ check_geometry(boost::variant<Geometry1>(geometry1), boost::variant<Geometry2>(geometry2), caseid, wkt1, wkt2, expected);
+}
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_expand.hpp b/libs/geometry/test/algorithms/test_expand.hpp
new file mode 100644
index 000000000..ebf22e374
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_expand.hpp
@@ -0,0 +1,56 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_EXPAND_HPP
+#define BOOST_GEOMETRY_TEST_EXPAND_HPP
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/expand.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/algorithms/assign.hpp>
+#include <boost/geometry/io/dsv/write.hpp>
+
+
+template <typename Geometry, typename Box>
+void test_expand(Box& box,
+ std::string const& wkt,
+ std::string const& expected)
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+
+ bg::expand(box, geometry);
+
+ std::ostringstream out;
+ out << bg::dsv(box, ",", "(", ")", ",", "", "");
+
+ BOOST_CHECK_EQUAL(out.str(), expected);
+}
+
+template <typename Geometry, typename Box>
+void test_expand_other_strategy(Box& box,
+ std::string const& wkt,
+ std::string const& expected)
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+
+
+ bg::expand(box, geometry);
+
+ std::ostringstream out;
+ out << bg::dsv(box, ",", "(", ")", ",", "", "");
+
+ BOOST_CHECK_EQUAL(out.str(), expected);
+}
+
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_for_each.hpp b/libs/geometry/test/algorithms/test_for_each.hpp
new file mode 100644
index 000000000..b93b72de3
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_for_each.hpp
@@ -0,0 +1,277 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_FOR_EACH_HPP
+#define BOOST_GEOMETRY_TEST_FOR_EACH_HPP
+
+#include <geometry_test_common.hpp>
+
+#include <boost/config.hpp>
+#include <boost/geometry/algorithms/for_each.hpp>
+
+#include <boost/geometry/algorithms/distance.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+#include <boost/geometry/io/wkt/wkt.hpp>
+#include <boost/geometry/io/dsv/write.hpp>
+
+
+template<typename Point>
+inline void translate_x_function(Point& p)
+{
+ bg::set<0>(p, bg::get<0>(p) + 100.0);
+}
+
+template<typename Point>
+struct scale_y_functor
+{
+ inline void operator()(Point& p)
+ {
+ bg::set<1>(p, bg::get<1>(p) * 100.0);
+ }
+};
+
+template<typename Point>
+struct sum_x_functor
+{
+ typename bg::coordinate_type<Point>::type sum;
+
+ sum_x_functor()
+ : sum(0)
+ {}
+
+ inline void operator()(Point const& p)
+ {
+ sum += bg::get<0>(p);
+ }
+};
+
+// Per segment
+static std::ostringstream g_out;
+
+template<typename Segment>
+inline void stream_segment(Segment const& s)
+{
+ g_out << bg::dsv(s) << " ";
+}
+
+template<typename Segment>
+struct sum_segment_length
+{
+ typename bg::coordinate_type<Segment>::type sum;
+
+ sum_segment_length()
+ : sum(0)
+ {}
+ inline void operator()(Segment const& s)
+ {
+ sum += bg::distance(s.first, s.second);
+ }
+};
+
+template<typename Segment>
+inline void modify_segment(Segment& s)
+{
+ if (bg::math::equals(bg::get<0,0>(s), 1.0))
+ {
+ bg::set<0,0>(s, 10.0);
+ }
+}
+
+
+template <typename Geometry>
+void test_per_point_const(Geometry const& geometry, int expected)
+{
+ typedef typename bg::point_type<Geometry>::type point_type;
+
+ // Class (functor)
+ sum_x_functor<point_type> functor;
+ functor = bg::for_each_point(geometry, functor);
+ BOOST_CHECK_EQUAL(functor.sum, expected);
+
+
+ // Lambda
+#if !defined(BOOST_NO_CXX11_LAMBDAS)
+
+ typename bg::coordinate_type<point_type>::type sum_x = 0;
+
+ bg::for_each_point
+ (
+ geometry,
+ [&sum_x](point_type const& p)
+ {
+ sum_x += bg::get<0>(p);
+ }
+
+ );
+
+ BOOST_CHECK_EQUAL(sum_x, expected);
+#endif
+}
+
+template <typename Geometry>
+void test_per_point_non_const(Geometry& geometry,
+ std::string const& expected1,
+ std::string const& expected2)
+{
+#if !defined(BOOST_NO_CXX11_LAMBDAS)
+ Geometry copy = geometry;
+#endif
+
+ typedef typename bg::point_type<Geometry>::type point_type;
+
+ // function
+ bg::for_each_point(geometry, translate_x_function<point_type>);
+ std::ostringstream out1;
+ out1 << bg::wkt(geometry);
+
+ BOOST_CHECK_MESSAGE(out1.str() == expected1,
+ "for_each_point: "
+ << " expected " << expected1
+ << " got " << bg::wkt(geometry));
+
+ // functor
+ bg::for_each_point(geometry, scale_y_functor<point_type>());
+
+ std::ostringstream out2;
+ out2 << bg::wkt(geometry);
+
+ BOOST_CHECK_MESSAGE(out2.str() == expected2,
+ "for_each_point: "
+ << " expected " << expected2
+ << " got " << bg::wkt(geometry));
+
+#if !defined(BOOST_NO_CXX11_LAMBDAS)
+ // Lambda, both functions above together. Without / with capturing
+
+ geometry = copy;
+ bg::for_each_point
+ (
+ geometry,
+ [](point_type& p)
+ {
+ bg::set<0>(p, bg::get<0>(p) + 100);
+ }
+
+ );
+
+ typename bg::coordinate_type<point_type>::type scale = 100;
+ bg::for_each_point
+ (
+ geometry,
+ [&](point_type& p)
+ {
+ bg::set<1>(p, bg::get<1>(p) * scale);
+ }
+
+ );
+
+ std::ostringstream out3;
+ out3 << bg::wkt(geometry);
+
+ BOOST_CHECK_MESSAGE(out3.str() == expected2,
+ "for_each_point (lambda): "
+ << " expected " << expected2
+ << " got " << bg::wkt(geometry));
+#endif
+
+}
+
+
+template <typename Geometry>
+void test_per_point(std::string const& wkt
+ , int expected_sum_x
+ , std::string const& expected1
+ , std::string const& expected2
+ )
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ test_per_point_const(geometry, expected_sum_x);
+ test_per_point_non_const(geometry, expected1, expected2);
+}
+
+
+
+template <typename Geometry>
+void test_per_segment_const(Geometry const& geometry,
+ std::string const& expected_dsv,
+ double expected_length)
+{
+ typedef typename bg::point_type<Geometry>::type point_type;
+
+ // function
+ g_out.str("");
+ g_out.clear();
+ bg::for_each_segment(geometry,
+ stream_segment<bg::model::referring_segment<point_type const> >);
+ std::string out = g_out.str();
+ boost::trim(out);
+ BOOST_CHECK_EQUAL(out, expected_dsv);
+
+ // functor
+ sum_segment_length<bg::model::referring_segment<point_type const> > functor;
+ functor = bg::for_each_segment(geometry, functor);
+
+ BOOST_CHECK_CLOSE(functor.sum, expected_length, 0.0001);
+}
+
+
+template <typename Geometry>
+void test_per_segment_non_const(Geometry& geometry,
+ std::string const& expected_wkt)
+{
+ typedef typename bg::point_type<Geometry>::type point_type;
+
+ // function
+ bg::for_each_segment(geometry,
+ modify_segment<bg::model::referring_segment<point_type> >);
+
+ std::ostringstream out;
+ out << bg::wkt(geometry);
+
+ BOOST_CHECK_MESSAGE(out.str() == expected_wkt,
+ "for_each_segment: "
+ << " expected " << expected_wkt
+ << " got " << bg::wkt(geometry));
+
+ // function is working here, functor works for all others,
+ // it will also work here.
+}
+
+
+template <typename Geometry>
+void test_per_segment(std::string const& wkt
+ , std::string const& expected_dsv
+ , double expected_length
+ , std::string const& expected_wkt
+ )
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ test_per_segment_const(geometry, expected_dsv, expected_length);
+ test_per_segment_non_const(geometry, expected_wkt);
+}
+
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt
+ , int expected_sum_x
+ , std::string const& expected1
+ , std::string const& expected2
+ , std::string const& expected_dsv
+ , double expected_length
+ , std::string const& expected_wkt
+ )
+{
+ test_per_point<Geometry>(wkt, expected_sum_x, expected1, expected2);
+ test_per_segment<Geometry>(wkt, expected_dsv, expected_length, expected_wkt);
+}
+
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_intersection.hpp b/libs/geometry/test/algorithms/test_intersection.hpp
new file mode 100644
index 000000000..4594cb19e
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_intersection.hpp
@@ -0,0 +1,241 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_INTERSECTION_HPP
+#define BOOST_GEOMETRY_TEST_INTERSECTION_HPP
+
+#include <fstream>
+#include <iomanip>
+
+#include <boost/foreach.hpp>
+
+#include <boost/geometry/algorithms/intersection.hpp>
+#include <boost/geometry/algorithms/area.hpp>
+#include <boost/geometry/algorithms/correct.hpp>
+#include <boost/geometry/algorithms/length.hpp>
+#include <boost/geometry/algorithms/num_points.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+
+
+#if defined(TEST_WITH_SVG)
+# include <boost/geometry/io/svg/svg_mapper.hpp>
+#endif
+
+#include <geometry_test_common.hpp>
+
+
+template <typename OutputType, typename CalculationType, typename G1, typename G2>
+typename bg::default_area_result<G1>::type test_intersection(std::string const& caseid,
+ G1 const& g1, G2 const& g2,
+ std::size_t expected_count = 0, std::size_t expected_point_count = 0,
+ double expected_length_or_area = 0,
+ double percentage = 0.0001,
+ bool debug = false)
+{
+ static const bool is_line = bg::geometry_id<OutputType>::type::value == 2;
+
+ if (debug)
+ {
+ std::cout << std::endl << "case " << caseid << std::endl;
+ }
+
+
+ typedef typename bg::coordinate_type<G1>::type coordinate_type;
+ typedef typename bg::point_type<G1>::type point_type;
+
+ typedef bg::strategy_intersection
+ <
+ typename bg::cs_tag<point_type>::type,
+ G1,
+ G2,
+ point_type,
+ CalculationType
+ > strategy;
+
+ // Check both normal behaviour, and _inserter behaviour
+ if (! debug)
+ {
+ std::vector<OutputType> out;
+ bg::intersection(g1, g2, out);
+ }
+ std::vector<OutputType> clip;
+ bg::detail::intersection::intersection_insert<OutputType>(g1, g2, std::back_inserter(clip), strategy());
+
+
+ typename bg::default_area_result<G1>::type length_or_area = 0;
+ std::size_t n = 0;
+ for (typename std::vector<OutputType>::iterator it = clip.begin();
+ it != clip.end();
+ ++it)
+ {
+ if (expected_point_count > 0)
+ {
+ n += bg::num_points(*it, true);
+ }
+
+ // instead of specialization we check it run-time here
+ length_or_area += is_line
+ ? bg::length(*it)
+ : bg::area(*it);
+
+ if (debug)
+ {
+ std::cout << std::setprecision(20) << bg::wkt(*it) << std::endl;
+ }
+ }
+
+
+#if ! defined(BOOST_GEOMETRY_NO_BOOST_TEST)
+ if (expected_point_count > 0)
+ {
+ BOOST_CHECK_MESSAGE(n == expected_point_count,
+ "intersection: " << caseid
+ << " #points expected: " << expected_point_count
+ << " detected: " << n
+ << " type: " << string_from_type<coordinate_type>::name()
+ );
+ }
+
+ if (expected_count > 0)
+ {
+ BOOST_CHECK_MESSAGE(clip.size() == expected_count,
+ "intersection: " << caseid
+ << " #outputs expected: " << expected_count
+ << " detected: " << clip.size()
+ << " type: " << string_from_type<coordinate_type>::name()
+ );
+ }
+
+ 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);
+#endif
+
+
+#if defined(TEST_WITH_SVG)
+ {
+ bool const ccw =
+ bg::point_order<G1>::value == bg::counterclockwise
+ || bg::point_order<G2>::value == bg::counterclockwise;
+ bool const open =
+ bg::closure<G1>::value == bg::open
+ || bg::closure<G2>::value == bg::open;
+
+ std::ostringstream filename;
+ filename << "intersection_"
+ << caseid << "_"
+ << string_from_type<coordinate_type>::name()
+ << string_from_type<CalculationType>::name()
+ << (ccw ? "_ccw" : "")
+ << (open ? "_open" : "")
+ << ".svg";
+
+ std::ofstream svg(filename.str().c_str());
+
+ bg::svg_mapper<point_type> mapper(svg, 500, 500);
+
+ mapper.add(g1);
+ mapper.add(g2);
+
+ mapper.map(g1, is_line
+ ? "opacity:0.6;stroke:rgb(0,255,0);stroke-width:5"
+ : "fill-opacity:0.5;fill:rgb(153,204,0);"
+ "stroke:rgb(153,204,0);stroke-width:3");
+ mapper.map(g2, "fill-opacity:0.3;fill:rgb(51,51,153);"
+ "stroke:rgb(51,51,153);stroke-width:3");
+
+ for (typename std::vector<OutputType>::const_iterator it = clip.begin();
+ it != clip.end(); ++it)
+ {
+ mapper.map(*it, "fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,0,0);"
+ "stroke:rgb(255,0,255);stroke-width:8");
+ }
+ }
+#endif
+
+ if (debug)
+ {
+ std::cout << "end case " << caseid << std::endl;
+ }
+
+ return length_or_area;
+}
+
+template <typename OutputType, typename G1, typename G2>
+typename bg::default_area_result<G1>::type test_one(std::string const& caseid,
+ std::string const& wkt1, std::string const& wkt2,
+ std::size_t expected_count = 0, std::size_t expected_point_count = 0,
+ double expected_length_or_area = 0,
+ double percentage = 0.0001,
+ bool debug = false)
+{
+ G1 g1;
+ bg::read_wkt(wkt1, g1);
+
+ G2 g2;
+ bg::read_wkt(wkt2, g2);
+
+ // Reverse if necessary
+ bg::correct(g1);
+ bg::correct(g2);
+
+ return test_intersection<OutputType, void>(caseid, g1, g2,
+ expected_count, expected_point_count,
+ expected_length_or_area, percentage,
+ debug);
+}
+
+template <typename OutputType, typename Areal, typename Linear>
+void test_one_lp(std::string const& caseid,
+ std::string const& wkt_areal, std::string const& wkt_linear,
+ std::size_t expected_count = 0, std::size_t expected_point_count = 0,
+ double expected_length = 0,
+ double percentage = 0.0001,
+ bool debug1 = false, bool debug2 = false)
+{
+ Areal areal;
+ bg::read_wkt(wkt_areal, areal);
+ bg::correct(areal);
+
+ Linear linear;
+ bg::read_wkt(wkt_linear, linear);
+
+ test_intersection<OutputType, void>(caseid, areal, linear,
+ expected_count, expected_point_count,
+ expected_length, percentage, debug1);
+
+ // A linestring reversed should deliver exactly the same.
+ bg::reverse(linear);
+
+ test_intersection<OutputType, void>(caseid + "_rev", areal, linear,
+ expected_count, expected_point_count,
+ expected_length, percentage, debug2);
+}
+
+template <typename Geometry1, typename Geometry2>
+void test_point_output(std::string const& wkt1, std::string const& wkt2, unsigned int expected_count)
+{
+ Geometry1 g1;
+ bg::read_wkt(wkt1, g1);
+ bg::correct(g1);
+
+ Geometry2 g2;
+ bg::read_wkt(wkt2, g2);
+ bg::correct(g2);
+
+ std::vector<typename bg::point_type<Geometry1>::type> points;
+ bg::intersection(g1, g2, points);
+ BOOST_CHECK_EQUAL(points.size(), expected_count);
+}
+
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_intersects.hpp b/libs/geometry/test/algorithms/test_intersects.hpp
new file mode 100644
index 000000000..dac1b1eae
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_intersects.hpp
@@ -0,0 +1,67 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_INTERSECTS_HPP
+#define BOOST_GEOMETRY_TEST_INTERSECTS_HPP
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/core/ring_type.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/io/wkt/read.hpp>
+
+
+template <typename Geometry1, typename Geometry2>
+void test_geometry(std::string const& wkt1,
+ std::string const& wkt2, bool expected)
+{
+ Geometry1 geometry1;
+ Geometry2 geometry2;
+
+ bg::read_wkt(wkt1, geometry1);
+ bg::read_wkt(wkt2, geometry2);
+
+ bool detected = bg::intersects(geometry1, geometry2);
+ bool detected2 = bg::intersects(geometry2, geometry1);
+
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "intersects: " << wkt1
+ << " with " << wkt2
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+ BOOST_CHECK_MESSAGE(detected2 == expected,
+ "intersects: " << wkt1
+ << " with " << wkt2
+ << " -> Expected: " << expected
+ << " detected: " << detected2);
+}
+
+
+template <typename Geometry>
+void test_self_intersects(std::string const& wkt, bool expected)
+{
+ Geometry geometry;
+
+ bg::read_wkt(wkt, geometry);
+
+ bool detected = bg::intersects(geometry);
+
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "intersects: " << wkt
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+}
+
+
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_length.hpp b/libs/geometry/test/algorithms/test_length.hpp
new file mode 100644
index 000000000..d91ba4989
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_length.hpp
@@ -0,0 +1,64 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_LENGTH_HPP
+#define BOOST_GEOMETRY_TEST_LENGTH_HPP
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/length.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/variant/variant.hpp>
+
+
+template <typename Geometry>
+void test_length(Geometry const& geometry, long double expected_length)
+{
+ BOOST_AUTO(length, bg::length(geometry));
+
+#ifdef GEOMETRY_TEST_DEBUG
+ std::ostringstream out;
+ out << typeid(typename bg::coordinate_type<Geometry>::type).name()
+ << std::endl
+ << typeid(typename bg::default_length_result<Geometry>::type).name()
+ << std::endl
+ << "length : " << bg::length(geometry)
+ << std::endl;
+ std::cout << out.str();
+#endif
+
+ BOOST_CHECK_CLOSE(length, expected_length, 0.0001);
+}
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt, double expected_length)
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ test_length(geometry, expected_length);
+ test_length(boost::variant<Geometry>(geometry), expected_length);
+}
+
+template <typename Geometry>
+void test_empty_input(Geometry const& geometry)
+{
+ try
+ {
+ bg::length(geometry);
+ }
+ catch(bg::empty_input_exception const& )
+ {
+ return;
+ }
+ BOOST_CHECK_MESSAGE(false, "A empty_input_exception should have been thrown" );
+}
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_overlaps.hpp b/libs/geometry/test/algorithms/test_overlaps.hpp
new file mode 100644
index 000000000..b4e76a340
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_overlaps.hpp
@@ -0,0 +1,44 @@
+// Generic Geometry2 Library
+// Unit Test
+
+// Copyright (c) 2007-2012 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_OVERLAPS_HPP
+#define BOOST_GEOMETRY_TEST_OVERLAPS_HPP
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/core/ring_type.hpp>
+#include <boost/geometry/algorithms/overlaps.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+#include <boost/geometry/geometries/ring.hpp>
+#include <boost/geometry/geometries/polygon.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+
+
+template <typename Geometry1, typename Geometry2>
+void test_geometry(std::string const& wkt1,
+ std::string const& wkt2, bool expected)
+{
+ Geometry1 geometry1;
+ Geometry2 geometry2;
+
+ bg::read_wkt(wkt1, geometry1);
+ bg::read_wkt(wkt2, geometry2);
+
+ bool detected = bg::overlaps(geometry1, geometry2);
+
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "overlaps: " << wkt1
+ << " with " << wkt2
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+}
+
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_overlay.hpp b/libs/geometry/test/algorithms/test_overlay.hpp
new file mode 100644
index 000000000..8b7bd0172
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_overlay.hpp
@@ -0,0 +1,161 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_OVERLAY_HPP
+#define BOOST_GEOMETRY_TEST_OVERLAY_HPP
+
+#include <string>
+
+// 1. (Example) testcases
+static std::string example_box = "box(1.5 1.5, 4.5 2.5)";
+
+static std::string example_polygon =
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3)"
+ "(4.0 2.0, 4.2 1.4, 4.8 1.9, 4.4 2.2, 4.0 2.0))";
+
+static std::string example_ring =
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3))";
+
+static std::string example_star =
+ "POLYGON((4.0 -0.5 , 3.5 1.0 , 2.0 1.5 , 3.5 2.0 , 4.0 3.5 , 4.5 2.0 , 6.0 1.5 , 4.5 1.0 , 4.0 -0.5))";
+
+static std::string polygon_empty = "POLYGON EMPTY";
+
+// 2. Alphabetically ordered testcase pairs
+
+static std::string crossed[2] =
+ {"POLYGON((0 0,0 5,5 5,5 0,0 0),(4 1,3 4,1 2,4 1))",
+ "POLYGON((2 1,1 4,4 3,2 1))"};
+
+static std::string disjoint[2] =
+ {"POLYGON((3 0,3 1,4 1,4 0,3 0))",
+ "POLYGON((3 4,3 5,4 5,4 4,3 4))"};
+
+static std::string distance_zero[2] =
+ {"POLYGON((1 1,1 4,4 4,4 1,1 1))",
+ "POLYGON((1.9 0.9,2.0 4.000001,2.1 1.0,1.9 0.9))"};
+
+// e-45 gives 'convenient' IEEE-single-FP-error,
+static std::string epsilon[2] =
+ {"POLYGON((0.0 0.0"
+ ",3.0e-45 4.0e-45"
+ ",4.0e-45 1.0e-45"
+ ",0.0 0.0))",
+ "POLYGON((2.0e-45 2.0e-45"
+ ",6.0e-45 4.0e-45"
+ ",4.0e-45 -1.0e-45"
+ ",2.0e-45 2.0e-45))"};
+
+static std::string epsilon_multi_ip[2] =
+ {
+ "POLYGON("
+ "(0.0e-44 2.0e-44,0.5e-44 2.5e-44,1.2e-44 2.0e-44,1.7e-44 2.5e-44,2.5e-44 2.0e-44,2.0e-44 1.5e-44"
+ ",2.5e-44 1.0e-44,2.0e-44 0.5e-44,1.7e-44 0.0e-44,1.5e-44 0.5e-44,1.2e-44 0.0e-44,1.0e-44 0.5e-44"
+ ",0.7e-44 0.0e-44,0.5e-44 1.7e-44,0.12e-44 1.5e-44,0.5e-44 1.2e-44,0.0e-44 1.0e-44,0.0e-44 2.0e-44))",
+ "POLYGON("
+ "(0.2e-44 0.2e-44,0.2e-44 2.2e-44,2.2e-44 2.2e-44,2.2e-44 0.2e-44,0.2e-44 0.2e-44))"
+ };
+
+static std::string equal_holes_disjoint[2] =
+ {"POLYGON((0 0,0 9,9 9,9 0,0 0),(1 1,4 1,4 8,1 8,1 1),(5 1,8 1,8 4,5 4,5 1))",
+ "POLYGON((0 0,0 9,9 9,9 0,0 0),(1 1,4 1,4 8,1 8,1 1),(5 5,8 5,8 8,5 8,5 5))"};
+
+static std::string first_within_second[2] =
+ {"POLYGON((2 2,2 3,3 3,3 2,2 2))",
+ "POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))"};
+
+static std::string first_within_hole_of_second[2] =
+ {"POLYGON((2 2,2 3,3 3,3 2,2 2))",
+ "POLYGON((0 0, 0 5, 5 5, 5 0, 0 0),(1 1,4 1,4 4,1 4,1 1))"};
+
+// == case 52
+static std::string fitting[2] =
+ {"POLYGON((0 0,0 5,5 5,5 0,0 0),(4 1,3 4,1 2,4 1))",
+ "POLYGON((1 2,3 4,4 1,1 2))"};
+
+static std::string identical[2] =
+ {"POLYGON((0 0,0 1,1 1,1 0,0 0))",
+ "POLYGON((1 1,1 0,0 0,0 1,1 1))"};
+
+// case 2102 from "algorithms/detail/overlay/robustness/assemble.hpp"
+static std::string intersect_exterior_and_interiors_winded[2] =
+ {"POLYGON((2 0.5,0.5 2,0.5 8,2 9.5,6 9.5,8.5 8,8.5 2,7 0.5,2 0.5),(2 2,7 2,7 8,2 8,2 2))",
+ "POLYGON((1 1,1 9,8 9,8 1,1 1),(4 4,5 4,5 5,4 5,4 4))"};
+
+static std::string intersect_holes_disjoint[2] =
+ {"POLYGON((0 0,0 7,5 7,5 0,0 0),(2 2,3 2,3 3,2 3,2 2))",
+ "POLYGON((1 1,1 6,6 6,6 1,1 1),(2 4,3 4,3 5,2 5,2 4))"};
+
+static std::string intersect_holes_intersect[2] =
+ {"POLYGON((0 0,0 7,5 7,5 0,0 0),(2 2,3 2,3 3,2 3,2 2))",
+ "POLYGON((1 1,1 6,6 6,6 1,1 1),(2.5 2.5,3.5 2.5,3.5 3.5,2.5 3.5,2.5 2.5))"};
+
+static std::string intersect_holes_intersect_and_disjoint[2] =
+ {"POLYGON((0 0,0 7,5 7,5 0,0 0),(2 2,3 2,3 3,2 3,2 2),(2 4,3 4,3 5,2 5,2 4))",
+ "POLYGON((1 1,1 6,6 6,6 1,1 1),(2.5 2.5,3.5 2.5,3.5 3.5,2.5 3.5,2.5 2.5))"};
+
+static std::string intersect_holes_intersect_and_touch[2] =
+ {"POLYGON((0 0,0 7,5 7,5 0,0 0),(2 2,3 2,3 3,2 3,2 2),(2.5 4,3 4.5,2.5 5,2 4.5,2.5 4))",
+ "POLYGON((1 1,1 6,6 6,6 1,1 1),(2.5 2.5,3.5 2.5,3.5 3.5,2.5 3.5,2.5 2.5),(3.5 4,4 4.5,3.5 5,3 4.5,3.5 4))"};
+
+static std::string intersect_holes_new_ring[2] =
+ {"POLYGON((4 4,4 16,16 16,16 4,4 4),(7 6,14 10,7 14,11 10,7 6))",
+ "POLYGON((2 2,2 18,18 18,18 2,2 2),(13 6,9 10,13 14,6 10,13 6))"};
+
+static std::string isovist1[2] =
+ {
+ "POLYGON((37.29449462890625 1.7902572154998779, 46.296027072709599 -2.4984308554828116, 45.389434814453125 -4.5143837928771973, 47.585065917176543 -6.1314922196594779, 46.523914387974358 -8.5152102535033496, 42.699958801269531 -4.4278755187988281, 42.577877044677734 -4.4900407791137695, 42.577911376953125 -4.4901103973388672, 40.758884429931641 -5.418975830078125, 40.6978759765625 -5.4500408172607422, 41.590042114257813 -7.2021245956420898, 57.297810222148939 -37.546793343968417, 50.974888957147442 -30.277285722290763, 37.140213012695313 1.3446992635726929, 37.000419616699219 1.664225697517395, 37.29449462890625 1.7902572154998779))",
+ "POLYGON((43.644271850585938 0.96149998903274536,43.764598846435547 0.93951499462127686,49.071769542946825 0.61489892713413252,48.43512638981781 -0.81299959072453376,47.830955505371094 -0.69758313894271851,47.263670054709685 -1.784876824891044,46.695858001708984 -1.6093428134918213,45.389434814453125 -4.5143837928771973,47.604561877161387 -6.087697464505224,46.559533858616469 -8.435196445683264,42.699958801269531 -4.4278755187988281,42.577877044677734 -4.4900407791137695,42.577911376953125 -4.4901103973388672,40.758884429931641 -5.418975830078125,40.6978759765625 -5.4500408172607422,41.590042114257813 -7.2021245956420898,57.524304765518266 -37.807195733984784,41.988733475572282 -19.945838749437218,41.821544647216797 -19.211688995361328,40.800632476806641 -17.208097457885742,39.966808319091797 -17.625011444091797,38.823680877685547 -16.296066284179688,37.326129913330078 -17.190576553344727,35.963497161865234 -15.476018905639648,35.656356811523438 -15.66030216217041,34.931102752685547 -16.223842620849609,34.634240447128811 -15.85007183479255,34.886280059814453 -14.120697975158691,34.658355712890625 -13.81736946105957,34.328716278076172 -13.992490768432617,33.598796844482422 -14.546377182006836,33.164891643669634 -14.000060288415174,33.566280364990234 -12.450697898864746,33.339523315429688 -12.147735595703125,32.998821258544922 -12.323249816894531,32.274600982666016 -12.879127502441406,31.682494778186321 -12.133624901803865,32.226280212402344 -10.790698051452637,32.000633239746094 -10.488097190856934,31.669155120849609 -10.653837203979492,30.947774887084961 -11.208560943603516,30.207040612748258 -10.275926149505661,30.896280288696289 -9.1206979751586914,30.670633316040039 -8.8180980682373047,30.339155197143555 -8.9838371276855469,29.619997024536133 -9.5368013381958008,29.135100397190627 -8.9262827849488211,32.718830108642578 -4.3281683921813965,32.708168029785156 -2.3611698150634766,32.708126068115234 -2.3611700534820557,32.708126068115234 -2.3611266613006592,30.501169204711914 -2.3718316555023193,27.069889344709196 -4.2926591211028242,26.472516656201325 -3.5380830513658776,36.954700469970703 1.2597870826721191,37.140213012695313 1.3446992635726929,37.000419616699219 1.664225697517395,37.29449462890625 1.7902572154998779,37.43402099609375 1.470055103302002,51.370888500897557 7.4163459734570729,51.20102152843122 7.1738039562841562,42.721500396728516 3.6584999561309814,42.721500396728516 2.2342472076416016,42.399410247802734 1.4956772327423096,43.644271850585938 0.96149998903274536))"
+ };
+
+static std::string new_hole[2] =
+ {"POLYGON((2 2,2 5,5 5,5 2,2 2))",
+ "POLYGON((0 0,0 6,3 6,3 4,1 4,1 3,3 3,3 0,0 0))"};
+
+static std::string only_hole_intersections[3] =
+ {"POLYGON((0 0,0 10,20 10,20 0,0 0),(1 1,7 5,5 7,1 1),(11 1,17 5,15 7,11 1))",
+ "POLYGON((0 0,0 10,20 10,20 0,0 0),(1 1,7 6,6 7,1 1),(11 1,17 6,16 7,11 1))",
+ "POLYGON((0.5 0.5,0.5 9.5,19.5 9.5,19.5 0.5,0.5 0.5),(1 1,7 6,6 7,1 1),(11 1,17 6,16 7,11 1))"};
+
+static std::string side_side[2] =
+ {"POLYGON((0 0,0 1,1 1,1 0,0 0))",
+ "POLYGON((1 0,1 1,2 1,2 0,1 0))"};
+
+static std::string simplex_normal[2] =
+ {"POLYGON((0 1,2 5,5 3,0 1))",
+ "POLYGON((3 0,0 3,4 5,3 0))"};
+
+static std::string simplex_reversed[2] =
+ {"POLYGON((0 1,5 3,2 5,0 1))",
+ "POLYGON((3 0,4 5,0 3,3 0))"};
+
+static std::string star_comb_15[2] =
+ {"POLYGON((25 52.5,27.1694 29.5048,46.5004 42.146,29.8746 26.1126,51.8105 18.8807,28.9092 21.8826,36.9318 0.223356,25 20,13.0682 0.223356,21.0908 21.8826,-1.81052 18.8807,20.1254 26.1126,3.49963 42.146,22.8306 29.5048,25 52.5))",
+ "POLYGON((25 0,0 25,25 50,50 25,49.0741 24.0741,25 48.1481,24.0741 47.2222,48.1481 23.1481,47.2222 22.2222,23.1481 46.2963,22.2222 45.3704,46.2963 21.2963,45.3704 20.3704,21.2963 44.4444,20.3704 43.5185,44.4444 19.4444,43.5185 18.5185,19.4444 42.5926,18.5185 41.6667,42.5926 17.5926,41.6667 16.6667,17.5926 40.7407,16.6667 39.8148,40.7407 15.7407,39.8148 14.8148,15.7407 38.8889,14.8148 37.963,38.8889 13.8889,37.963 12.963,13.8889 37.037,12.963 36.1111,37.037 12.037,36.1111 11.1111,12.037 35.1852,11.1111 34.2593,35.1852 10.1852,34.2593 9.25926,10.1852 33.3333,9.25926 32.4074,33.3333 8.33333,32.4074 7.40741,8.33333 31.4815,7.40741 30.5556,31.4815 6.48148,30.5556 5.55556,6.48148 29.6296,5.55556 28.7037,29.6296 4.62963,28.7037 3.7037,4.62963 27.7778,3.7037 26.8519,27.7778 2.77778,26.8519 1.85185,2.77778 25.9259,1.85185 25,25.9259 0.925926,25 0))"};
+
+static std::string two_bends[2] =
+ {"POLYGON((0 4,4 8,7 7,8 4,5 3,4 0,0 4))",
+ "POLYGON((0 4,4 8,5 5,8 4,7 1,4 0,0 4))"};
+
+// within each other, having no intersections but many holes within each other
+static std::string winded[2] =
+ {"POLYGON((0 0,0 11,11 11,11 0,0 0),(3 3,4 3,4 4,3 4,3 3),(5 3,6 3,6 4,5 4,5 3),(2 6,7 6,7 9,2 9,2 6),(9 2,10 2,10 5,9 5,9 2))",
+ "POLYGON((1 1,1 10,10 10,10 6,8 6,8 1,1 1),(2 2,7 2,7 5,2 5,2 2),(3 7,4 7,4 8,3 8,3 7),(5 7,6 7,6 8,5 8,5 7),(8 7,9 7,9 8,8 8,8 7))"};
+
+static std::string within_holes_disjoint[2] =
+ {"POLYGON((0 0,0 7,7 7,7 0,0 0),(2 2,3 2,3 3,2 3,2 2))",
+ "POLYGON((1 1,1 6,6 6,6 1,1 1),(2 4,3 4,3 5,2 5,2 4))"};
+
+// == case 53
+static std::string wrapped[3] = {
+ "POLYGON((2 2,2 3,3 3,3 2,2 2))",
+ /*a:*/ "POLYGON((0 2,0 5,5 5,5 0,2 0,2 2,3 2,3 1,4 1,4 4,1 4,1 3,2 3,2 2,0 2))", // NOT st_isvalid
+ /*b:*/ "POLYGON((0 2,0 5,5 5,5 0,2 0,2 2,0 2),(1 3,2 3,2 2,3 2,3 1,4 1,4 4,1 4,1 3))" // st_isvalid
+ };
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_perimeter.hpp b/libs/geometry/test/algorithms/test_perimeter.hpp
new file mode 100644
index 000000000..0d6a9537a
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_perimeter.hpp
@@ -0,0 +1,64 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_PERIMETER_HPP
+#define BOOST_GEOMETRY_TEST_PERIMETER_HPP
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/perimeter.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+
+
+#include <boost/geometry/io/wkt/read.hpp>
+
+
+template <typename Geometry>
+void test_perimeter(Geometry const& geometry, long double expected_perimeter)
+{
+ typename bg::default_distance_result<Geometry>::type perimeter = bg::perimeter(geometry);
+
+#ifdef GEOMETRY_TEST_DEBUG
+ std::ostringstream out;
+ out << typeid(typename bg::coordinate_type<Geometry>::type).name()
+ << std::endl
+ << typeid(typename bg::perimeter_result<Geometry>::type).name()
+ << std::endl
+ << "perimeter : " << bg::perimeter(geometry)
+ << std::endl;
+ std::cout << out.str();
+#endif
+
+ BOOST_CHECK_CLOSE(perimeter, expected_perimeter, 0.0001);
+}
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt, double expected_perimeter)
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ test_perimeter(geometry, expected_perimeter);
+}
+
+template <typename Geometry>
+void test_empty_input(Geometry const& geometry)
+{
+ try
+ {
+ bg::perimeter(geometry);
+ }
+ catch(bg::empty_input_exception const& )
+ {
+ return;
+ }
+ BOOST_CHECK_MESSAGE(false, "A empty_input_exception should have been thrown" );
+}
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_relate.hpp b/libs/geometry/test/algorithms/test_relate.hpp
new file mode 100644
index 000000000..e747a4047
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_relate.hpp
@@ -0,0 +1,33 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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_RELATE_HPP
+#define BOOST_GEOMETRY_TEST_RELATE_HPP
+
+#include <string>
+
+
+static std::string disjoint_simplex[2] =
+ {"POLYGON((0 0,0 2,2 2,0 0))",
+ "POLYGON((1 0,3 2,3 0,1 0))"};
+
+static std::string touch_simplex[2] =
+ {"POLYGON((0 0,0 2,2 2,0 0))",
+ "POLYGON((2 2,3 2,3 0,2 2))"};
+
+static std::string overlaps_box[2] =
+ {"POLYGON((0 0,0 2,2 2,0 0))",
+ "POLYGON((1 1,3 2,3 0,1 1))"};
+
+static std::string within_simplex[2] =
+ {"POLYGON((0 0,1 4,4 1,0 0))",
+ "POLYGON((1 1,1 3,3 1,1 1))"};
+
+
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_reverse.hpp b/libs/geometry/test/algorithms/test_reverse.hpp
new file mode 100644
index 000000000..97e537f7b
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_reverse.hpp
@@ -0,0 +1,38 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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_REVERSE_HPP
+#define BOOST_GEOMETRY_TEST_REVERSE_HPP
+
+// Test-functionality, shared between single and multi tests
+
+#include <geometry_test_common.hpp>
+#include <boost/geometry/algorithms/reverse.hpp>
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt, std::string const& expected)
+{
+ Geometry geometry;
+
+ bg::read_wkt(wkt, geometry);
+ bg::reverse(geometry);
+
+ std::ostringstream out;
+ out << bg::wkt(geometry);
+
+ BOOST_CHECK_MESSAGE(out.str() == expected,
+ "reverse: " << wkt
+ << " expected " << expected
+ << " got " << out.str());
+}
+
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_simplify.hpp b/libs/geometry/test/algorithms/test_simplify.hpp
new file mode 100644
index 000000000..30f0998f7
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_simplify.hpp
@@ -0,0 +1,96 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_SIMPLIFY_HPP
+#define BOOST_GEOMETRY_TEST_SIMPLIFY_HPP
+
+// Test-functionality, shared between single and multi tests
+
+#include <geometry_test_common.hpp>
+#include <boost/geometry/algorithms/simplify.hpp>
+#include <boost/geometry/algorithms/distance.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+
+template <typename Tag, typename Geometry>
+struct test_inserter
+{
+ static void apply(Geometry& , std::string const& , double )
+ {}
+};
+
+template <typename Geometry>
+struct test_inserter<bg::linestring_tag, Geometry>
+{
+ static void apply(Geometry& geometry, std::string const& expected, double distance)
+ {
+ Geometry simplified;
+ bg::detail::simplify::simplify_insert(geometry,
+ std::back_inserter(simplified), distance);
+
+ std::ostringstream out;
+ out << bg::wkt(simplified);
+ BOOST_CHECK_EQUAL(out.str(), expected);
+ }
+};
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt, std::string const& expected, double distance)
+{
+ Geometry geometry, simplified;
+
+ // Generate polygon using only integer coordinates and obvious results
+ // Polygon is a hexagon, having one extra point (2,1) on a line which should be filtered out.
+ bg::read_wkt(wkt, geometry);
+ bg::simplify(geometry, simplified, distance);
+
+ {
+ std::ostringstream out;
+ out << bg::wkt(simplified);
+
+ BOOST_CHECK_MESSAGE(out.str() == expected,
+ "simplify: " << bg::wkt(geometry)
+ << " expected " << expected
+ << " got " << bg::wkt(simplified));
+ }
+
+ // Check using user-specified strategy
+ typedef typename bg::point_type<Geometry>::type point_type;
+ typedef typename bg::cs_tag<point_type>::type tag;
+ typedef bg::strategy::distance::projected_point
+ <
+ point_type,
+ point_type
+ > strategy;
+ typedef bg::strategy::simplify::douglas_peucker
+ <
+ point_type,
+ strategy
+ > simplify_strategy_type;
+
+ BOOST_CONCEPT_ASSERT( (bg::concept::SimplifyStrategy<simplify_strategy_type>) );
+ bg::simplify(geometry, simplified, distance, simplify_strategy_type());
+
+ {
+ std::ostringstream out;
+ out << bg::wkt(simplified);
+ BOOST_CHECK_EQUAL(out.str(), expected);
+ }
+
+ // Check inserter (if applicable)
+ test_inserter
+ <
+ typename bg::tag<Geometry>::type,
+ Geometry
+ >::apply(geometry, expected, distance);
+}
+
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_touches.hpp b/libs/geometry/test/algorithms/test_touches.hpp
new file mode 100644
index 000000000..aa88ea96d
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_touches.hpp
@@ -0,0 +1,61 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_TOUCHES_HPP
+#define BOOST_GEOMETRY_TEST_TOUCHES_HPP
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/core/ring_type.hpp>
+#include <boost/geometry/algorithms/touches.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+#include <boost/geometry/geometries/ring.hpp>
+#include <boost/geometry/geometries/polygon.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+
+
+template <typename Geometry1, typename Geometry2>
+void test_touches(std::string const& wkt1,
+ std::string const& wkt2, bool expected)
+{
+ Geometry1 geometry1;
+ Geometry2 geometry2;
+
+ bg::read_wkt(wkt1, geometry1);
+ bg::read_wkt(wkt2, geometry2);
+
+ bool detected = bg::touches(geometry1, geometry2);
+
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "touches: " << wkt1
+ << " with " << wkt2
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+}
+
+
+template <typename Geometry>
+void test_self_touches(std::string const& wkt, bool expected)
+{
+ Geometry geometry;
+
+ bg::read_wkt(wkt, geometry);
+
+ bool detected = bg::touches(geometry);
+
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "touches: " << wkt
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+}
+
+
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_union.hpp b/libs/geometry/test/algorithms/test_union.hpp
new file mode 100644
index 000000000..c449c66e3
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_union.hpp
@@ -0,0 +1,174 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_UNION_HPP
+#define BOOST_GEOMETRY_TEST_UNION_HPP
+
+#include <fstream>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/range/algorithm/copy.hpp>
+
+#include <boost/geometry/algorithms/union.hpp>
+
+#include <boost/geometry/algorithms/area.hpp>
+#include <boost/geometry/algorithms/correct.hpp>
+#include <boost/geometry/algorithms/length.hpp>
+#include <boost/geometry/algorithms/num_points.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+
+
+#if defined(TEST_WITH_SVG)
+# include <boost/geometry/io/svg/svg_mapper.hpp>
+#endif
+
+
+
+template <typename OutputType, typename G1, typename G2>
+void test_union(std::string const& caseid, G1 const& g1, G2 const& g2,
+ std::size_t expected_count, std::size_t expected_hole_count,
+ int expected_point_count, double expected_area,
+ double percentage)
+{
+ typedef typename bg::coordinate_type<G1>::type coordinate_type;
+ std::vector<OutputType> clip;
+ bg::union_(g1, g2, clip);
+
+ typename bg::default_area_result<G1>::type area = 0;
+ std::size_t n = 0;
+ std::size_t holes = 0;
+ for (typename std::vector<OutputType>::iterator it = clip.begin();
+ it != clip.end(); ++it)
+ {
+ area += bg::area(*it);
+ holes += bg::num_interior_rings(*it);
+ n += bg::num_points(*it, true);
+ }
+
+ {
+ // Test inserter functionality
+ // Test if inserter returns output-iterator (using Boost.Range copy)
+ std::vector<OutputType> inserted, array_with_one_empty_geometry;
+ array_with_one_empty_geometry.push_back(OutputType());
+ boost::copy(array_with_one_empty_geometry, bg::detail::union_::union_insert<OutputType>(g1, g2, std::back_inserter(inserted)));
+
+ typename bg::default_area_result<G1>::type area_inserted = 0;
+ int index = 0;
+ for (typename std::vector<OutputType>::iterator it = inserted.begin();
+ it != inserted.end();
+ ++it, ++index)
+ {
+ // Skip the empty polygon created above to avoid the empty_input_exception
+ if (bg::num_points(*it) > 0)
+ {
+ area_inserted += bg::area(*it);
+ }
+ }
+ BOOST_CHECK_EQUAL(boost::size(clip), boost::size(inserted) - 1);
+ BOOST_CHECK_CLOSE(area_inserted, expected_area, percentage);
+ }
+
+
+
+ /***
+ std::cout << "case: " << caseid
+ << " n: " << n
+ << " area: " << area
+ << " polygons: " << boost::size(clip)
+ << " holes: " << holes
+ << std::endl;
+ ***/
+
+ if (expected_point_count >= 0)
+ {
+ BOOST_CHECK_MESSAGE(n == std::size_t(expected_point_count),
+ "union: " << caseid
+ << " #points expected: " << expected_point_count
+ << " detected: " << n
+ << " type: " << string_from_type<coordinate_type>::name()
+ );
+ }
+
+ BOOST_CHECK_EQUAL(clip.size(), expected_count);
+ BOOST_CHECK_EQUAL(holes, expected_hole_count);
+ BOOST_CHECK_CLOSE(area, expected_area, percentage);
+
+#if defined(TEST_WITH_SVG)
+ {
+ bool const ccw =
+ bg::point_order<G1>::value == bg::counterclockwise
+ || bg::point_order<G2>::value == bg::counterclockwise;
+ bool const open =
+ bg::closure<G1>::value == bg::open
+ || bg::closure<G2>::value == bg::open;
+
+ std::ostringstream filename;
+ filename << "union_"
+ << caseid << "_"
+ << string_from_type<coordinate_type>::name()
+ << (ccw ? "_ccw" : "")
+ << (open ? "_open" : "")
+ << ".svg";
+
+ std::ofstream svg(filename.str().c_str());
+
+ bg::svg_mapper
+ <
+ typename bg::point_type<G2>::type
+ > mapper(svg, 500, 500);
+ mapper.add(g1);
+ mapper.add(g2);
+
+ mapper.map(g1, "fill-opacity:0.5;fill:rgb(153,204,0);"
+ "stroke:rgb(153,204,0);stroke-width:3");
+ mapper.map(g2, "fill-opacity:0.3;fill:rgb(51,51,153);"
+ "stroke:rgb(51,51,153);stroke-width:3");
+ //mapper.map(g1, "opacity:0.6;fill:rgb(0,0,255);stroke:rgb(0,0,0);stroke-width:1");
+ //mapper.map(g2, "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1");
+
+ for (typename std::vector<OutputType>::const_iterator it = clip.begin();
+ it != clip.end(); ++it)
+ {
+ mapper.map(*it, "fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,0,0);"
+ "stroke:rgb(255,0,255);stroke-width:8");
+ //mapper.map(*it, "opacity:0.6;fill:none;stroke:rgb(255,0,0);stroke-width:5");
+ }
+ }
+#endif
+}
+
+template <typename OutputType, typename G1, typename G2>
+void test_one(std::string const& caseid, std::string const& wkt1, std::string const& wkt2,
+ std::size_t expected_count, std::size_t expected_hole_count,
+ int expected_point_count, double expected_area,
+ double percentage = 0.001)
+{
+ G1 g1;
+ bg::read_wkt(wkt1, g1);
+
+ G2 g2;
+ bg::read_wkt(wkt2, g2);
+
+ // Reverse if necessary
+ bg::correct(g1);
+ bg::correct(g2);
+
+ test_union<OutputType>(caseid, g1, g2,
+ expected_count, expected_hole_count, expected_point_count,
+ expected_area, percentage);
+}
+
+
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_unique.hpp b/libs/geometry/test/algorithms/test_unique.hpp
new file mode 100644
index 000000000..09d4981af
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_unique.hpp
@@ -0,0 +1,39 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_UNIQUE_HPP
+#define BOOST_GEOMETRY_TEST_UNIQUE_HPP
+
+// Test-functionality, shared between single and multi tests
+
+#include <geometry_test_common.hpp>
+#include <boost/geometry/algorithms/unique.hpp>
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt, std::string const& expected)
+{
+ Geometry geometry;
+
+ bg::read_wkt(wkt, geometry);
+ bg::unique(geometry);
+
+ std::ostringstream out;
+ out << bg::wkt(geometry);
+
+ BOOST_CHECK_MESSAGE(out.str() == expected,
+ "unique: " << wkt
+ << " expected " << expected
+ << " got " << out.str());
+}
+
+
+#endif
diff --git a/libs/geometry/test/algorithms/test_within.hpp b/libs/geometry/test/algorithms/test_within.hpp
new file mode 100644
index 000000000..bc3f9958d
--- /dev/null
+++ b/libs/geometry/test/algorithms/test_within.hpp
@@ -0,0 +1,126 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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_WITHIN_HPP
+#define BOOST_GEOMETRY_TEST_WITHIN_HPP
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/core/ring_type.hpp>
+#include <boost/geometry/algorithms/within.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+#include <boost/geometry/geometries/ring.hpp>
+#include <boost/geometry/geometries/polygon.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+
+#include <boost/geometry/strategies/cartesian/point_in_box.hpp>
+#include <boost/geometry/strategies/cartesian/box_in_box.hpp>
+#include <boost/geometry/strategies/agnostic/point_in_box_by_side.hpp>
+
+
+template <typename Geometry1, typename Geometry2>
+void test_geometry(std::string const& wkt1,
+ std::string const& wkt2, bool expected)
+{
+ Geometry1 geometry1;
+ Geometry2 geometry2;
+
+ bg::read_wkt(wkt1, geometry1);
+ bg::read_wkt(wkt2, geometry2);
+
+ bool detected = bg::within(geometry1, geometry2);
+
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "within: " << wkt1
+ << " in " << wkt2
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+}
+
+
+
+template <typename Point, bool Clockwise, bool Closed>
+void test_ordered_ring(std::string const& wkt_point,
+ std::string const& wkt_geometry, bool expected, bool on_border)
+{
+ typedef bg::model::ring<Point, Clockwise, Closed> ring_type;
+ ring_type ring;
+ Point point;
+
+ bg::read_wkt(wkt_geometry, ring);
+ if (! Clockwise)
+ {
+ std::reverse(boost::begin(ring), boost::end(ring));
+ }
+ if (! Closed)
+ {
+ ring.resize(ring.size() - 1);
+ }
+
+ bg::read_wkt(wkt_point, point);
+
+ bool detected = bg::within(point, ring);
+
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "within: " << wkt_point
+ << " in " << wkt_geometry
+ << " -> Expected: " << expected
+ << " detected: " << detected
+ << " clockwise: " << int(Clockwise)
+ << " closed: " << int(Closed)
+ );
+
+ // other strategy (note that this one cannot detect OnBorder
+ // (without modifications)
+
+ bg::strategy::within::franklin<Point> franklin;
+ detected = bg::within(point, ring, franklin);
+ if (! on_border)
+ {
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "within: " << wkt_point
+ << " in " << wkt_geometry
+ << " -> Expected: " << expected
+ << " detected: " << detected
+ << " clockwise: " << int(Clockwise)
+ << " closed: " << int(Closed)
+ );
+ }
+
+
+ bg::strategy::within::crossings_multiply<Point> cm;
+ detected = bg::within(point, ring, cm);
+ if (! on_border)
+ {
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "within: " << wkt_point
+ << " in " << wkt_geometry
+ << " -> Expected: " << expected
+ << " detected: " << detected
+ << " clockwise: " << int(Clockwise)
+ << " closed: " << int(Closed)
+ );
+ }
+}
+
+template <typename Point>
+void test_ring(std::string const& wkt_point,
+ std::string const& wkt_geometry,
+ bool expected, bool on_border)
+{
+ test_ordered_ring<Point, true, true>(wkt_point, wkt_geometry, expected, on_border);
+ test_ordered_ring<Point, false, true>(wkt_point, wkt_geometry, expected, on_border);
+ test_ordered_ring<Point, true, false>(wkt_point, wkt_geometry, expected, on_border);
+ test_ordered_ring<Point, false, false>(wkt_point, wkt_geometry, expected, on_border);
+ test_geometry<Point, bg::model::polygon<Point> >(wkt_point, wkt_geometry, expected);
+}
+
+#endif
diff --git a/libs/geometry/test/algorithms/touches.cpp b/libs/geometry/test/algorithms/touches.cpp
new file mode 100644
index 000000000..84430d527
--- /dev/null
+++ b/libs/geometry/test/algorithms/touches.cpp
@@ -0,0 +1,154 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2012 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_touches.hpp>
+
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.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);
+
+ // Touching at corner
+ test_touches<polygon, polygon>
+ (
+ "POLYGON((0 0,0 100,100 100,100 0,0 0))",
+ "POLYGON((100 100,100 200,200 200, 200 100,100 100))",
+ true
+ );
+
+ // Intersecting at corner
+ test_touches<polygon, polygon>
+ (
+ "POLYGON((0 0,0 100,101 101,100 0,0 0))",
+ "POLYGON((100 100,100 200,200 200, 200 100,100 100))",
+ false
+ );
+
+ // Touching at side (interior of a segment)
+ test_touches<polygon, polygon>
+ (
+ "POLYGON((0 0,0 100,100 100,100 0,0 0))",
+ "POLYGON((200 0,100 50,200 100,200 0))",
+ true
+ );
+
+ // Touching at side (partly collinear)
+ test_touches<polygon, polygon>
+ (
+ "POLYGON((0 0,0 100,100 100,100 0,0 0))",
+ "POLYGON((200 20,100 20,100 80,200 80,200 20))",
+ true
+ );
+
+ // Completely equal
+ test_touches<polygon, polygon>
+ (
+ "POLYGON((0 0,0 100,100 100,100 0,0 0))",
+ "POLYGON((0 0,0 100,100 100,100 0,0 0))",
+ false
+ );
+
+ // Spatially equal
+ test_touches<polygon, polygon>
+ (
+ "POLYGON((0 0,0 100,100 100,100 0,0 0))",
+ "POLYGON((0 0,0 100,100 100,100 80,100 20,100 0,0 0))",
+ false
+ );
+
+ // Spatially equal (without equal segments)
+ test_touches<polygon, polygon>
+ (
+ "POLYGON((0 0,0 100,100 100,100 0,0 0))",
+ "POLYGON((0 0,0 50,0 100,50 100,100 100,100 50,100 0,50 0,0 0))",
+ false
+ );
+
+
+ // Touching at side (opposite equal)
+ test_touches<polygon, polygon>
+ (
+ "POLYGON((0 0,0 100,100 100,100 0,0 0))",
+ "POLYGON((200 0,100 0,100 100,200 100,200 0))",
+ true
+ );
+
+ // Touching at side (opposite equal - but with real "equal" turning point)
+ test_touches<polygon, polygon>
+ (
+ "POLYGON((0 0,0 100,100 100,100 80,100 20,100 0,0 0))",
+ "POLYGON((200 0,100 0,100 20,100 80,100 100,200 100,200 0))",
+ true
+ );
+ // First partly collinear to side, than overlapping
+ test_touches<polygon, polygon>
+ (
+ "POLYGON((0 0,0 100,100 100,100 0,0 0))",
+ "POLYGON((200 20,100 20,100 50,50 50,50 80,100 80,200 80,200 20))",
+ false
+ );
+
+ // Touching interior (= no touch)
+ test_touches<polygon, polygon>
+ (
+ "POLYGON((0 0,0 100,100 100,100 0,0 0))",
+ "POLYGON((20 20,20 80,100 50,20 20))",
+ false
+ );
+
+ // Fitting in hole
+ test_touches<polygon, polygon>
+ (
+ "POLYGON((0 0,0 100,100 100,100 0,0 0),(40 40,60 40,60 60,40 60,40 40))",
+ "POLYGON((40 40,40 60,60 60,60 40,40 40))",
+ 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;
+}
+
+/*
+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
+*/ \ No newline at end of file
diff --git a/libs/geometry/test/algorithms/touches.vcproj b/libs/geometry/test/algorithms/touches.vcproj
new file mode 100644
index 000000000..79cc17048
--- /dev/null
+++ b/libs/geometry/test/algorithms/touches.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="touches"
+ ProjectGUID="{8359726E-9F03-4300-8F63-1FEAC84251D0}"
+ RootNamespace="touches"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\touches"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NONDLL;_CRT_SECURE_NO_WARNINGS"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\touches"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NONDLL;_CRT_SECURE_NO_WARNINGS"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\touches.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/transform.cpp b/libs/geometry/test/algorithms/transform.cpp
new file mode 100644
index 000000000..7a9c1c32a
--- /dev/null
+++ b/libs/geometry/test/algorithms/transform.cpp
@@ -0,0 +1,140 @@
+// 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.
+
+// 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 <iostream>
+#include <sstream>
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/make.hpp>
+#include <boost/geometry/algorithms/transform.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+#include <boost/geometry/io/dsv/write.hpp>
+#include <boost/geometry/io/wkt/wkt.hpp>
+
+#include <test_common/test_point.hpp>
+
+template <typename P1, typename P2>
+void test_transform_point(
+ typename bg::select_most_precise
+ <
+ typename bg::coordinate_type<P1>::type,
+ double
+ >::type value)
+{
+ P1 p1;
+ bg::set<0>(p1, 1);
+ bg::set<1>(p1, 2);
+ P2 p2;
+ BOOST_CHECK(bg::transform(p1, p2));
+
+ BOOST_CHECK_CLOSE(value * bg::get<0>(p1), bg::get<0>(p2), 0.001);
+ BOOST_CHECK_CLOSE(value * bg::get<1>(p1), bg::get<1>(p2), 0.001);
+}
+
+template <typename P1, typename P2>
+void test_transform_linestring()
+{
+ bg::model::linestring<P1> line1;
+ line1.push_back(bg::make<P1>(1, 1));
+ line1.push_back(bg::make<P1>(2, 2));
+ bg::model::linestring<P2> line2;
+ BOOST_CHECK(bg::transform(line1, line2));
+ BOOST_CHECK_EQUAL(line1.size(), line2.size());
+
+ std::ostringstream out1, out2;
+ out1 << bg::wkt(line1);
+ out2 << bg::wkt(line2);
+ BOOST_CHECK_EQUAL(out1.str(), out1.str());
+}
+
+
+template <typename P1, typename P2>
+void test_all(double value = 1.0)
+{
+ test_transform_point<P1, P2>(value);
+ test_transform_linestring<P1, P2>();
+}
+
+template <typename T, typename DegreeOrRadian>
+void test_transformations(double phi, double theta, double r)
+{
+ typedef bg::model::point<T, 3, bg::cs::cartesian> cartesian_type;
+ cartesian_type p;
+
+ // 1: using spherical coordinates
+ {
+ typedef bg::model::point<T, 3, bg::cs::spherical<DegreeOrRadian> > spherical_type;
+ spherical_type sph1;
+ assign_values(sph1, phi, theta, r);
+ BOOST_CHECK(transform(sph1, p));
+
+ spherical_type sph2;
+ BOOST_CHECK(transform(p, sph2));
+
+ BOOST_CHECK_CLOSE(bg::get<0>(sph1), bg::get<0>(sph2), 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(sph1), bg::get<1>(sph2), 0.001);
+
+ //std::cout << dsv(p) << std::endl;
+ //std::cout << dsv(sph2) << std::endl;
+ }
+
+ // 2: using spherical coordinates on unit sphere
+ {
+ typedef bg::model::point<T, 2, bg::cs::spherical<DegreeOrRadian> > spherical_type;
+ spherical_type sph1, sph2;
+ assign_values(sph1, phi, theta);
+ BOOST_CHECK(transform(sph1, p));
+ BOOST_CHECK(transform(p, sph2));
+
+ BOOST_CHECK_CLOSE(bg::get<0>(sph1), bg::get<0>(sph2), 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(sph1), bg::get<1>(sph2), 0.001);
+
+ //std::cout << dsv(sph1) << " " << dsv(p) << " " << dsv(sph2) << std::endl;
+ }
+}
+
+int test_main(int, char* [])
+{
+ typedef bg::model::d2::point_xy<double > P;
+ test_all<P, P>();
+ test_all<bg::model::d2::point_xy<int>, bg::model::d2::point_xy<float> >();
+
+ 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);
+ 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);
+
+ 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);
+
+ 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);
+
+#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);
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/transform.vcproj b/libs/geometry/test/algorithms/transform.vcproj
new file mode 100644
index 000000000..fcf3c902d
--- /dev/null
+++ b/libs/geometry/test/algorithms/transform.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="transform"
+ ProjectGUID="{41413E56-08DA-4592-94D2-5311FE90C62B}"
+ RootNamespace="transform"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\transform"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\transform"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\transform.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/union.cpp b/libs/geometry/test/algorithms/union.cpp
new file mode 100644
index 000000000..751825244
--- /dev/null
+++ b/libs/geometry/test/algorithms/union.cpp
@@ -0,0 +1,442 @@
+// 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.
+
+// 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 <iostream>
+#include <string>
+
+#define BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
+#define TEST_ISOVIST
+
+//#define BOOST_GEOMETRY_DEBUG_ASSEMBLE
+//#define BOOST_GEOMETRY_DEBUG_IDENTIFIER
+
+
+#include <algorithms/test_union.hpp>
+#include <algorithms/test_overlay.hpp>
+
+#include <algorithms/overlay/overlay_cases.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+
+
+template <typename Ring, typename Polygon>
+void test_areal()
+{
+ typedef typename bg::coordinate_type<Polygon>::type ct;
+
+ test_one<Polygon, Polygon, Polygon>("simplex_normal",
+ simplex_normal[0], simplex_normal[1],
+ 1, 0, 13, 11.526367);
+
+ test_one<Polygon, Polygon, Polygon>("simplex_with_empty_1",
+ simplex_normal[0], polygon_empty,
+ 1, 0, 4, 8.0);
+ test_one<Polygon, Polygon, Polygon>("simplex_with_empty_2",
+ polygon_empty, simplex_normal[0],
+ 1, 0, 4, 8.0);
+
+ test_one<Polygon, Polygon, Polygon>("star_ring", example_star, example_ring,
+ 1, 0, 23, 5.67017141);
+
+ // This sample was selected because of the border case, and ttmath generates one point more.
+ test_one<Polygon, Polygon, Polygon>("star_poly", example_star, example_polygon,
+ 1, 1,
+ if_typed_tt<ct>(28, 27), 5.647949);
+
+ // Pseudo-box as Polygon
+ // (note, internally, the intersection points is different, so yes,
+ // it has to be tested)
+ test_one<Polygon, Polygon, Polygon>("box_poly3", "POLYGON((1.5 1.5 , 1.5 2.5 , 4.5 2.5 , 4.5 1.5 , 1.5 1.5))",
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,5.3 2.5,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3))",
+ 1, 1, 15, 5.93625);
+
+ test_one<Polygon, Polygon, Polygon>("first_within_second",
+ first_within_second[0], first_within_second[1],
+ 1, 0, 5, 25.0);
+
+ test_one<Polygon, Polygon, Polygon>("second_within_first",
+ first_within_second[1], first_within_second[0],
+ 1, 0, 5, 25.0);
+
+ test_one<Polygon, Polygon, Polygon>("first_within_hole_of_second",
+ first_within_hole_of_second[0], first_within_hole_of_second[1],
+ 2, 1, 15, 17.0);
+
+ test_one<Polygon, Polygon, Polygon>("new_hole",
+ new_hole[0], new_hole[1],
+ 1, 1, 14, 23.0);
+
+ test_one<Polygon, Polygon, Polygon>("side_side",
+ side_side[0], side_side[1], 1, 0, 7, 2.0);
+
+ test_one<Polygon, Polygon, Polygon>("identical",
+ identical[0], identical[1], 1, 0, 5, 1.0);
+
+ test_one<Polygon, Polygon, Polygon>("disjoint",
+ disjoint[0], disjoint[1], 2, 0, 10, 2.0);
+
+ test_one<Polygon, Polygon, Polygon>("intersect_holes_intersect",
+ intersect_holes_intersect[0], intersect_holes_intersect[1],
+ 1, 1, 14, 39.75);
+
+ test_one<Polygon, Polygon, Polygon>("intersect_holes_intersect_and_disjoint",
+ intersect_holes_intersect_and_disjoint[0], intersect_holes_intersect_and_disjoint[1],
+ 1, 1, 14, 39.75);
+
+ test_one<Polygon, Polygon, Polygon>("intersect_holes_intersect_and_touch",
+ intersect_holes_intersect_and_touch[0], intersect_holes_intersect_and_touch[1],
+ 1, 1, 14, 39.75);
+
+ test_one<Polygon, Polygon, Polygon>("intersect_holes_new_ring",
+ intersect_holes_new_ring[0], intersect_holes_new_ring[1],
+ 1, 2, 15, 253.8961);
+
+ test_one<Polygon, Polygon, Polygon>("intersect_holes_disjoint",
+ intersect_holes_disjoint[0],
+ intersect_holes_disjoint[1],
+ 1, 0, 9, 40.0);
+
+ test_one<Polygon, Polygon, Polygon>("within_holes_disjoint",
+ within_holes_disjoint[0], within_holes_disjoint[1],
+ 1, 0, 5, 49.0);
+
+ test_one<Polygon, Polygon, Polygon>("winded",
+ winded[0], winded[1],
+ 1, 5, 30, 114.0);
+
+ test_one<Polygon, Polygon, Polygon>("two_bends",
+ two_bends[0], two_bends[1],
+ 1, 0, 7, 40.0);
+
+ test_one<Polygon, Polygon, Polygon>("star_comb_15",
+ star_comb_15[0], star_comb_15[1],
+ 1, 27, 204, 898.09693338);
+
+ test_one<Polygon, Polygon, Polygon>("equal_holes_disjoint",
+ equal_holes_disjoint[0], equal_holes_disjoint[1],
+ 1, 1, 10, 81 - 3 * 7);
+
+ test_one<Polygon, Polygon, Polygon>("only_hole_intersections1",
+ only_hole_intersections[0], only_hole_intersections[1],
+ 1, 2, 13, 190.9090909);
+ test_one<Polygon, Polygon, Polygon>("only_hole_intersections2",
+ only_hole_intersections[0], only_hole_intersections[2],
+ 1, 2, 13, 190.9090909);
+
+ test_one<Polygon, Polygon, Polygon>("intersect_exterior_and_interiors_winded",
+ intersect_exterior_and_interiors_winded[0], intersect_exterior_and_interiors_winded[1],
+ 1, 1, 26, 66.5333333);
+
+ test_one<Polygon, Polygon, Polygon>("crossed",
+ crossed[0], crossed[1],
+ 1, 3, 17, 23.5); // Area from SQL Server - was somehow wrong before
+
+ test_one<Polygon, Polygon, Polygon>("fitting",
+ fitting[0], fitting[1],
+ 1, 0, 5, 25);
+
+ test_one<Polygon, Polygon, Polygon>("distance_zero",
+ distance_zero[0], distance_zero[1],
+ 1, 0, 11, 9.0098387);
+
+ test_one<Polygon, Polygon, Polygon>("wrapped_a",
+ wrapped[0], wrapped[1],
+ 1, 1, 16, 16);
+ test_one<Polygon, Polygon, Polygon>("wrapped_b",
+ wrapped[0], wrapped[2],
+ 1, 1, 16, 16);
+
+ test_one<Polygon, Polygon, Polygon>("9",
+ case_9[0], case_9[1], 2, 0, 8, 11);
+ test_one<Polygon, Polygon, Polygon>("22",
+ case_22[0], case_22[1], 2, 0, 8, 9.5);
+ test_one<Polygon, Polygon, Polygon>("25",
+ case_25[0], case_25[1], 2, 0, 8, 7);
+ test_one<Polygon, Polygon, Polygon>("26",
+ case_26[0], case_26[1], 2, 0, 9, 7.5);
+ test_one<Polygon, Polygon, Polygon>("31",
+ case_31[0], case_31[1], 2, 0, 8, 4.5);
+ test_one<Polygon, Polygon, Polygon>("32",
+ case_32[0], case_32[1], 2, 0, 8, 4.5);
+ test_one<Polygon, Polygon, Polygon>("33",
+ case_33[0], case_33[1], 2, 0, 8, 4.5);
+ test_one<Polygon, Polygon, Polygon>("36",
+ case_36[0], case_36[1], 1, 0, 10, 14.375);
+ test_one<Polygon, Polygon, Polygon>("40",
+ case_40[0], case_40[1], 2, 0, 18, 11);
+
+ // Test rings which should be generated by assemble
+ test_one<Polygon, Polygon, Polygon>("53_iet",
+ case_53[0], case_53[2], 1, 1, 16, 16);
+ test_one<Polygon, Polygon, Polygon>("58_iet",
+ case_58[0], case_58[2], 1, 3, 20, 12.16666);
+ test_one<Polygon, Polygon, Polygon>("59_iet",
+ case_59[0], case_59[2], 1, 1, 14, 17.20833);
+
+
+ /*
+ test_one<Polygon, Polygon, Polygon>(102,
+ simplex_normal[0], simplex_reversed[1],
+ 1, 0, 7, X);
+
+ test_one<Polygon, Polygon, Polygon>(103,
+ simplex_reversed[0], simplex_normal[1],
+ 1, 0, 7, 24.0);
+
+ test_one<Polygon, Polygon, Polygon>(104,
+ simplex_reversed[0], simplex_reversed[1],
+ 1, 0, 7, 24.0);
+
+ test_one<Polygon, Polygon, Polygon>(100,
+ star_15, comb_15,
+ 1, 10, 7, 24.0);
+ */
+
+ // test some other input/output types
+
+ // 1 input Ring
+ test_one<Polygon, Polygon, Ring>("identical_pr", identical[0], identical[1], 1, 0, 5, 1.0);
+ test_one<Polygon, Ring, Polygon>("identical_rp", identical[0], identical[1], 1, 0, 5, 1.0);
+
+ // 2 input rings
+ test_one<Polygon, Ring, Ring>("identical_rr", identical[0], identical[1], 1, 0, 5, 1.0);
+
+ // output is also Ring
+ test_one<Ring, Ring, Ring>("identical_rrr", identical[0], identical[1], 1, 0, 5, 1.0);
+
+ // "new hole", tested with Ring -> the newly formed hole will be omitted
+ test_one<Ring, Ring, Ring>("new_hole_discarded", new_hole[0], new_hole[1], 1, 0, 9, 24.0);
+
+ test_one<Polygon, Polygon, Polygon>("ggl_list_20110306_javier",
+ ggl_list_20110306_javier[0], ggl_list_20110306_javier[1],
+ 1, 1, 16, 80456.4904910401);
+
+ test_one<Polygon, Polygon, Polygon>("ggl_list_20110307_javier",
+ ggl_list_20110307_javier[0], ggl_list_20110307_javier[1],
+ 1, 1, 13, 20016.4);
+
+ test_one<Polygon, Polygon, Polygon>("ggl_list_20110627_phillip",
+ ggl_list_20110627_phillip[0], ggl_list_20110627_phillip[1],
+ 1, 0,
+ if_typed<ct, double>(5, if_typed_tt<ct>(8, 7)),
+ 14729.07145);
+
+
+ // Float gives sometimes 14, sometimes 14 points
+ test_one<Polygon, Polygon, Polygon>("ggl_list_20110716_enrico",
+ ggl_list_20110716_enrico[0], ggl_list_20110716_enrico[1],
+ 1, 1,
+ if_typed<ct, double>(18, if_typed<ct, float>(-1, 17)),
+ 129904.197692871);
+
+ test_one<Polygon, Polygon, Polygon>("ggl_list_20110820_christophe",
+ ggl_list_20110820_christophe[0], ggl_list_20110820_christophe[1],
+ if_typed<ct, float>(2, 1),
+ 0,
+ if_typed_tt<ct>(9, 8),
+ 67.3550722317627);
+
+
+#ifdef TEST_ISOVIST
+#ifdef _MSC_VER
+ test_one<Polygon, Polygon, Polygon>("isovist",
+ isovist1[0], isovist1[1],
+ 1,
+ 0,
+ if_typed<ct, float>(71, if_typed<ct, double>(70, 73)),
+ 313.36036462, 0.1);
+
+ // SQL Server gives: 313.360374193241
+ // PostGIS gives: 313.360364623393
+
+#endif
+#endif
+
+ // Ticket 5103 https://svn.boost.org/trac/boost/ticket/5103
+ // This ticket was actually reported for Boost.Polygon
+ // We check it for Boost.Geometry as well.
+ // SQL Server gives: 2515271331437.69
+ // PostGIS gives: 2515271327070.52
+ // Boost.Geometry gives: 2515271327070.5237746891 (ttmath)
+ // 2515271327070.5156 (double)
+ // 2515271320603.0000 (int)
+ // Note the int-test was tested outside of this unit test. It is in two points 0.37 off (logical for an int).
+ // Because of the width of the polygon (400000 meter) this causes a substantial difference.
+
+ test_one<Polygon, Polygon, Polygon>("ticket_5103", ticket_5103[0], ticket_5103[1],
+ 1, 0, 25, 2515271327070.5);
+
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_a", buffer_rt_a[0], buffer_rt_a[1],
+ 1, 0, 265, 19.280667);
+
+ // Robustness issues, followed out buffer-robustness-tests, test them also reverse
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_f", buffer_rt_f[0], buffer_rt_f[1],
+ 1, 0, if_typed<ct, double>(22, 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>(22, 23), 4.60853);
+
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_g", buffer_rt_g[0], buffer_rt_g[1],
+ 1, 0, 17, 16.571);
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_g_rev", buffer_rt_g[1], buffer_rt_g[0],
+ 1, 0, 17, 16.571);
+
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_i", buffer_rt_i[0], buffer_rt_i[1],
+ 1, 0, 13, 13.6569);
+
+ bool test_rt_i_rev = true;
+#ifndef _MSC_VER
+ if (boost::is_same<ct, float>::type::value)
+ {
+ // TODO: this case has to be fixed for gcc/float on non-Windows
+ test_rt_i_rev = false;
+ }
+
+#endif
+ if (test_rt_i_rev)
+ {
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_i_rev", buffer_rt_i[1], buffer_rt_i[0],
+ 1, 0, 13, 13.6569);
+ }
+
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_j", buffer_rt_j[0], buffer_rt_j[1],
+ 1, 0, -1, 16.5711);
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_j_rev", buffer_rt_j[1], buffer_rt_j[0],
+ 1, 0, -1, 16.5711);
+
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_l", buffer_rt_l[0], buffer_rt_l[1],
+ 1, 0, -1, 19.3995);
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_l_rev", buffer_rt_l[1], buffer_rt_l[0],
+ 1, 0, -1, 19.3995);
+
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_m1", buffer_rt_m1[0], buffer_rt_m1[1],
+ 1, 0, if_typed_tt<ct>(14, 13), 19.4852);
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_m1_rev", buffer_rt_m1[1], buffer_rt_m1[0],
+ 1, 0, if_typed_tt<ct>(14, 13), 19.4852);
+
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_m2", buffer_rt_m2[0], buffer_rt_m2[1],
+ 1, 0, if_typed_tt<ct>(20, 19), 21.4853);
+ 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);
+
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_q", buffer_rt_q[0], buffer_rt_q[1],
+ 1, 0, if_typed<ct, float>(18, 17), 18.5710);
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_q_rev", buffer_rt_q[1], buffer_rt_q[0],
+ 1, 0, if_typed<ct, float>(18, 17), 18.5710);
+
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_r", buffer_rt_r[0], buffer_rt_r[1],
+ 1, 0, if_typed<ct, float>(19, 20), 21.07612);
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_r_rev", buffer_rt_r[1], buffer_rt_r[0],
+ 1, 0, if_typed_tt<ct>(20, 19), 21.07612);
+
+ 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);
+ test_one<Polygon, Polygon, Polygon>("buffer_rt_t_ref", buffer_rt_t[1], buffer_rt_t[0],
+ 1, 0, if_typed_tt<ct>(16, 14), 15.6569);
+
+ test_one<Polygon, Polygon, Polygon>("buffer_mp1", buffer_mp1[0], buffer_mp1[1],
+ 1, 0, 91, 22.815);
+
+ if (boost::is_same<ct, double>::type::value)
+ {
+ // Contains robustness issue for collinear-opposite.
+ // In double it delivers a polygon and a hole
+ test_one<Polygon, Polygon, Polygon>("buffer_mp2", buffer_mp2[0], buffer_mp2[1],
+ 1, 1, 218, 36.7535642);
+ }
+ else if (boost::is_same<ct, float>::type::value)
+ {
+ // In float (and ttmath) it delivers one polygon
+ test_one<Polygon, Polygon, Polygon>("buffer_mp2", buffer_mp2[0], buffer_mp2[1],
+ 1, 0, 217, 36.7528377);
+ }
+}
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::polygon<P> polygon;
+ typedef bg::model::ring<P> ring;
+ typedef bg::model::box<P> box;
+
+ test_areal<ring, polygon>();
+
+#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
+ // Open
+ test_areal<bg::model::ring<P, true, false>, bg::model::polygon<P, true, false> >();
+
+ // Counter clockwise
+ test_areal<bg::model::ring<P, false>, bg::model::polygon<P, false> >();
+
+ // Counter clockwise and open
+ test_areal<bg::model::ring<P, false, false>, bg::model::polygon<P, false, false> >();
+#endif
+
+ test_one<polygon, box, polygon>("box_ring", example_box, example_ring,
+ 1, 1, 15, 6.38875);
+
+ test_one<polygon, box, polygon>("box_poly", example_box, example_polygon,
+ 1, 3, 23, 6.30983);
+
+
+ test_one<polygon, box, polygon>("box_poly1", example_box,
+ "POLYGON((3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2))",
+ 1, 1, 15, 6.38875);
+ test_one<polygon, box, polygon>("box_poly2", example_box,
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,5.3 2.5,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3))",
+ 1, 1, 15, 5.93625);
+
+ // 3: see areal
+
+ test_one<polygon, box, polygon>("box_poly4", example_box,
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,4.5 2.5,4.5 1.2,4.9 0.8,2.9 0.7,2 1.3))",
+ 1, 1, 15, 4.651245);
+
+ test_one<polygon, box, polygon>("box_poly5", example_box,
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,4.5 2.5,4.5 2.3,5.0 2.3,5.0 2.1,4.5 2.1,4.5 1.9,4.0 1.9,4.5 1.2,4.9 0.8,2.9 0.7,2 1.3))",
+ 1, 1, 21, 4.7191);
+
+ test_one<polygon, box, polygon>("box_poly6", example_box,
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,4.5 1.2,2.9 0.7,2 1.3))",
+ 1, 1, 15, 4.2174);
+
+ test_one<polygon, box, polygon>("box_poly7", example_box,
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.0 3.0,5.0 2.0,2.9 0.7,2 1.3))",
+ 1, 1, 17, 4.270554);
+
+ test_one<polygon, box, polygon>("box_poly8", "box(0 0, 3 3)",
+ "POLYGON((2 2, 1 4, 2 4, 3 3, 2 2))",
+ 1, 0, 8, 10.25);
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<double> >();
+#if defined(HAVE_TTMATH)
+ std::cout << "Testing TTMATH" << std::endl;
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
+ test_all<bg::model::d2::point_xy<float> >();
+ //test_all<bg::model::d2::point_xy<long double> >();
+
+#if defined(HAVE_TTMATH)
+ std::cout << "Testing TTMATH" << std::endl;
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/union.vcproj b/libs/geometry/test/algorithms/union.vcproj
new file mode 100644
index 000000000..a3399b777
--- /dev/null
+++ b/libs/geometry/test/algorithms/union.vcproj
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="union"
+ ProjectGUID="{CA5EE1D6-CB4B-4A15-85C5-31D5C00289C4}"
+ RootNamespace="union"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\union"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/bigobj"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NONDLL;_CRT_SECURE_NO_WARNINGS"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\union"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NONDLL;_CRT_SECURE_NO_WARNINGS"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\union.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/unique.cpp b/libs/geometry/test/algorithms/unique.cpp
new file mode 100644
index 000000000..4460029eb
--- /dev/null
+++ b/libs/geometry/test/algorithms/unique.cpp
@@ -0,0 +1,60 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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_unique.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+
+
+template <typename Point>
+void test_all()
+{
+ test_geometry<bg::model::linestring<Point> >(
+ "LINESTRING(0 0,1 1)",
+ "LINESTRING(0 0,1 1)");
+
+ test_geometry<bg::model::linestring<Point> >(
+ "LINESTRING(0 0,1 1,1 1)",
+ "LINESTRING(0 0,1 1)");
+
+ test_geometry<bg::model::linestring<Point> >(
+ "LINESTRING(0 0,0 0,1 1)",
+ "LINESTRING(0 0,1 1)");
+
+ // Consecutive points
+ test_geometry<bg::model::linestring<Point> >(
+ "LINESTRING(0 0,0 0,0 0,0 0,1 1,1 1,1 1)",
+ "LINESTRING(0 0,1 1)");
+
+ // Other types
+ test_geometry<bg::model::ring<Point> >(
+ "POLYGON((0 0,0 1,1 1,1 1,1 1,1 0,0 0,0 0))",
+ "POLYGON((0 0,0 1,1 1,1 0,0 0))");
+
+ // With holes
+ test_geometry<bg::model::polygon<Point> >(
+ "POLYGON((0 0,0 10,10 10,10 10,10 10,10 0,0 0,0 0))",
+ "POLYGON((0 0,0 10,10 10,10 0,0 0))");
+}
+
+
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<int> >();
+ 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/unique.vcproj b/libs/geometry/test/algorithms/unique.vcproj
new file mode 100644
index 000000000..e4a67084e
--- /dev/null
+++ b/libs/geometry/test/algorithms/unique.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="unique"
+ ProjectGUID="{104D31F9-49BA-4A1A-B84F-0A3AEE3C4DB2}"
+ RootNamespace="unique"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\unique"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\unique"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\unique.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/within.cpp b/libs/geometry/test/algorithms/within.cpp
new file mode 100644
index 000000000..ccf75c673
--- /dev/null
+++ b/libs/geometry/test/algorithms/within.cpp
@@ -0,0 +1,271 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 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_within.hpp>
+
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+
+template <typename P>
+void test_all()
+{
+ // trivial case
+ test_ring<P>("POINT(1 1)", "POLYGON((0 0,0 2,2 2,2 0,0 0))", true, false);
+
+ // on border/corner
+ test_ring<P>("POINT(0 0)", "POLYGON((0 0,0 2,2 2,2 0,0 0))", false, true);
+ test_ring<P>("POINT(0 1)", "POLYGON((0 0,0 2,2 2,2 0,0 0))", false, true);
+
+ // aligned to segment/vertex
+ test_ring<P>("POINT(1 1)", "POLYGON((0 0,0 3,3 3,3 1,2 1,2 0,0 0))", true, false);
+ test_ring<P>("POINT(1 1)", "POLYGON((0 0,0 3,4 3,3 1,2 2,2 0,0 0))", true, false);
+
+ // same polygon, but point on border
+ test_ring<P>("POINT(3 3)", "POLYGON((0 0,0 3,3 3,3 1,2 1,2 0,0 0))", false, true);
+ test_ring<P>("POINT(3 3)", "POLYGON((0 0,0 3,4 3,3 1,2 2,2 0,0 0))", false, true);
+
+ // holes
+ test_geometry<P, bg::model::polygon<P> >("POINT(2 2)",
+ "POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,3 1,3 3,1 3,1 1))", false);
+
+ typedef bg::model::box<P> box_type;
+
+ test_geometry<P, box_type>("POINT(1 1)", "BOX(0 0,2 2)", true);
+ test_geometry<P, box_type>("POINT(0 0)", "BOX(0 0,2 2)", false);
+ test_geometry<P, box_type>("POINT(2 2)", "BOX(0 0,2 2)", false);
+ test_geometry<P, box_type>("POINT(0 1)", "BOX(0 0,2 2)", false);
+ test_geometry<P, box_type>("POINT(1 0)", "BOX(0 0,2 2)", false);
+
+ test_geometry<box_type, box_type>("BOX(1 1,2 2)", "BOX(0 0,3 3)", true);
+ test_geometry<box_type, box_type>("BOX(0 0,3 3)", "BOX(1 1,2 2)", false);
+
+ /*
+ test_within_code<P, box_type>("POINT(1 1)", "BOX(0 0,2 2)", 1);
+ test_within_code<P, box_type>("POINT(1 0)", "BOX(0 0,2 2)", 0);
+ test_within_code<P, box_type>("POINT(0 1)", "BOX(0 0,2 2)", 0);
+ test_within_code<P, box_type>("POINT(0 3)", "BOX(0 0,2 2)", -1);
+ test_within_code<P, box_type>("POINT(3 3)", "BOX(0 0,2 2)", -1);
+
+ test_within_code<box_type, box_type>("BOX(1 1,2 2)", "BOX(0 0,3 3)", 1);
+ test_within_code<box_type, box_type>("BOX(0 1,2 2)", "BOX(0 0,3 3)", 0);
+ test_within_code<box_type, box_type>("BOX(1 0,2 2)", "BOX(0 0,3 3)", 0);
+ test_within_code<box_type, box_type>("BOX(1 1,2 3)", "BOX(0 0,3 3)", 0);
+ test_within_code<box_type, box_type>("BOX(1 1,3 2)", "BOX(0 0,3 3)", 0);
+ test_within_code<box_type, box_type>("BOX(1 1,3 4)", "BOX(0 0,3 3)", -1);
+ */
+
+ // Real-life problem (solved now), point is in the middle, 409623 is also a coordinate
+ // on the border, has been wrong in the past (2009)
+ test_ring<P>("POINT(146383 409623)",
+ "POLYGON((146351 410597,146521 410659,147906 410363,148088 410420"
+ ",148175 410296,148281 409750,148215 409623,148154 409666,148154 409666"
+ ",148130 409625,148035 409626,148035 409626,148008 409544,147963 409510"
+ ",147993 409457,147961 409352,147261 408687,147008 408586,145714 408840"
+ ",145001 409033,144486 409066,144616 409308,145023 410286,145254 410488"
+ ",145618 410612,145618 410612,146015 410565,146190 410545,146351 410597))",
+ true, false);
+}
+
+template <typename Point>
+void test_spherical()
+{
+ typedef typename bg::coordinate_type<Point>::type ct;
+ bg::model::polygon<Point> wrangel;
+
+ // SQL Server check (no geography::STWithin, so check with intersection trick)
+ /*
+
+ with q as (
+ select geography::STGeomFromText('POLYGON((-178.569 71.5641,-179.034 71.5977,-179.305 71.5514,-179.629 71.5772,-180 71.5358,179.53 71.4383,178.872 71.2175,178.618 71.0355,178.791 70.7964,179.273 70.8886,179.678 70.8955,-180 70.9972,-179.274 70.9078,-178.819 70.98,-177.939 71.0375,-177.62 71.1166,-177.439 71.2269,-177.503 71.2775,-177.833 71.3461,-178.018 71.4497,-178.569 71.5641))',4326) as wrangel
+ )
+
+ select wrangel.STArea()/1000000.0
+ ,geography::STGeomFromText('POINT(-179.3 71.27)',4326).STIntersection(wrangel).STAsText() as workaround_within_1
+ ,geography::STGeomFromText('POINT(-179.9 70.95)',4326).STIntersection(wrangel).STAsText() as workaround_within_2
+ ,geography::STGeomFromText('POINT(179.9 70.95)',4326).STIntersection(wrangel).STAsText() as workaround_within_3
+ from q
+
+ -> 7669.10402181435 POINT (-179.3 71.27) GEOMETRYCOLLECTION EMPTY GEOMETRYCOLLECTION EMPTY
+
+ PostGIS knows Within for Geography neither, and the intersection trick gives the same result
+
+ */
+
+ bg::read_wkt("POLYGON((-178.568604 71.564148,-178.017548 71.449692,-177.833313 71.3461,-177.502838 71.277466 ,-177.439453 71.226929,-177.620026 71.116638,-177.9389 71.037491,-178.8186 70.979965,-179.274445 70.907761,-180 70.9972,179.678314 70.895538,179.272766 70.888596,178.791016 70.7964,178.617737 71.035538,178.872192 71.217484,179.530273 71.4383 ,-180 71.535843 ,-179.628601 71.577194,-179.305298 71.551361,-179.03421 71.597748,-178.568604 71.564148))", wrangel);
+
+ bool within = bg::within(Point(-179.3, 71.27), wrangel);
+ BOOST_CHECK_EQUAL(within, true);
+
+ within = bg::within(Point(-179.9, 70.95), wrangel);
+ BOOST_CHECK_EQUAL(within, false);
+
+ within = bg::within(Point(179.9, 70.95), wrangel);
+ BOOST_CHECK_EQUAL(within, false);
+
+ // Test using great circle mapper
+ // http://www.gcmap.com/mapui?P=5E52N-9E53N-7E50N-5E52N,7E52.5N,8E51.5N,6E51N
+
+ bg::model::polygon<Point> triangle;
+ bg::read_wkt("POLYGON((5 52,9 53,7 50,5 52))", triangle);
+ BOOST_CHECK_EQUAL(bg::within(Point(7, 52.5), triangle), true);
+ BOOST_CHECK_EQUAL(bg::within(Point(8.0, 51.5), triangle), false);
+ BOOST_CHECK_EQUAL(bg::within(Point(6.0, 51.0), triangle), false);
+
+ // Test spherical boxes
+ // See also http://www.gcmap.com/mapui?P=1E45N-19E45N-19E55N-1E55N-1E45N,10E55.1N,10E45.1N
+ bg::model::box<Point> box;
+ bg::read_wkt("POLYGON((1 45,19 55))", box);
+ BOOST_CHECK_EQUAL(bg::within(Point(10, 55.1), box), true);
+ BOOST_CHECK_EQUAL(bg::within(Point(10, 55.2), box), true);
+ BOOST_CHECK_EQUAL(bg::within(Point(10, 55.3), box), true);
+ BOOST_CHECK_EQUAL(bg::within(Point(10, 55.4), box), false);
+
+ BOOST_CHECK_EQUAL(bg::within(Point(10, 45.1), box), false);
+ BOOST_CHECK_EQUAL(bg::within(Point(10, 45.2), box), false);
+ BOOST_CHECK_EQUAL(bg::within(Point(10, 45.3), box), false);
+ BOOST_CHECK_EQUAL(bg::within(Point(10, 45.4), box), true);
+
+ // Crossing the dateline (Near Tuvalu)
+ // http://www.gcmap.com/mapui?P=178E10S-178W10S-178W6S-178E6S-178E10S,180W5.999S,180E9.999S
+ // http://en.wikipedia.org/wiki/Tuvalu
+
+ bg::model::box<Point> tuvalu(Point(178, -10), Point(-178, -6));
+ BOOST_CHECK_EQUAL(bg::within(Point(180, -8), tuvalu), true);
+ BOOST_CHECK_EQUAL(bg::within(Point(-180, -8), tuvalu), true);
+ BOOST_CHECK_EQUAL(bg::within(Point(180, -5.999), tuvalu), false);
+ BOOST_CHECK_EQUAL(bg::within(Point(180, -10.001), tuvalu), true);
+}
+
+void test_3d()
+{
+ typedef boost::geometry::model::point<double, 3, boost::geometry::cs::cartesian> point_type;
+ typedef boost::geometry::model::box<point_type> box_type;
+ box_type box(point_type(0, 0, 0), point_type(4, 4, 4));
+ BOOST_CHECK_EQUAL(bg::within(point_type(2, 2, 2), box), true);
+ BOOST_CHECK_EQUAL(bg::within(point_type(2, 4, 2), box), false);
+ BOOST_CHECK_EQUAL(bg::within(point_type(2, 2, 4), box), false);
+ BOOST_CHECK_EQUAL(bg::within(point_type(2, 2, 5), box), false);
+
+ box_type box2(point_type(2, 2, 2), point_type(3, 3, 3));
+ BOOST_CHECK_EQUAL(bg::within(box2, box), true);
+
+}
+
+template <typename P1, typename P2>
+void test_mixed_of()
+{
+ typedef boost::geometry::model::polygon<P1> polygon_type1;
+ typedef boost::geometry::model::polygon<P2> polygon_type2;
+ typedef boost::geometry::model::box<P1> box_type1;
+ typedef boost::geometry::model::box<P2> box_type2;
+
+ polygon_type1 poly1, poly2;
+ boost::geometry::read_wkt("POLYGON((0 0,0 5,5 5,5 0,0 0))", poly1);
+ boost::geometry::read_wkt("POLYGON((0 0,0 5,5 5,5 0,0 0))", poly2);
+
+ box_type1 box1(P1(1, 1), P1(4, 4));
+ box_type2 box2(P2(0, 0), P2(5, 5));
+ P1 p1(3, 3);
+ P2 p2(3, 3);
+
+ BOOST_CHECK_EQUAL(bg::within(p1, poly2), true);
+ BOOST_CHECK_EQUAL(bg::within(p2, poly1), true);
+ BOOST_CHECK_EQUAL(bg::within(p2, box1), true);
+ BOOST_CHECK_EQUAL(bg::within(p1, box2), true);
+ BOOST_CHECK_EQUAL(bg::within(box1, box2), true);
+ BOOST_CHECK_EQUAL(bg::within(box2, box1), false);
+}
+
+
+void test_mixed()
+{
+ // Mixing point types and coordinate types
+ test_mixed_of
+ <
+ boost::geometry::model::d2::point_xy<double>,
+ boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>
+ >();
+ test_mixed_of
+ <
+ boost::geometry::model::d2::point_xy<float>,
+ boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>
+ >();
+ test_mixed_of
+ <
+ boost::geometry::model::d2::point_xy<int>,
+ boost::geometry::model::d2::point_xy<double>
+ >();
+}
+
+void test_strategy()
+{
+ // Test by explicitly specifying a strategy
+ typedef bg::model::d2::point_xy<double> point_type;
+ typedef bg::model::box<point_type> box_type;
+ point_type p(3, 3);
+ box_type b(point_type(0, 0), point_type(5, 5));
+
+ bool r = bg::within(p, b,
+ bg::strategy::within::point_in_box<point_type, box_type>());
+ BOOST_CHECK_EQUAL(r, true);
+
+ r = bg::within(b, b,
+ bg::strategy::within::box_in_box<box_type, box_type>());
+ BOOST_CHECK_EQUAL(r, false);
+
+ r = bg::within(p, b,
+ bg::strategy::within::point_in_box_by_side<point_type, box_type>());
+ BOOST_CHECK_EQUAL(r, true);
+}
+
+
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ std::string const polygon_li = "POLYGON((1872000 528000,1872000 192000,1536119 192000,1536000 528000,1200000 528000,1200000 863880,1536000 863880,1872000 863880,1872000 528000))";
+ bg::model::polygon<int_point_type> int_poly;
+ bg::model::polygon<double_point_type> double_poly;
+ bg::read_wkt(polygon_li, int_poly);
+ bg::read_wkt(polygon_li, double_poly);
+
+ std::string const point_li = "POINT(1592000 583950)";
+ int_point_type int_point;
+ double_point_type double_point;
+ bg::read_wkt(point_li, int_point);
+ bg::read_wkt(point_li, double_point);
+
+ bool wi = bg::within(int_point, int_poly);
+ bool wd = bg::within(double_point, double_poly);
+
+ BOOST_CHECK_MESSAGE(wi == wd, "within<a double> different from within<an int>");
+}
+
+int test_main( int , char* [] )
+{
+ test_large_integers();
+
+ test_all<bg::model::d2::point_xy<int> >();
+ test_all<bg::model::d2::point_xy<double> >();
+
+ test_spherical<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> > >();
+
+ test_mixed();
+ test_3d();
+ test_strategy();
+
+
+#if defined(HAVE_TTMATH)
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+ test_spherical<bg::model::point<ttmath_big, 2, bg::cs::spherical_equatorial<bg::degree> > >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/within.vcproj b/libs/geometry/test/algorithms/within.vcproj
new file mode 100644
index 000000000..89d03ef72
--- /dev/null
+++ b/libs/geometry/test/algorithms/within.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="within"
+ ProjectGUID="{C7BCD670-543D-4B29-B2D6-F3169949F79D}"
+ RootNamespace="within"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\within"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\within"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\within.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/arithmetic/Jamfile.v2 b/libs/geometry/test/arithmetic/Jamfile.v2
new file mode 100644
index 000000000..a1a9db0f3
--- /dev/null
+++ b/libs/geometry/test/arithmetic/Jamfile.v2
@@ -0,0 +1,15 @@
+# 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-arithmetic
+ :
+ [ run arithmetic.cpp ]
+ [ run dot_product.cpp ]
+ ;
diff --git a/libs/geometry/test/arithmetic/arithmetic.cpp b/libs/geometry/test/arithmetic/arithmetic.cpp
new file mode 100644
index 000000000..f7d2e3427
--- /dev/null
+++ b/libs/geometry/test/arithmetic/arithmetic.cpp
@@ -0,0 +1,144 @@
+// 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.
+
+// 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/geometry/arithmetic/arithmetic.hpp>
+
+#include <boost/geometry/algorithms/assign.hpp>
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include <test_common/test_point.hpp>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+template <typename P>
+void test_addition()
+{
+ P p1;
+ bg::assign_values(p1, 1, 2, 3);
+ bg::add_value(p1, 10);
+ BOOST_CHECK(bg::get<0>(p1) == 11);
+ BOOST_CHECK(bg::get<1>(p1) == 12);
+ BOOST_CHECK(bg::get<2>(p1) == 13);
+
+ P p2;
+ bg::assign_values(p2, 4, 5, 6);
+ bg::add_point(p1, p2);
+ BOOST_CHECK(bg::get<0>(p1) == 15);
+ BOOST_CHECK(bg::get<1>(p1) == 17);
+ BOOST_CHECK(bg::get<2>(p1) == 19);
+}
+
+template <typename P>
+void test_subtraction()
+{
+ P p1;
+ bg::assign_values(p1, 1, 2, 3);
+ bg::subtract_value(p1, 10);
+ BOOST_CHECK(bg::get<0>(p1) == -9);
+ BOOST_CHECK(bg::get<1>(p1) == -8);
+ BOOST_CHECK(bg::get<2>(p1) == -7);
+
+ P p2;
+ bg::assign_values(p2, 4, 6, 8);
+ bg::subtract_point(p1, p2);
+ BOOST_CHECK(bg::get<0>(p1) == -13);
+ BOOST_CHECK(bg::get<1>(p1) == -14);
+ BOOST_CHECK(bg::get<2>(p1) == -15);
+}
+
+template <typename P>
+void test_multiplication()
+{
+ P p1;
+ bg::assign_values(p1, 1, 2, 3);
+ bg::multiply_value(p1, 5);
+ BOOST_CHECK(bg::get<0>(p1) == 5);
+ BOOST_CHECK(bg::get<1>(p1) == 10);
+ BOOST_CHECK(bg::get<2>(p1) == 15);
+
+ P p2;
+ bg::assign_values(p2, 4, 5, 6);
+ bg::multiply_point(p1, p2);
+ BOOST_CHECK(bg::get<0>(p1) == 20);
+ BOOST_CHECK(bg::get<1>(p1) == 50);
+ BOOST_CHECK(bg::get<2>(p1) == 90);
+}
+
+template <typename P>
+void test_division()
+{
+ P p1;
+ bg::assign_values(p1, 50, 100, 150);
+ bg::divide_value(p1, 5);
+ BOOST_CHECK(bg::get<0>(p1) == 10);
+ BOOST_CHECK(bg::get<1>(p1) == 20);
+ BOOST_CHECK(bg::get<2>(p1) == 30);
+
+ P p2;
+ bg::assign_values(p2, 2, 4, 6);
+ bg::divide_point(p1, p2);
+ BOOST_CHECK(bg::get<0>(p1) == 5);
+ BOOST_CHECK(bg::get<1>(p1) == 5);
+ BOOST_CHECK(bg::get<2>(p1) == 5);
+}
+
+template <typename P>
+void test_assign()
+{
+ P p1;
+ P p2;
+ bg::assign_values(p1, 12, 34, 56);
+ bg::assign_point(p2, p1);
+ BOOST_CHECK(bg::get<0>(p2) == 12);
+ BOOST_CHECK(bg::get<1>(p2) == 34);
+ BOOST_CHECK(bg::get<2>(p2) == 56);
+
+ bg::assign_value(p2, 78);
+ BOOST_CHECK(bg::get<0>(p2) == 78);
+ BOOST_CHECK(bg::get<1>(p2) == 78);
+ BOOST_CHECK(bg::get<2>(p2) == 78);
+}
+
+
+template <typename P>
+void test_all()
+{
+ test_addition<P>();
+ test_subtraction<P>();
+ test_multiplication<P>();
+ test_division<P>();
+ test_assign<P>();
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<int[3]>();
+ test_all<float[3]>();
+ test_all<double[3]>();
+ test_all<test::test_point>();
+ test_all<bg::model::point<int, 3, bg::cs::cartesian> >();
+ test_all<bg::model::point<float, 3, bg::cs::cartesian> >();
+ test_all<bg::model::point<double, 3, bg::cs::cartesian> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/arithmetic/arithmetic.vcproj b/libs/geometry/test/arithmetic/arithmetic.vcproj
new file mode 100644
index 000000000..f2d448a33
--- /dev/null
+++ b/libs/geometry/test/arithmetic/arithmetic.vcproj
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="arithmetic"
+ ProjectGUID="{4D447233-54DC-4C1B-B8DF-4689590ACF56}"
+ RootNamespace="arithmetic"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\arithmetic"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ RuntimeLibrary="1"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\arithmetic"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\arithmetic.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/arithmetic/arithmetic_tests.sln b/libs/geometry/test/arithmetic/arithmetic_tests.sln
new file mode 100644
index 000000000..37a636a0e
--- /dev/null
+++ b/libs/geometry/test/arithmetic/arithmetic_tests.sln
@@ -0,0 +1,25 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "arithmetic", "arithmetic.vcproj", "{4D447233-54DC-4C1B-B8DF-4689590ACF56}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dot_product", "dot_product.vcproj", "{C9CD2A98-3327-4560-A979-4BF506F777A8}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4D447233-54DC-4C1B-B8DF-4689590ACF56}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4D447233-54DC-4C1B-B8DF-4689590ACF56}.Debug|Win32.Build.0 = Debug|Win32
+ {4D447233-54DC-4C1B-B8DF-4689590ACF56}.Release|Win32.ActiveCfg = Release|Win32
+ {4D447233-54DC-4C1B-B8DF-4689590ACF56}.Release|Win32.Build.0 = Release|Win32
+ {C9CD2A98-3327-4560-A979-4BF506F777A8}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C9CD2A98-3327-4560-A979-4BF506F777A8}.Debug|Win32.Build.0 = Debug|Win32
+ {C9CD2A98-3327-4560-A979-4BF506F777A8}.Release|Win32.ActiveCfg = Release|Win32
+ {C9CD2A98-3327-4560-A979-4BF506F777A8}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/arithmetic/dot_product.cpp b/libs/geometry/test/arithmetic/dot_product.cpp
new file mode 100644
index 000000000..2242e3c30
--- /dev/null
+++ b/libs/geometry/test/arithmetic/dot_product.cpp
@@ -0,0 +1,53 @@
+// 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.
+
+// 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/geometry/arithmetic/dot_product.hpp>
+
+
+#include <boost/geometry/algorithms/assign.hpp>
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include <test_common/test_point.hpp>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+template <typename P>
+void test_all()
+{
+ P p1;
+ bg::assign_values(p1, 1, 2, 3);
+ P p2;
+ bg::assign_values(p2, 4, 5, 6);
+ BOOST_CHECK(bg::dot_product(p1, p2) == 1*4 + 2*5 + 3*6);
+}
+
+int test_main(int, char* [])
+{
+ test_all<int[3]>();
+ test_all<float[3]>();
+ test_all<double[3]>();
+ test_all<test::test_point>();
+ test_all<bg::model::point<int, 3, bg::cs::cartesian> >();
+ test_all<bg::model::point<float, 3, bg::cs::cartesian> >();
+ test_all<bg::model::point<double, 3, bg::cs::cartesian> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/arithmetic/dot_product.vcproj b/libs/geometry/test/arithmetic/dot_product.vcproj
new file mode 100644
index 000000000..879b92154
--- /dev/null
+++ b/libs/geometry/test/arithmetic/dot_product.vcproj
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="dot_product"
+ ProjectGUID="{C9CD2A98-3327-4560-A979-4BF506F777A8}"
+ RootNamespace="dot_product"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\dot_product"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ RuntimeLibrary="1"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\dot_product"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\dot_product.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/boost.vsprops b/libs/geometry/test/boost.vsprops
new file mode 100644
index 000000000..c527810d4
--- /dev/null
+++ b/libs/geometry/test/boost.vsprops
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="boost"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="&quot;$(BOOST_ROOT)&quot;;../../.."
+ PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+ WarningLevel="3"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalLibraryDirectories="$(BOOST_ROOT)\lib"
+ />
+ <UserMacro
+ Name="BOOST_ROOT"
+ Value="../../.."
+ />
+</VisualStudioPropertySheet>
diff --git a/libs/geometry/test/concepts/Jamfile.v2 b/libs/geometry/test/concepts/Jamfile.v2
new file mode 100644
index 000000000..476e0be11
--- /dev/null
+++ b/libs/geometry/test/concepts/Jamfile.v2
@@ -0,0 +1,15 @@
+# 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-concepts
+ :
+ [ run linestring_concept.cpp ]
+ [ run polygon_concept.cpp ]
+ ;
diff --git a/libs/geometry/test/concepts/concepts_tests.sln b/libs/geometry/test/concepts/concepts_tests.sln
new file mode 100644
index 000000000..1430bdcc0
--- /dev/null
+++ b/libs/geometry/test/concepts/concepts_tests.sln
@@ -0,0 +1,25 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "linestring_concept", "linestring_concept.vcproj", "{CA8D5E44-7D8F-44A1-900C-35C28890299B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "polygon_concept", "polygon_concept.vcproj", "{306B99D1-576A-4EB6-BF7E-B111CA3807FE}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {CA8D5E44-7D8F-44A1-900C-35C28890299B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CA8D5E44-7D8F-44A1-900C-35C28890299B}.Debug|Win32.Build.0 = Debug|Win32
+ {CA8D5E44-7D8F-44A1-900C-35C28890299B}.Release|Win32.ActiveCfg = Release|Win32
+ {CA8D5E44-7D8F-44A1-900C-35C28890299B}.Release|Win32.Build.0 = Release|Win32
+ {306B99D1-576A-4EB6-BF7E-B111CA3807FE}.Debug|Win32.ActiveCfg = Debug|Win32
+ {306B99D1-576A-4EB6-BF7E-B111CA3807FE}.Debug|Win32.Build.0 = Debug|Win32
+ {306B99D1-576A-4EB6-BF7E-B111CA3807FE}.Release|Win32.ActiveCfg = Release|Win32
+ {306B99D1-576A-4EB6-BF7E-B111CA3807FE}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/concepts/linestring_concept.cpp b/libs/geometry/test/concepts/linestring_concept.cpp
new file mode 100644
index 000000000..befce07bb
--- /dev/null
+++ b/libs/geometry/test/concepts/linestring_concept.cpp
@@ -0,0 +1,77 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2011-2012 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 <deque>
+#include <vector>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/append.hpp>
+#include <boost/geometry/algorithms/clear.hpp>
+#include <boost/geometry/algorithms/make.hpp>
+#include <boost/geometry/core/access.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/concepts/linestring_concept.hpp>
+
+#include <boost/geometry/io/dsv/write.hpp>
+
+
+#include <test_common/test_point.hpp>
+#include <test_geometries/all_custom_linestring.hpp>
+#include <test_geometries/wrapped_boost_array.hpp>
+
+
+
+template <typename Geometry>
+void test_linestring()
+{
+ BOOST_CONCEPT_ASSERT( (bg::concept::Linestring<Geometry>) );
+ BOOST_CONCEPT_ASSERT( (bg::concept::ConstLinestring<Geometry>) );
+
+ Geometry geometry;
+ typedef typename bg::point_type<Geometry>::type P;
+
+ bg::clear(geometry);
+ BOOST_CHECK_EQUAL(boost::size(geometry), 0);
+
+ bg::append(geometry, bg::make<P>(1, 2));
+ BOOST_CHECK_EQUAL(boost::size(geometry), 1);
+
+ bg::append(geometry, bg::make<P>(3, 4));
+ BOOST_CHECK_EQUAL(boost::size(geometry), 2);
+
+ bg::traits::resize<Geometry>::apply(geometry, 1);
+ BOOST_CHECK_EQUAL(boost::size(geometry), 1);
+
+ //std::cout << bg::dsv(geometry) << std::endl;
+ P p = *boost::begin(geometry);
+ //std::cout << bg::dsv(p) << std::endl;
+ BOOST_CHECK_EQUAL(bg::get<0>(p), 1);
+ BOOST_CHECK_EQUAL(bg::get<1>(p), 2);
+
+ bg::clear(geometry);
+ BOOST_CHECK_EQUAL(boost::size(geometry), 0);
+}
+
+template <typename Point>
+void test_all()
+{
+ test_linestring<bg::model::linestring<Point> >();
+ test_linestring<test::wrapped_boost_array<Point, 10> >();
+ test_linestring<all_custom_linestring<Point> >();
+}
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/concepts/linestring_concept.vcproj b/libs/geometry/test/concepts/linestring_concept.vcproj
new file mode 100644
index 000000000..c40b03bf1
--- /dev/null
+++ b/libs/geometry/test/concepts/linestring_concept.vcproj
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="linestring_concept"
+ ProjectGUID="{CA8D5E44-7D8F-44A1-900C-35C28890299B}"
+ RootNamespace="linestring_concept"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\linestring_concept"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\linestring_concept"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\linestring_concept.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/core/Jamfile.v2 b/libs/geometry/test/core/Jamfile.v2
new file mode 100644
index 000000000..398d1e025
--- /dev/null
+++ b/libs/geometry/test/core/Jamfile.v2
@@ -0,0 +1,26 @@
+# 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-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 reverse_dispatch.cpp ]
+ [ run ring.cpp ]
+ [ run tag.cpp ]
+ [ run topological_dimension.cpp ]
+ ;
+
+# The reverse_dispatch somehow asks for UAC-control on MinGW...
diff --git a/libs/geometry/test/core/access.cpp b/libs/geometry/test/core/access.cpp
new file mode 100644
index 000000000..451348bb4
--- /dev/null
+++ b/libs/geometry/test/core/access.cpp
@@ -0,0 +1,133 @@
+// 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.
+
+// 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/geometry/core/access.hpp>
+
+
+#include <boost/geometry/core/coordinate_type.hpp>
+#include <boost/geometry/algorithms/make.hpp>
+
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+
+#include <boost/geometry/core/cs.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/segment.hpp>
+#include <boost/geometry/geometries/box.hpp>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+template <typename G>
+void test_get_set()
+{
+ typedef typename bg::coordinate_type<G>::type coordinate_type;
+
+ G g;
+ bg::set<0>(g, coordinate_type(1));
+ bg::set<1>(g, coordinate_type(2));
+
+ coordinate_type x = bg::get<0>(g);
+ coordinate_type y = bg::get<1>(g);
+
+ BOOST_CHECK_CLOSE(double(x), 1.0, 0.0001);
+ BOOST_CHECK_CLOSE(double(y), 2.0, 0.0001);
+}
+
+template <typename G>
+void test_indexed_get_set(G& g)
+{
+ bg::set<0, 0>(g, 1);
+ bg::set<0, 1>(g, 2);
+ bg::set<1, 0>(g, 3);
+ bg::set<1, 1>(g, 4);
+
+ typedef typename bg::coordinate_type<G>::type coordinate_type;
+ coordinate_type x1 = bg::get<0, 0>(g);
+ coordinate_type y1 = bg::get<0, 1>(g);
+ coordinate_type x2 = bg::get<1, 0>(g);
+ coordinate_type y2 = bg::get<1, 1>(g);
+
+ BOOST_CHECK_CLOSE(double(x1), 1.0, 0.0001);
+ BOOST_CHECK_CLOSE(double(y1), 2.0, 0.0001);
+ BOOST_CHECK_CLOSE(double(x2), 3.0, 0.0001);
+ BOOST_CHECK_CLOSE(double(y2), 4.0, 0.0001);
+}
+
+template <typename G, typename T>
+void test_indexed_get(G const& g, T a, T b, T c, T d)
+{
+ T x1 = bg::get<0, 0>(g);
+ T y1 = bg::get<0, 1>(g);
+ T x2 = bg::get<1, 0>(g);
+ T y2 = bg::get<1, 1>(g);
+
+ BOOST_CHECK_CLOSE(double(x1), double(a), 0.0001);
+ BOOST_CHECK_CLOSE(double(y1), double(b), 0.0001);
+ BOOST_CHECK_CLOSE(double(x2), double(c), 0.0001);
+ BOOST_CHECK_CLOSE(double(y2), double(d), 0.0001);
+}
+
+template <typename P>
+void test_all()
+{
+ typedef typename bg::coordinate_type<P>::type coordinate_type;
+
+ // POINT, setting coordinate
+ test_get_set<P>();
+
+
+ // BOX, setting left/right/top/bottom
+ bg::model::box<P> b;
+ test_indexed_get_set(b);
+
+ // SEGMENT (in GGL not having default constructor; however that is not a requirement)
+ P p1 = bg::make_zero<P>();
+ P p2 = bg::make_zero<P>();
+ bg::model::referring_segment<P> s(p1, p2);
+ test_indexed_get_set(s);
+
+ // CONST SEGMENT
+ bg::set<0>(p1, 1); // we don't use assign because dim in {2,3}
+ bg::set<1>(p1, 2);
+ bg::set<0>(p2, 3);
+ bg::set<1>(p2, 4);
+ bg::model::referring_segment<P const> cs(p1, p2);
+ test_indexed_get(cs,
+ coordinate_type(1), coordinate_type(2),
+ coordinate_type(3), coordinate_type(4));
+}
+
+
+int test_main(int, char* [])
+{
+ test_get_set<int[2]>();
+ test_get_set<float[2]>();
+ test_get_set<double[2]>();
+ test_get_set<double[3]>();
+
+ test_get_set<boost::tuple<double, double> >();
+
+ test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/core/access.vcproj b/libs/geometry/test/core/access.vcproj
new file mode 100644
index 000000000..845fa4efe
--- /dev/null
+++ b/libs/geometry/test/core/access.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="access"
+ ProjectGUID="{5542B963-D229-4393-968F-E62DDCE4B87B}"
+ RootNamespace="access"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\access"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\access"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\access.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/core/coordinate_dimension.cpp b/libs/geometry/test/core/coordinate_dimension.cpp
new file mode 100644
index 000000000..94a90bbfd
--- /dev/null
+++ b/libs/geometry/test/core/coordinate_dimension.cpp
@@ -0,0 +1,74 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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/core/coordinate_dimension.hpp>
+
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+#include <boost/geometry/geometries/register/linestring.hpp>
+
+#include <vector>
+#include <deque>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque)
+
+
+template <typename G, int Expected>
+void test_geometry()
+{
+ BOOST_CHECK_EQUAL(bg::dimension<G>::type::value, Expected);
+}
+
+template <typename P, size_t D>
+void test_all()
+{
+ test_geometry<P, D>();
+ test_geometry<P const, D>();
+ test_geometry<bg::model::linestring<P> , D>();
+ test_geometry<bg::model::ring<P> , D>();
+ test_geometry<bg::model::polygon<P> , D>();
+ test_geometry<bg::model::box<P> , D>();
+ test_geometry<bg::model::segment<P> , D>();
+ test_geometry<bg::model::referring_segment<P const> , D>();
+
+ test_geometry<std::vector<P>, D>();
+ test_geometry<std::deque<P>, D>();
+}
+
+int test_main(int, char* [])
+{
+ test_geometry<int[2], 2>();
+ test_geometry<float[2], 2>();
+ test_geometry<double[2], 2>();
+
+ test_geometry<int[3], 3>();
+ test_geometry<float[3], 3>();
+ test_geometry<double[3], 3>();
+
+ test_geometry<boost::tuple<double, double>, 2>();
+ test_geometry<boost::tuple<double, double, double>, 3>();
+
+ test_all<bg::model::point<int, 2, bg::cs::cartesian>, 2 >();
+ test_all<bg::model::point<float, 2, bg::cs::cartesian>, 2 >();
+ test_all<bg::model::point<double, 2, bg::cs::cartesian>, 2 >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/core/coordinate_system.cpp b/libs/geometry/test/core/coordinate_system.cpp
new file mode 100644
index 000000000..5a79f329e
--- /dev/null
+++ b/libs/geometry/test/core/coordinate_system.cpp
@@ -0,0 +1,101 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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/core/coordinate_system.hpp>
+
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+#include <boost/geometry/geometries/register/linestring.hpp>
+
+#include <vector>
+#include <deque>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque)
+
+
+template <typename G, typename Expected>
+void test_geometry()
+{
+ BOOST_CHECK_EQUAL(typeid(typename bg::coordinate_system<G>::type).name(),
+ typeid(Expected).name());
+}
+
+template <typename P, typename Expected>
+void test_all()
+{
+ test_geometry<P, Expected>();
+ test_geometry<P const, Expected>();
+ test_geometry<bg::model::linestring<P> , Expected>();
+ test_geometry<bg::model::ring<P> , Expected>();
+ test_geometry<bg::model::polygon<P> , Expected>();
+ test_geometry<bg::model::box<P> , Expected>();
+ test_geometry<bg::model::segment<P> , Expected>();
+ test_geometry<bg::model::referring_segment<P const> , Expected>();
+
+ test_geometry<std::vector<P>, Expected>();
+ test_geometry<std::deque<P>, Expected>();
+}
+
+int test_main(int, char* [])
+{
+ // Because of the included headerfiles, there are always cartesian
+ test_geometry<int[2], bg::cs::cartesian>();
+ test_geometry<float[2], bg::cs::cartesian>();
+ test_geometry<double[2], bg::cs::cartesian>();
+
+ test_geometry<int[3], bg::cs::cartesian>();
+ test_geometry<float[3], bg::cs::cartesian>();
+ test_geometry<double[3], bg::cs::cartesian>();
+
+ // Because of the included headerfiles, there are always cartesian
+ test_geometry<boost::tuple<double, double>, bg::cs::cartesian>();
+ test_geometry<boost::tuple<double, double, double>, bg::cs::cartesian>();
+
+
+ // Test cartesian
+ test_all<bg::model::point<int, 2, bg::cs::cartesian>, bg::cs::cartesian>();
+ test_all<bg::model::point<float, 2, bg::cs::cartesian>, bg::cs::cartesian>();
+ test_all<bg::model::point<double, 2, bg::cs::cartesian>, bg::cs::cartesian>();
+
+ // Test spherical
+ test_all<bg::model::point<int, 2, bg::cs::spherical<bg::degree> >,
+ bg::cs::spherical<bg::degree> >();
+ test_all<bg::model::point<float, 2, bg::cs::spherical<bg::degree> >,
+ bg::cs::spherical<bg::degree> >();
+ test_all<bg::model::point<double, 2, bg::cs::spherical<bg::degree> >,
+ bg::cs::spherical<bg::degree> >();
+
+ test_all<bg::model::point<int, 2, bg::cs::spherical<bg::radian> >,
+ bg::cs::spherical<bg::radian> >();
+ test_all<bg::model::point<float, 2, bg::cs::spherical<bg::radian> >,
+ bg::cs::spherical<bg::radian> >();
+ test_all<bg::model::point<double, 2, bg::cs::spherical<bg::radian> >,
+ bg::cs::spherical<bg::radian> >();
+
+ // Test other
+ test_all<bg::model::point<double, 2, bg::cs::polar<bg::degree> >,
+ bg::cs::polar<bg::degree> >();
+
+ test_all<bg::model::point<double, 2, bg::cs::geographic<bg::degree> >,
+ bg::cs::geographic<bg::degree> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/core/coordinate_type.cpp b/libs/geometry/test/core/coordinate_type.cpp
new file mode 100644
index 000000000..e382a8908
--- /dev/null
+++ b/libs/geometry/test/core/coordinate_type.cpp
@@ -0,0 +1,78 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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/core/coordinate_type.hpp>
+
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+#include <boost/geometry/geometries/register/linestring.hpp>
+
+#include <vector>
+#include <deque>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque)
+
+
+template <typename G, typename Expected>
+void test_geometry()
+{
+ BOOST_CHECK_EQUAL(typeid(typename bg::coordinate_type<G>::type).name(),
+ typeid(Expected).name());
+}
+
+template <typename P, typename Expected>
+void test_all()
+{
+ test_geometry<P, Expected>();
+ test_geometry<P const, Expected>();
+ test_geometry<bg::model::linestring<P> , Expected>();
+ test_geometry<bg::model::ring<P> , Expected>();
+ test_geometry<bg::model::polygon<P> , Expected>();
+ test_geometry<bg::model::box<P> , Expected>();
+ test_geometry<bg::model::segment<P> , Expected>();
+ test_geometry<bg::model::referring_segment<P const> , Expected>();
+
+ test_geometry<std::vector<P>, Expected>();
+ test_geometry<std::deque<P>, Expected>();
+}
+
+int test_main(int, char* [])
+{
+ test_geometry<int[2], int>();
+ test_geometry<float[2], float>();
+ test_geometry<double[2], double>();
+
+ test_geometry<int[3], int>();
+ test_geometry<float[3], float>();
+ test_geometry<double[3], double>();
+
+ test_geometry<boost::tuple<float, float>, float>();
+ test_geometry<boost::tuple<double, double>, double>();
+ test_geometry<boost::tuple<long double, long double>, long double>();
+ test_geometry<boost::tuple<double, double, double>, double>();
+
+ test_all<bg::model::point<int, 2, bg::cs::cartesian>, int>();
+ test_all<bg::model::point<float, 2, bg::cs::cartesian>, float>();
+ test_all<bg::model::point<double, 2, bg::cs::cartesian>, double>();
+ test_all<bg::model::point<long double, 2, bg::cs::cartesian>, long double>();
+
+ return 0;
+}
diff --git a/libs/geometry/test/core/core.sln b/libs/geometry/test/core/core.sln
new file mode 100644
index 000000000..9f368dbc0
--- /dev/null
+++ b/libs/geometry/test/core/core.sln
@@ -0,0 +1,37 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "access", "access.vcproj", "{5542B963-D229-4393-968F-E62DDCE4B87B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reverse_dispatch", "reverse_dispatch.vcproj", "{EA65AF97-67BC-49C8-9CAF-4136514A41EE}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "radian_access", "radian_access.vcproj", "{DE2968B5-DCA6-4D85-A620-7DA111FC0E06}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ring", "ring.vcproj", "{1EE3F112-638F-4447-8F9D-4C5BB3304C3B}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {5542B963-D229-4393-968F-E62DDCE4B87B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {5542B963-D229-4393-968F-E62DDCE4B87B}.Debug|Win32.Build.0 = Debug|Win32
+ {5542B963-D229-4393-968F-E62DDCE4B87B}.Release|Win32.ActiveCfg = Release|Win32
+ {5542B963-D229-4393-968F-E62DDCE4B87B}.Release|Win32.Build.0 = Release|Win32
+ {EA65AF97-67BC-49C8-9CAF-4136514A41EE}.Debug|Win32.ActiveCfg = Debug|Win32
+ {EA65AF97-67BC-49C8-9CAF-4136514A41EE}.Debug|Win32.Build.0 = Debug|Win32
+ {EA65AF97-67BC-49C8-9CAF-4136514A41EE}.Release|Win32.ActiveCfg = Release|Win32
+ {EA65AF97-67BC-49C8-9CAF-4136514A41EE}.Release|Win32.Build.0 = Release|Win32
+ {DE2968B5-DCA6-4D85-A620-7DA111FC0E06}.Debug|Win32.ActiveCfg = Debug|Win32
+ {DE2968B5-DCA6-4D85-A620-7DA111FC0E06}.Debug|Win32.Build.0 = Debug|Win32
+ {DE2968B5-DCA6-4D85-A620-7DA111FC0E06}.Release|Win32.ActiveCfg = Release|Win32
+ {DE2968B5-DCA6-4D85-A620-7DA111FC0E06}.Release|Win32.Build.0 = Release|Win32
+ {1EE3F112-638F-4447-8F9D-4C5BB3304C3B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {1EE3F112-638F-4447-8F9D-4C5BB3304C3B}.Debug|Win32.Build.0 = Debug|Win32
+ {1EE3F112-638F-4447-8F9D-4C5BB3304C3B}.Release|Win32.ActiveCfg = Release|Win32
+ {1EE3F112-638F-4447-8F9D-4C5BB3304C3B}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/core/geometry_id.cpp b/libs/geometry/test/core/geometry_id.cpp
new file mode 100644
index 000000000..3d7f89c95
--- /dev/null
+++ b/libs/geometry/test/core/geometry_id.cpp
@@ -0,0 +1,73 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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/core/geometry_id.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+#include <boost/geometry/geometries/register/linestring.hpp>
+
+#include <vector>
+#include <deque>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque)
+
+
+template <typename G, int Expected>
+void test_geometry()
+{
+ BOOST_CHECK_EQUAL(bg::geometry_id<G>::type::value, Expected);
+}
+
+template <typename P>
+void test_all()
+{
+ test_geometry<P, 1>();
+ test_geometry<P const, 1>();
+ test_geometry<bg::model::linestring<P> , 2>();
+ test_geometry<bg::model::ring<P> , 93>();
+ test_geometry<bg::model::polygon<P> , 3>();
+ test_geometry<bg::model::box<P> , 94>();
+ test_geometry<bg::model::segment<P> , 92>();
+ test_geometry<bg::model::referring_segment<P const> , 92>();
+
+ test_geometry<std::vector<P>, 2>();
+ test_geometry<std::deque<P>, 2>();
+}
+
+int test_main(int, char* [])
+{
+ test_geometry<int[2], 1>();
+ test_geometry<float[2], 1>();
+ test_geometry<double[2], 1>();
+
+ test_geometry<int[3], 1>();
+ test_geometry<float[3], 1>();
+ test_geometry<double[3], 1>();
+
+ test_geometry<boost::tuple<double, double>, 1>();
+ test_geometry<boost::tuple<double, double, double>, 1>();
+
+ test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/core/point_type.cpp b/libs/geometry/test/core/point_type.cpp
new file mode 100644
index 000000000..3178bcb91
--- /dev/null
+++ b/libs/geometry/test/core/point_type.cpp
@@ -0,0 +1,82 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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/core/tag.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/variant.hpp>
+
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+#include <boost/geometry/geometries/register/linestring.hpp>
+
+#include <boost/variant/variant.hpp>
+
+#include <vector>
+#include <deque>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque)
+
+
+template <typename G, typename Expected>
+void test_geometry()
+{
+ BOOST_CHECK_EQUAL(typeid(typename bg::point_type<G>::type).name(),
+ typeid(Expected).name());
+}
+
+template <typename P>
+void test_all()
+{
+ test_geometry<P, P>();
+ test_geometry<P const, P>();
+ test_geometry<bg::model::linestring<P> , P>();
+ test_geometry<bg::model::ring<P> , P>();
+ test_geometry<bg::model::polygon<P> , P>();
+ test_geometry<bg::model::box<P> , P>();
+ test_geometry<bg::model::segment<P> , P>();
+ test_geometry<bg::model::referring_segment<P const> , P>();
+
+ test_geometry<std::vector<P>, P>();
+ test_geometry<std::deque<P>, P>();
+}
+
+int test_main(int, char* [])
+{
+ test_geometry<int[2], int[2]>();
+ test_geometry<float[2], float[2]>();
+ test_geometry<double[2], double[2]>();
+
+ test_geometry<int[3], int[3]>();
+ test_geometry<float[3], float[3]>();
+ test_geometry<double[3], double[3]>();
+
+ test_geometry<boost::tuple<double, double>,
+ boost::tuple<double, double> >();
+ test_geometry<boost::tuple<double, double, double>,
+ boost::tuple<double, double, double> >();
+
+ test_geometry<boost::variant<bg::model::box<boost::tuple<double, double> > >,
+ boost::tuple<double, double> >();
+
+ test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/core/radian_access.cpp b/libs/geometry/test/core/radian_access.cpp
new file mode 100644
index 000000000..d0aa59ac3
--- /dev/null
+++ b/libs/geometry/test/core/radian_access.cpp
@@ -0,0 +1,110 @@
+// 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.
+
+// 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/geometry/core/radian_access.hpp>
+
+#include <boost/geometry/core/cs.hpp>
+#include <boost/geometry/core/coordinate_type.hpp>
+#include <boost/geometry/geometries/point.hpp>
+
+
+template <std::size_t D, typename P, typename T>
+void test_get(T const& c, T const& e)
+{
+ //std::cout << "get_as_radian " << typeid(P).name() << std::endl;
+
+ typedef typename bg::coordinate_type<P>::type coordinate_type;
+
+ P p;
+ bg::set<D>(p, coordinate_type(c));
+
+ coordinate_type g = bg::get_as_radian<D>(p);
+
+ BOOST_CHECK_CLOSE(double(g), double(e), 0.0001);
+}
+
+
+template <std::size_t D, typename P, typename T>
+void test_set(T const& c, T const& e)
+{
+ //std::cout << "set_from_radian " << typeid(P).name() << std::endl;
+
+ typedef typename bg::coordinate_type<P>::type coordinate_type;
+
+ P p;
+ bg::set_from_radian<D>(p, coordinate_type(c));
+
+ coordinate_type g = bg::get<D>(p);
+
+ BOOST_CHECK_CLOSE(double(g), double(e), 0.0001);
+}
+
+
+template <typename T>
+void test()
+{
+ double d2r = 3.1415926535897932384626433832795 / 180.0;
+
+ // Degree
+ test_get<0, bg::model::point<T, 2, bg::cs::spherical<bg::degree> > >
+ (1.0, 1.0 * d2r);
+ test_get<1, bg::model::point<T, 2, bg::cs::spherical<bg::degree> > >
+ (2.0, 2.0 * d2r);
+
+ test_set<0, bg::model::point<T, 2, bg::cs::spherical<bg::degree> > >
+ (1.0, 1.0 / d2r);
+ test_set<1, bg::model::point<T, 2, bg::cs::spherical<bg::degree> > >
+ (2.0, 2.0 / d2r);
+
+
+ // Radian
+ test_get<0, bg::model::point<T, 2, bg::cs::spherical<bg::radian> > >
+ (1.0, 1.0);
+ test_get<1, bg::model::point<T, 2, bg::cs::spherical<bg::radian> > >
+ (1.0, 1.0);
+
+ test_set<0, bg::model::point<T, 2, bg::cs::spherical<bg::radian> > >
+ (1.0, 1.0);
+ test_set<1, bg::model::point<T, 2, bg::cs::spherical<bg::radian> > >
+ (1.0, 1.0);
+
+
+ // Cartesian (== untouched, no conversion)
+ test_get<0, bg::model::point<T, 2, bg::cs::cartesian> >
+ (1.0, 1.0);
+ test_get<1, bg::model::point<T, 2, bg::cs::cartesian> >
+ (1.0, 1.0);
+
+ // Dimension >=2, should always be untouched, even for degree
+ // (assuming lat/lon + height)
+ test_set<2, bg::model::point<T, 3, bg::cs::spherical<bg::radian> > >
+ (1.0, 1.0);
+ test_set<2, bg::model::point<T, 3, bg::cs::spherical<bg::degree> > >
+ (1.0, 1.0);
+
+}
+
+
+
+
+int test_main(int, char* [])
+{
+ //test<float>();
+ test<double>();
+
+ return 0;
+}
diff --git a/libs/geometry/test/core/radian_access.vcproj b/libs/geometry/test/core/radian_access.vcproj
new file mode 100644
index 000000000..5e5613ca0
--- /dev/null
+++ b/libs/geometry/test/core/radian_access.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="radian_access"
+ ProjectGUID="{DE2968B5-DCA6-4D85-A620-7DA111FC0E06}"
+ RootNamespace="radian_access"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\radian_access"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\radian_access"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\radian_access.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/core/reverse_dispatch.cpp b/libs/geometry/test/core/reverse_dispatch.cpp
new file mode 100644
index 000000000..cff472ec2
--- /dev/null
+++ b/libs/geometry/test/core/reverse_dispatch.cpp
@@ -0,0 +1,65 @@
+// 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.
+
+// 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/geometry/core/reverse_dispatch.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+
+
+template <typename Geometry1, typename Geometry2, bool Expected>
+void test_reversed()
+{
+ BOOST_CHECK_EQUAL((bg::reverse_dispatch<Geometry1, Geometry2>::type::value),
+ Expected);
+}
+
+
+template <typename P>
+void test_all()
+{
+
+ test_reversed<P, P, false>();
+ test_reversed<P, bg::model::linestring<P>, false>();
+ test_reversed<bg::model::linestring<P>, P, true>();
+ test_reversed<bg::model::ring<P>, P, true>();
+ test_reversed<bg::model::linestring<P>, bg::model::ring<P>, false>();
+ test_reversed<bg::model::ring<P>, bg::model::linestring<P>, true>();
+}
+
+template <typename P1, typename P2>
+void test_mixed()
+{
+ test_reversed<P1, P2, false>();
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_mixed
+ <
+ bg::model::point<int, 2, bg::cs::cartesian>,
+ bg::model::point<int, 2, bg::cs::spherical<bg::degree> >
+ >();
+ test_mixed
+ <
+ bg::model::point<int, 2, bg::cs::spherical<bg::degree> >,
+ bg::model::point<int, 2, bg::cs::spherical<bg::radian> >
+ >();
+ return 0;
+}
diff --git a/libs/geometry/test/core/reverse_dispatch.vcproj b/libs/geometry/test/core/reverse_dispatch.vcproj
new file mode 100644
index 000000000..2966d9db4
--- /dev/null
+++ b/libs/geometry/test/core/reverse_dispatch.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="reverse_dispatch"
+ ProjectGUID="{EA65AF97-67BC-49C8-9CAF-4136514A41EE}"
+ RootNamespace="reverse_dispatch"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\reverse_dispatch"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\reverse_dispatch"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\reverse_dispatch.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/core/ring.cpp b/libs/geometry/test/core/ring.cpp
new file mode 100644
index 000000000..f2c3ac4cb
--- /dev/null
+++ b/libs/geometry/test/core/ring.cpp
@@ -0,0 +1,74 @@
+// 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.
+
+// 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>
+
+
+// To be tested:
+#include <boost/geometry/core/ring_type.hpp>
+#include <boost/geometry/core/exterior_ring.hpp>
+#include <boost/geometry/core/interior_rings.hpp>
+
+// For geometries:
+#include <boost/geometry/core/cs.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/polygon.hpp>
+
+
+#include <boost/geometry/io/wkt/read.hpp>
+
+
+
+
+template <typename P>
+void test_ring(std::string const& wkt,
+ std::size_t expected_main_count,
+ std::size_t expected_interior_ring_count,
+ std::size_t expected_first_interior_count)
+{
+ typedef bg::model::polygon<P> the_polygon;
+ typedef typename bg::ring_type<the_polygon>::type the_ring;
+ typedef typename bg::interior_return_type<the_polygon const>::type the_interior;
+
+ the_polygon poly;
+ bg::read_wkt(wkt, poly);
+
+ the_ring ext = bg::exterior_ring(poly);
+ the_interior rings = bg::interior_rings(poly);
+
+ BOOST_CHECK_EQUAL(bg::num_interior_rings(poly), expected_interior_ring_count);
+ BOOST_CHECK_EQUAL(boost::size(rings), expected_interior_ring_count);
+ BOOST_CHECK_EQUAL(boost::size(ext), expected_main_count);
+ if (boost::size(rings))
+ {
+ BOOST_CHECK_EQUAL(boost::size(rings.front()), expected_first_interior_count);
+ }
+}
+
+
+template <typename P>
+void test_all()
+{
+ test_ring<P>("POLYGON((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))", 5, 1, 5);
+ test_ring<P>("POLYGON((0 0,0 3,3 3,3 0,0 0),(1 1,2 2,2 1,1 1),(1 1,1 2,2 2,1 1))", 5, 2, 4);
+ test_ring<P>("POLYGON((0 0,0 3,3 3,3 0,0 0))", 5, 0, 0);
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
+ return 0;
+}
diff --git a/libs/geometry/test/core/ring.vcproj b/libs/geometry/test/core/ring.vcproj
new file mode 100644
index 000000000..e5e1a90fb
--- /dev/null
+++ b/libs/geometry/test/core/ring.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="ring"
+ ProjectGUID="{1EE3F112-638F-4447-8F9D-4C5BB3304C3B}"
+ RootNamespace="ring"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\ring"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\ring"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\ring.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/core/tag.cpp b/libs/geometry/test/core/tag.cpp
new file mode 100644
index 000000000..d3bbc4bc3
--- /dev/null
+++ b/libs/geometry/test/core/tag.cpp
@@ -0,0 +1,74 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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/core/tag.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+#include <boost/geometry/geometries/register/linestring.hpp>
+
+#include <vector>
+#include <deque>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque)
+
+
+template <typename G, typename Expected>
+void test_geometry()
+{
+ BOOST_CHECK_EQUAL(typeid(typename bg::tag<G>::type).name(),
+ typeid(Expected).name());
+}
+
+template <typename P, size_t D>
+void test_all()
+{
+ test_geometry<P, bg::point_tag>();
+ test_geometry<P const, bg::point_tag>();
+ test_geometry<bg::model::linestring<P> , bg::linestring_tag>();
+ test_geometry<bg::model::ring<P> , bg::ring_tag>();
+ test_geometry<bg::model::polygon<P> , bg::polygon_tag>();
+ test_geometry<bg::model::box<P> , bg::box_tag>();
+ test_geometry<bg::model::segment<P> , bg::segment_tag>();
+ test_geometry<bg::model::referring_segment<P const> , bg::segment_tag>();
+
+ test_geometry<std::vector<P>, bg::linestring_tag>();
+ test_geometry<std::deque<P>, bg::linestring_tag>();
+
+}
+
+int test_main(int, char* [])
+{
+ test_geometry<int[2], bg::point_tag>();
+ test_geometry<float[2], bg::point_tag>();
+ test_geometry<double[2], bg::point_tag>();
+
+ test_geometry<int[3], bg::point_tag>();
+ test_geometry<float[3], bg::point_tag>();
+ test_geometry<double[3], bg::point_tag>();
+
+ test_geometry<boost::tuple<double, double>, bg::point_tag>();
+ test_geometry<boost::tuple<double, double, double>, bg::point_tag>();
+
+ test_all<bg::model::point<int, 2, bg::cs::cartesian>, 2 >();
+ test_all<bg::model::point<float, 2, bg::cs::cartesian>, 2 >();
+ test_all<bg::model::point<double, 2, bg::cs::cartesian>, 2 >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/core/topological_dimension.cpp b/libs/geometry/test/core/topological_dimension.cpp
new file mode 100644
index 000000000..392e5f866
--- /dev/null
+++ b/libs/geometry/test/core/topological_dimension.cpp
@@ -0,0 +1,73 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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/core/topological_dimension.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/geometries/register/linestring.hpp>
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+
+#include <vector>
+#include <deque>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque)
+
+
+template <typename G, int Expected>
+void test_geometry()
+{
+ BOOST_CHECK_EQUAL(bg::topological_dimension<G>::type::value, Expected);
+}
+
+template <typename P>
+void test_all()
+{
+ test_geometry<P, 0>();
+ test_geometry<P const, 0>();
+ test_geometry<bg::model::linestring<P> , 1>();
+ test_geometry<bg::model::ring<P> , 2>(); // being discussed
+ test_geometry<bg::model::polygon<P> , 2>();
+ test_geometry<bg::model::box<P> , 2>();
+ test_geometry<bg::model::segment<P> , 1>();
+ test_geometry<bg::model::referring_segment<P const> , 1>();
+
+ test_geometry<std::vector<P>, 1>();
+ test_geometry<std::deque<P>, 1>();
+
+}
+
+int test_main(int, char* [])
+{
+ test_geometry<int[2], 0>();
+ test_geometry<float[2], 0>();
+ test_geometry<double[2], 0>();
+
+ test_geometry<int[3], 0>();
+ test_geometry<float[3], 0>();
+ test_geometry<double[3], 0>();
+
+ test_geometry<boost::tuple<double, double>, 0>();
+ test_geometry<boost::tuple<double, double, double>, 0>();
+
+ test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/geometries/Jamfile.v2 b/libs/geometry/test/geometries/Jamfile.v2
new file mode 100644
index 000000000..5b809bb12
--- /dev/null
+++ b/libs/geometry/test/geometries/Jamfile.v2
@@ -0,0 +1,28 @@
+# 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-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 ]
+ #[ compile-fail custom_linestring.cpp
+ # : # requirements
+ # <define>TEST_FAIL_CLEAR
+ # : # target name
+ # custom_linestring_test_fail_clear
+ #]
+ [ run custom_linestring.cpp ]
+ [ run segment.cpp ]
+ ;
diff --git a/libs/geometry/test/geometries/adapted.cpp b/libs/geometry/test/geometries/adapted.cpp
new file mode 100644
index 000000000..3ba47ef72
--- /dev/null
+++ b/libs/geometry/test/geometries/adapted.cpp
@@ -0,0 +1,112 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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 <deque>
+#include <vector>
+
+#include <geometry_test_common.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>
+
+#include <test_common/test_point.hpp>
+
+#define BOOST_GEOMETRY_TEST_RING
+
+
+
+#if defined(BOOST_GEOMETRY_TEST_RING)
+
+ #include <boost/geometry/geometries/register/ring.hpp>
+ #include <boost/geometry/geometries/concepts/ring_concept.hpp>
+
+ BOOST_GEOMETRY_REGISTER_RING_TEMPLATED(std::vector)
+ BOOST_GEOMETRY_REGISTER_RING_TEMPLATED(std::deque)
+
+#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>
+
+ BOOST_GEOMETRY_REGISTER_MULTI_POINT_TEMPLATED(std::vector)
+ BOOST_GEOMETRY_REGISTER_MULTI_POINT_TEMPLATED(std::deque)
+
+#else
+
+ #include <boost/geometry/geometries/register/linestring.hpp>
+ #include <boost/geometry/geometries/concepts/linestring_concept.hpp>
+
+ BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
+ BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque)
+
+#endif
+
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+// ----------------------------------------------------------------------------
+
+template <typename G>
+void test_geometry(G const& geometry, std::size_t expected_size = 0)
+{
+#if defined(BOOST_GEOMETRY_TEST_RING)
+ BOOST_CONCEPT_ASSERT( (bg::concept::ConstRing<G>) );
+#elif defined(BOOST_GEOMETRY_TEST_MULTI_POINT)
+ BOOST_CONCEPT_ASSERT( (bg::concept::ConstMultiPoint<G>) );
+#else
+ BOOST_CONCEPT_ASSERT( (bg::concept::ConstLinestring<G>) );
+#endif
+
+ typedef typename bg::point_type<G>::type P;
+ typedef typename bg::coordinate_type<P>::type C;
+
+ // Check range-like behaviour
+ BOOST_CHECK_EQUAL(boost::size(geometry), expected_size);
+
+}
+
+template <typename P>
+void test_all()
+{
+ test_geometry(std::vector<P>());
+ test_geometry(std::deque<P>());
+ //test_geometry(std::list<P>());
+
+ /***
+ double vertices[][3] = {
+ {-1, -1, 1}, {1, -1, 1}, {1, 1, 1}, {-1, 1, 1},
+ {-1, -1, -1}, {1, -1, -1}, {1, 1, -1}, {-1, 1, -1}
+ };
+
+ test_geometry(vertices, 8);
+ ***/
+}
+
+int test_main(int, char* [])
+{
+ test_all<test::test_point>();
+ test_all<boost::tuple<float, float> >();
+ test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<long double, 2, bg::cs::cartesian> >();
+
+ test_all<boost::tuple<float, float, float> >();
+ test_all<bg::model::point<double, 3, bg::cs::cartesian> >();
+ test_all<bg::model::point<long double, 3, bg::cs::cartesian> >();
+
+ test_all<boost::tuple<float, float, float, float, float> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/geometries/boost_array_as_point.cpp b/libs/geometry/test/geometries/boost_array_as_point.cpp
new file mode 100644
index 000000000..c1ffe0bf5
--- /dev/null
+++ b/libs/geometry/test/geometries/boost_array_as_point.cpp
@@ -0,0 +1,36 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010 Alfredo Correa
+// Copyright (c) 2010-2012 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/geometry.hpp>
+#include<boost/geometry/geometries/adapted/boost_array.hpp>
+#include<boost/geometry/geometries/adapted/c_array.hpp>
+#include<boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include<iostream>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+int test_main(int, char* [])
+{
+ bg::model::point<double, 3, bg::cs::cartesian> p1(1,2,3);
+ double p2[3] = {4,5,6};
+ boost::tuple<double, double, double> p3(7,8,9);
+ boost::array<double, 3> p4 = {{10,11,12}};
+ std::clog << bg::distance(p1, p2) << std::endl;
+ std::clog << bg::distance(p2, p3) << std::endl;
+ std::clog << bg::distance(p3, p4) << std::endl;
+ return 0;
+}
+
diff --git a/libs/geometry/test/geometries/boost_array_as_point.vcproj b/libs/geometry/test/geometries/boost_array_as_point.vcproj
new file mode 100644
index 000000000..75008a582
--- /dev/null
+++ b/libs/geometry/test/geometries/boost_array_as_point.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="boost_array_as_point"
+ ProjectGUID="{77F84000-D088-46AD-A023-08552101B1C5}"
+ RootNamespace="boost_array_as_point"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\boost_array_as_point"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\boost_array_as_point"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\boost_array_as_point.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/geometries/boost_fusion.cpp b/libs/geometry/test/geometries/boost_fusion.cpp
new file mode 100644
index 000000000..38a4a05ff
--- /dev/null
+++ b/libs/geometry/test/geometries/boost_fusion.cpp
@@ -0,0 +1,71 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright Akira Takahashi 2011
+
+// 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/fusion/include/adapt_struct_named.hpp>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/geometries/adapted/boost_fusion.hpp>
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include <iostream>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_FUSION_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+struct for_fusion_2d
+{
+ float x,y;
+};
+struct for_fusion_3d
+{
+ double x,y,z;
+};
+
+BOOST_FUSION_ADAPT_STRUCT(for_fusion_2d, (float, x) (float, y))
+BOOST_FUSION_ADAPT_STRUCT(for_fusion_3d, (double, x) (double, y) (double, z))
+
+
+void test_2d()
+{
+ bg::model::point<double, 2, bg::cs::cartesian> p1(1, 2);
+ double p2[2] = {3, 4};
+ boost::tuple<double, double> p3(5,6);
+
+ for_fusion_2d pf = {7, 8};
+
+ BOOST_CHECK_CLOSE(bg::distance(p1, pf), 8.4852813742385695, 0.01);
+ BOOST_CHECK_CLOSE(bg::distance(p2, pf), 5.6568542494923806, 0.01);
+ BOOST_CHECK_CLOSE(bg::distance(p3, pf), 2.82843, 0.01);
+}
+
+void test_3d()
+{
+ bg::model::point<double, 3, bg::cs::cartesian> p1(1, 2, 3);
+ double p2[3] = {4, 5, 6};
+ boost::tuple<double, double, double> p3(7, 8, 9);
+
+ for_fusion_3d pf = {10, 11, 12};
+
+ BOOST_CHECK_CLOSE(bg::distance(p1, pf), 15.58845726811, 0.01);
+ BOOST_CHECK_CLOSE(bg::distance(p2, pf), 10.392304845413, 0.01);
+ BOOST_CHECK_CLOSE(bg::distance(p3, pf), 5.196152, 0.01);
+}
+
+int test_main(int, char* [])
+{
+ test_2d();
+ test_3d();
+ return 0;
+}
+
diff --git a/libs/geometry/test/geometries/boost_fusion.vcproj b/libs/geometry/test/geometries/boost_fusion.vcproj
new file mode 100644
index 000000000..95d2b6015
--- /dev/null
+++ b/libs/geometry/test/geometries/boost_fusion.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="boost_fusion"
+ ProjectGUID="{C218C979-890F-4690-84E0-837DC661CE57}"
+ RootNamespace="boost_fusion"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\boost_fusion"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\boost_fusion"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\boost_fusion.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/geometries/boost_polygon.cpp b/libs/geometry/test/geometries/boost_polygon.cpp
new file mode 100644
index 000000000..42dc2c5a8
--- /dev/null
+++ b/libs/geometry/test/geometries/boost_polygon.cpp
@@ -0,0 +1,174 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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)
+
+// geometry::num_points does not accept the ring_proxy for adaptation, like
+// centroid and probably many more algorithms. TODO: fix that. Until then we
+// define it such that num_points is not called.
+#define BOOST_GEOMETRY_EMPTY_INPUT_NO_THROW
+
+#include <geometry_test_common.hpp>
+
+
+#include <boost/geometry/geometry.hpp>
+
+#include <boost/geometry/geometries/box.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/polygon.hpp>
+#include <boost/geometry/geometries/ring.hpp>
+
+#include <boost/geometry/geometries/adapted/boost_polygon/point.hpp>
+#include <boost/geometry/geometries/adapted/boost_polygon/box.hpp>
+#include <boost/geometry/geometries/adapted/boost_polygon/ring.hpp>
+#include <boost/geometry/geometries/adapted/boost_polygon/polygon.hpp>
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+
+#include <iostream>
+
+template <typename T>
+void fill_polygon_with_two_holes(boost::polygon::polygon_with_holes_data<T>& boost_polygon_polygon)
+{
+ std::vector<boost::polygon::point_data<T> > point_vector;
+ point_vector.push_back(boost::polygon::point_data<T>(0, 0));
+ point_vector.push_back(boost::polygon::point_data<T>(0, 10));
+ point_vector.push_back(boost::polygon::point_data<T>(10, 10));
+ point_vector.push_back(boost::polygon::point_data<T>(10, 0));
+ point_vector.push_back(boost::polygon::point_data<T>(0, 0));
+ boost_polygon_polygon.set(point_vector.begin(), point_vector.end());
+
+
+ std::vector<boost::polygon::polygon_data<T> > holes;
+ holes.resize(2);
+
+ {
+ std::vector<boost::polygon::point_data<T> > point_vector;
+ point_vector.push_back(boost::polygon::point_data<T>(1, 1));
+ point_vector.push_back(boost::polygon::point_data<T>(2, 1));
+ point_vector.push_back(boost::polygon::point_data<T>(2, 2));
+ point_vector.push_back(boost::polygon::point_data<T>(1, 2));
+ point_vector.push_back(boost::polygon::point_data<T>(1, 1));
+ holes[0].set(point_vector.begin(), point_vector.end());
+ }
+
+ {
+ std::vector<boost::polygon::point_data<T> > point_vector;
+ point_vector.push_back(boost::polygon::point_data<T>(3, 3));
+ point_vector.push_back(boost::polygon::point_data<T>(4, 3));
+ point_vector.push_back(boost::polygon::point_data<T>(4, 4));
+ point_vector.push_back(boost::polygon::point_data<T>(3, 4));
+ point_vector.push_back(boost::polygon::point_data<T>(3, 3));
+ holes[1].set(point_vector.begin(), point_vector.end());
+ }
+ boost_polygon_polygon.set_holes(holes.begin(), holes.end());
+}
+
+
+template <typename T>
+void test_coordinate_type()
+{
+ // 1a: Check if Boost.Polygon's point fulfills Boost.Geometry's point concept
+ bg::concept::check<boost::polygon::point_data<T> >();
+
+ // 1b: use a Boost.Polygon point in Boost.Geometry, calc. distance with two point types
+ boost::polygon::point_data<T> boost_polygon_point(1, 2);
+
+ typedef bg::model::point<T, 2, bg::cs::cartesian> bg_point_type;
+ bg_point_type boost_geometry_point(3, 4);
+ BOOST_CHECK_EQUAL(bg::distance(boost_polygon_point, boost_geometry_point),
+ 2 * std::sqrt(2.0));
+
+ // 2a: Check if Boost.Polygon's box fulfills Boost.Geometry's box concept
+ bg::concept::check<boost::polygon::rectangle_data<T> >();
+
+ // 2b: use a Boost.Polygon rectangle in Boost.Geometry, compare with boxes
+ boost::polygon::rectangle_data<T> boost_polygon_box;
+ bg::model::box<bg_point_type> boost_geometry_box;
+
+ bg::assign_values(boost_polygon_box, 0, 1, 5, 6);
+ bg::assign_values(boost_geometry_box, 0, 1, 5, 6);
+ T boost_polygon_area = bg::area(boost_polygon_box);
+ T boost_geometry_area = bg::area(boost_geometry_box);
+ T boost_polygon_area_by_boost_polygon = boost::polygon::area(boost_polygon_box);
+ BOOST_CHECK_EQUAL(boost_polygon_area, boost_geometry_area);
+ BOOST_CHECK_EQUAL(boost_polygon_area, boost_polygon_area_by_boost_polygon);
+
+ // 3a: Check if Boost.Polygon's polygon fulfills Boost.Geometry's ring concept
+ bg::concept::check<boost::polygon::polygon_data<T> >();
+
+ // 3b: use a Boost.Polygon polygon (ring)
+ boost::polygon::polygon_data<T> boost_polygon_ring;
+ {
+ // Filling it is a two-step process using Boost.Polygon
+ std::vector<boost::polygon::point_data<T> > point_vector;
+ point_vector.push_back(boost::polygon::point_data<T>(0, 0));
+ point_vector.push_back(boost::polygon::point_data<T>(0, 3));
+ point_vector.push_back(boost::polygon::point_data<T>(4, 0));
+ point_vector.push_back(boost::polygon::point_data<T>(0, 0));
+ boost_polygon_ring.set(point_vector.begin(), point_vector.end());
+ }
+
+ // Boost-geometry ring
+ bg::model::ring<bg_point_type> boost_geometry_ring;
+ {
+ boost_geometry_ring.push_back(bg_point_type(0, 0));
+ boost_geometry_ring.push_back(bg_point_type(0, 3));
+ boost_geometry_ring.push_back(bg_point_type(4, 0));
+ boost_geometry_ring.push_back(bg_point_type(0, 0));
+ }
+ boost_polygon_area = bg::area(boost_polygon_ring);
+ boost_geometry_area = bg::area(boost_geometry_ring);
+ boost_polygon_area_by_boost_polygon = boost::polygon::area(boost_polygon_ring);
+ BOOST_CHECK_EQUAL(boost_polygon_area, boost_geometry_area);
+ BOOST_CHECK_EQUAL(boost_polygon_area, boost_polygon_area_by_boost_polygon);
+
+ // Check mutable ring
+ std::string wkt = "POLYGON((0 0,0 10,10 10,10 0,0 0))";
+ bg::read_wkt(wkt, boost_polygon_ring);
+ bg::read_wkt(wkt, boost_geometry_ring);
+ boost_polygon_area = bg::area(boost_polygon_ring);
+ boost_geometry_area = bg::area(boost_geometry_ring);
+ boost_polygon_area_by_boost_polygon = boost::polygon::area(boost_polygon_ring);
+ BOOST_CHECK_EQUAL(boost_polygon_area, boost_geometry_area);
+ BOOST_CHECK_EQUAL(boost_polygon_area, boost_polygon_area_by_boost_polygon);
+
+ // 4a: Boost.Polygon's polygon with holes
+ boost::polygon::polygon_with_holes_data<T> boost_polygon_polygon;
+ fill_polygon_with_two_holes(boost_polygon_polygon);
+
+ // Using Boost.Polygon
+ boost_polygon_area = bg::area(boost_polygon_polygon);
+ boost_polygon_area_by_boost_polygon = boost::polygon::area(boost_polygon_polygon);
+ BOOST_CHECK_EQUAL(boost_polygon_area, boost_polygon_area_by_boost_polygon);
+
+ wkt = "POLYGON((0 0,0 10,10 10,10 0,0 0),(1 1,2 1,2 2,1 2,1 1),(3 3,4 3,4 4,3 4,3 3))";
+
+ bg::model::polygon<bg_point_type> boost_geometry_polygon;
+ bg::read_wkt(wkt, boost_geometry_polygon);
+
+ boost_geometry_area = bg::area(boost_geometry_polygon);
+ BOOST_CHECK_EQUAL(boost_polygon_area, boost_geometry_area);
+
+ bg::clear(boost_polygon_polygon);
+ bg::read_wkt(wkt, boost_polygon_polygon);
+ boost_geometry_area = bg::area(boost_polygon_polygon);
+ BOOST_CHECK_EQUAL(boost_polygon_area, boost_geometry_area);
+
+ std::ostringstream out;
+ out << bg::wkt(boost_polygon_polygon);
+ BOOST_CHECK_EQUAL(wkt, out.str());
+
+}
+
+int test_main(int, char* [])
+{
+ test_coordinate_type<int>();
+ //test_coordinate_type<float>(); // compiles, but "BOOST_CHECK_EQUAL" fails
+ test_coordinate_type<double>();
+ return 0;
+}
diff --git a/libs/geometry/test/geometries/boost_polygon.vcproj b/libs/geometry/test/geometries/boost_polygon.vcproj
new file mode 100644
index 000000000..f346bb667
--- /dev/null
+++ b/libs/geometry/test/geometries/boost_polygon.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="boost_polygon"
+ ProjectGUID="{6809180F-1E31-42B0-8481-67AC8E9B180B}"
+ RootNamespace="boost_polygon"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\boost_polygon"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\boost_polygon"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\boost_polygon.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/geometries/boost_polygon_overlay.cpp b/libs/geometry/test/geometries/boost_polygon_overlay.cpp
new file mode 100644
index 000000000..f7db77353
--- /dev/null
+++ b/libs/geometry/test/geometries/boost_polygon_overlay.cpp
@@ -0,0 +1,122 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2011-2012 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/geometry.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/adapted/boost_polygon/point.hpp>
+#include <boost/geometry/geometries/adapted/boost_polygon/box.hpp>
+#include <boost/geometry/geometries/adapted/boost_polygon/ring.hpp>
+#include <boost/geometry/geometries/adapted/boost_polygon/polygon.hpp>
+#include <boost/geometry/io/wkt/wkt.hpp>
+
+#include<iostream>
+
+template <typename T>
+void test_overlay_using_boost_polygon(std::string const& case_id, std::string const& wkt_p, std::string const& wkt_q)
+{
+ typedef boost::polygon::polygon_set_data<T> polygon_set;
+
+ polygon_set p, q;
+ polygon_set out_i, out_u;
+
+ {
+ // Read polygons, conveniently using Boost.Geometry
+ typedef boost::geometry::model::multi_polygon
+ <
+ boost::polygon::polygon_with_holes_data<T>
+ > mp_type;
+ mp_type mp, mq;
+
+ bg::read_wkt(wkt_p, mp);
+ bg::read_wkt(wkt_q, mq);
+
+ p.insert(mp.begin(), mp.end());
+ q.insert(mq.begin(), mq.end());
+ }
+
+ {
+ using namespace boost::polygon::operators;
+ out_i = p & q;
+ out_u = p | q;
+ }
+
+ double area_p = boost::polygon::area(p);
+ double area_q = boost::polygon::area(q);
+ double area_i = boost::polygon::area(out_i);
+ double area_u = boost::polygon::area(out_u);
+
+ double sum = area_p + area_q - area_u - area_i;
+ BOOST_CHECK_MESSAGE(abs(sum) < 0.001,
+ "Overlay error\n"
+ << "Boost.Polygon " << case_id
+ << " area p: " << area_p
+ << " area q: " << area_q
+ << " area i: " << area_i
+ << " area u: " << area_u
+ << " sum: " << sum
+ );
+}
+
+
+template <typename T>
+void test_overlay_using_boost_geometry(std::string const& case_id, std::string const& wkt_p, std::string const& wkt_q)
+{
+ typedef boost::geometry::model::multi_polygon
+ <
+ boost::geometry::model::polygon
+ <
+ boost::geometry::model::d2::point_xy<T>
+ >
+ > mp_type;
+
+ // Read it using Boost.Geometry
+ mp_type p, q, out_i, out_u;
+
+ boost::geometry::read_wkt(wkt_p, p);
+ boost::geometry::read_wkt(wkt_q, q);
+
+ boost::geometry::intersection(p, q, out_i);
+ boost::geometry::union_(p, q, out_u);
+
+ double area_p = boost::geometry::area(p);
+ double area_q = boost::geometry::area(q);
+ double area_i = boost::geometry::area(out_i);
+ double area_u = boost::geometry::area(out_u);
+
+ double sum = area_p + area_q - area_u - area_i;
+ BOOST_CHECK_MESSAGE(abs(sum) < 0.001,
+ "Overlay error\n"
+ << "Boost.Geometry " << case_id
+ << " area p: " << area_p
+ << " area q: " << area_q
+ << " area i: " << area_i
+ << " area u: " << area_u
+ << " sum: " << sum
+ );
+}
+
+template <typename T>
+void test_overlay(std::string const& case_id, std::string const& wkt_p, std::string const& wkt_q)
+{
+ test_overlay_using_boost_polygon<T>(case_id, wkt_p, wkt_q);
+ test_overlay_using_boost_geometry<T>(case_id, wkt_p, wkt_q);
+}
+
+
+int test_main(int, char* [])
+{
+ test_overlay<int>("case 1", "MULTIPOLYGON(((100 900,0 800,100 800,100 900)),((200 700,100 800,100 700,200 700)),((500 400,400 400,400 300,500 400)),((600 300,500 200,600 200,600 300)),((600 700,500 800,500 700,600 700)),((700 500,600 500,600 400,700 500)),((900 300,800 400,800 300,900 300)))",
+ "MULTIPOLYGON(((200 900,100 1000,100 800,200 800,200 900)),((400 500,300 600,300 500,400 500)),((500 900,400 800,500 800,500 900)),((600 800,500 700,600 700,600 800)),((700 500,600 400,700 400,700 500)),((1000 1000,900 900,1000 900,1000 1000)))");
+ test_overlay<int>("case 2", "MULTIPOLYGON(((200 400,100 400,100 300,200 400)),((300 100,200 100,200 0,300 0,300 100)),((600 700,500 700,500 600,600 700)),((700 300,600 300,600 200,700 300)),((800 500,700 600,700 500,800 500)),((900 800,800 700,900 700,900 800)),((1000 200,900 100,1000 100,1000 200)),((1000 800,900 900,900 800,1000 800)))",
+ "MULTIPOLYGON(((200 800,100 800,100 700,200 700,200 800)),((400 200,300 100,400 100,400 200)),((400 800,300 700,400 700,400 800)),((700 100,600 0,700 0,700 100)),((700 200,600 200,600 100,700 200)),((900 200,800 200,800 0,900 0,900 200)),((1000 300,900 200,1000 200,1000 300)))");
+ return 0;
+}
diff --git a/libs/geometry/test/geometries/boost_polygon_overlay.vcproj b/libs/geometry/test/geometries/boost_polygon_overlay.vcproj
new file mode 100644
index 000000000..8f662b36e
--- /dev/null
+++ b/libs/geometry/test/geometries/boost_polygon_overlay.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="boost_polygon_overlay"
+ ProjectGUID="{93C4EB19-8A0C-437E-9F82-A0DB4A4A5C32}"
+ RootNamespace="boost_polygon_overlay"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\boost_polygon_overlay"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\boost_polygon_overlay"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\boost_polygon_overlay.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/geometries/boost_range.cpp b/libs/geometry/test/geometries/boost_range.cpp
new file mode 100644
index 000000000..d80ca33c8
--- /dev/null
+++ b/libs/geometry/test/geometries/boost_range.cpp
@@ -0,0 +1,116 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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/geometry.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/adapted/boost_range/adjacent_filtered.hpp>
+#include <boost/geometry/geometries/adapted/boost_range/filtered.hpp>
+#include <boost/geometry/geometries/adapted/boost_range/reversed.hpp>
+#include <boost/geometry/geometries/adapted/boost_range/strided.hpp>
+#include <boost/geometry/geometries/adapted/boost_range/sliced.hpp>
+#include <boost/geometry/geometries/adapted/boost_range/uniqued.hpp>
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+
+#include <sstream>
+
+struct not_two
+{
+ template <typename P>
+ bool operator()(P const& p) const
+ {
+ return boost::geometry::get<0>(p) != 2.0;
+ }
+};
+
+struct sum_not_five
+{
+ template <typename P>
+ bool operator()(P const& p1, P const& p2) const
+ {
+ return boost::geometry::get<0>(p1) + boost::geometry::get<0>(p2) != 5.0;
+ }
+};
+
+
+template <typename P>
+void test_range_adaptor()
+{
+ bg::model::linestring<P> ls;
+ bg::read_wkt("LINESTRING(1 1,2 2,3 3,4 4)", ls);
+
+ {
+ std::ostringstream out;
+ out << bg::wkt(ls);
+ BOOST_CHECK_EQUAL(out.str(), "LINESTRING(1 1,2 2,3 3,4 4)");
+ }
+
+ {
+ std::ostringstream out;
+ out << bg::wkt(ls | boost::adaptors::reversed);
+ BOOST_CHECK_EQUAL(out.str(), "LINESTRING(4 4,3 3,2 2,1 1)");
+ }
+
+ {
+ std::ostringstream out;
+ out << bg::wkt(ls | boost::adaptors::strided(2));
+ BOOST_CHECK_EQUAL(out.str(), "LINESTRING(1 1,3 3)");
+ }
+
+ {
+ std::ostringstream out;
+ out << bg::wkt(ls | boost::adaptors::sliced(1,3));
+ BOOST_CHECK_EQUAL(out.str(), "LINESTRING(2 2,3 3)");
+ }
+
+ {
+ std::ostringstream out;
+ out << bg::wkt(ls | boost::adaptors::filtered(not_two()));
+ BOOST_CHECK_EQUAL(out.str(), "LINESTRING(1 1,3 3,4 4)");
+ }
+
+ {
+ std::ostringstream out;
+ out << bg::wkt(ls | boost::adaptors::adjacent_filtered(sum_not_five()));
+ BOOST_CHECK_EQUAL(out.str(), "LINESTRING(1 1,3 3,4 4)");
+ }
+
+ {
+ bg::model::linestring<P> ls2;
+ bg::read_wkt("LINESTRING(1 1,1 1,2 2,3 3,3 3,4 4)", ls2);
+ std::ostringstream out;
+
+
+ // uniqued needs == operator, equals
+ //out << bg::wkt(ls | boost::adaptors::uniqued);
+ //BOOST_CHECK_EQUAL(out.str(), "LINESTRING(1 1,2 2,3 3,4 4)");
+ }
+}
+
+template <typename P>
+void test_all()
+{
+ test_range_adaptor<P>();
+}
+
+
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<double> >();
+ test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
+
+ return 0;
+ }
+
diff --git a/libs/geometry/test/geometries/boost_range.vcproj b/libs/geometry/test/geometries/boost_range.vcproj
new file mode 100644
index 000000000..e6f7455e9
--- /dev/null
+++ b/libs/geometry/test/geometries/boost_range.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="boost_range"
+ ProjectGUID="{8E719071-B525-4F58-832A-AB75FCA8BEA0}"
+ RootNamespace="boost_range"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\boost_range"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\boost_range"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\boost_range.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/geometries/boost_tuple.cpp b/libs/geometry/test/geometries/boost_tuple.cpp
new file mode 100644
index 000000000..b6db1f02b
--- /dev/null
+++ b/libs/geometry/test/geometries/boost_tuple.cpp
@@ -0,0 +1,39 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2008-2012 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)
+
+
+#include <geometry_test_common.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include <boost/geometry/algorithms/distance.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <iostream>
+
+
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+template <typename P>
+void test_all()
+{
+ P p1, p2;
+ bg::distance(p1, p2);
+}
+
+int test_main(int, char* [])
+{
+ test_all<boost::tuple<float> >();
+ test_all<boost::tuple<int, int> >();
+ test_all<boost::tuple<double, double, double> >();
+ test_all<boost::tuple<float, float, float, float> >();
+ test_all<boost::tuple<float, float, float, float, float> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/geometries/box.cpp b/libs/geometry/test/geometries/box.cpp
new file mode 100644
index 000000000..5e1fdaae5
--- /dev/null
+++ b/libs/geometry/test/geometries/box.cpp
@@ -0,0 +1,105 @@
+// 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.
+
+// 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/geometry/algorithms/make.hpp>
+
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include <test_common/test_point.hpp>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+template <typename P>
+bg::model::box<P> create_box()
+{
+ P p1;
+ P p2;
+ bg::assign_values(p1, 1, 2, 5);
+ bg::assign_values(p2, 3, 4, 6);
+ return bg::model::box<P>(p1, p2);
+}
+
+template <typename B, typename T>
+void check_box(B& to_check,
+ T min_x, T min_y, T min_z,
+ T max_x, T max_y, T max_z)
+{
+ BOOST_CHECK_EQUAL(bg::get<0>(to_check.min_corner()), min_x);
+ BOOST_CHECK_EQUAL(bg::get<1>(to_check.min_corner()), min_y);
+ BOOST_CHECK_EQUAL(bg::get<2>(to_check.min_corner()), min_z);
+ BOOST_CHECK_EQUAL(bg::get<0>(to_check.max_corner()), max_x);
+ BOOST_CHECK_EQUAL(bg::get<1>(to_check.max_corner()), max_y);
+ BOOST_CHECK_EQUAL(bg::get<2>(to_check.max_corner()), max_z);
+}
+
+template <typename P>
+void test_construction()
+{
+ typedef typename bg::coordinate_type<P>::type T;
+
+ bg::model::box<P> b1 = bg::make_zero<bg::model::box<P> >();
+ check_box(b1, T(),T(),T(),T(),T(),T());
+
+ bg::model::box<P> b2(create_box<P>());
+ check_box(b2, 1,2,5,3,4,6);
+
+ bg::model::box<P> b3 = bg::make_inverse<bg::model::box<P> >();
+ check_box(b3, boost::numeric::bounds<T>::highest(),
+ boost::numeric::bounds<T>::highest(),
+ boost::numeric::bounds<T>::highest(),
+ boost::numeric::bounds<T>::lowest(),
+ boost::numeric::bounds<T>::lowest(),
+ boost::numeric::bounds<T>::lowest());
+}
+
+template <typename P>
+void test_assignment()
+{
+ bg::model::box<P> b(create_box<P>());
+ bg::set<0>(b.min_corner(), 10);
+ bg::set<1>(b.min_corner(), 20);
+ bg::set<2>(b.min_corner(), 30);
+ bg::set<0>(b.max_corner(), 40);
+ bg::set<1>(b.max_corner(), 50);
+ bg::set<2>(b.max_corner(), 60);
+ check_box(b, 10,20,30,40,50,60);
+}
+
+template <typename P>
+void test_all()
+{
+ test_construction<P>();
+ test_assignment<P>();
+}
+
+int test_main(int, char* [])
+{
+ test_all<int[3]>();
+ test_all<float[3]>();
+ test_all<double[3]>();
+ test_all<test::test_point>();
+ test_all<bg::model::point<int, 3, bg::cs::cartesian> >();
+ test_all<bg::model::point<float, 3, bg::cs::cartesian> >();
+ test_all<bg::model::point<double, 3, bg::cs::cartesian> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/geometries/box.vcproj b/libs/geometry/test/geometries/box.vcproj
new file mode 100644
index 000000000..08bf87585
--- /dev/null
+++ b/libs/geometry/test/geometries/box.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="box"
+ ProjectGUID="{EB7B69C6-2D62-43BC-BA18-D15BEB998665}"
+ RootNamespace="box"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\box"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\box"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\box.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/geometries/concepts/check.cpp b/libs/geometry/test/geometries/concepts/check.cpp
new file mode 100644
index 000000000..c4996a7a5
--- /dev/null
+++ b/libs/geometry/test/geometries/concepts/check.cpp
@@ -0,0 +1,76 @@
+// 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.
+
+// 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 <boost/geometry/core/cs.hpp>
+#include <boost/geometry/geometries/concepts/check.hpp>
+
+struct ro_point
+{
+ float x, y;
+};
+
+
+struct rw_point
+{
+ float x, y;
+};
+
+
+namespace boost { namespace geometry { namespace traits {
+
+template <> struct tag<ro_point> { typedef point_tag type; };
+template <> struct coordinate_type<ro_point> { typedef float type; };
+template <> struct coordinate_system<ro_point> { typedef bg::cs::cartesian type; };
+template <> struct dimension<ro_point> { enum { value = 2 }; };
+
+template <> struct access<ro_point, 0>
+{
+ static float get(ro_point const& p) { return p.x; }
+};
+
+template <> struct access<ro_point, 1>
+{
+ static float get(ro_point const& p) { return p.y; }
+};
+
+
+
+
+template <> struct tag<rw_point> { typedef point_tag type; };
+template <> struct coordinate_type<rw_point> { typedef float type; };
+template <> struct coordinate_system<rw_point> { typedef bg::cs::cartesian type; };
+template <> struct dimension<rw_point> { enum { value = 2 }; };
+
+template <> struct access<rw_point, 0>
+{
+ static float get(rw_point const& p) { return p.x; }
+ static void set(rw_point& p, float value) { p.x = value; }
+};
+
+template <> struct access<rw_point, 1>
+{
+ static float get(rw_point const& p) { return p.y; }
+ static void set(rw_point& p, float value) { p.y = value; }
+};
+
+
+}}} // namespace bg::traits
+
+
+int main()
+{
+ bg::concept::check<const ro_point>();
+ bg::concept::check<rw_point>();
+}
diff --git a/libs/geometry/test/geometries/concepts/check.sln b/libs/geometry/test/geometries/concepts/check.sln
new file mode 100644
index 000000000..98293a669
--- /dev/null
+++ b/libs/geometry/test/geometries/concepts/check.sln
@@ -0,0 +1,19 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "check", "check.vcproj", "{6260214E-DB6F-4934-ADF7-DD2B1666171B}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {6260214E-DB6F-4934-ADF7-DD2B1666171B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {6260214E-DB6F-4934-ADF7-DD2B1666171B}.Debug|Win32.Build.0 = Debug|Win32
+ {6260214E-DB6F-4934-ADF7-DD2B1666171B}.Release|Win32.ActiveCfg = Release|Win32
+ {6260214E-DB6F-4934-ADF7-DD2B1666171B}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/geometries/concepts/check.vcproj b/libs/geometry/test/geometries/concepts/check.vcproj
new file mode 100644
index 000000000..480b4145b
--- /dev/null
+++ b/libs/geometry/test/geometries/concepts/check.vcproj
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="check"
+ ProjectGUID="{6260214E-DB6F-4934-ADF7-DD2B1666171B}"
+ RootNamespace="check"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\check"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../../../../../boost;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\check"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=".;../../../../../boost;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\check.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/geometries/custom_linestring.cpp b/libs/geometry/test/geometries/custom_linestring.cpp
new file mode 100644
index 000000000..ef2bad43a
--- /dev/null
+++ b/libs/geometry/test/geometries/custom_linestring.cpp
@@ -0,0 +1,128 @@
+// 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.
+
+// 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 <deque>
+#include <vector>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/append.hpp>
+#include <boost/geometry/algorithms/clear.hpp>
+#include <boost/geometry/algorithms/make.hpp>
+#include <boost/geometry/core/access.hpp>
+#include <boost/geometry/geometries/concepts/linestring_concept.hpp>
+
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/register/linestring.hpp>
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include <test_common/test_point.hpp>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque)
+
+//#define TEST_FAIL_CLEAR
+//#define TEST_FAIL_APPEND
+
+
+
+// ----------------------------------------------------------------------------
+// First custom linestring, requires ONLY one traits: to register itself as a linestring
+template <typename P>
+struct custom_linestring1 : std::vector<P> {};
+
+namespace boost { namespace geometry { namespace traits {
+ template <typename P>
+ struct tag< custom_linestring1<P> > { typedef linestring_tag type; };
+}}} // namespace bg::traits
+
+// ----------------------------------------------------------------------------
+// Second custom linestring, decides to implement all edit operations itself
+// by specializing the "use_std" traits to false.
+// It should therefore implement the traits:: clear / append_point
+template <typename P>
+struct custom_linestring2 : std::deque<P> // std::pair<typename std::vector<P>::const_iterator, typename std::vector<P>::const_iterator>
+{
+};
+
+namespace boost { namespace geometry { namespace traits {
+ template <typename P>
+ struct tag< custom_linestring2<P> > { typedef linestring_tag type; };
+
+#if ! defined(TEST_FAIL_CLEAR)
+ template <typename P>
+ struct clear< custom_linestring2<P> >
+ {
+ // does not use std::vector<P>.clear() but something else.
+ static inline void apply(custom_linestring2<P>& ls) { ls.resize(0); }
+ };
+#endif
+
+}}} // namespace bg::traits
+
+// ----------------------------------------------------------------------------
+
+template <typename G>
+void test_linestring()
+{
+ BOOST_CONCEPT_ASSERT( (bg::concept::Linestring<G>) );
+ BOOST_CONCEPT_ASSERT( (bg::concept::ConstLinestring<G>) );
+
+ G geometry;
+ typedef typename bg::point_type<G>::type P;
+
+ bg::clear(geometry);
+ BOOST_CHECK_EQUAL(boost::size(geometry), 0u);
+
+ bg::append(geometry, bg::make_zero<P>());
+ BOOST_CHECK_EQUAL(boost::size(geometry), 1u);
+
+ //std::cout << geometry << std::endl;
+
+ bg::clear(geometry);
+ BOOST_CHECK_EQUAL(boost::size(geometry), 0u);
+
+
+ //P p = boost::range::front(geometry);
+}
+
+template <typename P>
+void test_all()
+{
+ test_linestring<bg::model::linestring<P> >();
+ test_linestring<bg::model::linestring<P, std::vector> >();
+ test_linestring<bg::model::linestring<P, std::deque> >();
+
+ test_linestring<custom_linestring1<P> >();
+ test_linestring<custom_linestring2<P> >();
+
+ test_linestring<std::vector<P> >();
+ test_linestring<std::deque<P> >();
+ //test_linestring<std::list<P> >();
+}
+
+int test_main(int, char* [])
+{
+ test_all<test::test_point>();
+ test_all<boost::tuple<float, float> >();
+ test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/geometries/custom_linestring.vcproj b/libs/geometry/test/geometries/custom_linestring.vcproj
new file mode 100644
index 000000000..8dfe0c7eb
--- /dev/null
+++ b/libs/geometry/test/geometries/custom_linestring.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="custom_linestring"
+ ProjectGUID="{CA8D5E44-7D8F-44A1-900C-35C28890299B}"
+ RootNamespace="custom_linestring"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\custom_linestring"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\custom_linestring"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\custom_linestring.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/geometries/geometries_tests.sln b/libs/geometry/test/geometries/geometries_tests.sln
new file mode 100644
index 000000000..56097d012
--- /dev/null
+++ b/libs/geometry/test/geometries/geometries_tests.sln
@@ -0,0 +1,61 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "box", "box.vcproj", "{EB7B69C6-2D62-43BC-BA18-D15BEB998665}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "custom_linestring", "custom_linestring.vcproj", "{CA8D5E44-7D8F-44A1-900C-35C28890299B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "segment", "segment.vcproj", "{F995B070-62A2-46FE-A676-79AADB71DBD8}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_array_as_point", "boost_array_as_point.vcproj", "{77F84000-D088-46AD-A023-08552101B1C5}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_polygon", "boost_polygon.vcproj", "{6809180F-1E31-42B0-8481-67AC8E9B180B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_range", "boost_range.vcproj", "{8E719071-B525-4F58-832A-AB75FCA8BEA0}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_fusion", "boost_fusion.vcproj", "{C218C979-890F-4690-84E0-837DC661CE57}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_polygon_overlay", "boost_polygon_overlay.vcproj", "{93C4EB19-8A0C-437E-9F82-A0DB4A4A5C32}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {EB7B69C6-2D62-43BC-BA18-D15BEB998665}.Debug|Win32.ActiveCfg = Debug|Win32
+ {EB7B69C6-2D62-43BC-BA18-D15BEB998665}.Debug|Win32.Build.0 = Debug|Win32
+ {EB7B69C6-2D62-43BC-BA18-D15BEB998665}.Release|Win32.ActiveCfg = Release|Win32
+ {EB7B69C6-2D62-43BC-BA18-D15BEB998665}.Release|Win32.Build.0 = Release|Win32
+ {CA8D5E44-7D8F-44A1-900C-35C28890299B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CA8D5E44-7D8F-44A1-900C-35C28890299B}.Debug|Win32.Build.0 = Debug|Win32
+ {CA8D5E44-7D8F-44A1-900C-35C28890299B}.Release|Win32.ActiveCfg = Release|Win32
+ {CA8D5E44-7D8F-44A1-900C-35C28890299B}.Release|Win32.Build.0 = Release|Win32
+ {F995B070-62A2-46FE-A676-79AADB71DBD8}.Debug|Win32.ActiveCfg = Debug|Win32
+ {F995B070-62A2-46FE-A676-79AADB71DBD8}.Debug|Win32.Build.0 = Debug|Win32
+ {F995B070-62A2-46FE-A676-79AADB71DBD8}.Release|Win32.ActiveCfg = Release|Win32
+ {F995B070-62A2-46FE-A676-79AADB71DBD8}.Release|Win32.Build.0 = Release|Win32
+ {77F84000-D088-46AD-A023-08552101B1C5}.Debug|Win32.ActiveCfg = Debug|Win32
+ {77F84000-D088-46AD-A023-08552101B1C5}.Debug|Win32.Build.0 = Debug|Win32
+ {77F84000-D088-46AD-A023-08552101B1C5}.Release|Win32.ActiveCfg = Release|Win32
+ {77F84000-D088-46AD-A023-08552101B1C5}.Release|Win32.Build.0 = Release|Win32
+ {6809180F-1E31-42B0-8481-67AC8E9B180B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {6809180F-1E31-42B0-8481-67AC8E9B180B}.Debug|Win32.Build.0 = Debug|Win32
+ {6809180F-1E31-42B0-8481-67AC8E9B180B}.Release|Win32.ActiveCfg = Release|Win32
+ {6809180F-1E31-42B0-8481-67AC8E9B180B}.Release|Win32.Build.0 = Release|Win32
+ {8E719071-B525-4F58-832A-AB75FCA8BEA0}.Debug|Win32.ActiveCfg = Debug|Win32
+ {8E719071-B525-4F58-832A-AB75FCA8BEA0}.Debug|Win32.Build.0 = Debug|Win32
+ {8E719071-B525-4F58-832A-AB75FCA8BEA0}.Release|Win32.ActiveCfg = Release|Win32
+ {8E719071-B525-4F58-832A-AB75FCA8BEA0}.Release|Win32.Build.0 = Release|Win32
+ {C218C979-890F-4690-84E0-837DC661CE57}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C218C979-890F-4690-84E0-837DC661CE57}.Debug|Win32.Build.0 = Debug|Win32
+ {C218C979-890F-4690-84E0-837DC661CE57}.Release|Win32.ActiveCfg = Release|Win32
+ {C218C979-890F-4690-84E0-837DC661CE57}.Release|Win32.Build.0 = Release|Win32
+ {93C4EB19-8A0C-437E-9F82-A0DB4A4A5C32}.Debug|Win32.ActiveCfg = Debug|Win32
+ {93C4EB19-8A0C-437E-9F82-A0DB4A4A5C32}.Debug|Win32.Build.0 = Debug|Win32
+ {93C4EB19-8A0C-437E-9F82-A0DB4A4A5C32}.Release|Win32.ActiveCfg = Release|Win32
+ {93C4EB19-8A0C-437E-9F82-A0DB4A4A5C32}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/geometries/segment.cpp b/libs/geometry/test/geometries/segment.cpp
new file mode 100644
index 000000000..49d68d9f6
--- /dev/null
+++ b/libs/geometry/test/geometries/segment.cpp
@@ -0,0 +1,101 @@
+// 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.
+
+// 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 <iostream>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/geometries/concepts/segment_concept.hpp>
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/segment.hpp>
+
+
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+#include <boost/geometry/io/dsv/write.hpp>
+
+
+#include <test_common/test_point.hpp>
+#include <test_geometries/custom_segment.hpp>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::referring_segment<P> S;
+
+ P p1;
+ P p2;
+ S s(p1, p2);
+ BOOST_CHECK_EQUAL(&s.first, &p1);
+ BOOST_CHECK_EQUAL(&s.second, &p2);
+
+ // Compilation tests, all things should compile.
+ BOOST_CONCEPT_ASSERT( (bg::concept::ConstSegment<S>) );
+ BOOST_CONCEPT_ASSERT( (bg::concept::Segment<S>) );
+
+ typedef typename bg::coordinate_type<S>::type T;
+ typedef typename bg::point_type<S>::type SP;
+
+
+ //std::cout << sizeof(typename coordinate_type<S>::type) << std::endl;
+
+ typedef bg::model::referring_segment<P const> CS;
+ //BOOST_CONCEPT_ASSERT( (concept::ConstSegment<CS>) );
+
+ CS cs(p1, p2);
+
+ typedef typename bg::coordinate_type<CS>::type CT;
+ typedef typename bg::point_type<CS>::type CSP;
+}
+
+
+
+template <typename S>
+void test_custom()
+{
+ S seg;
+ bg::set<0,0>(seg, 1);
+ bg::set<0,1>(seg, 2);
+ bg::set<1,0>(seg, 3);
+ bg::set<1,1>(seg, 4);
+ std::ostringstream out;
+ out << bg::dsv(seg);
+ BOOST_CHECK_EQUAL(out.str(), "((1, 2), (3, 4))");
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<int[3]>();
+ test_all<float[3]>();
+ test_all<double[3]>();
+ //test_all<test_point>();
+ test_all<bg::model::point<int, 3, bg::cs::cartesian> >();
+ test_all<bg::model::point<float, 3, bg::cs::cartesian> >();
+ test_all<bg::model::point<double, 3, bg::cs::cartesian> >();
+
+ test_custom<test::custom_segment>();
+ test_custom<test::custom_segment_of<bg::model::point<double, 2, bg::cs::cartesian> > >();
+ test_custom<test::custom_segment_of<test::custom_point_for_segment> >();
+ test_custom<test::custom_segment_4>();
+
+ return 0;
+}
+
diff --git a/libs/geometry/test/geometries/segment.vcproj b/libs/geometry/test/geometries/segment.vcproj
new file mode 100644
index 000000000..a25abee4e
--- /dev/null
+++ b/libs/geometry/test/geometries/segment.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="segment"
+ ProjectGUID="{F995B070-62A2-46FE-A676-79AADB71DBD8}"
+ RootNamespace="segment"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\segment"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\segment"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\segment.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/geometry_test_common.hpp b/libs/geometry/test/geometry_test_common.hpp
new file mode 100644
index 000000000..689408c77
--- /dev/null
+++ b/libs/geometry/test/geometry_test_common.hpp
@@ -0,0 +1,165 @@
+// 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.
+
+// 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)
+
+
+#ifndef GEOMETRY_TEST_GEOMETRY_TEST_COMMON_HPP
+#define GEOMETRY_TEST_GEOMETRY_TEST_COMMON_HPP
+
+#if defined(_MSC_VER)
+// 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)
+
+#include <boost/config.hpp>
+
+
+#if defined(BOOST_INTEL_CXX_VERSION)
+#define BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
+#endif
+
+
+#include <boost/foreach.hpp>
+
+
+// Include some always-included-for-testing files
+#if ! defined(BOOST_GEOMETRY_NO_BOOST_TEST)
+
+// Until Boost fixes it, silence warning issued by clang:
+// warning: unused variable 'check_is_close' [-Wunused-variable]
+#ifdef __clang__
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wunused-variable"
+#endif
+
+# include <boost/test/floating_point_comparison.hpp>
+# include <boost/test/included/test_exec_monitor.hpp>
+//# include <boost/test/included/prg_exec_monitor.hpp>
+# include <boost/test/impl/execution_monitor.ipp>
+
+#ifdef __clang__
+# pragma clang diagnostic pop
+#endif
+
+#endif
+
+
+#if defined(HAVE_TTMATH)
+# include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
+#endif
+
+#if defined(HAVE_CLN) || defined(HAVE_GMP)
+# include <boost/numeric_adaptor/numeric_adaptor.hpp>
+#endif
+
+
+#if defined(HAVE_GMP)
+# include <boost/numeric_adaptor/gmp_value_type.hpp>
+#endif
+#if defined(HAVE_CLN)
+# include <boost/numeric_adaptor/cln_value_type.hpp>
+#endif
+
+
+template <typename T>
+struct string_from_type {};
+
+template <> struct string_from_type<void>
+{ static std::string name() { return "v"; } };
+
+template <> struct string_from_type<float>
+{ static std::string name() { return "f"; } };
+
+template <> struct string_from_type<double>
+{ static std::string name() { return "d"; } };
+
+template <> struct string_from_type<long double>
+{ static std::string name() { return "e"; } };
+
+template <> struct string_from_type<int>
+{ static std::string name() { return "i"; } };
+
+#if defined(HAVE_TTMATH)
+ template <> struct string_from_type<ttmath_big>
+ { static std::string name() { return "t"; } };
+#endif
+
+#if defined(BOOST_RATIONAL_HPP)
+template <typename T> struct string_from_type<boost::rational<T> >
+{ static std::string name() { return "r"; } };
+#endif
+
+
+#if defined(HAVE_GMP)
+ template <> struct string_from_type<boost::numeric_adaptor::gmp_value_type>
+ { static std::string name() { return "g"; } };
+#endif
+
+#if defined(HAVE_CLN)
+ template <> struct string_from_type<boost::numeric_adaptor::cln_value_type>
+ { static std::string name() { return "c"; } };
+#endif
+
+
+template <typename CoordinateType, typename T1, typename T2>
+inline T1 if_typed_tt(T1 value_tt, T2 value)
+{
+#if defined(HAVE_TTMATH)
+ return boost::is_same<CoordinateType, ttmath_big>::type::value ? value_tt : value;
+#else
+ return value;
+#endif
+}
+
+template <typename CoordinateType, typename Specified, typename T>
+inline T if_typed(T value_typed, T value)
+{
+ return boost::is_same<CoordinateType, Specified>::value ? value_typed : value;
+}
+
+
+
+
+struct geographic_policy
+{
+ template <typename CoordinateType>
+ static inline CoordinateType apply(CoordinateType const& value)
+ {
+ return value;
+ }
+};
+
+struct mathematical_policy
+{
+ template <typename CoordinateType>
+ static inline CoordinateType apply(CoordinateType const& value)
+ {
+ return 90 - value;
+ }
+
+};
+
+
+
+
+// For all tests:
+// - do NOT use "using namespace boost::geometry" to make clear what is Boost.Geometry
+// - use bg:: as short alias
+#include <boost/geometry/core/tag.hpp>
+namespace bg = boost::geometry;
+
+
+#endif // GEOMETRY_TEST_GEOMETRY_TEST_COMMON_HPP
diff --git a/libs/geometry/test/io/Jamfile.v2 b/libs/geometry/test/io/Jamfile.v2
new file mode 100644
index 000000000..cf1cf59c9
--- /dev/null
+++ b/libs/geometry/test/io/Jamfile.v2
@@ -0,0 +1,11 @@
+# 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)
+
+build-project wkt ; \ No newline at end of file
diff --git a/libs/geometry/test/io/wkt/Jamfile.v2 b/libs/geometry/test/io/wkt/Jamfile.v2
new file mode 100644
index 000000000..c93e26a8e
--- /dev/null
+++ b/libs/geometry/test/io/wkt/Jamfile.v2
@@ -0,0 +1,15 @@
+# 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-io-wkt
+ :
+ [ run wkt.cpp ]
+ ;
+
diff --git a/libs/geometry/test/io/wkt/io_wkt_tests.sln b/libs/geometry/test/io/wkt/io_wkt_tests.sln
new file mode 100644
index 000000000..626c327bc
--- /dev/null
+++ b/libs/geometry/test/io/wkt/io_wkt_tests.sln
@@ -0,0 +1,19 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wkt", "wkt.vcproj", "{1FA2ADE2-F649-4245-951E-A8F5935E7127}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1FA2ADE2-F649-4245-951E-A8F5935E7127}.Debug|Win32.ActiveCfg = Debug|Win32
+ {1FA2ADE2-F649-4245-951E-A8F5935E7127}.Debug|Win32.Build.0 = Debug|Win32
+ {1FA2ADE2-F649-4245-951E-A8F5935E7127}.Release|Win32.ActiveCfg = Release|Win32
+ {1FA2ADE2-F649-4245-951E-A8F5935E7127}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/io/wkt/wkt.cpp b/libs/geometry/test/io/wkt/wkt.cpp
new file mode 100644
index 000000000..72badd383
--- /dev/null
+++ b/libs/geometry/test/io/wkt/wkt.cpp
@@ -0,0 +1,248 @@
+// 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.
+
+// 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 <sstream>
+#include <string>
+
+#include <boost/algorithm/string.hpp>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/algorithms/area.hpp>
+#include <boost/geometry/algorithms/length.hpp>
+#include <boost/geometry/algorithms/num_points.hpp>
+#include <boost/geometry/algorithms/perimeter.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+#include <boost/geometry/core/point_type.hpp>
+#include <boost/geometry/core/topological_dimension.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/io/wkt/write.hpp>
+#include <boost/variant/variant.hpp>
+
+template <typename G>
+void check_wkt(G const& geometry, std::string const& expected)
+{
+ std::ostringstream out;
+ out << bg::wkt(geometry);
+ BOOST_CHECK_EQUAL(boost::to_upper_copy(out.str()),
+ boost::to_upper_copy(expected));
+}
+
+template <typename G>
+void test_wkt(std::string const& wkt, std::size_t n, double len = 0,
+ double ar = 0, double peri = 0)
+{
+ G geometry;
+
+ bg::read_wkt(wkt, geometry);
+
+ /*
+ std::cout << "n=" << bg::num_points(geometry)
+ << " dim=" << bg::topological_dimension<G>::value
+ << " length=" << bg::length(geometry)
+ << " area=" << bg::area(geometry)
+ << " perimeter=" << bg::perimeter(geometry)
+ << std::endl << "\t\tgeometry=" << dsv(geometry)
+ << std::endl;
+ */
+
+ BOOST_CHECK_EQUAL(bg::num_points(geometry), n);
+ if (n > 0)
+ {
+ BOOST_CHECK_CLOSE(double(bg::length(geometry)), len, 0.0001);
+ BOOST_CHECK_CLOSE(double(bg::area(geometry)), ar, 0.0001);
+ BOOST_CHECK_CLOSE(double(bg::perimeter(geometry)), peri, 0.0001);
+ }
+
+ check_wkt(geometry, wkt);
+ check_wkt(boost::variant<G>(geometry), wkt);
+}
+
+template <typename G>
+void test_relaxed_wkt(std::string const& wkt, std::string const& expected)
+{
+ std::string e;
+ G geometry;
+ bg::read_wkt(wkt, geometry);
+ std::ostringstream out;
+ out << bg::wkt(geometry);
+
+ BOOST_CHECK_EQUAL(boost::to_upper_copy(out.str()), boost::to_upper_copy(expected));
+}
+
+
+
+
+template <typename G>
+void test_wrong_wkt(std::string const& wkt, std::string const& start)
+{
+ std::string e("no exception");
+ G geometry;
+ try
+ {
+ bg::read_wkt(wkt, geometry);
+ }
+ catch(bg::read_wkt_exception const& ex)
+ {
+ e = ex.what();
+ boost::to_lower(e);
+ }
+ catch(...)
+ {
+ e = "other exception";
+ }
+
+ bool check = true;
+
+#if defined(HAVE_TTMATH)
+ // For ttmath we skip bad lexical casts
+ typedef typename bg::coordinate_type<G>::type ct;
+
+ if (boost::is_same<ct, ttmath_big>::type::value
+ && boost::starts_with(start, "bad lexical cast"))
+ {
+ check = false;
+ }
+#endif
+
+ if (check)
+ {
+ BOOST_CHECK_MESSAGE(boost::starts_with(e, start), " Expected:"
+ << start << " Got:" << e << " with WKT: " << wkt);
+ }
+}
+
+template <typename G>
+void test_wkt_output_iterator(std::string const& wkt)
+{
+ G geometry;
+ bg::read_wkt<G>(wkt, std::back_inserter(geometry));
+}
+
+
+
+#ifndef GEOMETRY_TEST_MULTI
+template <typename T>
+void test_all()
+{
+ using namespace boost::geometry;
+ typedef bg::model::point<T, 2, bg::cs::cartesian> P;
+
+ test_wkt<P>("POINT(1 2)", 1);
+ test_wkt<bg::model::linestring<P> >("LINESTRING(1 1,2 2,3 3)", 3, 2 * sqrt(2.0));
+ test_wkt<bg::model::polygon<P> >("POLYGON((0 0,0 4,4 4,4 0,0 0)"
+ ",(1 1,1 2,2 2,2 1,1 1),(1 1,1 2,2 2,2 1,1 1))", 15, 0, 18, 24);
+
+ // Non OGC: a box defined by a polygon
+ //test_wkt<box<P> >("POLYGON((0 0,0 1,1 1,1 0,0 0))", 4, 0, 1, 4);
+ test_wkt<bg::model::ring<P> >("POLYGON((0 0,0 1,1 1,1 0,0 0))", 5, 0, 1, 4);
+
+ // We accept empty sequences as well (much better than EMPTY)...
+ // ...or even POINT() (see below)
+ test_wkt<bg::model::linestring<P> >("LINESTRING()", 0, 0);
+ test_wkt<bg::model::polygon<P> >("POLYGON(())", 0);
+ // ... or even with empty holes
+ test_wkt<bg::model::polygon<P> >("POLYGON((),(),())", 0);
+ // which all make no valid geometries, but they can exist.
+
+ // These WKT's are incomplete or abnormal but they are considered OK
+ test_relaxed_wkt<P>("POINT(1)", "POINT(1 0)");
+ test_relaxed_wkt<P>("POINT()", "POINT(0 0)");
+ test_relaxed_wkt<bg::model::linestring<P> >("LINESTRING(1,2,3)",
+ "LINESTRING(1 0,2 0,3 0)");
+ test_relaxed_wkt<P>("POINT ( 1 2) ", "POINT(1 2)");
+ test_relaxed_wkt<P>("POINT M ( 1 2)", "POINT(1 2)");
+ test_relaxed_wkt<bg::model::box<P> >("BOX(1 1,2 2)", "POLYGON((1 1,1 2,2 2,2 1,1 1))");
+
+ test_relaxed_wkt<bg::model::linestring<P> >("LINESTRING EMPTY", "LINESTRING()");
+
+ test_relaxed_wkt<bg::model::polygon<P> >("POLYGON( ( ) , ( ) , ( ) )",
+ "POLYGON((),(),())");
+
+ // Wrong WKT's
+ test_wrong_wkt<P>("POINT(1 2", "expected ')'");
+ test_wrong_wkt<P>("POINT 1 2)", "expected '('");
+ test_wrong_wkt<P>("POINT(1 2,)", "expected ')'");
+ test_wrong_wkt<P>("POINT(1 2)foo", "too much tokens at 'foo'");
+ test_wrong_wkt<P>("POINT(1 2 3)", "expected ')'");
+ test_wrong_wkt<P>("POINT(a 2 3)", "bad lexical cast");
+ test_wrong_wkt<P>("POINT 2 3", "expected '('");
+ test_wrong_wkt<P>("POINT Z (1 2 3)", "z only allowed");
+
+ test_wrong_wkt<P>("PIONT (1 2)", "should start with 'point'");
+
+ test_wrong_wkt<bg::model::linestring<P> >("LINESTRING())", "too much tokens");
+
+ test_wrong_wkt<bg::model::polygon<P> >("POLYGON((1 1,1 4,4 4,4 1,1 1)"
+ ",((2 2,2 3,3 3,3 2,2 2))", "bad lexical cast");
+
+ test_wrong_wkt<bg::model::box<P> >("BOX(1 1,2 2,3 3)", "box should have 2");
+ test_wrong_wkt<bg::model::box<P> >("BOX(1 1,2 2) )", "too much tokens");
+
+ if (boost::is_floating_point<T>::type::value
+ || ! boost::is_fundamental<T>::type::value)
+ {
+ test_wkt<P>("POINT(1.1 2.1)", 1);
+ }
+
+ // Deprecated:
+ // test_wkt_output_iterator<bg::model::linestring<P> >("LINESTRING(1 1,2 2,3 3)");
+ // test_wkt_output_iterator<bg::model::ring<P> >("POLYGON((1 1,2 2,3 3))");
+}
+#endif
+
+
+int test_main(int, char* [])
+{
+ test_all<double>();
+ test_all<int>();
+
+#if defined(HAVE_TTMATH)
+ test_all<ttmath_big>();
+#endif
+
+ return 0;
+}
+
+/*
+
+Results can be checked in PostGIS by query below,
+or by MySQL (but replace length by glength and remove the perimeter)
+
+Note:
+- PostGIS gives "3" for a numpoints of a multi-linestring of 6 points in total (!)
+ --> "npoints" should be taken for all geometries
+- SQL Server 2008 gives "6"
+ select geometry::STGeomFromText('MULTILINESTRING((1 1,2 2,3 3),(4 4,5 5,6 6))',0).STNumPoints()
+- MySQL gives "NULL"
+
+select 1 as code,'np p' as header,npoints(geomfromtext('POINT(1 2)')) as contents
+union select 2,'length point', length(geomfromtext('POINT(1 2)'))
+union select 3,'peri point', perimeter(geomfromtext('POINT(1 2)'))
+union select 4,'area point',area(geomfromtext('POINT(1 2)'))
+
+
+union select 5,'# ls',npoints(geomfromtext('LINESTRING(1 1,2 2,3 3)'))
+union select 6,'length ls',length(geomfromtext('LINESTRING(1 1,2 2,3 3)'))
+union select 7,'peri ls',perimeter(geomfromtext('LINESTRING(1 1,2 2,3 3)'))
+union select 8,'aera ls',area(geomfromtext('LINESTRING(1 1,2 2,3 3)'))
+
+union select 9,'# poly',npoints(geomfromtext('POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,1 2,2 2,2 1,1 1),(1 1,1 2,2 2,2 1,1 1))'))
+union select 10,'length poly',length(geomfromtext('POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,1 2,2 2,2 1,1 1),(1 1,1 2,2 2,2 1,1 1))'))
+union select 11,'peri poly',perimeter(geomfromtext('POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,1 2,2 2,2 1,1 1),(1 1,1 2,2 2,2 1,1 1))'))
+union select 12,'area poly',area(geomfromtext('POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,1 2,2 2,2 1,1 1),(1 1,1 2,2 2,2 1,1 1))'))
+
+*/
diff --git a/libs/geometry/test/io/wkt/wkt.vcproj b/libs/geometry/test/io/wkt/wkt.vcproj
new file mode 100644
index 000000000..988ee6af7
--- /dev/null
+++ b/libs/geometry/test/io/wkt/wkt.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="wkt"
+ ProjectGUID="{1FA2ADE2-F649-4245-951E-A8F5935E7127}"
+ RootNamespace="wkt"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\wkt"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\wkt"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\wkt.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/iterators/Jamfile.v2 b/libs/geometry/test/iterators/Jamfile.v2
new file mode 100644
index 000000000..72091f21f
--- /dev/null
+++ b/libs/geometry/test/iterators/Jamfile.v2
@@ -0,0 +1,15 @@
+# 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-iterators
+ :
+ [ run closing_iterator.cpp ]
+ [ run ever_circling_iterator.cpp ]
+ ;
diff --git a/libs/geometry/test/iterators/closing_iterator.cpp b/libs/geometry/test/iterators/closing_iterator.cpp
new file mode 100644
index 000000000..1638f639e
--- /dev/null
+++ b/libs/geometry/test/iterators/closing_iterator.cpp
@@ -0,0 +1,119 @@
+// 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.
+
+// 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 <algorithm>
+#include <iterator>
+#include <sstream>
+#include <string>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/iterators/closing_iterator.hpp>
+
+#include <boost/geometry/core/coordinate_type.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+
+// The closing iterator should also work on normal std:: containers
+void test_non_geometry()
+{
+ std::vector<int> v;
+ v.push_back(1);
+ v.push_back(2);
+ v.push_back(3);
+
+ typedef bg::closing_iterator
+ <
+ std::vector<int> const
+ > closing_iterator;
+
+
+ closing_iterator it(v);
+ closing_iterator end(v, true);
+
+ std::ostringstream out;
+ for (; it != end; ++it)
+ {
+ out << *it;
+ }
+ BOOST_CHECK_EQUAL(out.str(), "1231");
+}
+
+
+
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt)
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ typedef bg::closing_iterator<Geometry const> closing_iterator;
+
+
+ // 1. Test normal behaviour
+ {
+ closing_iterator it(geometry);
+ closing_iterator end(geometry, true);
+
+ std::ostringstream out;
+ for (; it != end; ++it)
+ {
+ out << " " << bg::get<0>(*it) << bg::get<1>(*it);
+ }
+ BOOST_CHECK_EQUAL(out.str(), " 11 14 44 41 11");
+
+ // Check compilations, it is (since Oct 2010) random access
+ it--;
+ --it;
+ it += 2;
+ it -= 2;
+ }
+
+ // 2: check copy behaviour
+ {
+ typedef typename boost::range_iterator<Geometry const>::type normal_iterator;
+ Geometry copy;
+
+ std::copy<closing_iterator>(
+ closing_iterator(geometry),
+ closing_iterator(geometry, true),
+ std::back_inserter(copy));
+
+ std::ostringstream out;
+ for (normal_iterator cit = boost::begin(copy); cit != boost::end(copy); ++cit)
+ {
+ out << " " << bg::get<0>(*cit) << bg::get<1>(*cit);
+ }
+ BOOST_CHECK_EQUAL(out.str(), " 11 14 44 41 11");
+ }
+}
+
+
+template <typename P>
+void test_all()
+{
+ test_non_geometry();
+ test_geometry<bg::model::ring<P> >("POLYGON((1 1,1 4,4 4,4 1))");
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/iterators/closing_iterator.vcproj b/libs/geometry/test/iterators/closing_iterator.vcproj
new file mode 100644
index 000000000..e11dc14ef
--- /dev/null
+++ b/libs/geometry/test/iterators/closing_iterator.vcproj
@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="closing_iterator"
+ ProjectGUID="{04C31A2D-BE88-4FDB-AFFE-EFDFFA9D9C39}"
+ RootNamespace="closing_iterator"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\closing_iterator"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\closing_iterator"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\closing_iterator.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/iterators/ever_circling_iterator.cpp b/libs/geometry/test/iterators/ever_circling_iterator.cpp
new file mode 100644
index 000000000..90142e13d
--- /dev/null
+++ b/libs/geometry/test/iterators/ever_circling_iterator.cpp
@@ -0,0 +1,97 @@
+// 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.
+
+// 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 <sstream>
+#include <string>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/iterators/ever_circling_iterator.hpp>
+
+#include <boost/geometry/core/coordinate_type.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+template <typename G>
+void test_geometry(std::string const& wkt)
+{
+ G geo;
+ bg::read_wkt(wkt, geo);
+ typedef typename boost::range_iterator<G const>::type iterator_type;
+
+
+ // Run 3 times through the geometry
+ int n = boost::size(geo) * 3;
+
+ {
+ std::ostringstream out;
+ bg::ever_circling_iterator<iterator_type> it(boost::begin(geo), boost::end(geo));
+ for (int i = 0; i < n; ++i, ++it)
+ {
+ out << bg::get<0>(*it);
+ }
+ BOOST_CHECK_EQUAL(out.str(), "123451234512345");
+ }
+
+ {
+ std::ostringstream out;
+ // Start somewhere
+ bg::ever_circling_iterator<iterator_type> it(
+ boost::begin(geo), boost::end(geo), boost::begin(geo) + 1);
+ for (int i = 0; i < n; ++i, ++it)
+ {
+ out << bg::get<0>(*it);
+ }
+ BOOST_CHECK_EQUAL(out.str(), "234512345123451");
+ }
+
+ {
+ std::ostringstream out;
+
+ // Navigate to somewhere
+ bg::ever_circling_iterator<iterator_type> it(boost::begin(geo), boost::end(geo));
+ for (int i = 0; i < n; ++i, ++it)
+ {
+ const int m = boost::size(geo);
+ it.moveto(boost::begin(geo) + m - (i % m) - 1);
+ out << bg::get<0>(*it);
+ }
+ BOOST_CHECK_EQUAL(out.str(), "543215432154321");
+ }
+
+ // Check the range_iterator-one
+ {
+ std::ostringstream out;
+ bg::ever_circling_range_iterator<G> it(geo);
+ for (int i = 0; i < n; ++i, ++it)
+ {
+ out << bg::get<0>(*it);
+ }
+ BOOST_CHECK_EQUAL(out.str(), "123451234512345");
+ }
+}
+
+template <typename P>
+void test_all()
+{
+ test_geometry<bg::model::linestring<P> >("linestring(1 1,2 2,3 3,4 4,5 5)");
+}
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/iterators/ever_circling_iterator.vcproj b/libs/geometry/test/iterators/ever_circling_iterator.vcproj
new file mode 100644
index 000000000..ebeddee29
--- /dev/null
+++ b/libs/geometry/test/iterators/ever_circling_iterator.vcproj
@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="ever_circling_iterator"
+ ProjectGUID="{73F8C969-FA1E-4D9D-81F9-35B1206F0C14}"
+ RootNamespace="ever_circling_iterator"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\ever_circling_iterator"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\ever_circling_iterator"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\ever_circling_iterator.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/iterators/iterators.sln b/libs/geometry/test/iterators/iterators.sln
new file mode 100644
index 000000000..8b1e55c7e
--- /dev/null
+++ b/libs/geometry/test/iterators/iterators.sln
@@ -0,0 +1,25 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ever_circling_iterator", "ever_circling_iterator.vcproj", "{73F8C969-FA1E-4D9D-81F9-35B1206F0C14}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "closing_iterator", "closing_iterator.vcproj", "{04C31A2D-BE88-4FDB-AFFE-EFDFFA9D9C39}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {73F8C969-FA1E-4D9D-81F9-35B1206F0C14}.Debug|Win32.ActiveCfg = Debug|Win32
+ {73F8C969-FA1E-4D9D-81F9-35B1206F0C14}.Debug|Win32.Build.0 = Debug|Win32
+ {73F8C969-FA1E-4D9D-81F9-35B1206F0C14}.Release|Win32.ActiveCfg = Release|Win32
+ {73F8C969-FA1E-4D9D-81F9-35B1206F0C14}.Release|Win32.Build.0 = Release|Win32
+ {04C31A2D-BE88-4FDB-AFFE-EFDFFA9D9C39}.Debug|Win32.ActiveCfg = Debug|Win32
+ {04C31A2D-BE88-4FDB-AFFE-EFDFFA9D9C39}.Debug|Win32.Build.0 = Debug|Win32
+ {04C31A2D-BE88-4FDB-AFFE-EFDFFA9D9C39}.Release|Win32.ActiveCfg = Release|Win32
+ {04C31A2D-BE88-4FDB-AFFE-EFDFFA9D9C39}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/multi/Jamfile.v2 b/libs/geometry/test/multi/Jamfile.v2
new file mode 100644
index 000000000..b38d8c5ad
--- /dev/null
+++ b/libs/geometry/test/multi/Jamfile.v2
@@ -0,0 +1,12 @@
+# 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)
+
+build-project algorithms ;
+build-project io ; \ No newline at end of file
diff --git a/libs/geometry/test/multi/algorithms/Jamfile.v2 b/libs/geometry/test/multi/algorithms/Jamfile.v2
new file mode 100644
index 000000000..624193c21
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/Jamfile.v2
@@ -0,0 +1,42 @@
+# 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-multi-algorithms
+ :
+ [ run multi_area.cpp ]
+ [ run multi_centroid.cpp ]
+ [ run multi_convert.cpp ]
+ [ run multi_convex_hull.cpp ]
+ [ run multi_correct.cpp ]
+ [ run multi_covered_by.cpp ]
+ [ run multi_difference.cpp ]
+ [ run multi_disjoint.cpp ]
+ [ run multi_distance.cpp ]
+ [ run multi_envelope.cpp ]
+ [ run multi_equals.cpp ]
+ [ run multi_for_each.cpp ]
+ [ run multi_intersection.cpp ]
+ [ run multi_intersects.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_touches.cpp ]
+ [ run multi_transform.cpp ]
+ [ run multi_union.cpp ]
+ [ run multi_unique.cpp ]
+ [ run multi_within.cpp ]
+ ;
+
+build-project overlay
+ ;
diff --git a/libs/geometry/test/multi/algorithms/multi_area.cpp b/libs/geometry/test/multi/algorithms/multi_area.cpp
new file mode 100644
index 000000000..3dbc658e1
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_area.cpp
@@ -0,0 +1,39 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 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_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/io/wkt/wkt.hpp>
+#include <boost/geometry/multi/io/wkt/wkt.hpp>
+
+
+
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::multi_polygon<bg::model::polygon<P> > mp;
+ test_geometry<mp>("MULTIPOLYGON(((0 0,0 7,4 2,2 0,0 0)))", 16.0);
+}
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_area.vcproj b/libs/geometry/test/multi/algorithms/multi_area.vcproj
new file mode 100644
index 000000000..7adb7a058
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_area.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_area"
+ ProjectGUID="{691082ED-2778-4300-9860-42DFBBABE535}"
+ RootNamespace="multi_area"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_area"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../..;."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_area"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../..;."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_area.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_centroid.cpp b/libs/geometry/test/multi/algorithms/multi_centroid.cpp
new file mode 100644
index 000000000..25c66c085
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_centroid.cpp
@@ -0,0 +1,122 @@
+// 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.
+
+// 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 <algorithms/test_centroid.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/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
+
+
+template <typename P>
+void test_2d(bool is_integer = false)
+{
+ typedef typename bg::coordinate_type<P>::type ct;
+#ifdef REPORT_RESULTS
+ std::cout << std::endl << "type: " << typeid(ct).name() << " size: " << sizeof(ct) << std::endl;
+#endif
+
+ if (! is_integer)
+ {
+ // Only working for floating point:
+
+ test_centroid<bg::model::multi_point<P> >(
+ "MULTIPOINT((1 1),(2 3),(5 0))",
+ 2.666666666666667, 1.33333);
+
+ test_centroid<bg::model::multi_linestring<bg::model::linestring<P> > >(
+ "MULTILINESTRING((0 0,0 2),(1 0,1 2))",
+ 0.5, 1.0);
+
+
+ test_centroid<bg::model::multi_polygon<bg::model::polygon<P> > >(
+ "MULTIPOLYGON(((1 1,1 3,3 3,3 1,1 1)),((4 1,4 3,8 3,8 1,4 1)))",
+ 4.666666666666667, 2.0);
+
+ test_centroid<bg::model::multi_polygon<bg::model::polygon<P> > >(
+ "MULTIPOLYGON(((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2"
+ ",3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3)),"
+ "((10 10,10 12,12 12,12 10,10 10)))",
+ 7.338463104108615, 6.0606722055552407);
+ }
+
+
+
+ // Test using real-world polygon with large (Y) coordinates
+ // (coordinates can be used for integer and floating point point-types)
+ // Note that this will fail (overflow) if centroid calculation uses float
+ test_centroid<bg::model::multi_polygon<bg::model::polygon<P> > >(
+ "MULTIPOLYGON(((426062 4527794,426123 4527731"
+ ",426113 4527700,426113 4527693,426115 4527671"
+ ",426133 4527584,426135 4527569,426124 4527558"
+ ",426103 4527547,426072 4527538,426003 4527535"
+ ",425972 4527532,425950 4527531,425918 4527528"
+ ",425894 4527517,425876 4527504,425870 4527484"
+ ",425858 4527442,425842 4527414,425816 4527397"
+ ",425752 4527384,425692 4527369,425658 4527349"
+ ",425624 4527307,425605 4527260,425598 4527213"
+ ",425595 4527167,425582 4527125,425548 4527064"
+ ",425535 4527027,425537 4526990,425534 4526943"
+ ",425525 4526904,425500 4526856,425461 4526811"
+ ",425450 4526798,425381 4526823,425362 4526830"
+ ",425329 4526848,425298 4526883,425291 4526897"
+ ",425268 4526923,425243 4526945,425209 4526971"
+ ",425172 4526990,425118 4527028,425104 4527044"
+ ",425042 4527090,424980 4527126,424925 4527147"
+ ",424881 4527148,424821 4527147,424698 4527125"
+ ",424610 4527121,424566 4527126,424468 4527139"
+ ",424426 4527141,424410 4527142,424333 4527130"
+ ",424261 4527110,424179 4527073,424024 4527012"
+ ",423947 4526987,423902 4526973,423858 4526961"
+ ",423842 4526951,423816 4526935,423799 4526910"
+ ",423776 4526905,423765 4526911,423739 4526927"
+ ",423692 4526946,423636 4526976,423608 4527008"
+ ",423570 4527016,423537 4527011,423505 4526996"
+ ",423480 4526994,423457 4527012,423434 4527021"
+ ",423367 4527008,423263 4526998,423210 4526993"
+ ",423157 4526996,423110 4526994,423071 4526984"
+ ",423048 4526984,423032 4526994,423254 4527613"
+ ",423889 4528156,424585 4528050,425479 4527974"
+ ",425795 4527867,426062 4527794)))",
+ 424530.6059719588, 4527519.619367547);
+}
+
+
+
+int test_main(int, char* [])
+{
+ test_2d<bg::model::d2::point_xy<float> >();
+ test_2d<bg::model::d2::point_xy<double> >();
+ test_2d<bg::model::d2::point_xy<long int> >(true);
+ //test_2d<bg::model::d2::point_xy<long long> >(true);
+ //test_2d<bg::model::d2::point_xy<long double> >();
+
+#ifdef HAVE_TTMATH
+ test_2d<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_centroid.vcproj b/libs/geometry/test/multi/algorithms/multi_centroid.vcproj
new file mode 100644
index 000000000..b713a4452
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_centroid.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_centroid"
+ ProjectGUID="{7EE302E1-7FCF-4E9E-8DB3-36EA4D88B6CA}"
+ RootNamespace="multi_centroid"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_centroid"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_centroid"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_centroid.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_clear.cpp b/libs/geometry/test/multi/algorithms/multi_clear.cpp
new file mode 100644
index 000000000..39d777930
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_clear.cpp
@@ -0,0 +1,69 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2011-2012 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/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>
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt, unsigned int expected)
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ boost::variant<Geometry> variant_geometry(geometry);
+
+ bg::clear(geometry);
+ BOOST_CHECK_EQUAL(bg::num_points(geometry), expected);
+
+ bg::clear(variant_geometry);
+ BOOST_CHECK_EQUAL(bg::num_points(variant_geometry), expected);
+}
+
+
+template <typename Point>
+void test_all()
+{
+ typedef bg::model::polygon<Point> poly;
+ typedef bg::model::linestring<Point> ls;
+ typedef bg::model::multi_point<Point> mpoint;
+ typedef bg::model::multi_linestring<ls> mls;
+ typedef bg::model::multi_polygon<poly> mpoly;
+
+ test_geometry<Point>("POINT(0 0)", 1);
+ test_geometry<ls>("LINESTRING(0 0,0 1)", 0);
+ test_geometry<poly>("POLYGON((0 0,0 1,1 0,0 0))", 0);
+ test_geometry<mpoint>("MULTIPOINT((0 0),(0 1),(1 0),(0 0))", 0);
+ test_geometry<mls>("MULTILINESTRING((0 0,0 1),(1 0,0 0))", 0);
+ test_geometry<mpoly>("MULTIPOLYGON(((0 0,0 1,1 0,0 0)),((10 0,10 1,11 0,10 0)))", 0);
+}
+
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_convert.cpp b/libs/geometry/test/multi/algorithms/multi_convert.cpp
new file mode 100644
index 000000000..840fa2e26
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_convert.cpp
@@ -0,0 +1,102 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 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/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()
+{
+ test_mixed_identical_result
+ <
+ bg::model::multi_point<Point1>,
+ bg::model::multi_point<Point2>
+ >
+ ("MULTIPOINT((1 1),(2 2),(3 3))");
+
+ test_mixed_identical_result
+ <
+ bg::model::multi_linestring<bg::model::linestring<Point1> >,
+ bg::model::multi_linestring<bg::model::linestring<Point2> >
+ >
+ ("MULTILINESTRING((1 1,2 2),(3 3,4 4))");
+
+ // Single -> multi (always possible)
+ test_mixed
+ <
+ Point1, bg::model::multi_point<Point2>
+ >
+ (
+ "POINT(1 1)",
+ "MULTIPOINT((1 1))"
+ );
+ test_mixed
+ <
+ bg::model::linestring<Point1>,
+ bg::model::multi_linestring<bg::model::linestring<Point2> >
+ >
+ (
+ "LINESTRING(1 1,2 2)",
+ "MULTILINESTRING((1 1,2 2))"
+ );
+ test_mixed
+ <
+ bg::model::segment<Point1>,
+ bg::model::multi_linestring<bg::model::linestring<Point2> >
+ >
+ (
+ "LINESTRING(1 1,2 2)",
+ "MULTILINESTRING((1 1,2 2))"
+ );
+ test_mixed
+ <
+ bg::model::box<Point1>,
+ bg::model::multi_polygon<bg::model::polygon<Point2> >
+ >
+ (
+ "BOX(0 0,1 1)",
+ "MULTIPOLYGON(((0 0,0 1,1 1,1 0,0 0)))"
+ );
+ test_mixed
+ <
+ bg::model::ring<Point1, true>,
+ bg::model::multi_polygon<bg::model::polygon<Point2, false> >
+ >
+ (
+ "POLYGON((0 0,0 1,1 1,1 0,0 0))",
+ "MULTIPOLYGON(((0 0,1 0,1 1,0 1,0 0)))"
+ );
+
+ // Multi -> single: should not compile (because multi often have 0 or >1 elements)
+}
+
+template <typename Point1, typename Point2>
+void test_mixed_types()
+{
+ test_mixed_point_types<Point1, Point2>();
+ test_mixed_point_types<Point2, Point1>();
+}
+
+int test_main( int , char* [] )
+{
+ test_mixed_types
+ <
+ bg::model::point<int, 2, bg::cs::cartesian>,
+ bg::model::point<double, 2, bg::cs::cartesian>
+ >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_convert.vcproj b/libs/geometry/test/multi/algorithms/multi_convert.vcproj
new file mode 100644
index 000000000..4829412be
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_convert.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_convert"
+ ProjectGUID="{21B7EF55-23C3-4FD2-9F2F-FD8F0F3FE167}"
+ RootNamespace="multi_convert"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_convert"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_convert"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_convert.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_convex_hull.cpp b/libs/geometry/test/multi/algorithms/multi_convex_hull.cpp
new file mode 100644
index 000000000..0da8d0ecf
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_convex_hull.cpp
@@ -0,0 +1,92 @@
+// 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.
+
+// 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 <cstddef>
+#include <iterator>
+#include <string>
+
+#include <algorithms/test_convex_hull.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+
+#include <boost/geometry/multi/core/point_order.hpp>
+#include <boost/geometry/multi/core/point_type.hpp>
+
+#include <boost/geometry/multi/views/detail/range_type.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>
+
+
+
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::multi_point<P> mp;
+ typedef bg::model::multi_linestring<bg::model::linestring<P> > ml;
+ typedef bg::model::multi_polygon<bg::model::polygon<P> > mpoly;
+
+ // All points below in upper-points and lower-points
+ test_geometry<mp>("MULTIPOINT((0 0),(5 0),(1 1),(4 1))", -1, 5, 4.0);
+ test_geometry<mp>("MULTIPOINT((0 1),(5 1),(1 0),(4 0))", -1, 5, 4.0);
+
+ // All points in vertical line (this delivers an empty polygon with 2 points and a closing point)
+ test_geometry<mp>("MULTIPOINT((1 0),(5 0),(3 0),(4 0),(2 0))", -1, 3, 0.0);
+
+ // One point only
+ test_geometry<mp>("MULTIPOINT((1 0))", -1, 3, 0.0);
+
+ // Problem of 6019, reproduced by the convex hull robustness test:
+ test_geometry<mp>("MULTIPOINT((2 9),(1 3),(9 4),(1 1),(1 0),(7 9),(2 5),(3 7),(3 6),(2 4))",
+ -1, 6, 48.0);
+
+ // Ticket 6019:
+ test_geometry<mp>("MULTIPOINT((0 53),(0 103),(0 53),(0 3),(0 3),(0 0),(1 0),(1 1),(2 1),(2 0),(2 0),(2 0),(3 0),(3 1),(4 1),(4 0),(5 0),(0 3),(10 3),(10 2),(10 2),(10 2),(5 2),(5 0),(5 0),(55 0),(105 0))",
+ -1, 4, 5407.5);
+ // Ticket 6021:
+ test_geometry<mp>("multipoint((0 53), (0 103), (1 53))", 3, 4, 25);
+
+ test_geometry<mp>("multipoint((1.1 1.1), (2.5 2.1), (3.1 3.1), (4.9 1.1), (3.1 1.9))", 5, 4, 3.8);
+ test_geometry<ml>("multilinestring((2 4, 3 4, 3 5), (4 3,4 4,5 4))", 6, 5, 3.0);
+ test_geometry<mpoly>("multipolygon(((1 4,1 6,2 5,3 5,4 6,4 4,1 4)), ((4 2,4 3,6 3,6 2,4 2)))", 12, 7, 14.0);
+
+ test_empty_input<mp>();
+ test_empty_input<ml>();
+ test_empty_input<mpoly>();
+}
+
+
+int test_main(int, char* [])
+{
+ //test_all<bg::model::d2::point_xy<int> >();
+ //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
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_convex_hull.vcproj b/libs/geometry/test/multi/algorithms/multi_convex_hull.vcproj
new file mode 100644
index 000000000..839e71c7c
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_convex_hull.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_convex_hull"
+ ProjectGUID="{B810C404-C4D9-4A6A-96B0-1DCED269D65D}"
+ RootNamespace="multi_convex_hull"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_convex_hull"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_convex_hull"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_convex_hull.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_correct.cpp b/libs/geometry/test/multi/algorithms/multi_correct.cpp
new file mode 100644
index 000000000..7359d3f76
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_correct.cpp
@@ -0,0 +1,63 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 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/correct.hpp>
+
+#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>
+#include <boost/geometry/geometries/linestring.hpp>
+#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>
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt, std::string const& expected)
+{
+ Geometry geometry;
+
+ bg::read_wkt(wkt, geometry);
+ bg::correct(geometry);
+
+ std::ostringstream out;
+ out << bg::wkt(geometry);
+
+ BOOST_CHECK_EQUAL(out.str(), expected);
+}
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::multi_polygon<bg::model::polygon<P> > cw_type;
+ std::string cw_mp =
+ "MULTIPOLYGON(((0 0,0 1,1 1,1 0,0 0)))";
+ test_geometry<cw_type>(cw_mp, cw_mp);
+
+ test_geometry<cw_type>("MULTIPOLYGON(((0 0,1 0,1 1,0 1,0 0)))",
+ cw_mp);
+}
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_correct.vcproj b/libs/geometry/test/multi/algorithms/multi_correct.vcproj
new file mode 100644
index 000000000..cc280ffd7
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_correct.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_correct"
+ ProjectGUID="{DFB00B88-2ED8-49CA-B739-7C8A8602D681}"
+ RootNamespace="multi_correct"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_correct"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_correct"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_correct.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_covered_by.cpp b/libs/geometry/test/multi/algorithms/multi_covered_by.cpp
new file mode 100644
index 000000000..df40109e5
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_covered_by.cpp
@@ -0,0 +1,59 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 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/correct.hpp>
+#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/geometries/point_xy.hpp>
+#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+#include <boost/geometry/multi/io/wkt/wkt.hpp>
+
+#include <algorithms/test_covered_by.hpp>
+
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::multi_polygon<bg::model::polygon<P> > mp;
+
+ // test multi-with-one-polygon (trivial case)
+ test_geometry<P, mp>("POINT(1 1)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", true);
+ test_geometry<P, mp>("POINT(3 3)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", false);
+ test_geometry<P, mp>("POINT(0 1)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", true);
+ test_geometry<P, mp>("POINT(4 4)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", false);
+
+ // test if it is in one of them
+ std::string multi("MULTIPOLYGON("
+ "((0 0,0 2,2 2,2 0,0 0))"
+ "((3 3,3 6,6 6,6 3,3 3))"
+ ")");
+ test_geometry<P, mp>("POINT(4 4)", multi, true);
+ test_geometry<P, mp>("POINT(1 1)", multi, true);
+ test_geometry<P, mp>("POINT(0 1)", multi, true);
+}
+
+int test_main( int , char* [] )
+{
+ //test_all<bg::model::d2::point_xy<int> >();
+ 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/multi/algorithms/multi_covered_by.vcproj b/libs/geometry/test/multi/algorithms/multi_covered_by.vcproj
new file mode 100644
index 000000000..87a62a938
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_covered_by.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_covered_by"
+ ProjectGUID="{680E56F0-229C-4377-BDC0-80EB9B59314B}"
+ RootNamespace="multi_covered_by"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_covered_by"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_covered_by"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_covered_by.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_difference.cpp b/libs/geometry/test/multi/algorithms/multi_difference.cpp
new file mode 100644
index 000000000..893d3009b
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_difference.cpp
@@ -0,0 +1,216 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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 <iostream>
+#include <string>
+
+//#define HAVE_TTMATH
+//#define BOOST_GEOMETRY_DEBUG_ASSEMBLE
+//#define BOOST_GEOMETRY_CHECK_WITH_SQLSERVER
+
+//#define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
+//#define BOOST_GEOMETRY_DEBUG_FOLLOW
+//#define BOOST_GEOMETRY_DEBUG_TRAVERSE
+
+
+#include <algorithms/test_difference.hpp>
+#include <algorithms/test_overlay.hpp>
+#include <multi/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/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>
+
+template <typename Ring, typename Polygon, typename MultiPolygon>
+void test_areal()
+{
+ test_one<Polygon, MultiPolygon, MultiPolygon>("simplex_multi",
+ case_multi_simplex[0], case_multi_simplex[1],
+ 5, 21, 5.58, 4, 17, 2.58);
+
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_multi_no_ip",
+ case_multi_no_ip[0], case_multi_no_ip[1],
+ 2, 12, 24.0, 2, 12, 34.0);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_multi_2",
+ case_multi_2[0], case_multi_2[1],
+ 2, 15, 19.6, 2, 13, 33.6);
+
+ test_one<Polygon, MultiPolygon, Polygon>("simplex_multi_mp_p",
+ case_multi_simplex[0], case_single_simplex,
+ 5, 21, 5.58, 4, 17, 2.58);
+ 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",
+ 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);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_62_multi",
+ case_62_multi[0], case_62_multi[1],
+ 0, 0, 0, 1, 5, 1);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_63_multi",
+ case_63_multi[0], case_63_multi[1],
+ 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);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_65_multi",
+ case_65_multi[0], case_65_multi[1],
+ 0, 0, 0, 2, 10, 3);
+ /* TODO: fix
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_72_multi",
+ case_72_multi[0], case_72_multi[1],
+ 3, 13, 1.65, 3, 17, 6.15);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_77_multi",
+ case_77_multi[0], case_77_multi[1],
+ 6, 31, 7, 6, 36, 13);
+ */
+
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_78_multi",
+ case_78_multi[0], case_78_multi[1],
+ 1, 5, 1.0, 1, 5, 1.0);
+
+ // Ticket on GGL list 2011/10/25
+ // to mix polygon/multipolygon in call to difference
+ test_one<Polygon, Polygon, Polygon>("ggl_list_20111025_vd_pp",
+ ggl_list_20111025_vd[0], ggl_list_20111025_vd[1],
+ 1, 4, 8.0, 1, 4, 12.5);
+ test_one<Polygon, Polygon, MultiPolygon>("ggl_list_20111025_vd_pm",
+ ggl_list_20111025_vd[0], ggl_list_20111025_vd[3],
+ 1, 4, 8.0, 1, 4, 12.5);
+ test_one<Polygon, MultiPolygon, Polygon>("ggl_list_20111025_vd_mp",
+ ggl_list_20111025_vd[2], ggl_list_20111025_vd[1],
+ 1, 4, 8.0, 1, 4, 12.5);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20111025_vd_mm",
+ ggl_list_20111025_vd[2], ggl_list_20111025_vd[3],
+ 1, 4, 8.0, 1, 4, 12.5);
+
+ // Second case
+ // This can be tested with this SQL for SQL-Server
+ /*
+ with viewy as (select geometry::STGeomFromText(
+ 'POLYGON((5 0,5 4,8 4,8 0,5 0))',0) as p,
+ geometry::STGeomFromText(
+ 'MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)),((4 0,4 2,6 2,6 0,4 0)))',0) as q)
+ select
+ p.STDifference(q).STArea(),p.STDifference(q).STNumGeometries(),p.STDifference(q) as p_min_q,
+ q.STDifference(p).STArea(),q.STDifference(p).STNumGeometries(),q.STDifference(p) as q_min_p,
+ p.STSymDifference(q).STArea(),q.STSymDifference(p) as p_xor_q
+ from viewy
+
+ Outputting:
+ 10, 1, <WKB>, 6, 2, <WKB>, 16, <WKB>
+ */
+
+ test_one<Polygon, Polygon, MultiPolygon>("ggl_list_20111025_vd_2",
+ ggl_list_20111025_vd_2[0], ggl_list_20111025_vd_2[1],
+ 1, 7, 10.0, 2, 10, 6.0);
+
+ test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120915_h2_a",
+ ggl_list_20120915_h2[0], ggl_list_20120915_h2[1],
+ 2, 13, 17.0, 0, 0, 0.0);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120915_h2_b",
+ ggl_list_20120915_h2[0], ggl_list_20120915_h2[2],
+ 2, 13, 17.0, 0, 0, 0.0);
+
+ test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120221_volker",
+ ggl_list_20120221_volker[0], ggl_list_20120221_volker[1],
+ 2, 12, 7962.66, 1, 18, 2775258.93,
+ 0.001);
+
+
+ /* TODO: fix
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_101_multi",
+ case_101_multi[0], case_101_multi[1],
+ 5, 23, 4.75, 5, 40, 12.75);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_102_multi",
+ case_102_multi[0], case_102_multi[1],
+ 2, 8, 0.75, 6, 25, 3.75);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_107_multi",
+ case_107_multi[0], case_107_multi[1],
+ 2, 11, 2.25, 3, 14, 3.0);
+ */
+ /*
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_1",
+ case_recursive_boxes_1[0], case_recursive_boxes_1[1],
+ 1, 1, 1, 1, 1, 1);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_2",
+ case_recursive_boxes_2[0], case_recursive_boxes_2[1],
+ 1, 1, 1, 1, 1, 1);
+
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_3",
+ case_recursive_boxes_3[0], case_recursive_boxes_3[1],
+ 1, 1, 1, 1, 1, 1);
+*/
+}
+
+template <typename MultiPolygon, typename MultiLineString>
+void test_areal_linear()
+{
+ typedef typename boost::range_value<MultiPolygon>::type Polygon;
+ typedef typename boost::range_value<MultiLineString>::type LineString;
+ typedef typename bg::point_type<Polygon>::type Point;
+ typedef bg::model::ring<Point> Ring;
+
+ test_one_lp<LineString, LineString, MultiPolygon>("case_mp_ls_1", "LINESTRING(2 0,2 5)", case_multi_simplex[0], 2, 4, 1.30);
+ test_one_lp<LineString, MultiLineString, Polygon>("case_p_mls_1", "MULTILINESTRING((2 0,2 5),(3 0,3 5))", case_single_simplex, 3, 6, 2.5);
+ test_one_lp<LineString, MultiLineString, MultiPolygon>("case_mp_mls_1", "MULTILINESTRING((2 0,2 5),(3 0,3 5))", case_multi_simplex[0], 5, 10, 3.1666667);
+ test_one_lp<LineString, MultiLineString, Ring>("case_r_mls_1", "MULTILINESTRING((2 0,2 5),(3 0,3 5))", case_single_simplex, 3, 6, 2.5);
+
+ // Collinear cases, with multiple turn points at the same location
+ test_one_lp<LineString, LineString, MultiPolygon>("case_mp_ls_2a", "LINESTRING(1 0,1 1,2 1,2 0)", "MULTIPOLYGON(((0 0,0 1,1 1,1 0,0 0)),((1 1,1 2,2 2,2 1,1 1)))", 1, 2, 1.0);
+ test_one_lp<LineString, LineString, MultiPolygon>("case_mp_ls_2b", "LINESTRING(1 0,1 1,2 1,2 0)", "MULTIPOLYGON(((1 1,1 2,2 2,2 1,1 1)),((0 0,0 1,1 1,1 0,0 0)))", 1, 2, 1.0);
+
+ test_one_lp<LineString, LineString, MultiPolygon>("case_mp_ls_3",
+ "LINESTRING(6 6,6 7,7 7,7 6,8 6,8 7,9 7,9 6)",
+ "MULTIPOLYGON(((5 7,5 8,6 8,6 7,5 7)),((6 6,6 7,7 7,7 6,6 6)),((8 8,9 8,9 7,8 7,7 7,7 8,8 8)))", 2, 5, 3.0);
+
+ return;
+
+ // TODO: this case contains collinearities and should still be solved
+ test_one_lp<LineString, LineString, MultiPolygon>("case_mp_ls_4",
+ "LINESTRING(0 5,0 6,1 6,1 5,2 5,2 6,3 6,3 5,3 4,3 3,2 3,2 4,1 4,1 3,0 3,0 4)",
+ "MULTIPOLYGON(((0 2,0 3,1 2,0 2)),((2 5,3 6,3 5,2 5)),((1 5,1 6,2 6,2 5,1 5)),((2 3,2 4,3 4,2 3)),((0 3,1 4,1 3,0 3)),((4 3,3 3,3 5,4 5,4 4,4 3)))", 5, 11, 6.0);
+}
+
+
+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::multi_polygon<polygon> multi_polygon;
+ test_areal<ring, polygon, multi_polygon>();
+ test_areal_linear<multi_polygon, bg::model::multi_linestring<bg::model::linestring<P> > >();
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ std::cout << "Testing TTMATH" << std::endl;
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_difference.vcproj b/libs/geometry/test/multi/algorithms/multi_difference.vcproj
new file mode 100644
index 000000000..825789743
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_difference.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_difference"
+ ProjectGUID="{7F85B87A-48A6-47BD-A08C-AB12AEA56582}"
+ RootNamespace="multi_difference"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_difference"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../..;."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_difference"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../..;."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_difference.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_disjoint.cpp b/libs/geometry/test/multi/algorithms/multi_disjoint.cpp
new file mode 100644
index 000000000..9d374f7c7
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_disjoint.cpp
@@ -0,0 +1,157 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2012 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 <iostream>
+#include <string>
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/disjoint.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/multi/io/wkt/read.hpp>
+#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/disjoint.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>
+#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+
+#include <test_common/test_point.hpp>
+
+#include <algorithms/test_relate.hpp>
+
+
+template <typename G1, typename G2>
+void test_disjoint(std::string const& id,
+ std::string const& wkt1,
+ std::string const& wkt2, bool expected)
+{
+ G1 g1;
+ bg::read_wkt(wkt1, g1);
+
+ G2 g2;
+ bg::read_wkt(wkt2, g2);
+
+ bool detected = bg::disjoint(g1, g2);
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "disjoint: " << id
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+}
+
+
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::polygon<P> polygon;
+ typedef bg::model::multi_polygon<polygon> mp;
+
+ test_disjoint<mp, mp>("",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ false);
+
+ // True disjoint
+ test_disjoint<mp, mp>("",
+ "MULTIPOLYGON(((0 0,0 4,4 4,4 0,0 0)))",
+ "MULTIPOLYGON(((6 6,6 10,10 10,10 6,6 6)))",
+ true);
+
+ // Touch -> not disjoint
+ test_disjoint<mp, mp>("",
+ "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)))",
+ "MULTIPOLYGON(((5 5,5 10,10 10,10 5,5 5)))",
+ false);
+
+ // Not disjoint but no IP's
+ test_disjoint<mp, mp>("no_ips",
+ "MULTIPOLYGON(((2 2,2 8,8 8,8 2,2 2)),((20 0,20 10,30 10,30 0,20 0)))",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((22 2,28 2,28 8,22 8,22 2)))",
+ false);
+
+ // Not disjoint and not inside each other (in first ring) but wrapped (in second rings)
+ test_disjoint<mp, mp>("no_ips2",
+ "MULTIPOLYGON(((2 2,2 8,8 8,8 2,2 2)),((20 0,20 10,30 10,30 0,20 0)))",
+ "MULTIPOLYGON(((2 12,2 18,8 18,8 12,2 12)),((22 2,28 2,28 8,22 8,22 2)))",
+ false);
+
+ test_disjoint<mp, mp>("no_ips2_rev",
+ "MULTIPOLYGON(((2 12,2 18,8 18,8 12,2 12)),((22 2,28 2,28 8,22 8,22 2)))",
+ "MULTIPOLYGON(((2 2,2 8,8 8,8 2,2 2)),((20 0,20 10,30 10,30 0,20 0)))",
+ false);
+
+
+ test_disjoint<P, mp>("point_mp1",
+ "POINT(0 0)",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ false);
+
+ test_disjoint<P, mp>("point_mp2",
+ "POINT(5 5)",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ false);
+
+ test_disjoint<P, mp>("point_mp1",
+ "POINT(11 11)",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ true);
+
+ std::string polygon_inside_hole("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0), (2 2,8 2,8 8,2 8,2 2)),((4 4,4 6,6 6,6 4,4 4)))");
+ test_disjoint<P, mp>("point_mp_pih1",
+ "POINT(5 5)",
+ polygon_inside_hole,
+ false);
+
+ test_disjoint<P, mp>("point_mp_pih2",
+ "POINT(3 3)",
+ polygon_inside_hole,
+ true);
+
+ test_disjoint<mp, P>("point_mp1rev",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ "POINT(0 0)",
+ false);
+
+}
+
+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
+
+ return 0;
+}
+
+
+/*
+with viewy as
+(
+select geometry::STGeomFromText('MULTIPOLYGON(((2 2,2 8,8 8,8 2,2 2)),((20 0,20 10,30 10,30 0,20 0)))',0) as p
+ , geometry::STGeomFromText('MULTIPOLYGON(((2 12,2 18,8 18,8 12,2 12)),((22 2,28 2,28 8,22 8,22 2)))',0) as q
+)
+ select p from viewy union all select q from viewy
+-- select p.STDisjoint(q) from viewy
+*/ \ No newline at end of file
diff --git a/libs/geometry/test/multi/algorithms/multi_disjoint.vcproj b/libs/geometry/test/multi/algorithms/multi_disjoint.vcproj
new file mode 100644
index 000000000..fb55ab325
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_disjoint.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="multi_disjoint"
+ ProjectGUID="{5DEA6558-9DF7-42D4-AF10-4D6D8BB7EAD1}"
+ RootNamespace="multi_disjoint"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_disjoint"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_disjoint"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_disjoint.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_distance.cpp b/libs/geometry/test/multi/algorithms/multi_distance.cpp
new file mode 100644
index 000000000..249598c91
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_distance.cpp
@@ -0,0 +1,171 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 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 <string>
+
+
+#include <geometry_test_common.hpp>
+
+#include <algorithms/test_distance.hpp>
+
+#include <boost/geometry/algorithms/distance.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+
+#include <boost/geometry/multi/algorithms/distance.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>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include <test_common/test_point.hpp>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+template <typename Geometry1, typename Geometry2>
+void test_distance(std::string const& wkt1, std::string const& wkt2, double expected)
+{
+ Geometry1 g1;
+ Geometry2 g2;
+ bg::read_wkt(wkt1, g1);
+ bg::read_wkt(wkt2, g2);
+ typename bg::default_distance_result<Geometry1, Geometry2>::type d = bg::distance(g1, g2);
+
+ BOOST_CHECK_CLOSE(d, expected, 0.0001);
+}
+
+template <typename Geometry1, typename Geometry2, typename Strategy>
+void test_distance(Strategy const& strategy, std::string const& wkt1,
+ std::string const& wkt2, double expected)
+{
+ Geometry1 g1;
+ Geometry2 g2;
+ bg::read_wkt(wkt1, g1);
+ bg::read_wkt(wkt2, g2);
+ typename bg::default_distance_result<Geometry1, Geometry2>::type d = bg::distance(g1, g2, strategy);
+
+ BOOST_CHECK_CLOSE(d, expected, 0.0001);
+}
+
+
+template <typename P>
+void test_2d()
+{
+ typedef bg::model::multi_point<P> mp;
+ typedef bg::model::multi_linestring<bg::model::linestring<P> > ml;
+ test_distance<P, P>("POINT(0 0)", "POINT(1 1)", sqrt(2.0));
+ test_distance<P, mp>("POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
+ test_distance<mp, P>("MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
+ test_distance<mp, mp>("MULTIPOINT((1 1),(1 0),(0 2))", "MULTIPOINT((2 2),(2 3))", sqrt(2.0));
+ test_distance<P, ml>("POINT(0 0)", "MULTILINESTRING((1 1,2 2),(1 0,2 0),(0 2,0 3))", 1.0);
+ test_distance<ml, P>("MULTILINESTRING((1 1,2 2),(1 0,2 0),(0 2,0 3))", "POINT(0 0)", 1.0);
+ test_distance<ml, mp>("MULTILINESTRING((1 1,2 2),(1 0,2 0),(0 2,0 3))", "MULTIPOINT((0 0),(1 1))", 0.0);
+
+ // Test with a strategy
+ bg::strategy::distance::pythagoras<P, P> pyth;
+ test_distance<P, P>(pyth, "POINT(0 0)", "POINT(1 1)", sqrt(2.0));
+ test_distance<P, mp>(pyth, "POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
+ test_distance<mp, P>(pyth, "MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
+}
+
+
+template <typename P>
+void test_3d()
+{
+ typedef bg::model::multi_point<P> mp;
+ test_distance<P, P>("POINT(0 0 0)", "POINT(1 1 1)", sqrt(3.0));
+ test_distance<P, mp>("POINT(0 0 0)", "MULTIPOINT((1 1 1),(1 0 0),(0 1 2))", 1.0);
+ test_distance<mp, mp>("MULTIPOINT((1 1 1),(1 0 0),(0 0 2))", "MULTIPOINT((2 2 2),(2 3 4))", sqrt(3.0));
+}
+
+
+template <typename P1, typename P2>
+void test_mixed()
+{
+ typedef bg::model::multi_point<P1> mp1;
+ typedef bg::model::multi_point<P2> mp2;
+
+ test_distance<P1, P2>("POINT(0 0)", "POINT(1 1)", sqrt(2.0));
+
+ test_distance<P1, mp1>("POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
+ test_distance<P1, mp2>("POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
+ test_distance<P2, mp1>("POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
+ test_distance<P2, mp2>("POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
+
+ // Test automatic reversal
+ test_distance<mp1, P1>("MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
+ test_distance<mp1, P2>("MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
+ test_distance<mp2, P1>("MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
+ test_distance<mp2, P2>("MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
+
+ // Test multi-multi using different point types for each
+ test_distance<mp1, mp2>("MULTIPOINT((1 1),(1 0),(0 2))", "MULTIPOINT((2 2),(2 3))", sqrt(2.0));
+
+ // Test with a strategy
+ using namespace bg::strategy::distance;
+
+ test_distance<P1, P2>(pythagoras<P1, P2>(), "POINT(0 0)", "POINT(1 1)", sqrt(2.0));
+
+ test_distance<P1, mp1>(pythagoras<P1, P1>(), "POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
+ test_distance<P1, mp2>(pythagoras<P1, P2>(), "POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
+ test_distance<P2, mp1>(pythagoras<P2, P1>(), "POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
+ test_distance<P2, mp2>(pythagoras<P2, P2>(), "POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
+
+ // Most interesting: reversal AND a strategy (note that the stategy must be reversed automatically
+ test_distance<mp1, P1>(pythagoras<P1, P1>(), "MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
+ test_distance<mp1, P2>(pythagoras<P1, P2>(), "MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
+ test_distance<mp2, P1>(pythagoras<P2, P1>(), "MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
+ test_distance<mp2, P2>(pythagoras<P2, P2>(), "MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
+}
+
+template <typename P>
+void test_empty_input()
+{
+ P p;
+ bg::model::multi_point<P> mp_empty;
+ bg::model::multi_linestring<bg::model::linestring<P> > ml_empty;
+
+ test_empty_input(p, mp_empty);
+ test_empty_input(p, ml_empty);
+ test_empty_input(mp_empty, mp_empty);
+
+ // Test behaviour if one of the inputs is empty
+ bg::model::multi_point<P> mp;
+ mp.push_back(p);
+ test_empty_input(mp_empty, mp);
+ test_empty_input(mp, mp_empty);
+}
+
+
+int test_main( int , char* [] )
+{
+ test_2d<boost::tuple<float, float> >();
+ test_2d<bg::model::d2::point_xy<float> >();
+ test_2d<bg::model::d2::point_xy<double> >();
+
+ test_3d<boost::tuple<float, float, float> >();
+ test_3d<bg::model::point<double, 3, bg::cs::cartesian> >();
+
+ test_mixed<bg::model::d2::point_xy<float>, bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ test_2d<bg::model::d2::point_xy<ttmath_big> >();
+ test_mixed<bg::model::d2::point_xy<ttmath_big>, bg::model::d2::point_xy<double> >();
+#endif
+
+ test_empty_input<bg::model::d2::point_xy<int> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_distance.vcproj b/libs/geometry/test/multi/algorithms/multi_distance.vcproj
new file mode 100644
index 000000000..7b3e77d28
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_distance.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_distance"
+ ProjectGUID="{D770F3E8-0567-4EDD-91FC-20BA402A3F74}"
+ RootNamespace="multi_distance"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_distance"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_distance"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_distance.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_envelope.cpp b/libs/geometry/test/multi/algorithms/multi_envelope.cpp
new file mode 100644
index 000000000..dad5d0bc2
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_envelope.cpp
@@ -0,0 +1,71 @@
+// 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.
+
+// 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 <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>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include <test_common/test_point.hpp>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+template <typename P>
+void test_2d()
+{
+ /*test_envelope<bg::model::multi_point<P> >(
+ "MULTIPOINT((1 1),(1 0),(1 2))", 1, 1, 0, 2);
+ test_envelope<bg::model::multi_linestring<bg::model::linestring<P> > >(
+ "MULTILINESTRING((0 0,1 1),(1 1,2 2),(2 2,3 3))", 0, 3, 0, 3);
+*/
+ test_envelope<bg::model::multi_polygon<bg::model::polygon<P> > >(
+ "MULTIPOLYGON(((1 1,1 3,3 3,3 1,1 1)),((4 4,4 6,6 6,6 4,4 4)))", 1, 6, 1, 6);
+}
+
+
+template <typename P>
+void test_3d()
+{
+ typedef bg::model::multi_point<P> mp;
+}
+
+
+int test_main( int , char* [] )
+{
+ test_2d<boost::tuple<float, float> >();
+ test_2d<bg::model::d2::point_xy<float> >();
+ test_2d<bg::model::d2::point_xy<double> >();
+
+ test_3d<boost::tuple<float, float, float> >();
+ test_3d<bg::model::point<double, 3, bg::cs::cartesian> >();
+
+#ifdef HAVE_TTMATH
+ test_2d<bg::model::d2::point_xy<ttmath_big> >();
+ test_2d<bg::model::point<ttmath_big, 3, bg::cs::cartesian> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_envelope.vcproj b/libs/geometry/test/multi/algorithms/multi_envelope.vcproj
new file mode 100644
index 000000000..9d4db61af
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_envelope.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_envelope"
+ ProjectGUID="{85385CF0-240C-4900-B5EA-E34D2415A18F}"
+ RootNamespace="multi_envelope"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_envelope"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_envelope"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_envelope.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_equals.cpp b/libs/geometry/test/multi/algorithms/multi_equals.cpp
new file mode 100644
index 000000000..64bc0d470
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_equals.cpp
@@ -0,0 +1,57 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2010-2012 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_equals.hpp>
+
+#include <boost/geometry/multi/algorithms/area.hpp>
+#include <boost/geometry/multi/algorithms/equals.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>
+void test_all()
+{
+ std::string case1 = "MULTIPOLYGON(((0 0,0 7,4 2,2 0,0 0)))";
+ std::string case1_p = "POLYGON((0 0,0 7,4 2,2 0,0 0))";
+
+ typedef bg::model::polygon<P> polygon;
+ typedef bg::model::multi_polygon<polygon> mp;
+ test_geometry<mp, mp>("c1", case1, case1, true);
+
+ test_geometry<mp, mp>("c2",
+ "MULTIPOLYGON(((0 0,0 7.01,4 2,2 0,0 0)))",
+ case1, false);
+
+ // Different order == equal
+ test_geometry<mp, mp>("c3",
+ "MULTIPOLYGON(((0 0,0 7,4 2,2 0,0 0)),((10 10,10 12,12 10,10 10)))",
+ "MULTIPOLYGON(((10 10,10 12,12 10,10 10)),((0 0,0 7,4 2,2 0,0 0)))",
+ true);
+
+ // check different types
+ test_geometry<polygon, mp>("c1_p_mp", case1_p, case1, true);
+ test_geometry<mp, polygon>("c1_mp_p", case1, case1_p, true);
+
+}
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_equals.vcproj b/libs/geometry/test/multi/algorithms/multi_equals.vcproj
new file mode 100644
index 000000000..c35636018
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_equals.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_equals"
+ ProjectGUID="{AA0EFD64-E034-421A-BD4A-E5A336D95C30}"
+ RootNamespace="multi_equals"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_equals"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../..;."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_equals"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../..;."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_equals.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_for_each.cpp b/libs/geometry/test/multi/algorithms/multi_for_each.cpp
new file mode 100644
index 000000000..846abdda5
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_for_each.cpp
@@ -0,0 +1,84 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 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/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>
+#include <boost/geometry/geometries/linestring.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#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 <algorithms/test_for_each.hpp>
+
+
+template <typename P>
+void test_all()
+{
+ test_geometry<bg::model::multi_point<P> >
+ (
+ "MULTIPOINT((1 1))"
+
+ // per point
+ , 1
+ , "MULTIPOINT((101 1))"
+ , "MULTIPOINT((101 100))"
+ // per segment
+ , ""
+ , 0
+ , "MULTIPOINT((1 1))"
+ );
+
+ test_geometry<bg::model::multi_linestring<bg::model::linestring<P> > >
+ (
+ "MULTILINESTRING((1 1,2 2))"
+
+ , 3
+ , "MULTILINESTRING((101 1,102 2))"
+ , "MULTILINESTRING((101 100,102 200))"
+
+ , "((1, 1), (2, 2))"
+ , std::sqrt(2.0)
+ , "MULTILINESTRING((10 1,2 2))"
+ );
+
+ typedef bg::model::multi_polygon<bg::model::polygon<P> > mp;
+ test_geometry<mp>
+ (
+ "MULTIPOLYGON(((1 1,1 4,4 4,4 1,1 1)))"
+
+ , 11
+ , "MULTIPOLYGON(((101 1,101 4,104 4,104 1,101 1)))"
+ , "MULTIPOLYGON(((101 100,101 400,104 400,104 100,101 100)))"
+
+ , "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1))"
+ , 4 * 3.0
+ , "MULTIPOLYGON(((10 1,10 4,4 4,4 1,1 1)))"
+ );
+}
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_for_each.vcproj b/libs/geometry/test/multi/algorithms/multi_for_each.vcproj
new file mode 100644
index 000000000..51c5b9667
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_for_each.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_for_each"
+ ProjectGUID="{B016FE33-D587-45C6-8444-607839BB2C2D}"
+ RootNamespace="multi_for_each"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_for_each"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_for_each"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_for_each.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_intersection.cpp b/libs/geometry/test/multi/algorithms/multi_intersection.cpp
new file mode 100644
index 000000000..fc94811f8
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_intersection.cpp
@@ -0,0 +1,227 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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 <iostream>
+#include <string>
+
+// #define BOOST_GEOMETRY_DEBUG_ASSEMBLE
+
+#include <algorithms/test_intersection.hpp>
+#include <algorithms/test_overlay.hpp>
+#include <multi/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/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>
+
+template <typename Ring, typename Polygon, typename MultiPolygon>
+void test_areal()
+{
+ test_one<Polygon, MultiPolygon, MultiPolygon>("simplex_multi",
+ case_multi_simplex[0], case_multi_simplex[1],
+ 2, 12, 6.42);
+
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_multi_no_ip",
+ case_multi_no_ip[0], case_multi_no_ip[1],
+ 2, 8, 8.5);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_multi_2",
+ case_multi_2[0], case_multi_2[1],
+ 3, 12, 5.9);
+
+ test_one<Polygon, MultiPolygon, Polygon>("simplex_multi_mp_p",
+ case_multi_simplex[0], case_single_simplex,
+ 2, 12, 6.42);
+
+ test_one<Polygon, Ring, MultiPolygon>("simplex_multi_r_mp",
+ case_single_simplex, case_multi_simplex[0],
+ 2, 12, 6.42);
+ test_one<Ring, MultiPolygon, Polygon>("simplex_multi_mp_r",
+ case_multi_simplex[0], case_single_simplex,
+ 2, 12, 6.42);
+
+ // Constructed cases for multi/touch/equal/etc
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_61_multi",
+ case_61_multi[0], case_61_multi[1],
+ 0, 0, 0.0);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_62_multi",
+ case_62_multi[0], case_62_multi[1],
+ 1, 5, 1.0);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_63_multi",
+ case_63_multi[0], case_63_multi[1],
+ 1, 5, 1.0);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_64_multi",
+ case_64_multi[0], case_64_multi[1],
+ 1, 5, 1.0);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_65_multi",
+ case_65_multi[0], case_65_multi[1],
+ 1, 5, 1.0);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_72_multi",
+ case_72_multi[0], case_72_multi[1],
+ 3, 14, 2.85);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_77_multi",
+ case_77_multi[0], case_77_multi[1],
+ 5, 33, 9);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_78_multi",
+ case_78_multi[0], case_78_multi[1],
+ 1, 0, 22); // In "get_turns" using partitioning, #points went from 17 to 16
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_101_multi",
+ case_101_multi[0], case_101_multi[1],
+ 4, 22, 4.75);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_102_multi",
+ case_102_multi[0], case_102_multi[1],
+ 3, 26, 19.75);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_107_multi",
+ case_107_multi[0], case_107_multi[1],
+ 2, 10, 1.5);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_1",
+ case_recursive_boxes_1[0], case_recursive_boxes_1[1],
+ 10, 97, 47.0);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_2",
+ case_recursive_boxes_2[0], case_recursive_boxes_2[1],
+ 1, 47, 90.0); // Area from SQL Server
+
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_3",
+ case_recursive_boxes_3[0], case_recursive_boxes_3[1],
+ 19, 87, 12.5); // Area from SQL Server
+
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_4",
+ case_recursive_boxes_4[0], case_recursive_boxes_4[1],
+ 13, 157, 67.0); // Area from SQL Server
+
+ test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120915_h2_a",
+ ggl_list_20120915_h2[0], ggl_list_20120915_h2[1],
+ 2, 10, 6.0); // Area from SQL Server
+ test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120915_h2_b",
+ ggl_list_20120915_h2[0], ggl_list_20120915_h2[2],
+ 2, 10, 6.0); // Area from SQL Server
+}
+
+template <typename Polygon, typename MultiPolygon, typename Box>
+void test_areal_clip()
+{
+ static std::string const clip = "POLYGON((1 1,4 4))";
+ test_one<Polygon, Box, MultiPolygon>("simplex_multi_mp_b", clip, case_multi_simplex[0],
+ 2, 11, 6.791666);
+ test_one<Polygon, MultiPolygon, Box>("simplex_multi_b_mp", case_multi_simplex[0], clip,
+ 2, 11, 6.791666);
+}
+
+template <typename LineString, typename MultiLineString, typename Box>
+void test_linear()
+{
+ typedef typename bg::point_type<MultiLineString>::type point;
+ test_one<point, MultiLineString, MultiLineString>("case_multi_ml_ml_1",
+ "MULTILINESTRING((0 0,1 1))", "MULTILINESTRING((0 1,1 0))",
+ 1, 1, 0);
+ test_one<point, MultiLineString, MultiLineString>("case_multi_ml_ml_2",
+ "MULTILINESTRING((0 0,1 1),(0.5 0,1.5 1))", "MULTILINESTRING((0 1,1 0),(0.5 1,1.5 0))",
+ 4, 4, 0);
+
+ test_one<point, LineString, MultiLineString>("case_multi_l_ml",
+ "LINESTRING(0 0,1 1)", "MULTILINESTRING((0 1,1 0),(0.5 1,1.5 0))",
+ 2, 2, 0);
+ test_one<point, MultiLineString, LineString>("case_multi_ml_l",
+ "MULTILINESTRING((0 1,1 0),(0.5 1,1.5 0))", "LINESTRING(0 0,1 1)",
+ 2, 2, 0);
+
+ test_one<LineString, MultiLineString, Box>("case_multi_ml_b",
+ "MULTILINESTRING((0 0,3 3)(1 0,4 3))", "POLYGON((1 1,3 2))",
+ 2, 4, 2 * std::sqrt(2.0));
+ test_one<LineString, Box, MultiLineString>("case_multi_b_ml",
+ "POLYGON((1 1,3 2))", "MULTILINESTRING((0 0,3 3)(1 0,4 3))",
+ 2, 4, 2 * std::sqrt(2.0));
+}
+
+template <typename P>
+void test_point_output()
+{
+ typedef bg::model::box<P> box;
+ typedef bg::model::linestring<P> linestring;
+ typedef bg::model::polygon<P> polygon;
+ typedef bg::model::multi_polygon<polygon> multi_polygon;
+
+ test_point_output<multi_polygon, multi_polygon>(case_multi_simplex[0], case_multi_simplex[1], 10);
+ test_point_output<linestring, multi_polygon>("linestring(4 0,0 4)", case_multi_simplex[0], 4);
+ test_point_output<box, multi_polygon>("box(3 0,4 6)", case_multi_simplex[0], 8);
+}
+
+template <typename MultiPolygon, typename MultiLineString>
+void test_areal_linear()
+{
+ typedef typename boost::range_value<MultiPolygon>::type Polygon;
+ typedef typename boost::range_value<MultiLineString>::type LineString;
+ typedef typename bg::point_type<Polygon>::type Point;
+ typedef bg::model::ring<Point> Ring;
+
+ test_one_lp<LineString, MultiPolygon, LineString>("case_mp_ls_1", case_multi_simplex[0], "LINESTRING(2 0,2 5)", 2, 4, 3.70);
+ test_one_lp<LineString, Polygon, MultiLineString>("case_p_mls_1", case_single_simplex, "MULTILINESTRING((2 0,2 5),(3 0,3 5))", 2, 4, 7.5);
+ test_one_lp<LineString, MultiPolygon, MultiLineString>("case_mp_mls_1", case_multi_simplex[0], "MULTILINESTRING((2 0,2 5),(3 0,3 5))", 4, 8, 6.8333333);
+ test_one_lp<LineString, Ring, MultiLineString>("case_r_mls_1", case_single_simplex, "MULTILINESTRING((2 0,2 5),(3 0,3 5))", 2, 4, 7.5);
+}
+
+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::multi_polygon<polygon> multi_polygon;
+ test_areal<ring, polygon, multi_polygon>();
+
+#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
+
+ typedef bg::model::ring<P, false> ring_ccw;
+ typedef bg::model::polygon<P, false> polygon_ccw;
+ typedef bg::model::multi_polygon<polygon_ccw> multi_polygon_ccw;
+ test_areal<ring_ccw, polygon_ccw, multi_polygon_ccw>();
+
+ typedef bg::model::ring<P, true, false> ring_open;
+ typedef bg::model::polygon<P, true, false> polygon_open;
+ typedef bg::model::multi_polygon<polygon_open> multi_polygon_open;
+ test_areal<ring_open, polygon_open, multi_polygon_open>();
+
+ typedef bg::model::ring<P, false, false> ring_open_ccw;
+ typedef bg::model::polygon<P, false, false> polygon_open_ccw;
+ typedef bg::model::multi_polygon<polygon_open_ccw> multi_polygon_open_ccw;
+ test_areal<ring_open_ccw, polygon_open_ccw, multi_polygon_open_ccw>();
+
+ test_areal_clip<polygon, multi_polygon, box>();
+ test_areal_clip<polygon_ccw, multi_polygon_ccw, box>();
+
+ typedef bg::model::linestring<P> linestring;
+ typedef bg::model::multi_linestring<linestring> multi_linestring;
+
+ test_linear<linestring, multi_linestring, box>();
+ test_areal_linear<multi_polygon, multi_linestring>();
+#endif
+
+ test_point_output<P>();
+ // linear
+
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ std::cout << "Testing TTMATH" << std::endl;
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_intersection.vcproj b/libs/geometry/test/multi/algorithms/multi_intersection.vcproj
new file mode 100644
index 000000000..a286b038c
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_intersection.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_intersection"
+ ProjectGUID="{FFB78F24-7999-4416-BDED-9C35A3DDF32D}"
+ RootNamespace="multi_intersection"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_intersection"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../..;."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_intersection"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../..;."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_intersection.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_intersects.cpp b/libs/geometry/test/multi/algorithms/multi_intersects.cpp
new file mode 100644
index 000000000..d07b8b6cf
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_intersects.cpp
@@ -0,0 +1,51 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2012 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 <iostream>
+#include <string>
+
+
+#include <geometry_test_common.hpp>
+
+#include <algorithms/test_intersects.hpp>
+
+#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>
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::polygon<P> polygon;
+ typedef bg::model::multi_polygon<polygon> mp;
+
+ test_geometry<mp, mp>("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ true);
+
+ test_geometry<P, mp>("POINT(0 0)",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ 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
+
+ return 0;
+}
+
diff --git a/libs/geometry/test/multi/algorithms/multi_length.cpp b/libs/geometry/test/multi/algorithms/multi_length.cpp
new file mode 100644
index 000000000..5d94be158
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_length.cpp
@@ -0,0 +1,38 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 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_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>
+void test_all()
+{
+ test_geometry<bg::model::multi_linestring<bg::model::linestring<P> > >
+ ("MULTILINESTRING((0 0,3 4,4 3))", 5 + sqrt(2.0));
+}
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_length.vcproj b/libs/geometry/test/multi/algorithms/multi_length.vcproj
new file mode 100644
index 000000000..43967af1a
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_length.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_length"
+ ProjectGUID="{9087BA6C-7563-41E6-90AD-F60BC58DDC17}"
+ RootNamespace="multi_length"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_length"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_length"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_length.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_num_geometries.cpp b/libs/geometry/test/multi/algorithms/multi_num_geometries.cpp
new file mode 100644
index 000000000..bf7a3cee4
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_num_geometries.cpp
@@ -0,0 +1,62 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2011-2012 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/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)
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ int detected = bg::num_geometries(geometry);
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "num_geometries: " << wkt
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+}
+
+
+template <typename Point>
+void test_all()
+{
+ typedef bg::model::polygon<Point> poly;
+ typedef bg::model::linestring<Point> ls;
+ typedef bg::model::multi_point<Point> mpoint;
+ typedef bg::model::multi_linestring<ls> mls;
+ typedef bg::model::multi_polygon<poly> mpoly;
+
+ test_geometry<Point>("POINT(0 0)", 1);
+ test_geometry<ls>("LINESTRING(0 0,0 1)", 1);
+ test_geometry<poly>("POLYGON((0 0,0 1,1 0,0 0))", 1);
+ test_geometry<mpoint>("MULTIPOINT((0 0),(0 1),(1 0),(0 0))", 4);
+ test_geometry<mls>("MULTILINESTRING((0 0,0 1),(1 0,0 0))", 2);
+ test_geometry<mpoly>("MULTIPOLYGON(((0 0,0 1,1 0,0 0)),((10 0,10 1,11 0,10 0)))", 2);
+}
+
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_num_geometries.vcproj b/libs/geometry/test/multi/algorithms/multi_num_geometries.vcproj
new file mode 100644
index 000000000..c1beefad1
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_num_geometries.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_num_geometries"
+ ProjectGUID="{8DB68EB9-07CA-4705-859E-B1A7098B5CF3}"
+ RootNamespace="multi_num_geometries"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_num_geometries"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_num_geometries"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_num_geometries.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_num_interior_rings.cpp b/libs/geometry/test/multi/algorithms/multi_num_interior_rings.cpp
new file mode 100644
index 000000000..73fcdc114
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_num_interior_rings.cpp
@@ -0,0 +1,55 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2011-2012 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/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)
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ int detected = bg::num_interior_rings(geometry);
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "num_interior_rings: " << wkt
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+}
+
+
+template <typename Point>
+void test_all()
+{
+ typedef bg::model::polygon<Point> poly;
+ typedef bg::model::multi_polygon<poly> mpoly;
+
+ test_geometry<poly>("POLYGON((0 0,0 10,10 0,0 0),(1 1,1 9,9 1,1 1))", 1);
+ test_geometry<mpoly>("MULTIPOLYGON(((0 0,0 10,10 0,0 0),(1 1,1 9,9 1,1 1)),((0 0,0 10,10 0,0 0),(1 1,1 4,4 1,1 1),(5 1,5 4,9 1,5 1)))", 3);
+}
+
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_num_interior_rings.vcproj b/libs/geometry/test/multi/algorithms/multi_num_interior_rings.vcproj
new file mode 100644
index 000000000..68c6ebf62
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_num_interior_rings.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_num_interior_rings"
+ ProjectGUID="{3F8E4B3A-43D5-49ED-89F6-C6D1CF609B02}"
+ RootNamespace="multi_num_interior_rings"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_num_interior_rings"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_num_interior_rings"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_num_interior_rings.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_num_points.cpp b/libs/geometry/test/multi/algorithms/multi_num_points.cpp
new file mode 100644
index 000000000..d43b71d47
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_num_points.cpp
@@ -0,0 +1,72 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2011-2012 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/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/variant/variant.hpp>
+
+
+template <typename Geometry>
+void check_geometry(Geometry const& geometry, std::string const& wkt, int expected)
+{
+ int detected = bg::num_points(geometry);
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "num_points: " << wkt
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+}
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt, int expected)
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ check_geometry(geometry, wkt, expected);
+ check_geometry(boost::variant<Geometry>(geometry), wkt, expected);
+}
+
+
+template <typename Point>
+void test_all()
+{
+ typedef bg::model::polygon<Point> poly;
+ typedef bg::model::linestring<Point> ls;
+ typedef bg::model::multi_point<Point> mpoint;
+ typedef bg::model::multi_linestring<ls> mls;
+ typedef bg::model::multi_polygon<poly> mpoly;
+
+ test_geometry<Point>("POINT(0 0)", 1);
+ test_geometry<ls>("LINESTRING(0 0,0 1)", 2);
+ test_geometry<poly>("POLYGON((0 0,0 1,1 0,0 0))", 4);
+ test_geometry<mpoint>("MULTIPOINT((0 0),(0 1),(1 0),(0 0))", 4);
+ test_geometry<mls>("MULTILINESTRING((0 0,0 1),(1 0,0 0))", 4);
+ test_geometry<mpoly>("MULTIPOLYGON(((0 0,0 1,1 0,0 0)),((10 0,10 1,11 0,10 0)))", 8);
+}
+
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_num_points.vcproj b/libs/geometry/test/multi/algorithms/multi_num_points.vcproj
new file mode 100644
index 000000000..590d220c3
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_num_points.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_num_points"
+ ProjectGUID="{EA4B2EB3-1FBA-42BE-B7D7-5A517BC74E2B}"
+ RootNamespace="multi_num_points"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_num_points"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_num_points"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_num_points.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_perimeter.cpp b/libs/geometry/test/multi/algorithms/multi_perimeter.cpp
new file mode 100644
index 000000000..8268fed62
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_perimeter.cpp
@@ -0,0 +1,39 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 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/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 <algorithms/test_perimeter.hpp>
+
+
+template <typename P>
+void test_all()
+{
+ test_geometry<bg::model::multi_polygon<bg::model::polygon<P> > >(
+ "MULTIPOLYGON(((0 0,0 1,1 0,0 0)))", 1.0 + 1.0 + sqrt(2.0));
+}
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_perimeter.vcproj b/libs/geometry/test/multi/algorithms/multi_perimeter.vcproj
new file mode 100644
index 000000000..4059e83bb
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_perimeter.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_perimeter"
+ ProjectGUID="{D91C3F39-B8A5-4EB9-A7A8-D72B297DCFBF}"
+ RootNamespace="multi_perimeter"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_perimeter"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_perimeter"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_perimeter.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_reverse.cpp b/libs/geometry/test/multi/algorithms/multi_reverse.cpp
new file mode 100644
index 000000000..78334928d
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_reverse.cpp
@@ -0,0 +1,57 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 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/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>
+
+
+template <typename P>
+void test_all()
+{
+ // Multi point, should happen nothing.
+ test_geometry<bg::model::multi_point<P> >(
+ "MULTIPOINT((0 0),(1 1))",
+ "MULTIPOINT((0 0),(1 1))");
+
+ test_geometry<bg::model::multi_linestring<bg::model::linestring<P> > >(
+ "MULTILINESTRING((0 0,1 1),(3 3,4 4))",
+ "MULTILINESTRING((1 1,0 0),(4 4,3 3))");
+
+ typedef bg::model::multi_polygon<bg::model::polygon<P> > mp;
+ test_geometry<mp>(
+ "MULTIPOLYGON(((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0)))",
+ "MULTIPOLYGON(((4 0,2 1,0 2,0 7,4 9,8 7,8 2,4 0)))");
+ test_geometry<mp>(
+ "MULTIPOLYGON(((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0),(7 3,7 6,1 6,1 3,4 3,7 3)))",
+ "MULTIPOLYGON(((4 0,2 1,0 2,0 7,4 9,8 7,8 2,4 0),(7 3,4 3,1 3,1 6,7 6,7 3)))");
+}
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<int> >();
+ test_all<bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_reverse.vcproj b/libs/geometry/test/multi/algorithms/multi_reverse.vcproj
new file mode 100644
index 000000000..6afcee18e
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_reverse.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_reverse"
+ ProjectGUID="{698BE05D-43E2-4BF5-B7FD-48BE3EE7BC21}"
+ RootNamespace="multi_reverse"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_reverse"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_reverse"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_reverse.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_simplify.cpp b/libs/geometry/test/multi/algorithms/multi_simplify.cpp
new file mode 100644
index 000000000..8b9d92265
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_simplify.cpp
@@ -0,0 +1,68 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 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>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/polygon.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_simplify.hpp>
+
+
+template <typename P>
+void test_all()
+{
+ test_geometry<bg::model::multi_point<P> >(
+ "MULTIPOINT((0 0),(1 1))",
+ "MULTIPOINT((0 0),(1 1))", 1.0);
+
+ test_geometry<bg::model::multi_linestring<bg::model::linestring<P> > >(
+ "MULTILINESTRING((0 0,5 5,10 10))",
+ "MULTILINESTRING((0 0,10 10))", 1.0);
+
+ typedef bg::model::multi_polygon<bg::model::polygon<P> > mp;
+ test_geometry<mp>(
+ "MULTIPOLYGON(((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0)))",
+ "MULTIPOLYGON(((4 0,8 2,8 7,4 9,0 7,0 2,4 0)))", 1.0);
+ test_geometry<mp>(
+ "MULTIPOLYGON(((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0),(7 3,7 6,1 6,1 3,4 3,7 3)))",
+ "MULTIPOLYGON(((4 0,8 2,8 7,4 9,0 7,0 2,4 0),(7 3,7 6,1 6,1 3,7 3)))", 1.0);
+
+ // Ticket 5954 https://svn.boost.org/trac/boost/ticket/5954
+ test_geometry<mp>(
+ "MULTIPOLYGON(((0.561648 1,1 1,1 0,0.468083 0,0.52758 0.00800554,0.599683 0.0280924,0.601611 0.265374,0.622693 0.316765,0.69507 0.357497,0.695623 0.429711,0.655111 0.502298,0.696467 0.543147,0.840712 0.593546,0.882583 0.66546,0.852357 0.748213,0.84264 0.789567,0.832667 0.841202,0.832667 0.841202,0.740538 0.873004,0.617349 0.905045,0.566576 0.977697,0.561648 1)),((0 0.801979,0.0308575 0.786234,0.0705513 0.631135,0.141616 0.527248,0.233985 0.505872,0.264777 0.526263,0.336631 0.505009,0.356603 0.422321,0.355803 0.350038,0.375252 0.205364,0.415206 0.0709182,0.45479 0,0 0,0 0,0 0.801979)))",
+ "MULTIPOLYGON(((0.561648 1,1 1,1 0,0.468083 0,0.52758 0.00800554,0.599683 0.0280924,0.601611 0.265374,0.622693 0.316765,0.69507 0.357497,0.695623 0.429711,0.655111 0.502298,0.696467 0.543147,0.840712 0.593546,0.882583 0.66546,0.852357 0.748213,0.84264 0.789567,0.832667 0.841202,0.740538 0.873004,0.617349 0.905045,0.566576 0.977697,0.561648 1)),((0 0.801979,0.0308575 0.786234,0.0705513 0.631135,0.141616 0.527248,0.233985 0.505872,0.264777 0.526263,0.336631 0.505009,0.356603 0.422321,0.355803 0.350038,0.375252 0.205364,0.415206 0.0709182,0.45479 0,0 0,0 0.801979)))", 1.0 / 2048.0);
+ test_geometry<mp>(
+ "MULTIPOLYGON(((1149.69 2047,2047 2047,2047 0,958.166 0,1079.96 16.3873,1227.55 57.5051,1231.5 543.221,1274.65 648.418,1422.81 731.796,1423.94 879.618,1341.01 1028.2,1425.67 1111.82,1720.94 1214.99,1806.65 1362.2,1744.77 1531.59,1724.88 1616.24,1704.47 1721.94,1704.47 1721.94,1515.88 1787.04,1263.71 1852.63,1159.78 2001.35,1149.69 2047)),((0 1641.65,63.1653 1609.42,144.419 1291.93,289.888 1079.28,478.967 1035.52,541.999 1077.26,689.084 1033.75,729.966 864.491,728.329 716.528,768.141 420.38,849.927 145.17,930.955 0,0 0,0 0,0 1641.65)))",
+ "MULTIPOLYGON(((1149.69 2047,2047 2047,2047 0,958.166 0,1079.96 16.3873,1227.55 57.5051,1231.5 543.221,1274.65 648.418,1422.81 731.796,1423.94 879.618,1341.01 1028.2,1425.67 1111.82,1720.94 1214.99,1806.65 1362.2,1744.77 1531.59,1724.88 1616.24,1704.47 1721.94,1515.88 1787.04,1263.71 1852.63,1159.78 2001.35,1149.69 2047)),((0 1641.65,63.1653 1609.42,144.419 1291.93,289.888 1079.28,478.967 1035.52,541.999 1077.26,689.084 1033.75,729.966 864.491,728.329 716.528,768.141 420.38,849.927 145.17,930.955 0,0 0,0 1641.65)))", 1.0);
+ // End ticket 5954
+}
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_simplify.vcproj b/libs/geometry/test/multi/algorithms/multi_simplify.vcproj
new file mode 100644
index 000000000..e4d11963a
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_simplify.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_simplify"
+ ProjectGUID="{76A74CE4-EBF8-4F8A-98B7-1AF607B2B68C}"
+ RootNamespace="multi_simplify"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_simplify"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_simplify"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_simplify.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_touches.cpp b/libs/geometry/test/multi/algorithms/multi_touches.cpp
new file mode 100644
index 000000000..0186c62e3
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_touches.cpp
@@ -0,0 +1,80 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2010-2012 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_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/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>
+
+
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::polygon<P> polygon;
+ typedef bg::model::multi_polygon<polygon> mp;
+
+ test_self_touches<mp>("MULTIPOLYGON(((0 0,0 100,100 100,100 0,0 0)))",
+ false);
+
+ // Exactly equal
+ test_touches<mp, mp>("MULTIPOLYGON(((0 0,0 100,100 100,100 0,0 0)))",
+ "MULTIPOLYGON(((0 0,0 100,100 100,100 0,0 0)))",
+ false);
+
+ // Spatially equal
+ test_touches<mp, mp>("MULTIPOLYGON(((0 0,0 100,100 100,100 0,0 0)))",
+ "MULTIPOLYGON(((0 0,0 100,100 100,100 80,100 20,100 0,0 0)))",
+ false);
+
+ // One exactly equal, another pair touching
+ test_touches<mp, mp>("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((20 0,20 10,30 10,30 0,20 0)))",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((30 10,30 20,40 20,40 10,30 10)))",
+ false);
+
+ // One spatially equal (without equal segments), another pair touching
+ test_touches<mp, mp>("MULTIPOLYGON(((0 0,0 5,0 10,5 10,10 10,10 5,10 0,5 0,0 0)),((20 0,20 10,30 10,30 0,20 0)))",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((30 10,30 20,40 20,40 10,30 10)))",
+ false);
+
+ // Alternate touches
+ test_touches<mp, mp>("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((20 0,20 10,30 10,30 0,20 0)))",
+ "MULTIPOLYGON(((10 10,10 20,20 20,20 10,10 10)),((30 10,30 20,40 20,40 10,30 10)))",
+ true);
+
+ // Touch plus inside
+ // TODO fix this
+ test_touches<mp, mp>("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((20 0,20 10,30 10,30 0,20 0)))",
+ "MULTIPOLYGON(((10 10,10 20,20 20,20 10,10 10)),((22 2,28 2,28 8,22 8,22 2)))",
+ false);
+}
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_touches.vcproj b/libs/geometry/test/multi/algorithms/multi_touches.vcproj
new file mode 100644
index 000000000..05468f6cd
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_touches.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="multi_touches"
+ ProjectGUID="{108173B8-B6F4-4366-8018-2BF282ED4881}"
+ RootNamespace="multi_touches"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_touches"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../..;."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_touches"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../..;."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_touches.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_transform.cpp b/libs/geometry/test/multi/algorithms/multi_transform.cpp
new file mode 100644
index 000000000..dddb01c45
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_transform.cpp
@@ -0,0 +1,97 @@
+// 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.
+
+// 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 <iostream>
+#include <sstream>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/transform.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+#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.
+// This test explicitly tests all geometries, including multi*
+// while the transform.cpp tests various strategies.
+
+template <typename Geometry>
+void test_transform(std::string const& wkt, std::string const& expected)
+{
+ typedef typename bg::point_type<Geometry>::type point_type;
+
+ Geometry geometry_in, geometry_out;
+ bg::read_wkt(wkt, geometry_in);
+ bg::transform(geometry_in, geometry_out,
+ bg::strategy::transform::scale_transformer<point_type>(2, 2));
+ std::ostringstream detected;
+ detected << bg::wkt(geometry_out);
+ BOOST_CHECK_EQUAL(detected.str(), expected);
+}
+
+
+template <typename T>
+void test_all()
+{
+ typedef bg::model::d2::point_xy<T> P;
+
+ test_transform<P>(
+ "POINT(1 1)",
+ "POINT(2 2)");
+ test_transform<bg::model::linestring<P> >(
+ "LINESTRING(1 1,2 2)",
+ "LINESTRING(2 2,4 4)");
+ test_transform<bg::model::segment<P> >(
+ "LINESTRING(1 1,2 2)",
+ "LINESTRING(2 2,4 4)");
+ test_transform<bg::model::ring<P> >(
+ "POLYGON((0 0,0 1,1 0,0 0))",
+ "POLYGON((0 0,0 2,2 0,0 0))");
+ test_transform<bg::model::polygon<P> >(
+ "POLYGON((0 0,0 1,1 0,0 0))",
+ "POLYGON((0 0,0 2,2 0,0 0))");
+ test_transform<bg::model::box<P> >(
+ "POLYGON((0 0,0 1,1 1,1 0,0 0))",
+ "POLYGON((0 0,0 2,2 2,2 0,0 0))");
+ test_transform<bg::model::multi_point<P> >(
+ "MULTIPOINT((1 1),(2 2))",
+ "MULTIPOINT((2 2),(4 4))");
+ test_transform<bg::model::multi_linestring<bg::model::linestring<P> > >(
+ "MULTILINESTRING((1 1,2 2))",
+ "MULTILINESTRING((2 2,4 4))");
+ test_transform<bg::model::multi_polygon<bg::model::polygon<P> > >(
+ "MULTIPOLYGON(((0 0,0 1,1 0,0 0)))",
+ "MULTIPOLYGON(((0 0,0 2,2 0,0 0)))");
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<double>();
+
+#ifdef HAVE_TTMATH
+ test_all<ttmath_big>();
+#endif
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_transform.vcproj b/libs/geometry/test/multi/algorithms/multi_transform.vcproj
new file mode 100644
index 000000000..543890ffb
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_transform.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_transform"
+ ProjectGUID="{64985954-0A74-46F5-908F-865E905C3414}"
+ RootNamespace="multi_transform"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_transform"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_transform"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_transform.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_union.cpp b/libs/geometry/test/multi/algorithms/multi_union.cpp
new file mode 100644
index 000000000..5cbe1e7a7
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_union.cpp
@@ -0,0 +1,149 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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 <iostream>
+#include <string>
+
+
+#include <algorithms/test_union.hpp>
+#include <algorithms/test_overlay.hpp>
+#include <multi/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/geometries/point_xy.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 Ring, typename Polygon, typename MultiPolygon>
+void test_areal()
+{
+ test_one<Polygon, MultiPolygon, MultiPolygon>("simplex_multi",
+ case_multi_simplex[0], case_multi_simplex[1],
+ 1, 0, 20, 14.58);
+
+ test_one<Polygon, Polygon, MultiPolygon>("simplex_multi_p_mp",
+ case_single_simplex, case_multi_simplex[0],
+ 1, 0, 20, 14.58);
+ test_one<Polygon, MultiPolygon, Polygon>("simplex_multi_mp_p",
+ case_multi_simplex[0], case_single_simplex,
+ 1, 0, 20, 14.58);
+
+ test_one<Polygon, Ring, MultiPolygon>("simplex_multi_r_mp",
+ case_single_simplex, case_multi_simplex[0],
+ 1, 0, 20, 14.58);
+ test_one<Ring, MultiPolygon, Polygon>("simplex_multi_mp_r",
+ case_multi_simplex[0], case_single_simplex,
+ 1, 0, 20, 14.58);
+
+
+ // Normal test cases
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_multi_no_ip",
+ case_multi_no_ip[0], case_multi_no_ip[1],
+ 4, 0, 16, 66.5);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_multi_2",
+ case_multi_2[0], case_multi_2[1],
+ 3, 0, 16, 59.1);
+
+ // Constructed cases for multi/touch/equal/etc
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_61_multi",
+ case_61_multi[0], case_61_multi[1],
+ 1, 0, 11, 4.0);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_62_multi",
+ case_62_multi[0], case_62_multi[1],
+ 2, 0, 10, 2.0);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_63_multi",
+ case_63_multi[0], case_63_multi[1],
+ 2, 0, 10, 2.0);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_64_multi",
+ case_64_multi[0], case_64_multi[1],
+ 1, 0, 9, 3.0);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_65_multi",
+ case_65_multi[0], case_65_multi[1],
+ 3, 0, 15, 4.0);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_66_multi",
+ case_66_multi[0], case_66_multi[1],
+ 3, 0, 23, 7.0);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_75_multi",
+ case_75_multi[0], case_75_multi[1],
+ 5, 0, 25, 5.0);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_76_multi",
+ case_76_multi[0], case_76_multi[1],
+ 5, 0, 31, 8.0);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_89_multi",
+ case_89_multi[0], case_89_multi[1],
+ 1, 0, 13, 6);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_101_multi",
+ case_101_multi[0], case_101_multi[1],
+ 1, 0, 32, 22.25);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_103_multi",
+ case_103_multi[0], case_103_multi[1],
+ 1, 0, 7, 25);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_104_multi",
+ case_104_multi[0], case_104_multi[1],
+ 1, 0, 8, 25);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_105_multi",
+ case_105_multi[0], case_105_multi[1],
+ 1, 0, 5, 25);
+
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_1",
+ case_recursive_boxes_1[0], case_recursive_boxes_1[1],
+ 1, 1, 36, 97.0);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_2",
+ case_recursive_boxes_2[0], case_recursive_boxes_2[1],
+ 1, 0, 14, 100.0); // Area from SQL Server
+ test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_3",
+ case_recursive_boxes_3[0], case_recursive_boxes_3[1],
+ 17, 0, 159, 56.5); // Area from SQL Server
+
+ test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120915_h2_a",
+ ggl_list_20120915_h2[0], ggl_list_20120915_h2[1],
+ 1, 0, 12, 23.0); // Area from SQL Server
+ test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120915_h2_b",
+ ggl_list_20120915_h2[0], ggl_list_20120915_h2[2],
+ 1, 0, 12, 23.0); // Area from SQL Server
+}
+
+template <typename P>
+void test_all()
+{
+
+ {
+ typedef bg::model::ring<P> ring;
+ typedef bg::model::polygon<P> polygon;
+ typedef bg::model::multi_polygon<polygon> multi_polygon;
+ test_areal<ring, polygon, multi_polygon>();
+ }
+
+ {
+ typedef bg::model::ring<P, false> ring_ccw;
+ typedef bg::model::polygon<P, false> polygon_ccw;
+ typedef bg::model::multi_polygon<polygon_ccw> multi_polygon_ccw;
+ test_areal<ring_ccw, polygon_ccw, multi_polygon_ccw>();
+ }
+
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ std::cout << "Testing TTMATH" << std::endl;
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_union.vcproj b/libs/geometry/test/multi/algorithms/multi_union.vcproj
new file mode 100644
index 000000000..9adb10145
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_union.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_union"
+ ProjectGUID="{1A8443BE-2666-4D6B-B4BC-6A7B7DD224B0}"
+ RootNamespace="multi_union"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_union"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../..;."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_union"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../..;."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_union.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_unique.cpp b/libs/geometry/test/multi/algorithms/multi_unique.cpp
new file mode 100644
index 000000000..397e46265
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_unique.cpp
@@ -0,0 +1,60 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 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/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>
+
+
+template <typename P>
+void test_all()
+{
+ // Multi point, should happen nothing, even if there are duplicate points
+ test_geometry<bg::model::multi_point<P> >(
+ "MULTIPOINT((0 0),(0 0),(1 1))",
+ "MULTIPOINT((0 0),(0 0),(1 1))");
+
+ test_geometry<bg::model::multi_linestring<bg::model::linestring<P> > >(
+ "MULTILINESTRING((0 0,1 1,1 1),(3 3,3 3,4 4))",
+ "MULTILINESTRING((0 0,1 1),(3 3,4 4))");
+
+ typedef bg::model::multi_polygon<bg::model::polygon<P> > mp;
+ test_geometry<mp>(
+ "MULTIPOLYGON(((0 0,0 1,1 1,1 1,1 1,1 0,0 0,0 0)))",
+ "MULTIPOLYGON(((0 0,0 1,1 1,1 0,0 0)))");
+
+ // With holes
+ test_geometry<mp>(
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 10,10 10,10 0,0 0,0 0)))",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))");
+
+}
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<int> >();
+ test_all<bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/multi_unique.vcproj b/libs/geometry/test/multi/algorithms/multi_unique.vcproj
new file mode 100644
index 000000000..d6a662b10
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_unique.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_unique"
+ ProjectGUID="{71879D37-84A8-4949-8CDB-212982F81D80}"
+ RootNamespace="multi_unique"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_unique"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_unique"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_unique.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/multi_within.cpp b/libs/geometry/test/multi/algorithms/multi_within.cpp
new file mode 100644
index 000000000..59db2dbc6
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_within.cpp
@@ -0,0 +1,59 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 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/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 <algorithms/test_within.hpp>
+
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::multi_polygon<bg::model::polygon<P> > mp;
+
+ // test multi-with-one-polygon (trivial case)
+ test_geometry<P, mp>("POINT(1 1)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", true);
+ test_geometry<P, mp>("POINT(3 3)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", false);
+ test_geometry<P, mp>("POINT(0 1)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", false);
+ test_geometry<P, mp>("POINT(4 4)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", false);
+
+ // test if it is in one of them
+ std::string multi("MULTIPOLYGON("
+ "((0 0,0 2,2 2,2 0,0 0))"
+ "((3 3,3 6,6 6,6 3,3 3))"
+ ")");
+ test_geometry<P, mp>("POINT(4 4)", multi, true);
+ test_geometry<P, mp>("POINT(1 1)", multi, true);
+ test_geometry<P, mp>("POINT(0 1)", multi, false);
+}
+
+int test_main( int , char* [] )
+{
+ //test_all<bg::model::d2::point_xy<int> >();
+ 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/multi/algorithms/multi_within.vcproj b/libs/geometry/test/multi/algorithms/multi_within.vcproj
new file mode 100644
index 000000000..f5d6ad350
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/multi_within.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_within"
+ ProjectGUID="{CA8D5E44-7D8F-44A1-901C-35C28890299B}"
+ RootNamespace="multi_within"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_within"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_within"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_within.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/algorithms/overlay/Jamfile.v2 b/libs/geometry/test/multi/algorithms/overlay/Jamfile.v2
new file mode 100644
index 000000000..a2e9a0ce5
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/overlay/Jamfile.v2
@@ -0,0 +1,14 @@
+# 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-multi-algorithms-overlay
+ :
+ [ run multi_traverse.cpp ]
+ ;
diff --git a/libs/geometry/test/multi/algorithms/overlay/multi_overlay.sln b/libs/geometry/test/multi/algorithms/overlay/multi_overlay.sln
new file mode 100644
index 000000000..ecb94cc33
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/overlay/multi_overlay.sln
@@ -0,0 +1,19 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_traverse", "multi_traverse.vcproj", "{DB00BBA3-4959-4F9E-A235-E487FF766207}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {DB00BBA3-4959-4F9E-A235-E487FF766207}.Debug|Win32.ActiveCfg = Debug|Win32
+ {DB00BBA3-4959-4F9E-A235-E487FF766207}.Debug|Win32.Build.0 = Debug|Win32
+ {DB00BBA3-4959-4F9E-A235-E487FF766207}.Release|Win32.ActiveCfg = Release|Win32
+ {DB00BBA3-4959-4F9E-A235-E487FF766207}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/multi/algorithms/overlay/multi_overlay_cases.hpp b/libs/geometry/test/multi/algorithms/overlay/multi_overlay_cases.hpp
new file mode 100644
index 000000000..0ddd3a0a7
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/overlay/multi_overlay_cases.hpp
@@ -0,0 +1,446 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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_MULTI_OVERLAY_CASES_HPP
+#define BOOST_GEOMETRY_TEST_MULTI_OVERLAY_CASES_HPP
+
+
+#include <string>
+
+
+static std::string case_multi_simplex[2] = {
+ "MULTIPOLYGON(((0 1,2 5,5 3,0 1)),((1 1,5 2,5 0,1 1)))",
+ "MULTIPOLYGON(((3 0,0 3,4 5,3 0)))" };
+
+// To mix multi/single
+static std::string case_single_simplex = "POLYGON((3 0,0 3,4 5,3 0))";
+
+static std::string case_multi_no_ip[2] =
+{
+ "MULTIPOLYGON(((4 1,0 7,7 9,4 1)),((8 1,6 3,10 4,8 1)),((12 6,10 7,13 8,12 6)))",
+ "MULTIPOLYGON(((14 4,8 8,15 10,14 4)),((15 3,18 9,20 2,15 3)),((3 4,1 7,5 7,3 4)))"
+};
+
+static std::string case_multi_2[2] =
+{
+ "MULTIPOLYGON(((4 3,2 7,10 9,4 3)),((8 1,6 3,10 4,8 1)),((12 6,10 7,13 8,12 6)))",
+ "MULTIPOLYGON(((14 4,8 8,15 10,14 4)),((15 3,18 9,20 2,15 3)),((5 5,4 7,7 7,5 5)))"
+};
+
+static std::string case_61_multi[2] =
+{
+ // extracted from recursive boxes
+ "MULTIPOLYGON(((1 1,1 2,2 2,2 1,1 1)),((2 2,2 3,3 3,3 2,2 2)))",
+ "MULTIPOLYGON(((1 2,1 3,2 3,2 2,1 2)),((2 3,2 4,3 4,3 3,2 3)))"
+};
+
+static std::string case_62_multi[2] =
+{
+ // extracted from recursive boxes
+ "MULTIPOLYGON(((1 2,1 3,2 3,2 2,1 2)))",
+ "MULTIPOLYGON(((1 2,1 3,2 3,2 2,1 2)),((2 3,2 4,3 4,3 3,2 3)))"
+};
+
+static std::string case_63_multi[2] =
+{
+ // extracted from recursive boxes
+ "MULTIPOLYGON(((1 2,1 3,2 3,2 2,1 2)))",
+ "MULTIPOLYGON(((1 2,1 3,2 3,2 2,1 2)),((2 1,2 2,3 2,3 1,2 1)))"
+};
+
+static std::string case_64_multi[3] =
+{
+ // extracted from recursive boxes
+ "MULTIPOLYGON(((1 1,1 2,2 2,2 1,1 1)),((2 2,2 3,3 3,3 2,2 2)))",
+ "MULTIPOLYGON(((1 1,1 2,2 2,3 2,3 1,2 1,1 1)))" ,
+ // same but omitting not-necessary form-points at x=2 (==simplified)
+ "MULTIPOLYGON(((1 1,1 2,3 2,3 1,1 1)))"
+};
+
+static std::string case_65_multi[2] =
+{
+ "MULTIPOLYGON(((2 2,2 3,3 3,3 2,2 2)))",
+ "MULTIPOLYGON(((1 1,1 2,2 2,2 1,1 1)),((2 2,2 3,3 3,3 2,2 2)),((3 1,3 2,5 2,5 1,3 1)))"
+};
+
+static std::string case_66_multi[2] =
+{
+ "MULTIPOLYGON(((3 5,2 5,2 6,3 6,4 6,4 5,3 5)),((1 6,0 6,0 7,1 7,2 7,2 6,1 6)))",
+ "MULTIPOLYGON(((1 4,1 5,2 5,2 4,1 4)),((1 7,2 7,2 6,1 6,1 7)),((0 8,0 9,1 9,1 8,1 7,0 7,0 8)))"
+};
+
+static std::string case_67_multi[2] =
+{
+ "MULTIPOLYGON(((1 2,1 3,2 3,2 2,1 2)),((2 1,2 2,3 2,3 1,2 1)))",
+ "MULTIPOLYGON(((1 1,1 2,3 2,3 1,1 1)))"
+};
+
+static std::string case_68_multi[2] =
+{
+ "MULTIPOLYGON(((2 1,2 2,4 2,4 1,2 1)),((4 2,4 3,5 3,5 2,4 2)))",
+ "MULTIPOLYGON(((1 2,1 3,2 3,2 2,1 2)),((2 1,2 2,3 2,3 1,2 1)),((3 2,3 3,5 3,5 2,3 2)))"
+};
+
+static std::string case_69_multi[2] =
+{
+ "MULTIPOLYGON(((1 1,1 2,2 2,2 1,1 1)),((3 2,3 3,4 3,4 2,3 2)))",
+ "MULTIPOLYGON(((2 0,2 1,3 1,3 0,2 0)),((1 1,1 3,2 3,2 1,1 1)),((2 3,2 4,3 4,3 3,2 3)))"
+};
+
+static std::string case_71_multi[2] =
+{
+ "MULTIPOLYGON(((0 0,0 3,1 3,1 1,3 1,3 2,4 2,4 0,0 0)),((2 2,2 3,3 3,3 2,2 2)))",
+ "MULTIPOLYGON(((0 2,0 3,3 3,3 2,0 2)))"
+};
+
+static std::string case_72_multi[2] =
+{
+ // cluster with ii, done by both traverse and assemble
+ "MULTIPOLYGON(((0 3,4 4,3 0,3 3,0 3)),((3 3,2 1,1 2,3 3)))",
+ "MULTIPOLYGON(((0 0,1 4,3 3,4 1,0 0)))"
+};
+
+static std::string case_73_multi[2] =
+{
+ "MULTIPOLYGON(((2 2,2 3,3 3,3 2,2 2)),((1 1,1 2,2 2,2 1,1 1)))",
+ "MULTIPOLYGON(((1 1,1 2,2 2,2 3,3 3,3 1,1 1)))"
+};
+
+static std::string case_74_multi[2] =
+{
+ "MULTIPOLYGON(((3 0,2 0,2 1,3 1,3 3,1 3,1 2,2 2,2 1,0 1,0 5,4 5,4 0,3 0)))",
+ "MULTIPOLYGON(((0 2,0 3,1 3,1 1,2 1,2 0,0 0,0 2)),((2 3,1 3,1 4,2 4,2 3)))"
+};
+
+static std::string case_75_multi[2] =
+{
+ // cc/uu turns on all corners of second box
+ "MULTIPOLYGON(((1 1,1 2,2 2,2 1,1 1)),((1 3,1 4,2 4,2 3,1 3)),((2 2,2 3,3 3,3 2,2 2)),((3 1,3 2,4 2,4 1,3 1)),((3 3,3 4,4 4,4 3,3 3)))",
+ "MULTIPOLYGON(((2 2,2 3,3 3,3 2,2 2)))"
+};
+
+static std::string case_76_multi[2] =
+{
+ // cc/uu turns on all corners of second box, might generate TWO OVERLAPPING union polygons!
+ // therefore, don't follow uu.
+ "MULTIPOLYGON(((1 0,1 1,2 1,2 0,1 0)),((3 2,4 2,4 1,3 1,3 2)),((2 2,2 3,3 3,3 2,2 2)),((2 3,1 3,1 4,2 4,2 3)),((3 3,3 4,4 4,4 3,3 3)))",
+ "MULTIPOLYGON(((0 2,0 3,1 3,1 2,2 2,2 0,1 0,1 1,0 1,0 2)),((2 2,2 3,3 3,3 2,2 2)))"
+};
+
+static std::string case_77_multi[2] =
+{
+ // with a point on interior-ring-border of enclosing
+ // -> went wrong in the assemble phase for intersection (traversal is OK)
+ // -> fixed
+ "MULTIPOLYGON(((3 3,3 4,4 4,4 3,3 3)),((5 3,5 4,4 4,4 5,3 5,3 6,5 6,5 5,7 5,7 6,8 6,8 5,9 5,9 2,8 2,8 1,7 1,7 2,5 2,5 3),(6 3,8 3,8 4,6 4,6 3)))",
+ "MULTIPOLYGON(((6 3,6 4,7 4,7 3,6 3)),((2 3,1 3,1 4,3 4,3 5,4 5,4 6,5 6,5 7,9 7,9 4,7 4,7 5,8 5,8 6,7 6,7 5,6 5,6 4,4 4,4 3,3 3,3 2,2 2,2 3)),((5 2,4 2,4 3,6 3,6 2,5 2)),((7 2,7 3,8 3,8 2,8 1,7 1,7 2)))"
+};
+
+static std::string case_78_multi[2] =
+{
+ "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0),(2 2,4 2,4 3,2 3,2 2)))",
+ "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0),(3 2,4 2,4 3,3 3,3 2),(1 1,2 1,2 2,1 2,1 1)))"
+
+};
+
+static std::string case_80_multi[2] =
+{
+ // Many ux-clusters -> needs correct cluster-sorting
+ // Fixed now
+ "MULTIPOLYGON(((3 1,3 2,4 2,3 1)),((1 5,0 4,0 5,1 6,1 5)),((3 3,4 3,3 2,2 2,2 3,3 3)),((4 5,5 6,5 5,4 5)),((4 2,4 3,5 3,4 2)),((2.5 5.5,3 5,2 5,2 7,3 6,2.5 5.5)),((1 6,0 6,0 7,1 7,2 6,1 6)))",
+ "MULTIPOLYGON(((3 5,3 6,4 6,4 5,3 5)),((4 4,5 5,5 4,4 4)),((3 3,4 4,4 3,3 3)),((1 5,1 6,2 6,2 5,1 5)),((0 6,1 7,1 6,0 6)),((1 4,1 3,0 3,0 4,1 4)),((3 5,4 4,3 4,3 3,2 3,2 5,3 5)))"
+};
+
+static std::string case_81_multi[2] =
+{
+ "MULTIPOLYGON(((1 1,2 2,2 1,1 1)),((2 2,2 3,3 2,2 2)),((3 1,4 2,4 1,3 1)))",
+ "MULTIPOLYGON(((2 1,2 2,3 3,3 2,4 2,3 1,2 1)))"
+};
+
+static std::string case_82_multi[2] =
+{
+ "MULTIPOLYGON(((4 0,5 1,5 0,4 0)),((2 1,3 2,3 1,2 1)),((3 0,4 1,4 0,3 0)),((1 0,1 1,2 1,2 0,1 0)))",
+ "MULTIPOLYGON(((3 2,4 3,4 2,3 2)),((3 1,3 2,4 1,3 1)),((0 0,1 1,1 0,0 0)),((5 1,5 0,4 0,4 1,5 1)))"
+};
+
+static std::string case_83_multi[2] =
+{
+ // iu/iu
+ "MULTIPOLYGON(((1 0,1 1,2 1,1 0)),((0 1,0 4,1 4,1 1,0 1)),((2 1,2 2,3 2,3 1,2 1)),((2 3,3 4,3 3,2 3)))",
+ "MULTIPOLYGON(((1 0,2 1,2 0,1 0)),((0 3,1 4,1 3,0 3)),((2 3,2 4,3 3,2 3)),((1 3,2 3,2 2,0 2,1 3)))"
+};
+
+static std::string case_84_multi[2] =
+{
+ // iu/ux
+ "MULTIPOLYGON(((2 2,3 3,3 2,2 2)),((2 1,2 2,3 1,2 1)),((2 3,3 4,3 3,2 3)),((1 3,2 4,2 2,1 2,1 3)))",
+ "MULTIPOLYGON(((2 3,3 3,3 1,2 1,2 2,1 2,1 3,2 3)))"
+};
+
+static std::string case_85_multi[2] =
+{
+ // iu/ux (and ux/ux)
+ "MULTIPOLYGON(((0 1,0 2,1 2,0 1)),((1 1,1 2,2 1,1 1)),((0 3,1 3,0 2,0 3)))",
+ "MULTIPOLYGON(((1 3,2 3,2 1,1 1,1 2,0 2,1 3)))"
+};
+
+static std::string case_86_multi[2] =
+{
+ // iu/ux
+ "MULTIPOLYGON(((4 2,4 3,5 3,4 2)),((5 2,6 3,6 2,5 2)),((5 1,4 1,4 2,5 2,6 1,5 1)))",
+ "MULTIPOLYGON(((5 1,5 2,6 2,6 1,5 1)),((4 2,5 3,5 2,4 2)),((3 2,4 3,4 2,3 2)))"
+};
+
+static std::string case_87_multi[2] =
+{
+ // iu/ux where iu crosses, no touch
+ "MULTIPOLYGON(((5 0,5 1,6 0,5 0)),((6 2,7 3,7 2,6 2)),((5 1,5 3,6 3,6 1,5 1)))",
+ "MULTIPOLYGON(((5 1,5 2,7 2,7 1,6 1,6 0,5 0,5 1)),((4 3,5 3,5 2,3 2,4 3)))"
+};
+
+
+static std::string case_88_multi[2] =
+{
+ "MULTIPOLYGON(((0 0,0 1,1 0,0 0)),((1 1,1 2,2 1,1 1)),((0 2,0 3,1 3,2 3,2 2,1 2,0 1,0 2)))",
+ "MULTIPOLYGON(((0 0,0 1,1 0,0 0)),((0 1,1 2,1 1,0 1)),((0 2,0 3,1 3,1 2,0 2)))"
+};
+
+static std::string case_89_multi[2] =
+{
+ // Extract from rec.boxes_3
+ "MULTIPOLYGON(((8 1,7 1,8 2,8 3,9 4,9 2,8.5 1.5,9 1,8 0,8 1)),((9 1,9 2,10 2,10 1,9 0,9 1)))",
+ "MULTIPOLYGON(((8 3,9 4,9 3,8 3)),((7 0,7 1,8 1,8 0,7 0)),((9 2,9 1,8 1,8 3,8.5 2.5,9 3,9 2)))"
+};
+
+static std::string case_90_multi[2] =
+{
+ // iu/iu for Union; see ppt
+ "MULTIPOLYGON(((1 8,0 8,0 10,1 10,1 9,2 8,2 7,1 7,1 8)),((2 9,2 10,4 10,4 9,3 9,3 8,2 8,2 9)))",
+ "MULTIPOLYGON(((2 8,1 8,1 9,2 9,2 10,3 10,3 8,2 8)),((0 10,2 10,0 8,0 10)))"
+};
+
+static std::string case_91_multi[2] =
+{
+ // iu/xi for Intersection
+ "MULTIPOLYGON(((3 3,3 4,4 4,3 3)),((2 2,1 2,1 4,2 4,2 3,3 3,2 2)))",
+ "MULTIPOLYGON(((2 2,2 3,3 2,2 2)),((2 3,1 3,1 4,1.5 3.5,2 4,2.5 3.5,3 4,3 3,2 3)))"
+};
+
+static std::string case_92_multi[2] =
+{
+ // iu/iu all aligned (for union)
+ "MULTIPOLYGON(((7 2,7 3,8 2,7 2)),((8 4,9 5,9 4,8 4)),((8 2,8 3,9 2,8 2)),((7 3,7 4,8 4,8 3,7 3)),((9 3,9 4,10 4,10 3,9 3)))",
+ "MULTIPOLYGON(((9 2,8 2,8 3,9 3,10 2,9 2)),((7 5,8 5,9 6,9 4,8 4,7 3,6 3,6 4,6.5 3.5,7 4,6 4,7 5)))"
+};
+
+static std::string case_93_multi[2] =
+{
+ // iu/xi for intersection
+ "MULTIPOLYGON(((6 2,7 2,7 1,5 1,6 2)),((7 3,8 3,7.5 2.5,8 2,7 2,7 3)))",
+ "MULTIPOLYGON(((7 1,6 0,6 2,7 3,7 2,8 3,8 2,7 1)))"
+};
+
+
+static std::string case_94_multi[2] =
+{
+ // iu/iu for union
+ "MULTIPOLYGON(((9 2,9 3,10 3,10 2,9 2)),((7 3,8 4,9 3,8 3,9 2,7 2,7 3)),((8 6,9 5,9 4,8 4,8 6)))",
+ "MULTIPOLYGON(((6 2,6 3,7 3,8 2,6 2)),((9 3,10 3,9 2,9 1,8 0,7 0,8 1,8 3,8.5 2.5,9 3)),((7 4,7 5,8 5,9 6,9 4,8 4,8 3,7 3,7 4)))"
+};
+
+static std::string case_95_multi[2] =
+{
+ // iu/iu for union
+ "MULTIPOLYGON(((0 8,1 8,1 7,0 7,0 8)),((2 8,2 9,2.5 8.5,3 9,3 7,2 7,2 8)),((1 9,1 10,2 9,1 8,1 9)))",
+ "MULTIPOLYGON(((1 7,0 7,0 8,1 8,2 7,1 7)),((2 9,1 9,1 10,2 10,3 9,4 9,4 8,2 8,2 9)))"
+};
+
+static std::string case_96_multi[2] =
+{
+ // iu/iu all collinear, for intersection/union
+ "MULTIPOLYGON(((8 2,9 3,9 2,8 2)),((8 1,9 2,9 1,10 1,10 0,8 0,8 1)))",
+ "MULTIPOLYGON(((9 0,9 1,10 0,9 0)),((8 1,8 2,9 2,9 1,8 1)))"
+};
+
+static std::string case_97_multi[2] =
+{
+ // ux/ux for union
+ "MULTIPOLYGON(((4 4,4 5,4.5 4.5,5 5,6 5,5 4,5 3,4 3,4 4)))",
+ "MULTIPOLYGON(((5 3,5 4,6 3,5 3)),((6 5,7 5,6 4,5 4,6 5)))"
+};
+
+
+static std::string case_98_multi[2] =
+{
+ // ii/iu for intersection, solved by discarding iu (ordering not possible)
+ "MULTIPOLYGON(((2 0,3 1,3 0,2 0)),((2 2,2 3,1 3,1 4,2 4,3 3,3 4,5 2,4 2,4 1,3 1,3 2,2.5 1.5,3 1,2 1,2 2)))",
+ "MULTIPOLYGON(((4 2,4 3,5 2,4 2)),((1 0,0 0,0 2,4 2,4 1,2 1,2 0,1 0)),((3 3,4 4,4 3,3 2,3 3)))"
+};
+
+static std::string case_99_multi[2] =
+{
+ // iu/iu for intersection
+ "MULTIPOLYGON(((1 0,2 1,2 0,1 0)),((1 2,2 2,1.5 1.5,2 1,1 1,1 0,0 0,0 1,1 2)))",
+ "MULTIPOLYGON(((1 1,2 0,0 0,1 1)),((1 1,0 1,0 2,1 2,2 3,2 2,1 1)))"
+};
+
+static std::string case_100_multi[2] =
+{
+ // for intersection
+ "MULTIPOLYGON(((0 0,0 1,1 0,0 0)),((2 2,2 1,0 1,0 2,1 2,2 3,2 2)))",
+ "MULTIPOLYGON(((1 1,1 2,2 2,2 1,1 1)),((1 2,0 1,0 3,1 4,1 2)))"
+};
+
+static std::string case_101_multi[2] =
+{
+ // interior ring / union
+ "MULTIPOLYGON(((7 2,7 3,8 2,7 2)),((9 3,9 4,10 3,9 3)),((10 1,10 0,8 0,8 1,9 2,10 2,10 1)),((9 3,9 2,8 2,8 3,7 3,7 4,8 4,9 3)),((8 4,8 7,9 6,9 4,8 4)))",
+ "MULTIPOLYGON(((6 1,5 1,5 2,6 3,6 4,7 5,6 5,7 6,8 6,8 5,9 5,8 4,9 4,9 5,10 5,10 1,8 1,8 3,7 3,7 2,6 2,7 1,8 1,7 0,5 0,5 1,5.5 0.5,6 1),(8.5 2.5,9 2,9 3,8.5 2.5)))"
+};
+
+static std::string case_102_multi[2] =
+{
+ // interior ring 'fit' / union
+ "MULTIPOLYGON(((0 2,0 7,5 7,5 2,0 2),(4 3,4 6,1 6,2 5,1 5,1 4,3 4,4 3)),((3 4,3 5,4 5,3 4)),((2 5,3 6,3 5,2 4,2 5)))",
+ "MULTIPOLYGON(((0 2,0 7,5 7,5 2,0 2),(2 4,3 5,2 5,2 4),(4 4,3 4,3 3,4 4),(4 5,4 6,3 6,4 5)))"
+};
+
+static std::string case_103_multi[2] =
+{
+ // interior ring 'fit' (ix) / union / assemble
+ "MULTIPOLYGON(((0 0,0 5,5 5,5 0,2 0,2 1,3 1,3 2,2 2,2 3,1 2,2 2,2 1,1 0,0 0)))",
+ "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0),(2 1,2 2,1 1,2 1)))"
+};
+
+static std::string case_104_multi[2] =
+{
+ // interior ring 'fit' (ii) / union / assemble
+ "MULTIPOLYGON(((1 0,1 1,0 1,0 5,5 5,5 0,2 0,2 1,1 0),(2 2,3 3,2 3,2 2)))",
+ "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0),(1 1,3 1,3 2,1 2,1 1)))"
+};
+
+static std::string case_105_multi[2] =
+{
+ // interior ring 'fit' () / union / assemble
+ "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0),(2 2,3 2,3 3,1 3,2 2)))",
+ "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0),(1 1,2 1,2 2,1 1),(2 1,3 1,3 2,2 1),(1 3,3 3,3 4,2 3,2 4,1 4,1 3)))"
+};
+
+static std::string case_106_multi[2] =
+{
+ // interior ring 'fit' () / union / assemble
+ "MULTIPOLYGON(((0 0,0 3,1 2,1 3,2 3,2 1,3 2,2 2,3 3,2 3,3 4,1 4,1 3,0 3,0 5,5 5,5 0,0 0)))",
+ "MULTIPOLYGON(((0 0,0 5,1 5,1 4,2 4,2 5,3 5,3 3,4 4,5 4,5 0,2 0,3 1,2 1,2 3,1 3,2 2,1.5 1.5,2 1,1 1,0 0)),((1 0,2 1,2 0,1 0)))"
+};
+
+static std::string case_107_multi[2] =
+{
+ // For CCW polygon reports a iu/iu problem.
+ "MULTIPOLYGON(((6 8,7 9,7 7,8 7,7 6,6 6,6 8)),((6.5 9.5,7 10,7 9,6 9,6 10,6.5 9.5)))",
+ "MULTIPOLYGON(((5 7,6 8,6 10,7 9,8 10,8 8,7 8,6 7,6 6,5 7)))"
+};
+
+
+static std::string case_recursive_boxes_1[2] =
+{
+ // == 70
+ // Used in blog. KEEP
+ "MULTIPOLYGON(((1 0,0 0,0 1,1 1,1 2,0 2,0 4,2 4,2 5,3 5,3 6,1 6,1 5,0 5,0 10,9 10,9 9,7 9,7 8,6 8,6 7,8 7,8 6,9 6,9 4,8 4,8 5,7 5,7 6,6 6,6 5,5 5,5 4,4 4,4 3,5 3,5 2,7 2,7 3,6 3,6 4,8 4,8 3,10 3,10 0,6 0,6 1,5 1,5 0,1 0),(4 7,4 9,3 9,3 7,4 7),(8 1,9 1,9 2,8 2,8 1)),((10 7,10 6,9 6,9 7,8 7,8 8,9 8,9 9,10 9,10 7)))",
+ "MULTIPOLYGON(((1 0,0 0,0 7,2 7,2 6,5 6,5 5,4 5,4 4,5 4,5 3,7 3,7 2,6 2,6 0,1 0),(2 1,2 2,3 2,3 3,1 3,1 1,2 1)),((7 0,7 2,10 2,10 0,9 0,9 1,8 1,8 0,7 0)),((6 4,6 6,5 6,5 7,6 7,6 8,5 8,5 7,3 7,3 9,2 9,2 8,1 8,1 10,4 10,4 9,6 9,6 10,10 10,10 9,9 9,9 8,10 8,10 6,9 6,9 5,10 5,10 3,7 3,7 4,6 4),(7 7,7 6,8 6,8 7,7 7)))"
+};
+
+static std::string case_recursive_boxes_2[2] =
+{
+ // Traversal problem; Many ii-cases -> formerly caused "Endless loop"
+ // So it appears that there might be more decisions than intersection points
+ "MULTIPOLYGON(((1 0,0 0,0 4,1 4,1 5,0 5,0 10,3 10,3 9,4 9,4 10,6 10,6 9,5 9,5 8,6 8,6 9,7 9,7 10,10 10,10 0,1 0),(7 6,8 6,8 7,9 7,9 8,8 8,8 7,7 7,7 6),(9 1,9 2,8 2,8 1,9 1)))",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,8 0,8 1,7 1,7 0,0 0),(7 3,6 3,6 2,7 2,7 3),(6 7,7 7,7 8,6 8,6 7)))"
+};
+
+
+static std::string case_recursive_boxes_3[2] =
+{
+ // Previously a iu/ux problem causing union to fail.
+ // For CCW polygon it also reports a iu/iu problem.
+ // KEEP
+ "MULTIPOLYGON(((8 3,9 4,9 3,8 3)),((5 9,5 10,6 10,5 9)),((2 0,2 1,3 0,2 0)),((2 5,2 6,3 6,3 5,2 5)),((2 2,1 2,1 3,2 3,3 2,3 1,2 1,2 2)),((6 8,7 9,7 7,8 7,7 6,6 6,6 8)),((4 6,5 7,5 6,4 6)),((4 8,4 9,5 9,5 8,4 8)),((0 3,1 4,1 3,0 3)),((8 7,9 8,9 7,8 7)),((9 6,9 7,10 7,9 6)),((7 0,8 1,8 0,7 0)),((0 4,0 5,1 5,1 4,0 4)),((4 2,5 3,5 2,4 1,4 2)),((4 10,4 9,2 9,3 10,4 10)),((5 2,6 3,7 3,7 2,6 2,6 1,5 0,5 2)),((5 3,4 3,4 4,2 4,4 6,4 5,4.5 4.5,6 6,6 5,7 4,5 4,5 3)),((10 2,9 1,9 3,10 2)),((8 4,7 4,8 5,7 5,7 6,9 6,9 5,10 5,10 4,8 4)),((1 7,0 7,0 8,1 8,1 7)),((1 10,2 10,1 9,0 9,0 10,1 10)),((6.5 9.5,7 10,7 9,6 9,6 10,6.5 9.5)),((8 8,8 9,10 9,9 8,8 8)))",
+ "MULTIPOLYGON(((0 7,0 8,1 8,1 7,0 7)),((5 3,4 3,4 4,6 4,6 3,7 3,6 2,5 2,5 3)),((8 2,8 3,9 2,8 2)),((1 1,2 2,2 1,1 1)),((2 1,3 1,2 0,1 0,2 1)),((2 3,3 4,3 3,2 3)),((1 9,2 8,1 8,1 9)),((2 10,2 9,1 9,1 10,2 10)),((9 7,9 8,10 8,10 7,9 7)),((6 0,6 1,7 1,7 0,6 0)),((8 0,9 1,9 0,8 0)),((1 6,1 5,0 5,1 6)),((0 2,1 1,0 1,0 2)),((1 3,2 3,2 2,1 2,1 3)),((5 1,5 0,4 0,4 1,3 1,4 2,5 2,6 1,5 1)),((1 3,0 3,0 4,1 4,1 3)),((3 6,4 5,2 5,3 6)),((9 2,10 2,10 1,9 1,9 2)),((7 5,6 4,6 5,7 6,8 6,8 5,7 5)),((7 4,8 5,8.5 4.5,9 5,9 4,8 4,8.5 3.5,9 4,10 3,7 3,7 4)),((1 6,1 7,3 7,3 8,4 7,5 7,6 8,6 10,7 9,8 10,9 10,9 9,8 9,8 8,7 8,6 7,6 6,1 6)))"
+};
+
+
+static std::string case_recursive_boxes_4[2] =
+{
+ // Occurred after refactoring assemble
+ "MULTIPOLYGON(((9 3,10 4,10 3,9 3)),((9 9,10 10,10 9,9 9)),((0 1,0 3,1 4,0 4,0 5,1 6,0 6,0 8,1 9,1 8,2 9,2 7,1.5 6.5,2.5 5.5,3 6,3 5,4 6,2 6,2 7,3 8,2 8,3 9,0 9,0 10,6 10,5.5 9.5,6 9,6 10,7 10,7.5 9.5,8 10,8 9,7 9,7 8,6 8,6.5 7.5,7 8,8 8,8 9,9 9,9.5 8.5,10 9,10 8,9.5 7.5,10 7,10 5,8 5,8 4,7 3,7 2,8 3,8 4,9 5,9 3,10 2,10 1,8 1,8.5 0.5,9 1,10 0,4 0,4 1,3 1,3 0,1 0,1 1,0 0,0 1),(4 2,4.5 1.5,5 2,5 4,4.5 3.5,5 3,4 3,4 2),(3 3,4 4,2 4,2.5 3.5,3 4,3 3),(6 4,6.5 3.5,7 4,6 4),(5 7,5 9,4 9,4 8,5 7)))",
+ "MULTIPOLYGON(((1 0,2 1,2 0,1 0)),((7 9,7 10,8 10,7 9)),((1 0,0 0,0 3,1 3,2 2,2 3,1 3,1 4,2 4,2 5,1 4,0 4,0 8,1 7,1 6,2 7,1 7,1 9,0 9,0 10,7 10,6 9,6.5 8.5,7 9,8 9,9 8,8 8,9 7,9 6,10 7,10 5,9 5,9 4,10 5,10 0,7 0,8 1,7 1,6 0,3 0,3 1,1 1,1 0),(5 1,5.5 0.5,6 1,6 2,6.5 1.5,7 2,8 2,8 4,7 3,6 3,6 2,5 2,6 1,5 1),(4 4,5 4,5 5,4 4),(4 6,4 7,3 7,2 6,3 6,3 7,4 6),(6 5,6.5 4.5,7 5,6 5,7 6,7 7,6 7,6 5),(3.5 7.5,4 8,4 9,3 8,3.5 7.5)),((9 8,9 9,8 9,9 10,10 10,10 8,9 8)))"
+};
+
+static std::string pie_21_7_21_0_3[2] =
+{
+ "MULTIPOLYGON(((2500 2500,2500 3875,2855 3828,3187 3690,3472 3472,3690 3187,3828 2855,3875 2500,3828 2144,3690 1812,3472 1527,3187 1309,2855 1171,2499 1125,2144 1171,1812 1309,1527 1527,1309 1812,1171 2144,1125 2499,1171 2855,1309 3187,2500 2500)))",
+ "MULTIPOLYGON(((2500 2500,1704 3295,1937 3474,2208 3586,2499 3625,2791 3586,3062 3474,3295 3295,2500 2500)),((2500 2500,3586 2791,3625 2500,3586 2208,2500 2500)))"
+};
+
+static std::string pie_23_19_5_0_2[2] =
+{
+ "MULTIPOLYGON(((2500 2500,2500 3875,2855 3828,3187 3690,3472 3472,3690 3187,3828 2855,3875 2500,3828 2144,3690 1812,3472 1527,3187 1309,2855 1171,2499 1125,2144 1171,1812 1309,1527 1527,1309 1812,1171 2144,1125 2499,1171 2855,1309 3187,1527 3472,1812 3690,2500 2500)))",
+ "MULTIPOLYGON(((2500 2500,3586 2791,3625 2500,3586 2208,3474 1937,3295 1704,3062 1525,2791 1413,2499 1375,2208 1413,1937 1525,1704 1704,1525 1937,1413 2208,1375 2500,1413 2791,1525 3062,1704 3295,1937 3474,2208 3586,2500 2500)),((2500 2500,2791 3586,3062 3474,2500 2500)))"
+};
+
+static std::string pie_7_14_5_0_7[2] =
+{
+ "MULTIPOLYGON(((2500 2500,2500 3875,2855 3828,3187 3690,3472 3472,3690 3187,3828 2855,3875 2500,2500 2500)))",
+ "MULTIPOLYGON(((2500 2500,3586 2791,3625 2500,3586 2208,3474 1937,3295 1704,3062 1525,2791 1413,2499 1375,2208 1413,1937 1525,1704 1704,1525 1937,1413 2208,1375 2500,2500 2500)),((2500 2500,1525 3062,1704 3295,1937 3474,2208 3586,2499 3625,2791 3586,3062 3474,2500 2500)))"
+};
+
+static std::string pie_16_16_9_0_2[2] =
+{
+ "MULTIPOLYGON(((2500 2500,2500 3875,2855 3828,3187 3690,3472 3472,3690 3187,3828 2855,3875 2500,3828 2144,3690 1812,3472 1527,3187 1309,2855 1171,2499 1125,2144 1171,1812 1309,1527 1527,2500 2500)))",
+ "MULTIPOLYGON(((2500 2500,3295 1704,3062 1525,2791 1413,2499 1375,2208 1413,1937 1525,1704 1704,1525 1937,1413 2208,1375 2500,1413 2791,1525 3062,1704 3295,1937 3474,2208 3586,2499 3625,2500 2500)),((2500 2500,3062 3474,3295 3295,2500 2500)))"
+};
+
+static std::string pie_7_2_1_0_15[2] =
+{
+ "MULTIPOLYGON(((2500 2500,2500 3875,2855 3828,3187 3690,3472 3472,3690 3187,3828 2855,3875 2500,2500 2500)))",
+ "MULTIPOLYGON(((2500 2500,2791 3586,3062 3474,2500 2500)),((2500 2500,3474 3062,3586 2791,3625 2500,3586 2208,3474 1937,3295 1704,3062 1525,2791 1413,2499 1375,2208 1413,1937 1525,1704 1704,1525 1937,1413 2208,1375 2500,2500 2500)))"
+};
+
+// Case, not literally on this list but derived, to mix polygon/multipolygon in call to difference
+static std::string ggl_list_20111025_vd[4] =
+ {
+ "POLYGON((0 0,0 4,4 0,0 0))",
+ "POLYGON((10 0,10 5,15 0,10 0))",
+ "MULTIPOLYGON(((0 0,0 4,4 0,0 0)))",
+ "MULTIPOLYGON(((10 0,10 5,15 0,10 0)))"
+ };
+
+// Same, mail with other case with text "Say the MP is the 2 squares below and P is the blue-ish rectangle."
+static std::string ggl_list_20111025_vd_2[2] =
+ {
+ "POLYGON((5 0,5 4,8 4,8 0,5 0))",
+ "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)),((4 0,4 2,6 2,6 0,4 0)))"
+ };
+
+// Mail of h2 indicating that reversed order (in second polygon) has ix/ix problems
+static std::string ggl_list_20120915_h2[3] =
+ {
+ "MULTIPOLYGON(((-2 5, -1 5, 0 5, 2 5, 2 -2, 1 -2, 1 -1, 0 -1,0 0, -1 0, -2 0, -2 5)))",
+ "MULTIPOLYGON(((0 0, 1 0, 1 -1, 0 -1, 0 0)), ((-1 5, 0 5, 0 0, -1 0, -1 5)))",
+ "MULTIPOLYGON(((-1 5, 0 5, 0 0, -1 0, -1 5)), ((0 0, 1 0, 1 -1, 0 -1, 0 0)))"
+ };
+
+// Mail of volker, about another problem, but this specific example is causing two-point inner rings polygons which should be discarded
+// (condition of num_points in detail/overlay/convert_ring.hpp)
+static std::string ggl_list_20120221_volker[2] =
+ {
+ "MULTIPOLYGON(((1032 2130,1032 1764,2052 2712,1032 2130)),((3234 2580,2558 2690,3234 2532,3234 2580)),((2558 2690,2136 2790,2052 2712,2136 2760,2558 2690)))",
+ "MULTIPOLYGON(((3232 2532.469945355191,2136 2790,1032 1764,1032 1458,1032 1212,2136 2328,3232 2220.196721311475,3232 1056,1031 1056,1031 2856,3232 2856,3232 2532.469945355191),(3232 2412.426229508197,2136 2646,3232 2412.426229508197)))"
+ };
+
+
+#endif // BOOST_GEOMETRY_TEST_MULTI_OVERLAY_CASES_HPP
diff --git a/libs/geometry/test/multi/algorithms/overlay/multi_overlay_common.hpp b/libs/geometry/test/multi/algorithms/overlay/multi_overlay_common.hpp
new file mode 100644
index 000000000..5f24f3e82
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/overlay/multi_overlay_common.hpp
@@ -0,0 +1,40 @@
+// 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.
+// 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 GEOMETRY_TEST_MULTI_OVERLAY_COMMON_HPP
+#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/multi/io/wkt/read.hpp>
+//#include <boost/geometry/multi/io/svg/write_svg.hpp>
+
+
+
+template <typename P, typename Functor, typename T>
+void test_all(std::vector<T> const& expected, double precision = 0.01)
+{
+ typename boost::range_const_iterator<std::vector<T> >::type iterator
+ = boost::begin(expected);
+
+ typedef bg::model::multi_polygon<bg::model::polygon<P> > mp;
+ typedef bg::model::box<P> box;
+
+ BOOST_ASSERT(iterator != boost::end(expected));
+ test_overlay<mp, mp, Functor>("1", *iterator,
+ "MULTIPOLYGON(((0 1,2 5,5 3,0 1)),((1 1,5 2,5 0,1 1)))",
+ "MULTIPOLYGON(((3 0,0 3,4 5,3 0)))", precision);
+ iterator++;
+}
+
+
+#endif // GEOMETRY_TEST_MULTI_OVERLAY_COMMON_HPP
diff --git a/libs/geometry/test/multi/algorithms/overlay/multi_traverse.cpp b/libs/geometry/test/multi/algorithms/overlay/multi_traverse.cpp
new file mode 100644
index 000000000..faacd3615
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/overlay/multi_traverse.cpp
@@ -0,0 +1,447 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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)
+
+
+//#define BOOST_GEOMETRY_DEBUG_ENRICH
+//#define BOOST_GEOMETRY_DEBUG_RELATIVE_ORDER
+
+// Include the single-geometry version
+#define BOOST_GEOMETRY_TEST_MULTI
+#include <algorithms/overlay/traverse.cpp>
+
+
+
+#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/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 "multi_overlay_cases.hpp"
+
+
+
+template <typename MultiPolygon, bool Reverse>
+void test_geometries()
+{
+ namespace ov = bg::detail::overlay;
+
+ typedef test_traverse
+ <
+ MultiPolygon, MultiPolygon,
+ ov::operation_intersection, Reverse, Reverse
+ > test_traverse_intersection;
+ typedef test_traverse
+ <
+ MultiPolygon, MultiPolygon,
+ ov::operation_union, Reverse, Reverse
+ > test_traverse_union;
+
+ // Intersections:
+ test_traverse_intersection::apply
+ (
+ "simplex", 2, 6.42,
+ case_multi_simplex[0], case_multi_simplex[1]
+ );
+
+ test_traverse_intersection::apply
+ (
+ "case_65_multi", 1, 1,
+ case_65_multi[0], case_65_multi[1]
+ );
+ test_traverse_intersection::apply
+ (
+ "case_66_multi", 1, 1,
+ case_66_multi[0], case_66_multi[1]
+ );
+
+ test_traverse_intersection::apply
+ (
+ "case_67_multi", 1, 1,
+ case_67_multi[0], case_67_multi[1]
+ );
+ test_traverse_intersection::apply
+ (
+ "case_69_multi", 1, 1,
+ case_69_multi[0], case_69_multi[1]
+ );
+
+ test_traverse_intersection::apply
+ (
+ "case_71_multi", 2, 2,
+ case_71_multi[0], case_71_multi[1]
+ );
+
+ // #72, note that it intersects into 2 shapes,
+ // the third one is done by assemble (see intersection #72)
+ test_traverse_intersection::apply
+ (
+ "case_72_multi", 2, 1.35,
+ case_72_multi[0], case_72_multi[1]
+ );
+
+ test_traverse_intersection::apply
+ (
+ "case_73_multi", 2, 2,
+ case_73_multi[0], case_73_multi[1]
+ );
+ test_traverse_intersection::apply
+ (
+ "case_74_multi", 2, 3,
+ case_74_multi[0], case_74_multi[1]
+ );
+ test_traverse_intersection::apply
+ (
+ "case_75_multi", 1, 1,
+ case_75_multi[0], case_75_multi[1]
+ );
+ test_traverse_intersection::apply
+ (
+ "case_77_multi", 5, 9,
+ case_77_multi[0], case_77_multi[1]
+ );
+ test_traverse_intersection::apply
+ (
+ "case_78_multi", 2, 22, // Went from 3 to 2 by get_turns / partition
+ case_78_multi[0], case_78_multi[1]
+ );
+
+ test_traverse_intersection::apply
+ (
+ "case_80_multi", 1, 0.5,
+ case_80_multi[0], case_80_multi[1]
+ );
+ test_traverse_intersection::apply
+ (
+ "case_81_multi", 1, 0.25,
+ case_81_multi[0], case_81_multi[1]
+ );
+ test_traverse_intersection::apply
+ (
+ "case_83_multi", 3, 1.25,
+ case_83_multi[0], case_83_multi[1]
+ );
+
+ test_traverse_intersection::apply
+ (
+ "case_91_multi", 2, 1.0,
+ case_91_multi[0], case_91_multi[1]
+ );
+ test_traverse_intersection::apply
+ (
+ "case_92_multi", 3, 1.5,
+ case_92_multi[0], case_92_multi[1]
+ );
+ test_traverse_intersection::apply
+ (
+ "case_93_multi", 2, 1.25,
+ case_93_multi[0], case_93_multi[1]
+ );
+ test_traverse_intersection::apply
+ (
+ "case_96_multi", 2, 1.0,
+ case_96_multi[0], case_96_multi[1]
+ );
+ test_traverse_intersection::apply
+ (
+ "case_98_multi", 4, 3.0,
+ case_98_multi[0], case_98_multi[1]
+ );
+
+ test_traverse_intersection::apply
+ (
+ "case_99_multi", 3, 1.75,
+ case_99_multi[0], case_99_multi[1]
+ );
+ test_traverse_intersection::apply
+ (
+ "case_100_multi", 2, 1.5,
+ case_100_multi[0], case_100_multi[1]
+ );
+
+
+ test_traverse_intersection::apply
+ (
+ "case_recursive_boxes_2", 1, 91,
+ case_recursive_boxes_2[0], case_recursive_boxes_2[1]
+ );
+ test_traverse_intersection::apply
+ (
+ "case_107_multi", 2, 1.5,
+ case_107_multi[0], case_107_multi[1]
+ );
+ test_traverse_intersection::apply
+ (
+ "case_recursive_boxes_3", 19, 12.5,
+ case_recursive_boxes_3[0], case_recursive_boxes_3[1]
+ );
+
+ // Unions
+
+
+ test_traverse_union::apply
+ (
+ "simplex", 1, 14.58,
+ case_multi_simplex[0], case_multi_simplex[1]
+ );
+
+ test_traverse_union::apply
+ (
+ "case_61_multi", 1, 4,
+ case_61_multi[0], case_61_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_62_multi", 1, 1 /*UU 2, 2 */,
+ case_62_multi[0], case_62_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_63_multi", 1, 1 /*UU 2, 2 */,
+ case_63_multi[0], case_63_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_64_multi", 1, 3,
+ case_64_multi[0], case_64_multi[1]
+ );
+
+ test_traverse_union::apply
+ (
+ "case_66_multi", 1, 4 /*UU 3, 7 */,
+ case_66_multi[0], case_66_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_68_multi", 1, 4 /*UU 2, 5 */,
+ case_68_multi[0], case_68_multi[1]
+ );
+ // 71: single-polygon generates 2 shapes, multi-polygon
+ // generates 1 shape, both are self-tangent and OK
+ test_traverse_union::apply
+ (
+ "case_71_multi", 1, 9,
+ case_71_multi[0], case_71_multi[1]
+ );
+
+ test_traverse_union::apply
+ (
+ "case_72_multi", 1, 10.65,
+ case_72_multi[0], case_72_multi[1]
+ );
+
+ test_traverse_union::apply
+ (
+ "case_73_multi", 1, 3,
+ case_73_multi[0], case_73_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_74_multi", 2, 17,
+ case_74_multi[0], case_74_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_75_multi", 1, 1 /*UU 5, 5 */,
+ case_75_multi[0], case_75_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_76_multi", 2, 5 /*UU 6, 6 */,
+ case_76_multi[0], case_76_multi[1]
+ );
+
+ test_traverse_union::apply
+ (
+ "case_80_multi", 1, 9.25,
+ case_80_multi[0], case_80_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_81_multi", 1, 3.25,
+ case_81_multi[0], case_81_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_82_multi", 3, 4,
+ case_82_multi[0], case_82_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_84_multi", 1, 4,
+ case_84_multi[0], case_84_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_85_multi", 1, 3.5,
+ case_85_multi[0], case_85_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_86_multi", 1, 4,
+ case_86_multi[0], case_86_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_87_multi", 1, 6,
+ case_87_multi[0], case_87_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_88_multi", 2, 4,
+ case_88_multi[0], case_88_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_89_multi", 1, 6,
+ case_89_multi[0], case_89_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_90_multi", 1, 7.5,
+ case_90_multi[0], case_90_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_92_multi", 2, 6.25,
+ case_92_multi[0], case_92_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_94_multi", 1, 10.0,
+ case_94_multi[0], case_94_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_95_multi", 2, 6.5,
+ case_95_multi[0], case_95_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_96_multi", 1, 3.5,
+ case_96_multi[0], case_96_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_97_multi", 1, 3.75,
+ case_97_multi[0], case_97_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_101_multi", 1, 22.25,
+ case_101_multi[0], case_101_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_102_multi", 3, 24.25,
+ case_102_multi[0], case_102_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_103_multi", 1, 25,
+ case_103_multi[0], case_103_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_104_multi", 1, 25,
+ case_104_multi[0], case_104_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_105_multi", 1, 25,
+ case_105_multi[0], case_105_multi[1]
+ );
+ test_traverse_union::apply
+ (
+ "case_106_multi", 1, 25,
+ case_106_multi[0], case_106_multi[1]
+ );
+
+
+ test_traverse_union::apply
+ (
+ "case_recursive_boxes_1", 2, 97,
+ case_recursive_boxes_1[0], case_recursive_boxes_1[1]
+ );
+
+ test_traverse_union::apply
+ (
+ "case_recursive_boxes_3", 7, 49.5,
+ case_recursive_boxes_3[0], case_recursive_boxes_3[1]
+ );
+
+ test_traverse_intersection::apply
+ (
+ "pie_21_7_21_0_3", 2, 818824.56678,
+ pie_21_7_21_0_3[0], pie_21_7_21_0_3[1]
+ );
+
+ test_traverse_intersection::apply
+ (
+ "pie_23_19_5_0_2", 2, 2948602.3911823,
+ pie_23_19_5_0_2[0], pie_23_19_5_0_2[1]
+ );
+ test_traverse_intersection::apply
+ (
+ "pie_7_14_5_0_7", 2, 490804.56678,
+ pie_7_14_5_0_7[0], pie_7_14_5_0_7[1]
+ );
+ test_traverse_intersection::apply
+ (
+ "pie_16_16_9_0_2", 2, 1146795,
+ pie_16_16_9_0_2[0], pie_16_16_9_0_2[1]
+ );
+ test_traverse_intersection::apply
+ (
+ "pie_7_2_1_0_15", 2, 490585.5,
+ pie_7_2_1_0_15[0], pie_7_2_1_0_15[1]
+ );
+
+}
+
+template <typename T>
+void test_all()
+{
+ typedef bg::model::point<T, 2, bg::cs::cartesian> point_type;
+
+ typedef bg::model::multi_polygon
+ <
+ bg::model::polygon<point_type>
+ > multi_polygon;
+
+ typedef bg::model::multi_polygon
+ <
+ bg::model::polygon<point_type, false>
+ > multi_polygon_ccw;
+
+ test_geometries<multi_polygon, false>();
+ test_geometries<multi_polygon_ccw, true>();
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<double>();
+
+ return 0;
+}
diff --git a/libs/geometry/test/multi/algorithms/overlay/multi_traverse.vcproj b/libs/geometry/test/multi/algorithms/overlay/multi_traverse.vcproj
new file mode 100644
index 000000000..c4cb7b8e0
--- /dev/null
+++ b/libs/geometry/test/multi/algorithms/overlay/multi_traverse.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="multi_traverse"
+ ProjectGUID="{DB00BBA3-4959-4F9E-A235-E487FF766207}"
+ RootNamespace="multi_traverse"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_traverse"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../../..;../../../../../..;../../../../../../boost/geometry/extensions/contrib/ttmath;../../../algorithms/overlay"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_traverse"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=".;../../..;../../../../../..;../../../../../../boost/geometry/extensions/contrib/ttmath;../../../algorithms/overlay"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\multi_traverse.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/io/Jamfile.v2 b/libs/geometry/test/multi/io/Jamfile.v2
new file mode 100644
index 000000000..6985a7ab9
--- /dev/null
+++ b/libs/geometry/test/multi/io/Jamfile.v2
@@ -0,0 +1,12 @@
+# 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)
+
+build-project wkt ;
+build-project dsv ;
diff --git a/libs/geometry/test/multi/io/dsv/Jamfile.v2 b/libs/geometry/test/multi/io/dsv/Jamfile.v2
new file mode 100644
index 000000000..1434d754e
--- /dev/null
+++ b/libs/geometry/test/multi/io/dsv/Jamfile.v2
@@ -0,0 +1,15 @@
+# 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-multi-io-dsv
+ :
+ [ run dsv.cpp ]
+ ;
+
diff --git a/libs/geometry/test/multi/io/dsv/dsv.cpp b/libs/geometry/test/multi/io/dsv/dsv.cpp
new file mode 100644
index 000000000..7f565906f
--- /dev/null
+++ b/libs/geometry/test/multi/io/dsv/dsv.cpp
@@ -0,0 +1,100 @@
+// 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.
+
+// 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 <sstream>
+
+#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>
+
+template <typename Geometry>
+void test_dsv(std::string const& wkt, std::string const& expected, bool json = false)
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ std::ostringstream out;
+ if (json)
+ {
+ out << bg::dsv(geometry, ", ", "[", "]", ", ", "[ ", " ]", ", ");
+ }
+ else
+ {
+ out << bg::dsv(geometry);
+ }
+ BOOST_CHECK_EQUAL(out.str(), expected);
+}
+
+
+template <typename T>
+void test_all()
+{
+ using namespace boost::geometry;
+ typedef model::point<T, 2, cs::cartesian> point_type;
+ typedef model::multi_point<point_type> mpoint;
+ typedef model::multi_linestring<model::linestring<point_type> > mline;
+ typedef model::multi_polygon<model::polygon<point_type> > mpoly;
+
+ test_dsv<mpoint>
+ (
+ "multipoint((1 2),(3 4))",
+ "((1, 2), (3, 4))"
+ );
+ test_dsv<mline>
+ (
+ "multilinestring((1 1,2 2,3 3),(4 4,5 5,6 6))",
+ "(((1, 1), (2, 2), (3, 3)), ((4, 4), (5, 5), (6, 6)))"
+ );
+ test_dsv<mpoly>
+ (
+ // Multi with 2 poly's, first has hole, second is triangle
+ "multipolygon(((0 0,0 4,4 4,4 0,0 0),(1 1,1 2,2 2,2 1,1 1)),((5 5,6 5,5 6,5 5)))",
+ "((((0, 0), (0, 4), (4, 4), (4, 0), (0, 0)), ((1, 1), (1, 2), (2, 2), (2, 1), (1, 1))), (((5, 5), (6, 5), (5, 6), (5, 5))))"
+ );
+
+ // http://geojson.org/geojson-spec.html#id5
+ test_dsv<mpoint>
+ (
+ "multipoint((1 2),(3 4))",
+ "[ [1, 2], [3, 4] ]",
+ true
+ );
+
+ // http://geojson.org/geojson-spec.html#id6
+ test_dsv<mline>
+ (
+ "multilinestring((1 1,2 2,3 3),(4 4,5 5,6 6))",
+ "[ [ [1, 1], [2, 2], [3, 3] ], [ [4, 4], [5, 5], [6, 6] ] ]",
+ true
+ );
+
+ // http://geojson.org/geojson-spec.html#id7
+ test_dsv<mpoly>
+ (
+ "multipolygon(((0 0,0 4,4 4,4 0,0 0),(1 1,1 2,2 2,2 1,1 1)),((5 5,6 5,5 6,5 5)))",
+ "[ [ [ [0, 0], [0, 4], [4, 4], [4, 0], [0, 0] ], [ [1, 1], [1, 2], [2, 2], [2, 1], [1, 1] ] ], [ [ [5, 5], [6, 5], [5, 6], [5, 5] ] ] ]",
+ true
+ );
+
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<double>();
+ test_all<int>();
+
+ return 0;
+}
+
diff --git a/libs/geometry/test/multi/io/dsv/dsv.sln b/libs/geometry/test/multi/io/dsv/dsv.sln
new file mode 100644
index 000000000..ecea59719
--- /dev/null
+++ b/libs/geometry/test/multi/io/dsv/dsv.sln
@@ -0,0 +1,19 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{6CD4A68C-3EA1-11E1-B9E4-BF144924019B}") = "dsv", "dsv.vcproj", "{7463ED40-3EA1-11E1-9FC7-D0144924019B}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {7463ED40-3EA1-11E1-9FC7-D0144924019B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7463ED40-3EA1-11E1-9FC7-D0144924019B}.Debug|Win32.Build.0 = Debug|Win32
+ {7463ED40-3EA1-11E1-9FC7-D0144924019B}.Release|Win32.ActiveCfg = Release|Win32
+ {7463ED40-3EA1-11E1-9FC7-D0144924019B}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/multi/io/dsv/dsv.vcproj b/libs/geometry/test/multi/io/dsv/dsv.vcproj
new file mode 100644
index 000000000..494551daa
--- /dev/null
+++ b/libs/geometry/test/multi/io/dsv/dsv.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="dsv"
+ ProjectGUID="{7463ED40-3EA1-11E1-9FC7-D0144924019B}"
+ RootNamespace="dsv"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\dsv"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../../..;../../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\dsv"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../../..;../../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\dsv.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/io/wkt/Jamfile.v2 b/libs/geometry/test/multi/io/wkt/Jamfile.v2
new file mode 100644
index 000000000..2f0fea2ed
--- /dev/null
+++ b/libs/geometry/test/multi/io/wkt/Jamfile.v2
@@ -0,0 +1,15 @@
+# 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-multi-io-wkt
+ :
+ [ run wkt.cpp ]
+ ;
+
diff --git a/libs/geometry/test/multi/io/wkt/io_wkt_tests.sln b/libs/geometry/test/multi/io/wkt/io_wkt_tests.sln
new file mode 100644
index 000000000..a804d533a
--- /dev/null
+++ b/libs/geometry/test/multi/io/wkt/io_wkt_tests.sln
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wkt", "wkt.vcproj", "{CA8D5E44-7D8F-44A1-900C-35C28890299B}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1FA2ADE2-F649-4245-951E-A8F5935E7127}.Debug|Win32.ActiveCfg = Debug|Win32
+ {1FA2ADE2-F649-4245-951E-A8F5935E7127}.Debug|Win32.Build.0 = Debug|Win32
+ {1FA2ADE2-F649-4245-951E-A8F5935E7127}.Release|Win32.ActiveCfg = Release|Win32
+ {1FA2ADE2-F649-4245-951E-A8F5935E7127}.Release|Win32.Build.0 = Release|Win32
+ {F2A680B0-F6FC-479E-9988-24CF6851C13C}.Debug|Win32.ActiveCfg = Debug|Win32
+ {F2A680B0-F6FC-479E-9988-24CF6851C13C}.Debug|Win32.Build.0 = Debug|Win32
+ {F2A680B0-F6FC-479E-9988-24CF6851C13C}.Release|Win32.ActiveCfg = Release|Win32
+ {F2A680B0-F6FC-479E-9988-24CF6851C13C}.Release|Win32.Build.0 = Release|Win32
+ {CA8D5E44-7D8F-44A1-900C-35C28890299B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CA8D5E44-7D8F-44A1-900C-35C28890299B}.Debug|Win32.Build.0 = Debug|Win32
+ {CA8D5E44-7D8F-44A1-900C-35C28890299B}.Release|Win32.ActiveCfg = Release|Win32
+ {CA8D5E44-7D8F-44A1-900C-35C28890299B}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/multi/io/wkt/wkt.cpp b/libs/geometry/test/multi/io/wkt/wkt.cpp
new file mode 100644
index 000000000..a149946cf
--- /dev/null
+++ b/libs/geometry/test/multi/io/wkt/wkt.cpp
@@ -0,0 +1,103 @@
+// 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.
+
+// 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 <iostream>
+#include <sstream>
+#include <string>
+
+#include <boost/algorithm/string.hpp>
+#include <boost/concept/requires.hpp>
+
+#include <boost/test/floating_point_comparison.hpp>
+#include <boost/test/included/test_exec_monitor.hpp>
+
+#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>
+
+template <typename T>
+void test_all();
+
+
+// Include the single test
+#define GEOMETRY_TEST_MULTI
+#include "io/wkt/wkt.cpp"
+
+template <typename T>
+void test_all()
+{
+ using namespace boost::geometry;
+ typedef bg::model::point<T, 2, bg::cs::cartesian> P;
+
+ test_wkt<bg::model::multi_point<P> >("multipoint((1 2),(3 4))", 2);
+ test_wkt<bg::model::multi_linestring<bg::model::linestring<P> > >("multilinestring((1 1,2 2,3 3),(4 4,5 5,6 6))", 6, 4 * sqrt(2.0));
+ test_wkt<bg::model::multi_polygon<bg::model::polygon<P> > >("multipolygon(((0 0,0 2,2 2,2 0,0 0),(1 1,1 2,2 2,2 1,1 1)),((0 0,0 4,4 4,4 0,0 0)))", 15, 0, 21, 28);
+
+ // Support for the official alternative syntax for multipoint
+ // (provided by Aleksey Tulinov):
+ test_relaxed_wkt<bg::model::multi_point<P> >("multipoint(1 2,3 4)", "multipoint((1 2),(3 4))");
+
+ test_wrong_wkt<bg::model::multi_polygon<bg::model::polygon<P> > >(
+ "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0),(1 1,1 2,2 2,2 1,1 1)),(0 0,0 4,4 4,4 0,0 0)))",
+ "expected '('");
+
+ test_wrong_wkt<bg::model::multi_linestring<bg::model::linestring<P> > >(
+ "MULTILINESTRING ((10 10, 20 20, 10 40), (40 40, 30 30, 40 20, 30 10)), (0 0, 1 1)",
+ "too much tokens at ','");
+
+ test_wrong_wkt<bg::model::multi_point<P> >(
+ "MULTIPOINT((8 9), 10 11)",
+ "expected '(' at '10'");
+ test_wrong_wkt<bg::model::multi_point<P> >(
+ "MULTIPOINT(12 13, (14 15))",
+ "bad lexical cast: source type value could not be interpreted as target at '(' in 'multipoint(12 13, (14 15))'");
+ test_wrong_wkt<bg::model::multi_point<P> >(
+ "MULTIPOINT((16 17), (18 19)",
+ "expected ')' in 'multipoint((16 17), (18 19)'");
+ test_wrong_wkt<bg::model::multi_point<P> >(
+ "MULTIPOINT(16 17), (18 19)",
+ "too much tokens at ',' in 'multipoint(16 17), (18 19)'");
+}
+
+/*
+
+... see comments in "wkt.cpp"
+
+union select 13,'# mpoint',npoints(geomfromtext('MULTIPOINT((1 2),(3 4))'))
+union select 14,'length mpoint',length(geomfromtext('MULTIPOINT((1 2),(3 4))'))
+union select 15,'peri mpoint',perimeter(geomfromtext('MULTIPOINT((1 2),(3 4))'))
+union select 16,'area mpoint',area(geomfromtext('MULTIPOINT((1 2),(3 4))'))
+
+union select 17,'# mls',npoints(geomfromtext('MULTILINESTRING((1 1,2 2,3 3),(4 4,5 5,6 6))'))
+union select 18,'length mls',length(geomfromtext('MULTILINESTRING((1 1,2 2,3 3),(4 4,5 5,6 6))'))
+union select 19,'peri mls',perimeter(geomfromtext('MULTILINESTRING((1 1,2 2,3 3),(4 4,5 5,6 6))'))
+union select 20,'area mls',area(geomfromtext('MULTILINESTRING((1 1,2 2,3 3),(4 4,5 5,6 6))'))
+
+union select 21,'# mpoly',npoints(geomfromtext('MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0),(1 1,1 2,2 2,2 1,1 1)),((0 0,0 4,4 4,4 0,0 0)))'))
+union select 22,'length mpoly',length(geomfromtext('MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0),(1 1,1 2,2 2,2 1,1 1)),((0 0,0 4,4 4,4 0,0 0)))'))
+union select 23,'peri mpoly',perimeter(geomfromtext('MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0),(1 1,1 2,2 2,2 1,1 1)),((0 0,0 4,4 4,4 0,0 0)))'))
+union select 24,'area mpoly',area(geomfromtext('MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0),(1 1,1 2,2 2,2 1,1 1)),((0 0,0 4,4 4,4 0,0 0)))'))
+
+*/
diff --git a/libs/geometry/test/multi/io/wkt/wkt.vcproj b/libs/geometry/test/multi/io/wkt/wkt.vcproj
new file mode 100644
index 000000000..c8150e853
--- /dev/null
+++ b/libs/geometry/test/multi/io/wkt/wkt.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="wkt"
+ ProjectGUID="{CA8D5E44-7D8F-44A1-900C-35C28890299B}"
+ RootNamespace="wkt"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\wkt"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../../..;../../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\wkt"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../../..;../../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\wkt.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/multi/multi_tests.sln b/libs/geometry/test/multi/multi_tests.sln
new file mode 100644
index 000000000..abfef0161
--- /dev/null
+++ b/libs/geometry/test/multi/multi_tests.sln
@@ -0,0 +1,163 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_within", "algorithms\multi_within.vcproj", "{CA8D5E44-7D8F-44A1-901C-35C28890299B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_distance", "algorithms\multi_distance.vcproj", "{D770F3E8-0567-4EDD-91FC-20BA402A3F74}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_convex_hull", "algorithms\multi_convex_hull.vcproj", "{B810C404-C4D9-4A6A-96B0-1DCED269D65D}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_envelope", "algorithms\multi_envelope.vcproj", "{85385CF0-240C-4900-B5EA-E34D2415A18F}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_centroid", "algorithms\multi_centroid.vcproj", "{7EE302E1-7FCF-4E9E-8DB3-36EA4D88B6CA}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_correct", "algorithms\multi_correct.vcproj", "{DFB00B88-2ED8-49CA-B739-7C8A8602D681}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_simplify", "algorithms\multi_simplify.vcproj", "{76A74CE4-EBF8-4F8A-98B7-1AF607B2B68C}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_for_each", "algorithms\multi_for_each.vcproj", "{B016FE33-D587-45C6-8444-607839BB2C2D}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_area", "algorithms\multi_area.vcproj", "{691082ED-2778-4300-9860-42DFBBABE535}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_length", "algorithms\multi_length.vcproj", "{9087BA6C-7563-41E6-90AD-F60BC58DDC17}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_perimeter", "algorithms\multi_perimeter.vcproj", "{D91C3F39-B8A5-4EB9-A7A8-D72B297DCFBF}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_intersection", "algorithms\multi_intersection.vcproj", "{FFB78F24-7999-4416-BDED-9C35A3DDF32D}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_union", "algorithms\multi_union.vcproj", "{1A8443BE-2666-4D6B-B4BC-6A7B7DD224B0}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_equals", "algorithms\multi_equals.vcproj", "{AA0EFD64-E034-421A-BD4A-E5A336D95C30}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_reverse", "algorithms\multi_reverse.vcproj", "{698BE05D-43E2-4BF5-B7FD-48BE3EE7BC21}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_unique", "algorithms\multi_unique.vcproj", "{71879D37-84A8-4949-8CDB-212982F81D80}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_num_geometries", "algorithms\multi_num_geometries.vcproj", "{8DB68EB9-07CA-4705-859E-B1A7098B5CF3}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_num_points", "algorithms\multi_num_points.vcproj", "{EA4B2EB3-1FBA-42BE-B7D7-5A517BC74E2B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_num_interior_rings", "algorithms\multi_num_interior_rings.vcproj", "{3F8E4B3A-43D5-49ED-89F6-C6D1CF609B02}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_difference", "algorithms\multi_difference.vcproj", "{7F85B87A-48A6-47BD-A08C-AB12AEA56582}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_transform", "algorithms\multi_transform.vcproj", "{64985954-0A74-46F5-908F-865E905C3414}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_covered_by", "algorithms\multi_covered_by.vcproj", "{680E56F0-229C-4377-BDC0-80EB9B59314B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_convert", "algorithms\multi_convert.vcproj", "{21B7EF55-23C3-4FD2-9F2F-FD8F0F3FE167}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_disjoint", "algorithms\multi_disjoint.vcproj", "{5DEA6558-9DF7-42D4-AF10-4D6D8BB7EAD1}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_touches", "algorithms\multi_touches.vcproj", "{108173B8-B6F4-4366-8018-2BF282ED4881}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {CA8D5E44-7D8F-44A1-901C-35C28890299B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CA8D5E44-7D8F-44A1-901C-35C28890299B}.Debug|Win32.Build.0 = Debug|Win32
+ {CA8D5E44-7D8F-44A1-901C-35C28890299B}.Release|Win32.ActiveCfg = Release|Win32
+ {CA8D5E44-7D8F-44A1-901C-35C28890299B}.Release|Win32.Build.0 = Release|Win32
+ {D770F3E8-0567-4EDD-91FC-20BA402A3F74}.Debug|Win32.ActiveCfg = Debug|Win32
+ {D770F3E8-0567-4EDD-91FC-20BA402A3F74}.Debug|Win32.Build.0 = Debug|Win32
+ {D770F3E8-0567-4EDD-91FC-20BA402A3F74}.Release|Win32.ActiveCfg = Release|Win32
+ {D770F3E8-0567-4EDD-91FC-20BA402A3F74}.Release|Win32.Build.0 = Release|Win32
+ {B810C404-C4D9-4A6A-96B0-1DCED269D65D}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B810C404-C4D9-4A6A-96B0-1DCED269D65D}.Debug|Win32.Build.0 = Debug|Win32
+ {B810C404-C4D9-4A6A-96B0-1DCED269D65D}.Release|Win32.ActiveCfg = Release|Win32
+ {B810C404-C4D9-4A6A-96B0-1DCED269D65D}.Release|Win32.Build.0 = Release|Win32
+ {85385CF0-240C-4900-B5EA-E34D2415A18F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {85385CF0-240C-4900-B5EA-E34D2415A18F}.Debug|Win32.Build.0 = Debug|Win32
+ {85385CF0-240C-4900-B5EA-E34D2415A18F}.Release|Win32.ActiveCfg = Release|Win32
+ {85385CF0-240C-4900-B5EA-E34D2415A18F}.Release|Win32.Build.0 = Release|Win32
+ {7EE302E1-7FCF-4E9E-8DB3-36EA4D88B6CA}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7EE302E1-7FCF-4E9E-8DB3-36EA4D88B6CA}.Debug|Win32.Build.0 = Debug|Win32
+ {7EE302E1-7FCF-4E9E-8DB3-36EA4D88B6CA}.Release|Win32.ActiveCfg = Release|Win32
+ {7EE302E1-7FCF-4E9E-8DB3-36EA4D88B6CA}.Release|Win32.Build.0 = Release|Win32
+ {DFB00B88-2ED8-49CA-B739-7C8A8602D681}.Debug|Win32.ActiveCfg = Debug|Win32
+ {DFB00B88-2ED8-49CA-B739-7C8A8602D681}.Debug|Win32.Build.0 = Debug|Win32
+ {DFB00B88-2ED8-49CA-B739-7C8A8602D681}.Release|Win32.ActiveCfg = Release|Win32
+ {DFB00B88-2ED8-49CA-B739-7C8A8602D681}.Release|Win32.Build.0 = Release|Win32
+ {76A74CE4-EBF8-4F8A-98B7-1AF607B2B68C}.Debug|Win32.ActiveCfg = Debug|Win32
+ {76A74CE4-EBF8-4F8A-98B7-1AF607B2B68C}.Debug|Win32.Build.0 = Debug|Win32
+ {76A74CE4-EBF8-4F8A-98B7-1AF607B2B68C}.Release|Win32.ActiveCfg = Release|Win32
+ {76A74CE4-EBF8-4F8A-98B7-1AF607B2B68C}.Release|Win32.Build.0 = Release|Win32
+ {B016FE33-D587-45C6-8444-607839BB2C2D}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B016FE33-D587-45C6-8444-607839BB2C2D}.Debug|Win32.Build.0 = Debug|Win32
+ {B016FE33-D587-45C6-8444-607839BB2C2D}.Release|Win32.ActiveCfg = Release|Win32
+ {B016FE33-D587-45C6-8444-607839BB2C2D}.Release|Win32.Build.0 = Release|Win32
+ {691082ED-2778-4300-9860-42DFBBABE535}.Debug|Win32.ActiveCfg = Debug|Win32
+ {691082ED-2778-4300-9860-42DFBBABE535}.Debug|Win32.Build.0 = Debug|Win32
+ {691082ED-2778-4300-9860-42DFBBABE535}.Release|Win32.ActiveCfg = Release|Win32
+ {691082ED-2778-4300-9860-42DFBBABE535}.Release|Win32.Build.0 = Release|Win32
+ {9087BA6C-7563-41E6-90AD-F60BC58DDC17}.Debug|Win32.ActiveCfg = Debug|Win32
+ {9087BA6C-7563-41E6-90AD-F60BC58DDC17}.Debug|Win32.Build.0 = Debug|Win32
+ {9087BA6C-7563-41E6-90AD-F60BC58DDC17}.Release|Win32.ActiveCfg = Release|Win32
+ {9087BA6C-7563-41E6-90AD-F60BC58DDC17}.Release|Win32.Build.0 = Release|Win32
+ {D91C3F39-B8A5-4EB9-A7A8-D72B297DCFBF}.Debug|Win32.ActiveCfg = Debug|Win32
+ {D91C3F39-B8A5-4EB9-A7A8-D72B297DCFBF}.Debug|Win32.Build.0 = Debug|Win32
+ {D91C3F39-B8A5-4EB9-A7A8-D72B297DCFBF}.Release|Win32.ActiveCfg = Release|Win32
+ {D91C3F39-B8A5-4EB9-A7A8-D72B297DCFBF}.Release|Win32.Build.0 = Release|Win32
+ {FFB78F24-7999-4416-BDED-9C35A3DDF32D}.Debug|Win32.ActiveCfg = Debug|Win32
+ {FFB78F24-7999-4416-BDED-9C35A3DDF32D}.Debug|Win32.Build.0 = Debug|Win32
+ {FFB78F24-7999-4416-BDED-9C35A3DDF32D}.Release|Win32.ActiveCfg = Release|Win32
+ {FFB78F24-7999-4416-BDED-9C35A3DDF32D}.Release|Win32.Build.0 = Release|Win32
+ {1A8443BE-2666-4D6B-B4BC-6A7B7DD224B0}.Debug|Win32.ActiveCfg = Debug|Win32
+ {1A8443BE-2666-4D6B-B4BC-6A7B7DD224B0}.Debug|Win32.Build.0 = Debug|Win32
+ {1A8443BE-2666-4D6B-B4BC-6A7B7DD224B0}.Release|Win32.ActiveCfg = Release|Win32
+ {1A8443BE-2666-4D6B-B4BC-6A7B7DD224B0}.Release|Win32.Build.0 = Release|Win32
+ {AA0EFD64-E034-421A-BD4A-E5A336D95C30}.Debug|Win32.ActiveCfg = Debug|Win32
+ {AA0EFD64-E034-421A-BD4A-E5A336D95C30}.Debug|Win32.Build.0 = Debug|Win32
+ {AA0EFD64-E034-421A-BD4A-E5A336D95C30}.Release|Win32.ActiveCfg = Release|Win32
+ {AA0EFD64-E034-421A-BD4A-E5A336D95C30}.Release|Win32.Build.0 = Release|Win32
+ {698BE05D-43E2-4BF5-B7FD-48BE3EE7BC21}.Debug|Win32.ActiveCfg = Debug|Win32
+ {698BE05D-43E2-4BF5-B7FD-48BE3EE7BC21}.Debug|Win32.Build.0 = Debug|Win32
+ {698BE05D-43E2-4BF5-B7FD-48BE3EE7BC21}.Release|Win32.ActiveCfg = Release|Win32
+ {698BE05D-43E2-4BF5-B7FD-48BE3EE7BC21}.Release|Win32.Build.0 = Release|Win32
+ {71879D37-84A8-4949-8CDB-212982F81D80}.Debug|Win32.ActiveCfg = Debug|Win32
+ {71879D37-84A8-4949-8CDB-212982F81D80}.Debug|Win32.Build.0 = Debug|Win32
+ {71879D37-84A8-4949-8CDB-212982F81D80}.Release|Win32.ActiveCfg = Release|Win32
+ {71879D37-84A8-4949-8CDB-212982F81D80}.Release|Win32.Build.0 = Release|Win32
+ {8DB68EB9-07CA-4705-859E-B1A7098B5CF3}.Debug|Win32.ActiveCfg = Debug|Win32
+ {8DB68EB9-07CA-4705-859E-B1A7098B5CF3}.Debug|Win32.Build.0 = Debug|Win32
+ {8DB68EB9-07CA-4705-859E-B1A7098B5CF3}.Release|Win32.ActiveCfg = Release|Win32
+ {8DB68EB9-07CA-4705-859E-B1A7098B5CF3}.Release|Win32.Build.0 = Release|Win32
+ {EA4B2EB3-1FBA-42BE-B7D7-5A517BC74E2B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {EA4B2EB3-1FBA-42BE-B7D7-5A517BC74E2B}.Debug|Win32.Build.0 = Debug|Win32
+ {EA4B2EB3-1FBA-42BE-B7D7-5A517BC74E2B}.Release|Win32.ActiveCfg = Release|Win32
+ {EA4B2EB3-1FBA-42BE-B7D7-5A517BC74E2B}.Release|Win32.Build.0 = Release|Win32
+ {3F8E4B3A-43D5-49ED-89F6-C6D1CF609B02}.Debug|Win32.ActiveCfg = Debug|Win32
+ {3F8E4B3A-43D5-49ED-89F6-C6D1CF609B02}.Debug|Win32.Build.0 = Debug|Win32
+ {3F8E4B3A-43D5-49ED-89F6-C6D1CF609B02}.Release|Win32.ActiveCfg = Release|Win32
+ {3F8E4B3A-43D5-49ED-89F6-C6D1CF609B02}.Release|Win32.Build.0 = Release|Win32
+ {7F85B87A-48A6-47BD-A08C-AB12AEA56582}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7F85B87A-48A6-47BD-A08C-AB12AEA56582}.Debug|Win32.Build.0 = Debug|Win32
+ {7F85B87A-48A6-47BD-A08C-AB12AEA56582}.Release|Win32.ActiveCfg = Release|Win32
+ {7F85B87A-48A6-47BD-A08C-AB12AEA56582}.Release|Win32.Build.0 = Release|Win32
+ {64985954-0A74-46F5-908F-865E905C3414}.Debug|Win32.ActiveCfg = Debug|Win32
+ {64985954-0A74-46F5-908F-865E905C3414}.Debug|Win32.Build.0 = Debug|Win32
+ {64985954-0A74-46F5-908F-865E905C3414}.Release|Win32.ActiveCfg = Release|Win32
+ {64985954-0A74-46F5-908F-865E905C3414}.Release|Win32.Build.0 = Release|Win32
+ {680E56F0-229C-4377-BDC0-80EB9B59314B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {680E56F0-229C-4377-BDC0-80EB9B59314B}.Debug|Win32.Build.0 = Debug|Win32
+ {680E56F0-229C-4377-BDC0-80EB9B59314B}.Release|Win32.ActiveCfg = Release|Win32
+ {680E56F0-229C-4377-BDC0-80EB9B59314B}.Release|Win32.Build.0 = Release|Win32
+ {21B7EF55-23C3-4FD2-9F2F-FD8F0F3FE167}.Debug|Win32.ActiveCfg = Debug|Win32
+ {21B7EF55-23C3-4FD2-9F2F-FD8F0F3FE167}.Debug|Win32.Build.0 = Debug|Win32
+ {21B7EF55-23C3-4FD2-9F2F-FD8F0F3FE167}.Release|Win32.ActiveCfg = Release|Win32
+ {21B7EF55-23C3-4FD2-9F2F-FD8F0F3FE167}.Release|Win32.Build.0 = Release|Win32
+ {5DEA6558-9DF7-42D4-AF10-4D6D8BB7EAD1}.Debug|Win32.ActiveCfg = Debug|Win32
+ {5DEA6558-9DF7-42D4-AF10-4D6D8BB7EAD1}.Debug|Win32.Build.0 = Debug|Win32
+ {5DEA6558-9DF7-42D4-AF10-4D6D8BB7EAD1}.Release|Win32.ActiveCfg = Release|Win32
+ {5DEA6558-9DF7-42D4-AF10-4D6D8BB7EAD1}.Release|Win32.Build.0 = Release|Win32
+ {108173B8-B6F4-4366-8018-2BF282ED4881}.Debug|Win32.ActiveCfg = Debug|Win32
+ {108173B8-B6F4-4366-8018-2BF282ED4881}.Debug|Win32.Build.0 = Debug|Win32
+ {108173B8-B6F4-4366-8018-2BF282ED4881}.Release|Win32.ActiveCfg = Release|Win32
+ {108173B8-B6F4-4366-8018-2BF282ED4881}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/point_concept/Jamfile.v2 b/libs/geometry/test/point_concept/Jamfile.v2
new file mode 100644
index 000000000..7c4b8aed6
--- /dev/null
+++ b/libs/geometry/test/point_concept/Jamfile.v2
@@ -0,0 +1,22 @@
+# 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_point.cpp ]
+ [ compile well_formed_point_traits.cpp ]
+ [ compile array_point.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 ]
+ ;
diff --git a/libs/geometry/test/point_concept/array_point.cpp b/libs/geometry/test/point_concept/array_point.cpp
new file mode 100644
index 000000000..000deadc0
--- /dev/null
+++ b/libs/geometry/test/point_concept/array_point.cpp
@@ -0,0 +1,29 @@
+// 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.
+
+// 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_common/test_point.hpp>
+
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include "function_requiring_a_point.hpp"
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+
+
+int main()
+{
+ float p1[3] = { 0, 0, 0 };
+ const float p2[3] = { 0, 0, 0 };
+ test::function_requiring_a_point(p1, p2);
+ return 0;
+}
diff --git a/libs/geometry/test/point_concept/concept_checker.cpp b/libs/geometry/test/point_concept/concept_checker.cpp
new file mode 100644
index 000000000..0750972f4
--- /dev/null
+++ b/libs/geometry/test/point_concept/concept_checker.cpp
@@ -0,0 +1,76 @@
+// 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.
+
+// 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 <boost/geometry/core/cs.hpp>
+#include <boost/geometry/geometries/concepts/check.hpp>
+
+struct ro_point
+{
+ float x, y;
+};
+
+
+struct rw_point
+{
+ float x, y;
+};
+
+
+namespace boost { namespace geometry { namespace traits {
+
+template <> struct tag<ro_point> { typedef point_tag type; };
+template <> struct coordinate_type<ro_point> { typedef float type; };
+template <> struct coordinate_system<ro_point> { typedef cs::cartesian type; };
+template <> struct dimension<ro_point> { enum { value = 2 }; };
+
+template <> struct access<ro_point, 0>
+{
+ static float get(ro_point const& p) { return p.x; }
+};
+
+template <> struct access<ro_point, 1>
+{
+ static float get(ro_point const& p) { return p.y; }
+};
+
+
+
+
+template <> struct tag<rw_point> { typedef point_tag type; };
+template <> struct coordinate_type<rw_point> { typedef float type; };
+template <> struct coordinate_system<rw_point> { typedef cs::cartesian type; };
+template <> struct dimension<rw_point> { enum { value = 2 }; };
+
+template <> struct access<rw_point, 0>
+{
+ static float get(rw_point const& p) { return p.x; }
+ static void set(rw_point& p, float value) { p.x = value; }
+};
+
+template <> struct access<rw_point, 1>
+{
+ static float get(rw_point const& p) { return p.y; }
+ static void set(rw_point& p, float value) { p.y = value; }
+};
+
+
+}}} // namespace bg::traits
+
+
+int main()
+{
+ boost::geometry::concept::check<const ro_point>();
+ boost::geometry::concept::check<rw_point>();
+}
diff --git a/libs/geometry/test/point_concept/function_asserting_a_point.hpp b/libs/geometry/test/point_concept/function_asserting_a_point.hpp
new file mode 100644
index 000000000..8ff84d449
--- /dev/null
+++ b/libs/geometry/test/point_concept/function_asserting_a_point.hpp
@@ -0,0 +1,30 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library) Point concept unit tests
+//
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2007-2012 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 GEOMETRY_TEST_POINT_CONCEPT_FUNCTION_ASSERTING_A_POINT_HPP
+#define GEOMETRY_TEST_POINT_CONCEPT_FUNCTION_ASSERTING_A_POINT_HPP
+
+#include <boost/concept/requires.hpp>
+
+#include <boost/geometry/geometries/concepts/point_concept.hpp>
+
+namespace bg = boost::geometry;
+
+namespace test
+{
+ template <typename P, typename CP>
+ void function_asserting_a_point(P& p1, const CP& p2)
+ {
+ BOOST_CONCEPT_ASSERT((bg::concept::Point<P>));
+ BOOST_CONCEPT_ASSERT((bg::concept::ConstPoint<P>));
+
+ bg::get<0>(p1) = bg::get<0>(p2);
+ }
+}
+
+#endif // GEOMETRY_TEST_POINT_CONCEPT_FUNCTION_ASSERTING_A_POINT_HPP
diff --git a/libs/geometry/test/point_concept/function_requiring_a_point.hpp b/libs/geometry/test/point_concept/function_requiring_a_point.hpp
new file mode 100644
index 000000000..39dc38294
--- /dev/null
+++ b/libs/geometry/test/point_concept/function_requiring_a_point.hpp
@@ -0,0 +1,32 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library) Point concept unit tests
+//
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2007-2012 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 GEOMETRY_TEST_POINT_CONCEPT_FUNCTION_REQUIRING_A_POINT_HPP
+#define GEOMETRY_TEST_POINT_CONCEPT_FUNCTION_REQUIRING_A_POINT_HPP
+
+#include <boost/concept/requires.hpp>
+
+#include <boost/geometry/geometries/concepts/point_concept.hpp>
+
+namespace bg = boost::geometry;
+
+namespace test
+{
+ template <typename P, typename C>
+
+ inline BOOST_CONCEPT_REQUIRES(
+ ((bg::concept::Point<P>))
+ ((bg::concept::ConstPoint<C>)),
+ (void))
+ function_requiring_a_point(P& p1, const C& p2)
+ {
+ bg::set<0>(p1, bg::get<0>(p2));
+ }
+}
+
+#endif // GEOMETRY_TEST_POINT_CONCEPT_FUNCTION_REQUIRING_A_POINT_HPP
diff --git a/libs/geometry/test/point_concept/point_with_incorrect_dimension.cpp b/libs/geometry/test/point_concept/point_with_incorrect_dimension.cpp
new file mode 100644
index 000000000..baf653a0f
--- /dev/null
+++ b/libs/geometry/test/point_concept/point_with_incorrect_dimension.cpp
@@ -0,0 +1,58 @@
+// 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.
+
+// 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_common/test_point.hpp>
+
+#include "function_asserting_a_point.hpp"
+#include "function_requiring_a_point.hpp"
+
+#include <boost/geometry/core/cs.hpp>
+
+struct point
+{
+ float x, y;
+};
+
+namespace boost { namespace geometry { namespace traits {
+
+template <> struct tag<point> { typedef point_tag type; };
+template <> struct coordinate_type<point> { typedef float type; };
+template <> struct coordinate_system<point> { typedef bg::cs::cartesian type; };
+template <> struct dimension<point> { enum { value = 3 }; };
+
+template <> struct access<point, 0>
+{
+ static float get(point const& p) { return p.x; }
+ static void set(point& p, float value) { p.x = value; }
+};
+
+template <> struct access<point, 1>
+{
+ static float get(point const& p) { return p.y; }
+ static void set(point& p, float value) { p.y = value; }
+};
+
+
+}}} // namespace bg::traits
+
+
+int main()
+{
+ point p1;
+ const point p2;
+ test::function_requiring_a_point(p1, p2);
+ test::function_asserting_a_point(p1, p2);
+ return 0;
+}
diff --git a/libs/geometry/test/point_concept/point_without_coordinate_type.cpp b/libs/geometry/test/point_concept/point_without_coordinate_type.cpp
new file mode 100644
index 000000000..a9cb2b9b1
--- /dev/null
+++ b/libs/geometry/test/point_concept/point_without_coordinate_type.cpp
@@ -0,0 +1,53 @@
+// 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.
+
+// 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 "function_requiring_a_point.hpp"
+
+#include <boost/geometry/core/cs.hpp>
+
+struct point
+{
+ float x, y;
+};
+
+namespace boost { namespace geometry { namespace traits {
+
+template <> struct tag<point> { typedef point_tag type; };
+//template <> struct coordinate_type<point> { typedef float type; };
+template <> struct coordinate_system<point> { typedef bg::cs::cartesian type; };
+template <> struct dimension<point> { enum { value = 2 }; };
+
+template <> struct access<point, 0>
+{
+ static float get(point const& p) { return p.x; }
+ static void set(point& p, float value) { p.x = value; }
+};
+
+template <> struct access<point, 1>
+{
+ static float get(point const& p) { return p.y; }
+ static void set(point& p, float value) { p.y = value; }
+};
+
+
+}}} // namespace bg::traits
+
+int main()
+{
+ point p1;
+ const point p2;
+ test::function_requiring_a_point(p1, p2);
+ return 0;
+}
diff --git a/libs/geometry/test/point_concept/point_without_dimension.cpp b/libs/geometry/test/point_concept/point_without_dimension.cpp
new file mode 100644
index 000000000..61b7769cf
--- /dev/null
+++ b/libs/geometry/test/point_concept/point_without_dimension.cpp
@@ -0,0 +1,55 @@
+// 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.
+
+// 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 "function_requiring_a_point.hpp"
+
+#include <boost/geometry/core/cs.hpp>
+
+struct point
+{
+ float x, y;
+};
+
+
+namespace boost { namespace geometry { namespace traits {
+
+template <> struct tag<point> { typedef point_tag type; };
+template <> struct coordinate_type<point> { typedef float type; };
+template <> struct coordinate_system<point> { typedef bg::cs::cartesian type; };
+//template <> struct dimension<point> { enum { value = 2 }; };
+
+template <> struct access<point, 0>
+{
+ static float get(point const& p) { return p.x; }
+ static void set(point& p, float value) { p.x = value; }
+};
+
+template <> struct access<point, 1>
+{
+ static float get(point const& p) { return p.y; }
+ static void set(point& p, float value) { p.y = value; }
+};
+
+
+}}} // namespace bg::traits
+
+
+int main()
+{
+ point p1;
+ const point p2;
+ test::function_requiring_a_point(p1, p2);
+ return 0;
+}
diff --git a/libs/geometry/test/point_concept/point_without_getter.cpp b/libs/geometry/test/point_concept/point_without_getter.cpp
new file mode 100644
index 000000000..c7650dd39
--- /dev/null
+++ b/libs/geometry/test/point_concept/point_without_getter.cpp
@@ -0,0 +1,51 @@
+// 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.
+
+// 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 "function_requiring_a_point.hpp"
+
+#include <boost/geometry/core/cs.hpp>
+
+struct point
+{
+ float x, y;
+};
+
+namespace boost { namespace geometry { namespace traits {
+
+template <> struct tag<point> { typedef point_tag type; };
+template <> struct coordinate_type<point> { typedef float type; };
+template <> struct coordinate_system<point> { typedef bg::cs::cartesian type; };
+template <> struct dimension<point> { enum { value = 2 }; };
+
+template <> struct access<point, 0>
+{
+ static void set(point& p, float value) { p.x = value; }
+};
+
+template <> struct access<point, 1>
+{
+ static void set(point& p, float value) { p.y = value; }
+};
+
+
+}}} // namespace bg::traits
+
+int main()
+{
+ point p1;
+ const point p2;
+ test::function_requiring_a_point(p1, p2);
+ return 0;
+}
diff --git a/libs/geometry/test/point_concept/point_without_setter.cpp b/libs/geometry/test/point_concept/point_without_setter.cpp
new file mode 100644
index 000000000..882111889
--- /dev/null
+++ b/libs/geometry/test/point_concept/point_without_setter.cpp
@@ -0,0 +1,51 @@
+// 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.
+
+// 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 "function_requiring_a_point.hpp"
+
+#include <boost/geometry/core/cs.hpp>
+
+struct point
+{
+ float x, y;
+};
+
+namespace boost { namespace geometry { namespace traits {
+
+template <> struct tag<point> { typedef point_tag type; };
+template <> struct coordinate_type<point> { typedef float type; };
+template <> struct coordinate_system<point> { typedef bg::cs::cartesian type; };
+template <> struct dimension<point> { enum { value = 2 }; };
+
+template <> struct access<point, 0>
+{
+ static float get(point const& p) { return p.x; }
+};
+
+template <> struct access<point, 1>
+{
+ static float get(point const& p) { return p.y; }
+};
+
+
+}}} // namespace bg::traits
+
+int main()
+{
+ point p1;
+ const point p2;
+ test::function_requiring_a_point(p1, p2);
+ return 0;
+}
diff --git a/libs/geometry/test/point_concept/well_formed_point.cpp b/libs/geometry/test/point_concept/well_formed_point.cpp
new file mode 100644
index 000000000..20ae39c62
--- /dev/null
+++ b/libs/geometry/test/point_concept/well_formed_point.cpp
@@ -0,0 +1,34 @@
+// 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.
+
+// 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 <boost/tuple/tuple.hpp>
+
+#include <boost/geometry/core/cs.hpp>
+#include <boost/geometry/geometries/register/point.hpp>
+
+#include "function_requiring_a_point.hpp"
+
+struct point: public boost::tuple<float, float>
+{
+};
+
+BOOST_GEOMETRY_REGISTER_POINT_2D(point, float, cs::cartesian, get<0>(), get<1>())
+
+int main()
+{
+ point p1;
+ point const p2 = point();
+ test::function_requiring_a_point(p1, p2);
+ return 0;
+}
diff --git a/libs/geometry/test/point_concept/well_formed_point_traits.cpp b/libs/geometry/test/point_concept/well_formed_point_traits.cpp
new file mode 100644
index 000000000..fc4ab82f2
--- /dev/null
+++ b/libs/geometry/test/point_concept/well_formed_point_traits.cpp
@@ -0,0 +1,88 @@
+// 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.
+
+// 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 <boost/geometry/core/cs.hpp>
+
+#include "function_requiring_a_point.hpp"
+
+struct point
+{
+ point(): x(), y() {}
+ float x, y;
+};
+
+namespace boost { namespace geometry { namespace traits {
+
+template <>
+struct tag<point>
+{
+ typedef point_tag type;
+};
+
+template <>
+struct coordinate_type<point>
+{
+ typedef float type;
+};
+
+template <>
+struct coordinate_system<point>
+{
+ typedef bg::cs::cartesian type;
+};
+
+template <>
+struct dimension<point>
+{
+ enum { value = 2 };
+};
+
+template <>
+struct access<point, 0>
+{
+ static float get(point const& p)
+ {
+ return p.x;
+ }
+
+ static void set(point& p, float value)
+ {
+ p.x = value;
+ }
+};
+
+template <>
+struct access<point, 1>
+{
+ static float get(point const& p)
+ {
+ return p.y;
+ }
+
+ static void set(point& p, float value)
+ {
+ p.y = value;
+ }
+};
+
+
+}}} // namespace bg::traits
+
+int main()
+{
+ point p1;
+ const point p2;
+ test::function_requiring_a_point(p1, p2);
+ return 0;
+}
diff --git a/libs/geometry/test/policies/Jamfile.v2 b/libs/geometry/test/policies/Jamfile.v2
new file mode 100644
index 000000000..741c4d1bc
--- /dev/null
+++ b/libs/geometry/test/policies/Jamfile.v2
@@ -0,0 +1,14 @@
+# 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-policies
+ :
+ [ run compare.cpp ]
+ ;
diff --git a/libs/geometry/test/policies/compare.cpp b/libs/geometry/test/policies/compare.cpp
new file mode 100644
index 000000000..adb9f0309
--- /dev/null
+++ b/libs/geometry/test/policies/compare.cpp
@@ -0,0 +1,245 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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 <algorithm>
+
+#include <boost/geometry/algorithms/make.hpp>
+#include <boost/geometry/io/dsv/write.hpp>
+
+#include <boost/geometry/policies/compare.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+#include <test_common/test_point.hpp>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+template <typename Container>
+inline std::string coordinates(Container const& points)
+{
+ std::ostringstream out;
+ typedef typename boost::range_value<Container>::type point_type;
+ for (typename boost::range_const_iterator<Container>::type it = boost::begin(points);
+ it != boost::end(points);
+ ++it)
+ {
+ out << bg::dsv(*it);
+ }
+ return out.str();
+}
+
+template <typename P>
+void test_2d_compare()
+{
+ P p1 = bg::make<P>(3, 1);
+ P p2 = bg::make<P>(3, 1);
+ P p3 = bg::make<P>(1, 3);
+ P p4 = bg::make<P>(5, 2);
+ P p5 = bg::make<P>(3, 2);
+
+ // Test in all dimensions
+ {
+ bg::equal_to<P> et;
+ bg::less<P> lt;
+ bg::greater<P> gt;
+
+ BOOST_CHECK_EQUAL(et(p1, p2), true);
+ BOOST_CHECK_EQUAL(et(p1, p3), false);
+ BOOST_CHECK_EQUAL(et(p1, p4), false);
+ BOOST_CHECK_EQUAL(et(p1, p5), false);
+ BOOST_CHECK_EQUAL(et(p3, p4), false);
+
+ BOOST_CHECK_EQUAL(lt(p1, p2), false);
+ BOOST_CHECK_EQUAL(lt(p1, p3), false);
+ BOOST_CHECK_EQUAL(lt(p1, p4), true);
+ BOOST_CHECK_EQUAL(lt(p1, p5), true);
+ BOOST_CHECK_EQUAL(lt(p3, p4), true);
+
+ BOOST_CHECK_EQUAL(gt(p1, p2), false);
+ BOOST_CHECK_EQUAL(gt(p1, p3), true);
+ BOOST_CHECK_EQUAL(gt(p1, p4), false);
+ BOOST_CHECK_EQUAL(gt(p1, p5), false);
+ BOOST_CHECK_EQUAL(gt(p3, p4), false);
+ }
+
+
+ // Test in dimension 0, X
+ {
+ bg::equal_to<P, 0> et;
+ bg::less<P, 0> lt;
+ bg::greater<P, 0> gt;
+
+ BOOST_CHECK_EQUAL(et(p1, p2), true);
+ BOOST_CHECK_EQUAL(et(p1, p3), false);
+ BOOST_CHECK_EQUAL(et(p1, p4), false);
+ BOOST_CHECK_EQUAL(et(p1, p5), true);
+ BOOST_CHECK_EQUAL(et(p3, p4), false);
+
+ BOOST_CHECK_EQUAL(lt(p1, p2), false);
+ BOOST_CHECK_EQUAL(lt(p1, p3), false);
+ BOOST_CHECK_EQUAL(lt(p1, p4), true);
+ BOOST_CHECK_EQUAL(lt(p1, p5), false);
+ BOOST_CHECK_EQUAL(lt(p3, p4), true);
+
+ BOOST_CHECK_EQUAL(gt(p1, p2), false);
+ BOOST_CHECK_EQUAL(gt(p1, p3), true);
+ BOOST_CHECK_EQUAL(gt(p1, p4), false);
+ BOOST_CHECK_EQUAL(gt(p1, p5), false);
+ BOOST_CHECK_EQUAL(gt(p3, p4), false);
+ }
+
+ // Test in dimension 1, Y
+ {
+ bg::equal_to<P, 1> et;
+ bg::less<P, 1> lt;
+ bg::greater<P, 1> gt;
+
+ BOOST_CHECK_EQUAL(et(p1, p2), true);
+ BOOST_CHECK_EQUAL(et(p1, p3), false);
+ BOOST_CHECK_EQUAL(et(p1, p4), false);
+ BOOST_CHECK_EQUAL(et(p1, p5), false);
+ BOOST_CHECK_EQUAL(et(p3, p4), false);
+
+ BOOST_CHECK_EQUAL(lt(p1, p2), false);
+ BOOST_CHECK_EQUAL(lt(p1, p3), true);
+ BOOST_CHECK_EQUAL(lt(p1, p4), true);
+ BOOST_CHECK_EQUAL(lt(p1, p5), true);
+ BOOST_CHECK_EQUAL(lt(p3, p4), false);
+
+ BOOST_CHECK_EQUAL(gt(p1, p2), false);
+ BOOST_CHECK_EQUAL(gt(p1, p3), false);
+ BOOST_CHECK_EQUAL(gt(p1, p4), false);
+ BOOST_CHECK_EQUAL(gt(p1, p5), false);
+ BOOST_CHECK_EQUAL(gt(p3, p4), true);
+ }
+}
+
+
+template <typename P>
+void test_2d_sort()
+{
+ typedef typename bg::coordinate_type<P>::type ct;
+
+ std::vector<P> v;
+ v.push_back(bg::make<P>(3, 1));
+ v.push_back(bg::make<P>(2, 3));
+ v.push_back(bg::make<P>(2, 2));
+ v.push_back(bg::make<P>(1, 3));
+
+ // Sort on coordinates in order x,y,z
+ std::sort(v.begin(), v.end(), bg::less<P>());
+ std::string s = coordinates(v);
+ BOOST_CHECK_EQUAL(s, "(1, 3)(2, 2)(2, 3)(3, 1)");
+
+ // Reverse sort
+ std::sort(v.begin(), v.end(), bg::greater<P>());
+ s = coordinates(v);
+ BOOST_CHECK_EQUAL(s, "(3, 1)(2, 3)(2, 2)(1, 3)");
+
+ // Sort backwards on coordinates in order x,y,z
+ //std::sort(v.begin(), v.end(), bg::greater<P>());
+ //std::string s = coordinates(v);
+ //BOOST_CHECK_EQUAL(s, "(1, 3)(2, 2)(2, 3)(3, 1)");
+
+ // Refill to remove duplicate coordinates
+ v.clear();
+ v.push_back(bg::make<P>(4, 1));
+ v.push_back(bg::make<P>(3, 2));
+ v.push_back(bg::make<P>(2, 3));
+ v.push_back(bg::make<P>(1, 4));
+
+ // Sort ascending on only x-coordinate
+ std::sort(v.begin(), v.end(), bg::less<P, 0>());
+ s = coordinates(v);
+ BOOST_CHECK_EQUAL(s, "(1, 4)(2, 3)(3, 2)(4, 1)");
+
+ // Sort ascending on only y-coordinate
+ std::sort(v.begin(), v.end(), bg::less<P, 1>());
+ s = coordinates(v);
+ BOOST_CHECK_EQUAL(s, "(4, 1)(3, 2)(2, 3)(1, 4)");
+
+ // Sort descending on only x-coordinate
+ std::sort(v.begin(), v.end(), bg::greater<P, 0>());
+ s = coordinates(v);
+ //BOOST_CHECK_EQUAL(s, "(4, 1)(3, 2)(2, 3)(1, 4)");
+
+ // Sort descending on only y-coordinate
+ std::sort(v.begin(), v.end(), bg::greater<P, 1>());
+ s = coordinates(v);
+ BOOST_CHECK_EQUAL(s, "(1, 4)(2, 3)(3, 2)(4, 1)");
+
+ // Make non-unique vector
+ v.push_back(bg::make<P>(4, 1));
+ v.push_back(bg::make<P>(3, 2));
+ v.push_back(bg::make<P>(2, 3));
+ v.push_back(bg::make<P>(1, 4));
+ v.push_back(bg::make<P>(1, 5));
+ std::sort(v.begin(), v.end(), bg::less<P>());
+ s = coordinates(v);
+ BOOST_CHECK_EQUAL(s, "(1, 4)(1, 4)(1, 5)(2, 3)(2, 3)(3, 2)(3, 2)(4, 1)(4, 1)");
+
+
+ std::vector<P> v2;
+ std::unique_copy(v.begin(), v.end(), std::back_inserter(v2), bg::equal_to<P>());
+ s = coordinates(v2);
+ BOOST_CHECK_EQUAL(s, "(1, 4)(1, 5)(2, 3)(3, 2)(4, 1)");
+}
+
+
+template <typename P>
+void test_spherical()
+{
+ typedef typename bg::coordinate_type<P>::type ct;
+
+ std::vector<P> v;
+ v.push_back(bg::make<P>( 179.73, 71.56)); // east
+ v.push_back(bg::make<P>( 177.47, 71.23)); // less east
+ v.push_back(bg::make<P>(-178.78, 70.78)); // further east, = west, this is the most right point
+
+ // Sort on coordinates in order x,y,z
+ std::sort(v.begin(), v.end(), bg::less<P>());
+ std::string s = coordinates(v);
+ BOOST_CHECK_EQUAL(s, "(177.47, 71.23)(179.73, 71.56)(-178.78, 70.78)");
+
+ // Sort ascending on only x-coordinate
+ std::sort(v.begin(), v.end(), bg::less<P, 0>());
+ s = coordinates(v);
+ BOOST_CHECK_EQUAL(s, "(177.47, 71.23)(179.73, 71.56)(-178.78, 70.78)");
+
+ // Sort ascending on only x-coordinate, but override with std-comparison,
+ // (so this is the normal sorting behaviour that would have been used
+ // if it would not have been spherical)
+ std::sort(v.begin(), v.end(), bg::less<P, 0, std::less<ct> >());
+ s = coordinates(v);
+ BOOST_CHECK_EQUAL(s, "(-178.78, 70.78)(177.47, 71.23)(179.73, 71.56)");
+}
+
+
+int test_main(int, char* [])
+{
+ test_2d_compare<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_2d_compare<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+ test_2d_sort<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_2d_sort<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_2d_sort<boost::tuple<double, double> >();
+ test_2d_sort<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+ test_spherical<bg::model::point<double, 2, bg::cs::spherical<bg::degree> > >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/policies/compare.vcproj b/libs/geometry/test/policies/compare.vcproj
new file mode 100644
index 000000000..916e6d72b
--- /dev/null
+++ b/libs/geometry/test/policies/compare.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="compare"
+ ProjectGUID="{71AFA3C2-6873-4368-81D9-CA305A43B458}"
+ RootNamespace="compare"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\compare"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\compare"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\compare.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/policies/policy_tests.sln b/libs/geometry/test/policies/policy_tests.sln
new file mode 100644
index 000000000..16917fd38
--- /dev/null
+++ b/libs/geometry/test/policies/policy_tests.sln
@@ -0,0 +1,19 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "compare", "compare.vcproj", "{71AFA3C2-6873-4368-81D9-CA305A43B458}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {71AFA3C2-6873-4368-81D9-CA305A43B458}.Debug|Win32.ActiveCfg = Debug|Win32
+ {71AFA3C2-6873-4368-81D9-CA305A43B458}.Debug|Win32.Build.0 = Debug|Win32
+ {71AFA3C2-6873-4368-81D9-CA305A43B458}.Release|Win32.ActiveCfg = Release|Win32
+ {71AFA3C2-6873-4368-81D9-CA305A43B458}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/robustness/common/common_settings.hpp b/libs/geometry/test/robustness/common/common_settings.hpp
new file mode 100644
index 000000000..050f5367f
--- /dev/null
+++ b/libs/geometry/test/robustness/common/common_settings.hpp
@@ -0,0 +1,32 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Robustness Test
+//
+// Copyright (c) 2009-2012 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_COMMON_SETTINGS_HPP
+#define BOOST_GEOMETRY_COMMON_SETTINGS_HPP
+
+struct common_settings
+{
+ bool svg;
+ bool wkt;
+ bool also_difference;
+ double tolerance;
+
+ int field_size;
+ bool triangular;
+
+ common_settings()
+ : svg(false)
+ , wkt(false)
+ , also_difference(false)
+ , tolerance(1.0e-6)
+ , field_size(10)
+ , triangular(false)
+ {}
+};
+
+#endif // BOOST_GEOMETRY_COMMON_SETTINGS_HPP
diff --git a/libs/geometry/test/robustness/common/make_square_polygon.hpp b/libs/geometry/test/robustness/common/make_square_polygon.hpp
new file mode 100644
index 000000000..764fc4bb8
--- /dev/null
+++ b/libs/geometry/test/robustness/common/make_square_polygon.hpp
@@ -0,0 +1,46 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Robustness Test
+//
+// Copyright (c) 2009-2012 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_ROBUSTNESS_MAKE_SQUARE_POLYGON_HPP
+#define BOOST_GEOMETRY_TEST_ROBUSTNESS_MAKE_SQUARE_POLYGON_HPP
+
+#include <boost/geometry.hpp>
+
+template <typename Polygon, typename Generator, typename Settings>
+inline void make_square_polygon(Polygon& polygon, Generator& generator, Settings const& settings)
+{
+ using namespace boost::geometry;
+
+ typedef typename point_type<Polygon>::type point_type;
+ typedef typename coordinate_type<Polygon>::type coordinate_type;
+
+ coordinate_type x, y;
+ x = generator();
+ y = generator();
+
+ typename ring_type<Polygon>::type& ring = exterior_ring(polygon);
+
+ point_type p;
+ set<0>(p, x); set<1>(p, y); append(ring, p);
+ set<0>(p, x); set<1>(p, y + 1); append(ring, p);
+ set<0>(p, x + 1); set<1>(p, y + 1); append(ring, p);
+ set<0>(p, x + 1); set<1>(p, y); append(ring, p);
+ set<0>(p, x); set<1>(p, y); append(ring, p);
+
+ if (settings.triangular)
+ {
+ // Remove a point, generator says which
+ int c = generator() % 4;
+ if (c >= 1 && c <= 3)
+ {
+ ring.erase(ring.begin() + c);
+ }
+ }
+}
+
+#endif // BOOST_GEOMETRY_TEST_ROBUSTNESS_MAKE_SQUARE_POLYGON_HPP
diff --git a/libs/geometry/test/robustness/convex_hull/Jamfile.v2 b/libs/geometry/test/robustness/convex_hull/Jamfile.v2
new file mode 100644
index 000000000..20521d548
--- /dev/null
+++ b/libs/geometry/test/robustness/convex_hull/Jamfile.v2
@@ -0,0 +1,18 @@
+# Boost.Geometry (aka GGL, Generic Geometry Library)
+# Robustness Test - convex_hull
+#
+# Copyright (c) 2012 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)
+
+
+project random_multi_points
+ : requirements
+ <include>.
+ <library>../../../../program_options/build//boost_program_options
+ <link>static
+ ;
+
+exe random_multi_points : random_multi_points.cpp ;
diff --git a/libs/geometry/test/robustness/convex_hull/random_multi_points.cpp b/libs/geometry/test/robustness/convex_hull/random_multi_points.cpp
new file mode 100644
index 000000000..a0d3efb54
--- /dev/null
+++ b/libs/geometry/test/robustness/convex_hull/random_multi_points.cpp
@@ -0,0 +1,225 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Robustness Test - convex_hull
+
+// Copyright (c) 2012 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)
+
+#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
+#define BOOST_GEOMETRY_NO_BOOST_TEST
+
+#include <sstream>
+#include <fstream>
+
+#include <boost/program_options.hpp>
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/variate_generator.hpp>
+#include <boost/timer.hpp>
+
+#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
+{
+ bool svg;
+ bool wkt;
+
+ settings_type()
+ : svg(false)
+ , wkt(false)
+ {}
+};
+
+namespace bg = boost::geometry;
+
+template <typename Geometry1, typename Geometry2>
+void create_svg(std::string const& filename, Geometry1 const& points, Geometry2 const& hull)
+{
+ typedef typename boost::geometry::point_type<Geometry1>::type point_type;
+
+ boost::geometry::model::box<point_type> box;
+ bg::envelope(hull, box);
+ bg::buffer(box, box, 1.0);
+
+ std::ofstream svg(filename.c_str());
+ boost::geometry::svg_mapper<point_type> mapper(svg, 800, 800);
+ mapper.add(box);
+
+ mapper.map(hull, "opacity:0.8;fill:none;stroke:rgb(255,0,255);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round");
+ mapper.map(points, "fill-opacity:0.5;fill:rgb(0,0,255);", 5);
+}
+
+
+template <typename MultiPoint, typename Generator>
+inline void make_multi_point(MultiPoint& mp, Generator& generator, int pcount)
+{
+ typedef typename bg::point_type<MultiPoint>::type point_type;
+ typedef typename bg::coordinate_type<MultiPoint>::type coordinate_type;
+
+ for(int i = 0; i < pcount; i++)
+ {
+ coordinate_type x, y;
+ x = generator();
+ y = generator();
+
+ point_type p;
+ bg::set<0>(p, x);
+ bg::set<1>(p, y);
+
+ mp.push_back(p);
+ }
+}
+
+template <typename MultiPoint, typename Polygon>
+bool check_hull(MultiPoint const& mp, Polygon const& poly)
+{
+ for(typename boost::range_iterator<MultiPoint const>::type it = boost::begin(mp);
+ it != boost::end(mp);
+ ++it)
+ {
+ if (! bg::covered_by(*it, poly))
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+
+template <typename MultiPoint, typename Generator>
+void test_random_multi_points(MultiPoint& result, int& index,
+ Generator& generator,
+ int pcount, settings_type const& settings)
+{
+ typedef typename bg::point_type<MultiPoint>::type point_type;
+
+ MultiPoint mp;
+ bg::model::polygon<point_type> hull;
+
+ make_multi_point(mp, generator, pcount);
+ bg::convex_hull(mp, hull);
+ // Check if each point lies in the hull
+ bool correct = check_hull(mp, hull);
+ if (! correct)
+ {
+ std::cout << "ERROR! " << std::endl
+ << bg::wkt(mp) << std::endl
+ << bg::wkt(hull) << std::endl
+ << std::endl;
+ ;
+ }
+
+ if (settings.svg || ! correct)
+ {
+ std::ostringstream out;
+ out << "random_mp_" << index++ << "_" << pcount << ".svg";
+ create_svg(out.str(), mp, hull);
+ }
+ if (settings.wkt)
+ {
+ std::cout
+ << "input: " << bg::wkt(mp) << std::endl
+ << "output: " << bg::wkt(hull) << std::endl
+ << std::endl;
+ ;
+ }
+}
+
+
+template <typename T>
+void test_all(int seed, int count, int field_size, int pcount, settings_type const& settings)
+{
+ boost::timer t;
+
+ typedef boost::minstd_rand base_generator_type;
+
+ base_generator_type generator(seed);
+
+ boost::uniform_int<> random_coordinate(0, field_size - 1);
+ boost::variate_generator<base_generator_type&, boost::uniform_int<> >
+ coordinate_generator(generator, random_coordinate);
+
+ typedef bg::model::multi_point
+ <
+ bg::model::d2::point_xy<T>
+ > mp;
+
+ int index = 0;
+ for(int i = 0; i < count; i++)
+ {
+ mp p;
+ test_random_multi_points<mp>(p, index, coordinate_generator, pcount, settings);
+ }
+ std::cout
+ << "points: " << index
+ << " type: " << typeid(T).name()
+ << " time: " << t.elapsed() << std::endl;
+}
+
+int main(int argc, char** argv)
+{
+ try
+ {
+ namespace po = boost::program_options;
+ po::options_description description("=== random_multi_points ===\nAllowed options");
+
+ std::string type = "double";
+ int count = 1;
+ int seed = static_cast<unsigned int>(std::time(0));
+ int pcount = 3;
+ int field_size = 10;
+ settings_type settings;
+
+ description.add_options()
+ ("help", "Help message")
+ ("seed", po::value<int>(&seed), "Initialization seed for random generator")
+ ("count", po::value<int>(&count)->default_value(1), "Number of tests")
+ ("number", po::value<int>(&pcount)->default_value(30), "Number of points")
+ ("size", po::value<int>(&field_size)->default_value(10), "Size of the field")
+ ("type", po::value<std::string>(&type)->default_value("double"), "Type (int,float,double)")
+ ("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
+ ("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
+ ;
+
+ po::variables_map varmap;
+ po::store(po::parse_command_line(argc, argv, description), varmap);
+ po::notify(varmap);
+
+ if (varmap.count("help"))
+ {
+ std::cout << description << std::endl;
+ return 1;
+ }
+
+ if (type == "float")
+ {
+ test_all<float>(seed, count, field_size, pcount, settings);
+ }
+ else if (type == "double")
+ {
+ test_all<double>(seed, count, field_size, pcount, settings);
+ }
+ else if (type == "int")
+ {
+ test_all<int>(seed, count, field_size, pcount, settings);
+ }
+
+ }
+ catch(std::exception const& e)
+ {
+ std::cout << "Exception " << e.what() << std::endl;
+ }
+ catch(...)
+ {
+ std::cout << "Other exception" << std::endl;
+ }
+
+ return 0;
+}
diff --git a/libs/geometry/test/robustness/convex_hull/random_multi_points.sln b/libs/geometry/test/robustness/convex_hull/random_multi_points.sln
new file mode 100644
index 000000000..1261464c0
--- /dev/null
+++ b/libs/geometry/test/robustness/convex_hull/random_multi_points.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "random_multi_points", "random_multi_points.vcproj", "{334B6950-6F92-4FA3-9A82-ED6E3B19BB2C}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {334B6950-6F92-4FA3-9A82-ED6E3B19BB2C}.Debug|Win32.ActiveCfg = Debug|Win32
+ {334B6950-6F92-4FA3-9A82-ED6E3B19BB2C}.Debug|Win32.Build.0 = Debug|Win32
+ {334B6950-6F92-4FA3-9A82-ED6E3B19BB2C}.Release|Win32.ActiveCfg = Release|Win32
+ {334B6950-6F92-4FA3-9A82-ED6E3B19BB2C}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/robustness/convex_hull/random_multi_points.vcproj b/libs/geometry/test/robustness/convex_hull/random_multi_points.vcproj
new file mode 100644
index 000000000..3db9cd3be
--- /dev/null
+++ b/libs/geometry/test/robustness/convex_hull/random_multi_points.vcproj
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="random_multi_points"
+ ProjectGUID="{334B6950-6F92-4FA3-9A82-ED6E3B19BB2C}"
+ RootNamespace="random_multi_points"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\random_multi_points"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../..;."
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="2"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalLibraryDirectories=""
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\random_multi_points"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../..;."
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="program options"
+ >
+ <File
+ RelativePath="..\..\..\..\program_options\src\cmdline.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\program_options\src\config_file.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\program_options\src\convert.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\program_options\src\options_description.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\program_options\src\parsers.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\program_options\src\positional_options.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\program_options\src\split.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\program_options\src\utf8_codecvt_facet.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\program_options\src\value_semantic.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\program_options\src\variables_map.cpp"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\random_multi_points.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/robustness/overlay/buffer/Jamfile.v2 b/libs/geometry/test/robustness/overlay/buffer/Jamfile.v2
new file mode 100644
index 000000000..f724fcf8c
--- /dev/null
+++ b/libs/geometry/test/robustness/overlay/buffer/Jamfile.v2
@@ -0,0 +1,19 @@
+# Boost.Geometry (aka GGL, Generic Geometry Library)
+# Robustness Test - overlay - buffer
+#
+# Copyright (c) 2012 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)
+
+
+project recursive_polygons_buffer
+ : requirements
+ <include>.
+ <include>../..
+ <library>../../../../../program_options/build//boost_program_options
+ <link>static
+ ;
+
+exe recursive_polygons_buffer : recursive_polygons_buffer.cpp ;
diff --git a/libs/geometry/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp b/libs/geometry/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp
new file mode 100644
index 000000000..5dc2be518
--- /dev/null
+++ b/libs/geometry/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp
@@ -0,0 +1,352 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Robustness Test
+
+// Copyright (c) 2012 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)
+
+#if defined(_MSC_VER)
+# pragma warning( disable : 4244 )
+# pragma warning( disable : 4267 )
+#endif
+
+#include <fstream>
+#include <sstream>
+
+#include <boost/foreach.hpp>
+#include <boost/program_options.hpp>
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/variate_generator.hpp>
+#include <boost/timer.hpp>
+
+#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>
+
+#include <boost/geometry/extensions/algorithms/buffer/buffer_inserter.hpp>
+
+#include <boost/geometry/multi/multi.hpp> // TODO: more specific
+#include <boost/geometry/extensions/algorithms/buffer/multi_buffer_inserter.hpp>
+
+#include <boost/geometry/extensions/strategies/buffer.hpp>
+
+
+#include <common/common_settings.hpp>
+#include <common/make_square_polygon.hpp>
+
+
+struct buffer_settings : public common_settings
+{
+ int join_code;
+ double distance;
+};
+
+namespace bg = boost::geometry;
+
+template <typename Geometry1, typename Geometry2>
+void create_svg(std::string const& filename
+ , Geometry1 const& mp
+ , Geometry2 const& buffer
+ )
+{
+ typedef typename boost::geometry::point_type<Geometry1>::type point_type;
+
+
+ std::ofstream svg(filename.c_str());
+ boost::geometry::svg_mapper<point_type> mapper(svg, 800, 800);
+
+ boost::geometry::model::box<point_type> box;
+ bg::envelope(mp, box);
+ bg::buffer(box, box, 1.0);
+ mapper.add(box);
+
+ if (bg::num_points(buffer) > 0)
+ {
+ bg::envelope(buffer, box);
+ bg::buffer(box, box, 1.0);
+ mapper.add(box);
+ }
+
+ mapper.map(mp, "fill-opacity:0.5;fill:rgb(153,204,0);stroke:rgb(153,204,0);stroke-width:3");
+ mapper.map(buffer, "stroke-opacity:0.9;stroke:rgb(0,0,0);fill:none;stroke-width:1");
+
+ //mapper.map(intersection,"opacity:0.6;stroke:rgb(0,128,0);stroke-width:5");
+}
+
+
+
+
+template <typename MultiPolygon, typename Settings>
+bool verify(std::string const& caseid, MultiPolygon const& mp, MultiPolygon const& buffer, Settings const& settings)
+{
+ bool result = true;
+
+ // Area of buffer must be larger than of original polygon
+ BOOST_AUTO(area_mp, bg::area(mp));
+ BOOST_AUTO(area_buf, bg::area(buffer));
+
+ if (area_buf < area_mp)
+ {
+ result = false;
+ }
+
+ if (result)
+ {
+ typedef boost::range_value<MultiPolygon const>::type polygon_type;
+ BOOST_FOREACH(polygon_type const& polygon, mp)
+ {
+ typename bg::point_type<polygon_type>::type point;
+ bg::point_on_border(point, polygon);
+ if (! bg::within(point, buffer))
+ {
+ result = false;
+ }
+ }
+ }
+
+ bool svg = settings.svg;
+ bool wkt = settings.wkt;
+ if (! result)
+ {
+ std::cout << "ERROR " << caseid << std::endl;
+ //std::cout << bg::wkt(mp) << std::endl;
+ //std::cout << bg::wkt(buffer) << std::endl;
+ svg = true;
+ wkt = true;
+ }
+
+ if (svg || wkt)
+ {
+ //std::cout << caseid << std::endl;
+ }
+
+ if (svg)
+ {
+ std::ostringstream filename;
+ filename << caseid << "_"
+ << typeid(typename bg::coordinate_type<MultiPolygon>::type).name()
+ << ".svg";
+ create_svg(filename.str(), mp, buffer);
+ }
+
+ if (wkt)
+ {
+ std::ostringstream filename;
+ filename << caseid << "_"
+ << typeid(typename bg::coordinate_type<MultiPolygon>::type).name()
+ << ".wkt";
+ std::ofstream stream(filename.str().c_str());
+ stream << bg::wkt(mp) << std::endl;
+ stream << bg::wkt(buffer) << std::endl;
+ }
+
+ return result;
+}
+
+template <typename MultiPolygon, typename Generator, typename Settings>
+bool test_buffer(MultiPolygon& result, int& index,
+ Generator& generator,
+ int level, Settings const& settings)
+{
+ MultiPolygon p, q;
+
+ // Generate two boxes
+ if (level == 0)
+ {
+ p.resize(1);
+ q.resize(1);
+ make_square_polygon(p.front(), generator, settings);
+ make_square_polygon(q.front(), generator, settings);
+ bg::correct(p);
+ bg::correct(q);
+ }
+ else
+ {
+ bg::correct(p);
+ bg::correct(q);
+ if (! test_buffer(p, index, generator, level - 1, settings)
+ || ! test_buffer(q, index, generator, level - 1, settings))
+ {
+ return false;
+ }
+ }
+
+ typedef typename boost::range_value<MultiPolygon>::type polygon;
+
+ MultiPolygon mp;
+ bg::detail::union_::union_insert
+ <
+ polygon
+ >(p, q, std::back_inserter(mp));
+
+ bg::unique(mp);
+ bg::unique(mp);
+ bg::correct(mp);
+ result = mp;
+
+
+ typedef typename bg::coordinate_type<MultiPolygon>::type coordinate_type;
+ typedef typename bg::point_type<MultiPolygon>::type point_type;
+ typedef bg::strategy::buffer::distance_assymetric<coordinate_type> distance_strategy_type;
+ distance_strategy_type distance_strategy(settings.distance, settings.distance);
+
+ typedef bg::strategy::buffer::join_round<point_type, point_type> join_strategy_type;
+ join_strategy_type join_strategy;
+
+ typedef typename boost::range_value<MultiPolygon>::type polygon_type;
+ MultiPolygon buffered;
+
+ std::ostringstream out;
+ out << "recursive_polygons_buffer_" << index++ << "_" << level;
+
+ try
+ {
+ switch(settings.join_code)
+ {
+ case 1 :
+ bg::buffer_inserter<polygon_type>(mp, std::back_inserter(buffered),
+ distance_strategy,
+ bg::strategy::buffer::join_round<point_type, point_type>());
+ break;
+ case 2 :
+ bg::buffer_inserter<polygon_type>(mp, std::back_inserter(buffered),
+ distance_strategy,
+ bg::strategy::buffer::join_miter<point_type, point_type>());
+ break;
+ default :
+ return false;
+ }
+ }
+ catch(std::exception const& e)
+ {
+ MultiPolygon empty;
+ std::cout << out.str() << std::endl;
+ std::cout << "Exception " << e.what() << std::endl;
+ verify(out.str(), mp, empty, settings);
+ return false;
+ }
+
+
+ return verify(out.str(), mp, buffered, settings);
+}
+
+
+template <typename T, bool Clockwise, bool Closed, typename Settings>
+void test_all(int seed, int count, int level, Settings const& settings)
+{
+ boost::timer t;
+
+ typedef boost::minstd_rand base_generator_type;
+
+ base_generator_type generator(seed);
+
+ boost::uniform_int<> random_coordinate(0, settings.field_size - 1);
+ boost::variate_generator<base_generator_type&, boost::uniform_int<> >
+ coordinate_generator(generator, random_coordinate);
+
+ typedef bg::model::polygon
+ <
+ bg::model::d2::point_xy<T>, Clockwise, Closed
+ > polygon;
+ typedef bg::model::multi_polygon<polygon> mp;
+
+
+ int index = 0;
+ for(int i = 0; i < count; i++)
+ {
+ mp p;
+ test_buffer<mp>(p, index, coordinate_generator, level, settings);
+ }
+ std::cout
+ << "geometries: " << index
+ << " type: " << typeid(T).name()
+ << " time: " << t.elapsed() << std::endl;
+}
+
+int main(int argc, char** argv)
+{
+ try
+ {
+ namespace po = boost::program_options;
+ po::options_description description("=== recursive_polygons_linear_areal ===\nAllowed options");
+
+ int count = 1;
+ int seed = static_cast<unsigned int>(std::time(0));
+ int level = 3;
+ bool ccw = false;
+ bool open = false;
+ buffer_settings settings;
+ std::string form = "box";
+ std::string join = "round";
+
+ description.add_options()
+ ("help", "Help message")
+ ("seed", po::value<int>(&seed), "Initialization seed for random generator")
+ ("count", po::value<int>(&count)->default_value(1), "Number of tests")
+ ("level", po::value<int>(&level)->default_value(3), "Level to reach (higher->slower)")
+ ("distance", po::value<double>(&settings.distance)->default_value(1.0), "Distance (1.0)")
+ ("form", po::value<std::string>(&form)->default_value("box"), "Form of the polygons (box, triangle)")
+ ("join", po::value<std::string>(&join)->default_value("round"), "Form of the joins (round, miter)")
+ ("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
+ ("open", po::value<bool>(&open)->default_value(false), "Open polygons")
+ ("size", po::value<int>(&settings.field_size)->default_value(10), "Size of the field")
+ ("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
+ ("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
+ ;
+
+ po::variables_map varmap;
+ po::store(po::parse_command_line(argc, argv, description), varmap);
+ po::notify(varmap);
+
+ if (varmap.count("help")
+ || (form != "box" && form != "triangle")
+ || (join != "round" && join != "miter")
+ )
+ {
+ std::cout << description << std::endl;
+ return 1;
+ }
+
+ settings.triangular = form != "box";
+ settings.join_code = join == "round" ? 1 : 2;
+
+ if (ccw && open)
+ {
+ test_all<double, false, false>(seed, count, level, settings);
+ }
+ else if (ccw)
+ {
+ test_all<double, false, true>(seed, count, level, settings);
+ }
+ else if (open)
+ {
+ test_all<double, true, false>(seed, count, level, settings);
+ }
+ else
+ {
+ test_all<double, true, true>(seed, count, level, settings);
+ }
+
+#if defined(HAVE_TTMATH)
+ // test_all<ttmath_big, true, true>(seed, count, max, svg, level);
+#endif
+ }
+ catch(std::exception const& e)
+ {
+ std::cout << "Exception " << e.what() << std::endl;
+ }
+ catch(...)
+ {
+ std::cout << "Other exception" << std::endl;
+ }
+
+ return 0;
+}
diff --git a/libs/geometry/test/robustness/overlay/buffer/recursive_polygons_buffer.sln b/libs/geometry/test/robustness/overlay/buffer/recursive_polygons_buffer.sln
new file mode 100644
index 000000000..6e8c2574f
--- /dev/null
+++ b/libs/geometry/test/robustness/overlay/buffer/recursive_polygons_buffer.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "recursive_polygons_buffer", "recursive_polygons_buffer.vcxproj", "{02C9CFA4-C625-55CA-1C8E-2B96EBB09FE8}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {02C9CFA4-C625-55CA-1C8E-2B96EBB09FE8}.Debug|Win32.ActiveCfg = Debug|Win32
+ {02C9CFA4-C625-55CA-1C8E-2B96EBB09FE8}.Debug|Win32.Build.0 = Debug|Win32
+ {02C9CFA4-C625-55CA-1C8E-2B96EBB09FE8}.Release|Win32.ActiveCfg = Release|Win32
+ {02C9CFA4-C625-55CA-1C8E-2B96EBB09FE8}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/robustness/overlay/buffer/recursive_polygons_buffer.vcproj b/libs/geometry/test/robustness/overlay/buffer/recursive_polygons_buffer.vcproj
new file mode 100644
index 000000000..3cc4a384f
--- /dev/null
+++ b/libs/geometry/test/robustness/overlay/buffer/recursive_polygons_buffer.vcproj
@@ -0,0 +1,222 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="recursive_polygons_buffer"
+ RootNamespace="recursive_polygons_buffer"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\recursive_polygons_buffer"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../../..;.;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="2"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalLibraryDirectories=""
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\recursive_polygons_buffer"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../../..;.;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="program options"
+ >
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\cmdline.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\config_file.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\convert.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\options_description.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\parsers.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\positional_options.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\split.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\utf8_codecvt_facet.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\value_semantic.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\variables_map.cpp"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\recursive_polygons_buffer.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/robustness/overlay/linear_areal/Jamfile.v2 b/libs/geometry/test/robustness/overlay/linear_areal/Jamfile.v2
new file mode 100644
index 000000000..a31dadf15
--- /dev/null
+++ b/libs/geometry/test/robustness/overlay/linear_areal/Jamfile.v2
@@ -0,0 +1,19 @@
+# Boost.Geometry (aka GGL, Generic Geometry Library)
+# Robustness Test - overlay - linear/areal
+#
+# Copyright (c) 2012 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)
+
+
+project recursive_polygons_linear_areal
+ : requirements
+ <include>.
+ <include>../..
+ <library>../../../../../program_options/build//boost_program_options
+ <link>static
+ ;
+
+exe recursive_polygons_linear_areal : recursive_polygons_linear_areal.cpp ;
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
new file mode 100644
index 000000000..6585a227e
--- /dev/null
+++ b/libs/geometry/test/robustness/overlay/linear_areal/recursive_polygons_linear_areal.cpp
@@ -0,0 +1,501 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Robustness Test
+
+// Copyright (c) 2012 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)
+
+#if defined(_MSC_VER)
+# pragma warning( disable : 4244 )
+# pragma warning( disable : 4267 )
+#endif
+
+#include <fstream>
+#include <sstream>
+
+#include <boost/foreach.hpp>
+#include <boost/program_options.hpp>
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/variate_generator.hpp>
+#include <boost/timer.hpp>
+
+#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>
+
+#include <common/common_settings.hpp>
+#include <common/make_square_polygon.hpp>
+
+
+namespace bg = boost::geometry;
+
+template <typename Geometry1, typename Geometry2, typename Geometry3>
+void create_svg(std::string const& filename
+ , Geometry1 const& mp
+ , Geometry2 const& ls
+ , Geometry3 const& difference
+ , Geometry3 const& intersection
+ )
+{
+ typedef typename boost::geometry::point_type<Geometry1>::type point_type;
+
+
+ std::ofstream svg(filename.c_str());
+ boost::geometry::svg_mapper<point_type> mapper(svg, 800, 800);
+
+ boost::geometry::model::box<point_type> box;
+ bg::envelope(mp, box);
+ bg::buffer(box, box, 1.0);
+ mapper.add(box);
+ bg::envelope(ls, box);
+ bg::buffer(box, box, 1.0);
+ mapper.add(box);
+
+ mapper.map(mp, "fill-opacity:0.5;fill:rgb(153,204,0);stroke:rgb(153,204,0);stroke-width:3");
+ mapper.map(ls, "stroke-opacity:0.9;stroke:rgb(0,0,0);stroke-width:1");
+
+ mapper.map(intersection,"opacity:0.6;stroke:rgb(0,128,0);stroke-width:5");
+ mapper.map(difference, "opacity:0.6;stroke:rgb(255,0,255);stroke-width:5"); //;stroke-dasharray:1,7;stroke-linecap:round
+}
+
+
+template <typename Linestring, typename Generator, typename Settings>
+inline void make_random_linestring(Linestring& line, Generator& generator, Settings const& settings)
+{
+ using namespace boost::geometry;
+
+ typedef typename point_type<Linestring>::type point_type;
+ typedef typename coordinate_type<Linestring>::type coordinate_type;
+
+ coordinate_type x, y;
+ x = generator();
+ y = generator();
+
+ int count = 3 + generator() % 6;
+ int d = 0; // direction
+
+ for (int i = 0; i <= count && x <= settings.field_size; i++, x++, d = 1 - d)
+ {
+ append(line, make<point_type>(x, y + d));
+ append(line, make<point_type>(x, y + 1 - d));
+ }
+
+ if (d == 0 && generator() % 4 < 3 && y >= 2)
+ {
+ d = 1 - d;
+ x--;
+ y -= 2;
+ count = 3 + generator() % 6;
+ for (int i = 0; i <= count && x >= 0; i++, x--, d = 1 - d)
+ {
+ append(line, make<point_type>(x, y + d));
+ append(line, make<point_type>(x, y + 1 - d));
+ }
+ }
+
+ //if (settings.triangular)
+ //{
+ // // Remove a point, generator says which
+ // int c = generator() % 4;
+ // if (c >= 1 && c <= 3)
+ // {
+ // ring.erase(ring.begin() + c);
+ // }
+ //}
+}
+
+template<typename Geometry>
+class inside_check
+{
+ Geometry const& m_geo;
+ bool& m_result;
+public :
+
+ inside_check(Geometry const& geo, bool& result)
+ : m_geo(geo)
+ , m_result(result)
+ {}
+
+ inline inside_check<Geometry> operator=(inside_check<Geometry> const& input)
+ {
+ return inside_check<Geometry>(input.m_geo, input.m_result);
+ }
+
+ template <typename Point>
+ inline void operator()(Point const& p)
+ {
+ if (! bg::covered_by(p, m_geo))
+ {
+ if (m_result)
+ {
+ std::cout << "Does not fulfill inside check" << std::endl;
+ }
+ m_result = false;
+ }
+ }
+};
+
+
+template<typename Geometry>
+class outside_check
+{
+ Geometry const& m_geo;
+ bool& m_result;
+public :
+ outside_check(Geometry const& geo, bool& result)
+ : m_geo(geo)
+ , m_result(result)
+ {}
+
+ inline outside_check<Geometry> operator=(outside_check<Geometry> const& input)
+ {
+ return outside_check<Geometry>(input.m_geo, input.m_result);
+ }
+
+ template <typename Point>
+ inline void operator()(Point const& p)
+ {
+ if (bg::within(p, m_geo))
+ {
+ if (m_result)
+ {
+ std::cout << "Does not fulfill outside check" << std::endl;
+ }
+ m_result = false;
+ }
+ }
+};
+
+template<typename Segment>
+class border2_check
+{
+ Segment const& m_segment;
+ bool& m_result;
+
+public :
+ border2_check(Segment const& seg, bool& result)
+ : m_segment(seg)
+ , m_result(result)
+ {}
+
+ inline border2_check<Segment> operator=(border2_check<Segment> const& input)
+ {
+ return border2_check<Segment>(input.m_segment, input.m_result);
+ }
+
+ template <typename Segment2>
+ inline void operator()(Segment2 const& segment)
+ {
+ // Create copies (TODO: find out why referring_segment does not compile)
+ typedef typename bg::point_type<Segment2>::type pt;
+ typedef bg::model::segment<pt> segment_type;
+
+ typedef bg::strategy::intersection::relate_cartesian_segments
+ <
+ bg::policies::relate::segments_intersection_points
+ <
+ segment_type,
+ segment_type,
+ bg::segment_intersection_points<pt>
+ >
+ > policy;
+
+ segment_type seg1, seg2;
+ bg::convert(m_segment, seg1);
+ bg::convert(segment, seg2);
+ bg::segment_intersection_points<pt> is = policy::apply(seg1, seg2);
+
+ if (is.count == 2)
+ {
+ if (m_result)
+ {
+ std::cout << "Does not fulfill border2 check" << std::endl;
+ }
+ m_result = true;
+ }
+ }
+};
+
+template<typename Geometry>
+class border_check
+{
+ Geometry const& m_geo;
+ bool& m_result;
+public :
+ border_check(Geometry const& geo, bool& result)
+ : m_geo(geo)
+ , m_result(result)
+ {}
+
+ inline border_check<Geometry> operator=(border_check<Geometry> const& input)
+ {
+ return border_check<Geometry>(input.m_geo, input.m_result);
+ }
+
+ template <typename Segment>
+ inline void operator()(Segment const& s)
+ {
+ bool on_border = false;
+ border2_check<Segment> checker(s, on_border);
+ bg::for_each_segment(m_geo, checker);
+
+ if (on_border)
+ {
+ if (m_result)
+ {
+ std::cout << "Does not fulfill border check" << std::endl;
+ }
+ m_result = false;
+ }
+ }
+};
+
+
+template <typename MultiPolygon, typename Linestring, typename Settings>
+bool verify(std::string const& caseid, MultiPolygon const& mp, Linestring const& ls, Settings const& settings)
+{
+ bg::model::multi_linestring<Linestring> difference, intersection;
+ bg::difference(ls, mp, difference);
+ bg::intersection(ls, mp, intersection);
+
+ //typedef typename bg::length_result_type<point_type>::type length_type;
+
+ bool result = true;
+
+ // 1) Check by length
+ typedef double length_type;
+ length_type len_input = bg::length(ls);
+ length_type len_difference = bg::length(difference);
+ length_type len_intersection = bg::length(intersection);
+ if (! bg::math::equals(len_input, len_difference + len_intersection))
+ {
+ std::cout << "Input: " << len_input
+ << " difference: " << len_difference
+ << " intersection: " << len_intersection
+ << std::endl;
+
+ std::cout << "Does not fulfill length check" << std::endl;
+
+ result = false;
+ }
+
+ // 2) Check by within and covered by
+ inside_check<MultiPolygon> ic(mp, result);
+ bg::for_each_point(intersection, ic);
+
+ outside_check<MultiPolygon> oc(mp, result);
+ bg::for_each_point(difference, oc);
+
+ border_check<MultiPolygon> bc(mp, result);
+ bg::for_each_segment(difference, bc);
+
+ // 3) check also the mid-points from the difference to remove false positives
+ BOOST_FOREACH(Linestring const& d, difference)
+ {
+ Linestring difference_midpoints;
+ bg::midpoints(d, false, std::back_inserter(difference_midpoints));
+ outside_check<MultiPolygon> ocm(mp, result);
+ bg::for_each_point(difference_midpoints, ocm);
+ }
+
+
+ bool svg = settings.svg;
+ bool wkt = settings.wkt;
+ if (! result)
+ {
+ std::cout << "ERROR " << caseid << std::endl;
+ std::cout << bg::wkt(mp) << std::endl;
+ std::cout << bg::wkt(ls) << std::endl;
+ svg = true;
+ wkt = true;
+ }
+
+ if (svg)
+ {
+ std::ostringstream filename;
+ filename << caseid << "_"
+ << typeid(typename bg::coordinate_type<Linestring>::type).name()
+ << ".svg";
+ create_svg(filename.str(), mp, ls, difference, intersection);
+ }
+
+ if (wkt)
+ {
+ std::ostringstream filename;
+ filename << caseid << "_"
+ << typeid(typename bg::coordinate_type<Linestring>::type).name()
+ << ".wkt";
+ std::ofstream stream(filename.str().c_str());
+ stream << bg::wkt(mp) << std::endl;
+ stream << bg::wkt(ls) << std::endl;
+ }
+
+ return result;
+}
+
+template <typename MultiPolygon, typename Generator>
+bool test_linear_areal(MultiPolygon& result, int& index,
+ Generator& generator,
+ int level, common_settings const& settings)
+{
+ MultiPolygon p, q;
+
+ // Generate two boxes
+ if (level == 0)
+ {
+ p.resize(1);
+ q.resize(1);
+ make_square_polygon(p.front(), generator, settings);
+ make_square_polygon(q.front(), generator, settings);
+ bg::correct(p);
+ bg::correct(q);
+ }
+ else
+ {
+ bg::correct(p);
+ bg::correct(q);
+ if (! test_linear_areal(p, index, generator, level - 1, settings)
+ || ! test_linear_areal(q, index, generator, level - 1, settings))
+ {
+ return false;
+ }
+ }
+
+ typedef typename boost::range_value<MultiPolygon>::type polygon;
+
+ MultiPolygon mp;
+ bg::detail::union_::union_insert
+ <
+ polygon
+ >(p, q, std::back_inserter(mp));
+
+ bg::unique(mp);
+ bg::simplify(mp, result, 0.01);
+ bg::correct(mp);
+
+ // Generate a linestring
+ typedef typename bg::point_type<MultiPolygon>::type point_type;
+ typedef bg::model::linestring<point_type> linestring_type;
+ linestring_type ls;
+ make_random_linestring(ls, generator, settings);
+
+ std::ostringstream out;
+ out << "recursive_la_" << index++ << "_" << level;
+ return verify(out.str(), mp, ls, settings);
+}
+
+
+template <typename T, bool Clockwise, bool Closed>
+void test_all(int seed, int count, int level, common_settings const& settings)
+{
+ boost::timer t;
+
+ typedef boost::minstd_rand base_generator_type;
+
+ base_generator_type generator(seed);
+
+ boost::uniform_int<> random_coordinate(0, settings.field_size - 1);
+ boost::variate_generator<base_generator_type&, boost::uniform_int<> >
+ coordinate_generator(generator, random_coordinate);
+
+ typedef bg::model::polygon
+ <
+ bg::model::d2::point_xy<T>, Clockwise, Closed
+ > polygon;
+ typedef bg::model::multi_polygon<polygon> mp;
+
+
+ int index = 0;
+ for(int i = 0; i < count; i++)
+ {
+ mp p;
+ test_linear_areal<mp>(p, index, coordinate_generator, level, settings);
+ }
+ std::cout
+ << "geometries: " << index
+ << " type: " << typeid(T).name()
+ << " time: " << t.elapsed() << std::endl;
+}
+
+int main(int argc, char** argv)
+{
+ try
+ {
+ namespace po = boost::program_options;
+ po::options_description description("=== recursive_polygons_linear_areal ===\nAllowed options");
+
+ int count = 1;
+ int seed = static_cast<unsigned int>(std::time(0));
+ int level = 3;
+ bool ccw = false;
+ bool open = false;
+ common_settings settings;
+ std::string form = "box";
+
+ description.add_options()
+ ("help", "Help message")
+ ("seed", po::value<int>(&seed), "Initialization seed for random generator")
+ ("count", po::value<int>(&count)->default_value(1), "Number of tests")
+ ("diff", po::value<bool>(&settings.also_difference)->default_value(false), "Include testing on difference")
+ ("level", po::value<int>(&level)->default_value(3), "Level to reach (higher->slower)")
+ ("form", po::value<std::string>(&form)->default_value("box"), "Form of the polygons (box, triangle)")
+ ("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
+ ("open", po::value<bool>(&open)->default_value(false), "Open polygons")
+ ("size", po::value<int>(&settings.field_size)->default_value(10), "Size of the field")
+ ("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
+ ("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
+ ;
+
+ po::variables_map varmap;
+ po::store(po::parse_command_line(argc, argv, description), varmap);
+ po::notify(varmap);
+
+ if (varmap.count("help")
+ || (form != "box" && form != "triangle"))
+ {
+ std::cout << description << std::endl;
+ return 1;
+ }
+
+ settings.triangular = form != "box";
+
+ if (ccw && open)
+ {
+ test_all<double, false, false>(seed, count, level, settings);
+ }
+ else if (ccw)
+ {
+ test_all<double, false, true>(seed, count, level, settings);
+ }
+ else if (open)
+ {
+ test_all<double, true, false>(seed, count, level, settings);
+ }
+ else
+ {
+ test_all<double, true, true>(seed, count, level, settings);
+ }
+
+#if defined(HAVE_TTMATH)
+ // test_all<ttmath_big, true, true>(seed, count, max, svg, level);
+#endif
+ }
+ catch(std::exception const& e)
+ {
+ std::cout << "Exception " << e.what() << std::endl;
+ }
+ catch(...)
+ {
+ std::cout << "Other exception" << std::endl;
+ }
+
+ return 0;
+}
diff --git a/libs/geometry/test/robustness/overlay/linear_areal/recursive_polygons_linear_areal.sln b/libs/geometry/test/robustness/overlay/linear_areal/recursive_polygons_linear_areal.sln
new file mode 100644
index 000000000..5865e1c36
--- /dev/null
+++ b/libs/geometry/test/robustness/overlay/linear_areal/recursive_polygons_linear_areal.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "recursive_polygons_linear_areal", "recursive_polygons_linear_areal.vcproj", "{1E269699-9450-4DD6-ACC3-C6A9AD2FC6E0}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1E269699-9450-4DD6-ACC3-C6A9AD2FC6E0}.Debug|Win32.ActiveCfg = Debug|Win32
+ {1E269699-9450-4DD6-ACC3-C6A9AD2FC6E0}.Debug|Win32.Build.0 = Debug|Win32
+ {1E269699-9450-4DD6-ACC3-C6A9AD2FC6E0}.Release|Win32.ActiveCfg = Release|Win32
+ {1E269699-9450-4DD6-ACC3-C6A9AD2FC6E0}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/robustness/overlay/linear_areal/recursive_polygons_linear_areal.vcproj b/libs/geometry/test/robustness/overlay/linear_areal/recursive_polygons_linear_areal.vcproj
new file mode 100644
index 000000000..14e8dd6fd
--- /dev/null
+++ b/libs/geometry/test/robustness/overlay/linear_areal/recursive_polygons_linear_areal.vcproj
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="recursive_polygons_linear_areal"
+ ProjectGUID="{1E269699-9450-4DD6-ACC3-C6A9AD2FC6E0}"
+ RootNamespace="recursive_polygons_linear_areal"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\recursive_polygons_linear_areal"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../../..;.;../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="2"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalLibraryDirectories=""
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\recursive_polygons_linear_areal"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../../..;.;../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="program options"
+ >
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\cmdline.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\config_file.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\convert.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\options_description.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\parsers.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\positional_options.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\split.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\utf8_codecvt_facet.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\value_semantic.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\variables_map.cpp"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\recursive_polygons_linear_areal.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/strategies/Jamfile.v2 b/libs/geometry/test/strategies/Jamfile.v2
new file mode 100644
index 000000000..889ce66a9
--- /dev/null
+++ b/libs/geometry/test/strategies/Jamfile.v2
@@ -0,0 +1,21 @@
+# 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-strategies
+ :
+ [ run cross_track.cpp ]
+ [ run haversine.cpp ]
+ [ run projected_point.cpp ]
+ [ run pythagoras.cpp ]
+ [ run spherical_side.cpp ]
+ [ run transform_cs.cpp ]
+ [ run transformer.cpp ]
+ [ run within.cpp ]
+ ;
diff --git a/libs/geometry/test/strategies/cross_track.cpp b/libs/geometry/test/strategies/cross_track.cpp
new file mode 100644
index 000000000..38840dc72
--- /dev/null
+++ b/libs/geometry/test/strategies/cross_track.cpp
@@ -0,0 +1,151 @@
+// 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.
+
+// 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/geometry/io/wkt/read.hpp>
+
+#include <boost/geometry/algorithms/assign.hpp>
+#include <boost/geometry/algorithms/distance.hpp>
+
+#include <boost/geometry/strategies/spherical/distance_haversine.hpp>
+#include <boost/geometry/strategies/spherical/distance_cross_track.hpp>
+
+#include <boost/geometry/strategies/concepts/distance_concept.hpp>
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/segment.hpp>
+
+
+// This test is GIS oriented.
+
+
+template <typename Point, typename LatitudePolicy>
+void test_distance(
+ typename bg::coordinate_type<Point>::type const& lon1,
+ typename bg::coordinate_type<Point>::type const& lat1,
+ typename bg::coordinate_type<Point>::type const& lon2,
+ typename bg::coordinate_type<Point>::type const& lat2,
+ typename bg::coordinate_type<Point>::type const& lon3,
+ typename bg::coordinate_type<Point>::type const& lat3,
+ typename bg::coordinate_type<Point>::type const& radius,
+ typename bg::coordinate_type<Point>::type const& expected,
+ typename bg::coordinate_type<Point>::type const& tolerance)
+{
+ typedef bg::strategy::distance::cross_track
+ <
+ Point,
+ Point
+ > strategy_type;
+ typedef typename bg::strategy::distance::services::return_type
+ <
+ strategy_type
+ >::type return_type;
+
+
+ BOOST_CONCEPT_ASSERT
+ (
+ (bg::concept::PointSegmentDistanceStrategy<strategy_type>)
+ );
+
+
+ Point p1, p2, p3;
+ bg::assign_values(p1, lon1, LatitudePolicy::apply(lat1));
+ bg::assign_values(p2, lon2, LatitudePolicy::apply(lat2));
+ bg::assign_values(p3, lon3, LatitudePolicy::apply(lat3));
+
+
+ strategy_type strategy;
+ return_type d = strategy.apply(p1, p2, p3);
+
+ BOOST_CHECK_CLOSE(radius * d, expected, tolerance);
+
+ // Test specifying radius explicitly
+ strategy_type strategy_radius(radius);
+ d = strategy_radius.apply(p1, p2, p3);
+ BOOST_CHECK_CLOSE(d, expected, tolerance);
+
+
+ // Test the "default strategy" registration
+ bg::model::referring_segment<Point const> segment(p2, p3);
+ d = bg::distance(p1, segment);
+ BOOST_CHECK_CLOSE(radius * d, expected, tolerance);
+}
+
+
+template <typename Point>
+void test_case_boost_geometry_list_20120625()
+{
+ // This function tests the bug submitted by Karsten Ahnert
+ // on Boost.Geometry list at 2012-06-25, and wherefore he
+ // submitted a patch a few days later.
+
+ Point p1, p2;
+ bg::model::segment<Point> s1, s2;
+
+ bg::read_wkt("POINT(1 1)", p1);
+ bg::read_wkt("POINT(5 1)", p2);
+ bg::read_wkt("LINESTRING(0 2,2 2)", s1);
+ bg::read_wkt("LINESTRING(2 2,4 2)", s2);
+
+ BOOST_CHECK_CLOSE(boost::geometry::distance(p1, s1), 0.0174586, 0.0001);
+ BOOST_CHECK_CLOSE(boost::geometry::distance(p1, s2), 0.0246783, 0.0001);
+ BOOST_CHECK_CLOSE(boost::geometry::distance(p2, s1), 0.0551745, 0.0001);
+ BOOST_CHECK_CLOSE(boost::geometry::distance(p2, s2), 0.0246783, 0.0001);
+
+ // Check degenerated segments
+ bg::model::segment<Point> s3;
+ bg::read_wkt("LINESTRING(2 2,2 2)", s3);
+ BOOST_CHECK_CLOSE(boost::geometry::distance(p1, s3), 0.0246783, 0.0001);
+ BOOST_CHECK_CLOSE(boost::geometry::distance(p2, s3), 0.0551745, 0.0001);
+
+ // Point/Point distance should be identical:
+ Point p3;
+ bg::read_wkt("POINT(2 2)", p3);
+ BOOST_CHECK_CLOSE(boost::geometry::distance(p1, p3), 0.0246783, 0.0001);
+ BOOST_CHECK_CLOSE(boost::geometry::distance(p2, p3), 0.0551745, 0.0001);
+}
+
+
+template <typename Point, typename LatitudePolicy>
+void test_all()
+{
+ typename bg::coordinate_type<Point>::type const average_earth_radius = 6372795.0;
+
+ // distance (Paris <-> Amsterdam/Barcelona),
+ // with coordinates rounded as below ~87 km
+ // is equal to distance (Paris <-> Barcelona/Amsterdam)
+ typename bg::coordinate_type<Point>::type const p_to_ab = 86.798321 * 1000.0;
+ test_distance<Point, LatitudePolicy>(2, 48, 4, 52, 2, 41, average_earth_radius, p_to_ab, 0.1);
+ test_distance<Point, LatitudePolicy>(2, 48, 2, 41, 4, 52, average_earth_radius, p_to_ab, 0.1);
+
+ test_case_boost_geometry_list_20120625<Point>();
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> >, geographic_policy >();
+
+ // NYI: haversine for mathematical spherical coordinate systems
+ // test_all<bg::model::point<double, 2, bg::cs::spherical<bg::degree> >, mathematical_policya >();
+
+#if defined(HAVE_TTMATH)
+ typedef ttmath::Big<1,4> tt;
+ //test_all<bg::model::point<tt, 2, bg::cs::geographic<bg::degree> >, geographic_policy>();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/strategies/cross_track.vcproj b/libs/geometry/test/strategies/cross_track.vcproj
new file mode 100644
index 000000000..e51666fca
--- /dev/null
+++ b/libs/geometry/test/strategies/cross_track.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="cross_track"
+ ProjectGUID="{4CE6F112-9EA1-4D7E-9AC6-907E77895263}"
+ RootNamespace="cross_track"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\cross_track"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\cross_track"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\cross_track.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/strategies/haversine.cpp b/libs/geometry/test/strategies/haversine.cpp
new file mode 100644
index 000000000..9468810b8
--- /dev/null
+++ b/libs/geometry/test/strategies/haversine.cpp
@@ -0,0 +1,274 @@
+// 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.
+
+// 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/requires.hpp>
+#include <boost/concept_check.hpp>
+
+#include <boost/geometry/algorithms/assign.hpp>
+#include <boost/geometry/strategies/spherical/distance_haversine.hpp>
+#include <boost/geometry/strategies/concepts/distance_concept.hpp>
+
+
+#include <boost/geometry/geometries/point.hpp>
+
+#ifdef HAVE_TTMATH
+# include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
+#endif
+
+
+
+double const average_earth_radius = 6372795.0;
+
+
+template <typename Point, typename LatitudePolicy>
+struct test_distance
+{
+ typedef bg::strategy::distance::haversine
+ <
+ Point,
+ Point
+ > haversine_type;
+
+ BOOST_CONCEPT_ASSERT( (bg::concept::PointDistanceStrategy<haversine_type>) );
+
+
+ typedef typename bg::strategy::distance::services::return_type<haversine_type>::type return_type;
+
+ BOOST_CONCEPT_ASSERT
+ (
+ (bg::concept::PointDistanceStrategy<haversine_type>)
+ );
+
+
+ static void test(double lon1, double lat1, double lon2, double lat2,
+ double radius, return_type expected, double tolerance)
+ {
+ haversine_type strategy(radius);
+
+ Point p1, p2;
+ bg::assign_values(p1, lon1, LatitudePolicy::apply(lat1));
+ bg::assign_values(p2, lon2, LatitudePolicy::apply(lat2));
+ return_type d = strategy.apply(p1, p2);
+
+ BOOST_CHECK_CLOSE(d, expected, tolerance);
+ }
+};
+
+template <typename Point, typename LatitudePolicy>
+void test_all()
+{
+ // earth to unit-sphere -> divide by earth circumference, then it is from 0-1,
+ // then multiply with 2 PI, so effectively just divide by earth radius
+ double e2u = 1.0 / average_earth_radius;
+
+ // ~ Amsterdam/Paris, 467 kilometers
+ double const a_p = 467.2704 * 1000.0;
+ test_distance<Point, LatitudePolicy>::test(4, 52, 2, 48, average_earth_radius, a_p, 1.0);
+ test_distance<Point, LatitudePolicy>::test(2, 48, 4, 52, average_earth_radius, a_p, 1.0);
+ test_distance<Point, LatitudePolicy>::test(4, 52, 2, 48, 1.0, a_p * e2u, 0.001);
+
+ // ~ Amsterdam/Barcelona
+ double const a_b = 1232.9065 * 1000.0;
+ test_distance<Point, LatitudePolicy>::test(4, 52, 2, 41, average_earth_radius, a_b, 1.0);
+ test_distance<Point, LatitudePolicy>::test(2, 41, 4, 52, average_earth_radius, a_b, 1.0);
+ test_distance<Point, LatitudePolicy>::test(4, 52, 2, 41, 1.0, a_b * e2u, 0.001);
+}
+
+
+template <typename P1, typename P2, typename CalculationType, typename LatitudePolicy>
+void test_services()
+{
+ namespace bgsd = bg::strategy::distance;
+ namespace services = bg::strategy::distance::services;
+
+ {
+
+ // Compile-check if there is a strategy for this type
+ typedef typename services::default_strategy<bg::point_tag, P1, P2>::type haversine_strategy_type;
+ }
+
+ P1 p1;
+ bg::assign_values(p1, 4, 52);
+
+ P2 p2;
+ bg::assign_values(p2, 2, 48);
+
+ // ~ Amsterdam/Paris, 467 kilometers
+ double const km = 1000.0;
+ double const a_p = 467.2704 * km;
+ double const expected = a_p;
+
+ double const expected_lower = 460.0 * km;
+ double const expected_higher = 470.0 * km;
+
+ // 1: normal, calculate distance:
+
+ typedef bgsd::haversine<P1, P2, CalculationType> strategy_type;
+ typedef typename bgsd::services::return_type<strategy_type>::type return_type;
+
+ strategy_type strategy(average_earth_radius);
+ return_type result = strategy.apply(p1, p2);
+ BOOST_CHECK_CLOSE(result, return_type(expected), 0.001);
+
+ // 2: "similar" to construct a similar strategy (similar but with other template-parameters) for, e.g., the reverse P2/P1
+ // 2a: similar_type:
+ typedef typename services::similar_type<strategy_type, P2, P1>::type similar_type;
+ // 2b: get_similar
+ similar_type similar = services::get_similar<strategy_type, P2, P1>::apply(strategy);
+
+ //result = similar.apply(p1, p2); // should NOT compile because p1/p2 should also be reversed here
+ result = similar.apply(p2, p1);
+ BOOST_CHECK_CLOSE(result, return_type(expected), 0.001);
+
+
+ // 3: "comparable" to construct a "comparable strategy" for P1/P2
+ // a "comparable strategy" is a strategy which does not calculate the exact distance, but
+ // which returns results which can be mutually compared (e.g. avoid sqrt)
+
+ // 3a: "comparable_type"
+ typedef typename services::comparable_type<strategy_type>::type comparable_type;
+
+ // 3b: "get_comparable"
+ comparable_type comparable = bgsd::services::get_comparable<strategy_type>::apply(strategy);
+
+ // Check vice versa:
+ // First the result of the comparable strategy
+ return_type c_result = comparable.apply(p1, p2);
+ // Second the comparable result of the expected distance
+ return_type c_expected = services::result_from_distance<comparable_type>::apply(comparable, expected);
+ // And that one should be equa.
+ BOOST_CHECK_CLOSE(c_result, return_type(c_expected), 0.001);
+
+ // 4: the comparable_type should have a distance_strategy_constructor as well,
+ // knowing how to compare something with a fixed distance
+ return_type c_dist_lower = services::result_from_distance<comparable_type>::apply(comparable, expected_lower);
+ return_type c_dist_higher = services::result_from_distance<comparable_type>::apply(comparable, expected_higher);
+
+ // If this is the case:
+ BOOST_CHECK(c_dist_lower < c_result && c_result < c_dist_higher);
+
+ // Calculate the Haversine by hand here:
+ return_type c_check = return_type(2.0) * asin(sqrt(c_result)) * average_earth_radius;
+ BOOST_CHECK_CLOSE(c_check, expected, 0.001);
+
+ // This should also be the case
+ return_type dist_lower = services::result_from_distance<strategy_type>::apply(strategy, expected_lower);
+ return_type dist_higher = services::result_from_distance<strategy_type>::apply(strategy, expected_higher);
+ BOOST_CHECK(dist_lower < result && result < dist_higher);
+}
+
+/****
+template <typename P, typename Strategy>
+void time_compare_s(int const n)
+{
+ boost::timer t;
+ P p1, p2;
+ bg::assign_values(p1, 1, 1);
+ bg::assign_values(p2, 2, 2);
+ Strategy strategy;
+ typename Strategy::return_type s = 0;
+ for (int i = 0; i < n; i++)
+ {
+ for (int j = 0; j < n; j++)
+ {
+ s += strategy.apply(p1, p2);
+ }
+ }
+ std::cout << "s: " << s << " t: " << t.elapsed() << std::endl;
+}
+
+template <typename P>
+void time_compare(int const n)
+{
+ time_compare_s<P, bg::strategy::distance::haversine<P> >(n);
+ time_compare_s<P, bg::strategy::distance::comparable::haversine<P> >(n);
+}
+
+#include <time.h>
+double time_sqrt(int n)
+{
+ clock_t start = clock();
+
+ double v = 2.0;
+ double s = 0.0;
+ for (int i = 0; i < n; i++)
+ {
+ for (int j = 0; j < n; j++)
+ {
+ s += sqrt(v);
+ v += 1.0e-10;
+ }
+ }
+ clock_t end = clock();
+ double diff = double(end - start) / CLOCKS_PER_SEC;
+
+ std::cout << "Check: " << s << " Time: " << diff << std::endl;
+ return diff;
+}
+
+double time_normal(int n)
+{
+ clock_t start = clock();
+
+ double v = 2.0;
+ double s = 0.0;
+ for (int i = 0; i < n; i++)
+ {
+ for (int j = 0; j < n; j++)
+ {
+ s += v;
+ v += 1.0e-10;
+ }
+ }
+ clock_t end = clock();
+ double diff = double(end - start) / CLOCKS_PER_SEC;
+
+ std::cout << "Check: " << s << " Time: " << diff << std::endl;
+ return diff;
+}
+***/
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::point<int, 2, bg::cs::spherical_equatorial<bg::degree> >, geographic_policy>();
+ test_all<bg::model::point<float, 2, bg::cs::spherical_equatorial<bg::degree> >, geographic_policy>();
+ test_all<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> >, geographic_policy>();
+
+ // NYI: haversine for mathematical spherical coordinate systems
+ // test_all<bg::model::point<double, 2, bg::cs::spherical<bg::degree> >, mathematical_policy>();
+
+ //double t1 = time_sqrt(20000);
+ //double t2 = time_normal(20000);
+ //std::cout << "Factor: " << (t1 / t2) << std::endl;
+ //time_compare<bg::model::point<double, 2, bg::cs::spherical<bg::radian> > >(10000);
+
+#if defined(HAVE_TTMATH)
+ typedef ttmath::Big<1,4> tt;
+ test_all<bg::model::point<tt, 2, bg::cs::spherical_equatorial<bg::degree> >, geographic_policy>();
+#endif
+
+
+ test_services
+ <
+ bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> >,
+ bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> >,
+ double,
+ geographic_policy
+ >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/strategies/haversine.vcproj b/libs/geometry/test/strategies/haversine.vcproj
new file mode 100644
index 000000000..31ac6291d
--- /dev/null
+++ b/libs/geometry/test/strategies/haversine.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="haversine"
+ ProjectGUID="{AA654B76-E384-4E10-B367-4F51B5D3E96F}"
+ RootNamespace="haversine"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\haversine"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\haversine"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\haversine.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/strategies/projected_point.cpp b/libs/geometry/test/strategies/projected_point.cpp
new file mode 100644
index 000000000..11ea749a1
--- /dev/null
+++ b/libs/geometry/test/strategies/projected_point.cpp
@@ -0,0 +1,188 @@
+// 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.
+
+// 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/geometry/strategies/cartesian/distance_projected_point.hpp>
+#include <boost/geometry/strategies/concepts/distance_concept.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include <test_common/test_point.hpp>
+
+#ifdef HAVE_TTMATH
+# include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
+#endif
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+template <typename P, typename PS, typename CalculationType>
+void test_services()
+{
+ PS p1, p2;
+ bg::assign_values(p1, 0, 0);
+ bg::assign_values(p2, 0, 4);
+
+ P p;
+ bg::assign_values(p, 2, 0);
+
+ CalculationType const sqr_expected = 4;
+ CalculationType const expected = 2;
+
+
+ namespace bgsd = bg::strategy::distance;
+ namespace services = bg::strategy::distance::services;
+ // 1: normal, calculate distance:
+
+ typedef bgsd::projected_point<P, PS, CalculationType> strategy_type;
+
+ BOOST_CONCEPT_ASSERT( (bg::concept::PointSegmentDistanceStrategy<strategy_type>) );
+
+ typedef typename services::return_type<strategy_type>::type return_type;
+
+ strategy_type strategy;
+ return_type result = strategy.apply(p, p1, p2);
+ BOOST_CHECK_CLOSE(result, return_type(expected), 0.001);
+
+ // 2: "similar" to construct a similar strategy (similar but with other template-parameters) for, e.g., the reverse P2/P1
+ // 2a: similar_type:
+ typedef typename services::similar_type<strategy_type, P, PS>::type similar_type;
+ // 2b: get_similar
+ similar_type similar = services::get_similar<strategy_type, P, PS>::apply(strategy);
+
+ result = similar.apply(p, p1, p2);
+ BOOST_CHECK_CLOSE(result, return_type(expected), 0.001);
+
+
+ // 3: "comparable" to construct a "comparable strategy" for P1/P2
+ // a "comparable strategy" is a strategy which does not calculate the exact distance, but
+ // which returns results which can be mutually compared (e.g. avoid sqrt)
+
+ // 3a: "comparable_type"
+ typedef typename services::comparable_type<strategy_type>::type comparable_type;
+
+ // 3b: "get_comparable"
+ comparable_type comparable = bgsd::services::get_comparable<strategy_type>::apply(strategy);
+
+ return_type c_result = comparable.apply(p, p1, p2);
+ BOOST_CHECK_CLOSE(c_result, return_type(sqr_expected), 0.001);
+}
+
+
+template <typename P1, typename P2, typename T>
+void test_all_2d(std::string const& wkt_p,
+ std::string const& wkt_sp1,
+ std::string const& wkt_sp2,
+ T expected_distance)
+{
+ P1 p;
+ P2 sp1, sp2;
+ bg::read_wkt(wkt_p, p);
+ bg::read_wkt(wkt_sp1, sp1);
+ bg::read_wkt(wkt_sp2, sp2);
+
+ {
+ typedef bg::strategy::distance::projected_point
+ <
+ P1,
+ P2
+ > strategy_type;
+
+ BOOST_CONCEPT_ASSERT
+ (
+ (bg::concept::PointSegmentDistanceStrategy<strategy_type>)
+ );
+
+ strategy_type strategy;
+ typedef typename bg::strategy::distance::services::return_type<strategy_type>::type return_type;
+ return_type d = strategy.apply(p, sp1, sp2);
+ BOOST_CHECK_CLOSE(d, expected_distance, 0.001);
+ }
+
+ // Test combination with the comparable strategy
+ {
+ typedef bg::strategy::distance::projected_point
+ <
+ P1,
+ P2,
+ void,
+ bg::strategy::distance::comparable::pythagoras<P1, P2>
+ > strategy_type;
+ strategy_type strategy;
+ typedef typename bg::strategy::distance::services::return_type<strategy_type>::type return_type;
+ return_type d = strategy.apply(p, sp1, sp2);
+ T expected_squared_distance = expected_distance * expected_distance;
+ BOOST_CHECK_CLOSE(d, expected_squared_distance, 0.01);
+ }
+
+}
+
+template <typename P1, typename P2>
+void test_all_2d()
+{
+ test_all_2d<P1, P2>("POINT(1 1)", "POINT(0 0)", "POINT(2 3)", 0.27735203958327);
+ test_all_2d<P1, P2>("POINT(2 2)", "POINT(1 4)", "POINT(4 1)", 0.5 * sqrt(2.0));
+ test_all_2d<P1, P2>("POINT(6 1)", "POINT(1 4)", "POINT(4 1)", 2.0);
+ test_all_2d<P1, P2>("POINT(1 6)", "POINT(1 4)", "POINT(4 1)", 2.0);
+}
+
+template <typename P>
+void test_all_2d()
+{
+ //test_all_2d<P, int[2]>();
+ //test_all_2d<P, float[2]>();
+ //test_all_2d<P, double[2]>();
+ //test_all_2d<P, test::test_point>();
+ test_all_2d<P, bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_all_2d<P, bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_all_2d<P, bg::model::point<double, 2, bg::cs::cartesian> >();
+ test_all_2d<P, bg::model::point<long double, 2, bg::cs::cartesian> >();
+}
+
+int test_main(int, char* [])
+{
+ test_all_2d<int[2]>();
+ test_all_2d<float[2]>();
+ test_all_2d<double[2]>();
+ //test_all_2d<test::test_point>();
+
+ test_all_2d<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_all_2d<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_all_2d<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+ test_services
+ <
+ bg::model::point<double, 2, bg::cs::cartesian>,
+ bg::model::point<float, 2, bg::cs::cartesian>,
+ long double
+ >();
+
+
+#if defined(HAVE_TTMATH)
+ test_all_2d
+ <
+ bg::model::point<ttmath_big, 2, bg::cs::cartesian>,
+ bg::model::point<ttmath_big, 2, bg::cs::cartesian>
+ >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/strategies/projected_point.vcproj b/libs/geometry/test/strategies/projected_point.vcproj
new file mode 100644
index 000000000..0964383bf
--- /dev/null
+++ b/libs/geometry/test/strategies/projected_point.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="projected_point"
+ ProjectGUID="{A27A46D2-AAD2-47F9-86E2-21FF849EF2D4}"
+ RootNamespace="projected_point"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\projected_point"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\projected_point"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\projected_point.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/strategies/pythagoras.cpp b/libs/geometry/test/strategies/pythagoras.cpp
new file mode 100644
index 000000000..2b1f42886
--- /dev/null
+++ b/libs/geometry/test/strategies/pythagoras.cpp
@@ -0,0 +1,362 @@
+// 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.
+
+// 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>
+
+#if defined(_MSC_VER)
+# pragma warning( disable : 4101 )
+#endif
+
+#include <boost/timer.hpp>
+
+#include <boost/concept/requires.hpp>
+#include <boost/concept_check.hpp>
+
+#include <boost/geometry/algorithms/assign.hpp>
+#include <boost/geometry/strategies/cartesian/distance_pythagoras.hpp>
+#include <boost/geometry/strategies/concepts/distance_concept.hpp>
+
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+#include <test_common/test_point.hpp>
+
+#ifdef HAVE_TTMATH
+# include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
+#endif
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+template <typename P1, typename P2>
+void test_null_distance_3d()
+{
+ P1 p1;
+ bg::assign_values(p1, 1, 2, 3);
+ P2 p2;
+ bg::assign_values(p2, 1, 2, 3);
+
+ typedef bg::strategy::distance::pythagoras<P1, P2> pythagoras_type;
+ typedef typename bg::strategy::distance::services::return_type<pythagoras_type>::type return_type;
+
+ pythagoras_type pythagoras;
+ return_type result = pythagoras.apply(p1, p2);
+
+ BOOST_CHECK_EQUAL(result, return_type(0));
+}
+
+template <typename P1, typename P2>
+void test_axis_3d()
+{
+ P1 p1;
+ bg::assign_values(p1, 0, 0, 0);
+ P2 p2;
+ bg::assign_values(p2, 1, 0, 0);
+
+ typedef bg::strategy::distance::pythagoras<P1, P2> pythagoras_type;
+ typedef typename bg::strategy::distance::services::return_type<pythagoras_type>::type return_type;
+
+ pythagoras_type pythagoras;
+
+ return_type result = pythagoras.apply(p1, p2);
+ BOOST_CHECK_EQUAL(result, return_type(1));
+
+ bg::assign_values(p2, 0, 1, 0);
+ result = pythagoras.apply(p1, p2);
+ BOOST_CHECK_EQUAL(result, return_type(1));
+
+ bg::assign_values(p2, 0, 0, 1);
+ result = pythagoras.apply(p1, p2);
+ BOOST_CHECK_CLOSE(result, return_type(1), 0.001);
+}
+
+template <typename P1, typename P2>
+void test_arbitrary_3d()
+{
+ P1 p1;
+ bg::assign_values(p1, 1, 2, 3);
+ P2 p2;
+ bg::assign_values(p2, 9, 8, 7);
+
+ {
+ typedef bg::strategy::distance::pythagoras<P1, P2> strategy_type;
+ typedef typename bg::strategy::distance::services::return_type<strategy_type>::type return_type;
+
+ strategy_type strategy;
+ return_type result = strategy.apply(p1, p2);
+ BOOST_CHECK_CLOSE(result, return_type(10.77032961427), 0.001);
+ }
+
+ {
+ // Check comparable distance
+ typedef bg::strategy::distance::comparable::pythagoras<P1, P2> strategy_type;
+ typedef typename bg::strategy::distance::services::return_type<strategy_type>::type return_type;
+
+ strategy_type strategy;
+ return_type result = strategy.apply(p1, p2);
+ BOOST_CHECK_EQUAL(result, return_type(116));
+ }
+}
+
+template <typename P1, typename P2, typename CalculationType>
+void test_services()
+{
+ namespace bgsd = bg::strategy::distance;
+ namespace services = bg::strategy::distance::services;
+
+ {
+
+ // Compile-check if there is a strategy for this type
+ typedef typename services::default_strategy<bg::point_tag, P1, P2>::type pythagoras_strategy_type;
+ }
+
+
+ P1 p1;
+ bg::assign_values(p1, 1, 2, 3);
+
+ P2 p2;
+ bg::assign_values(p2, 4, 5, 6);
+
+ double const sqr_expected = 3*3 + 3*3 + 3*3; // 27
+ double const expected = sqrt(sqr_expected); // sqrt(27)=5.1961524227
+
+ // 1: normal, calculate distance:
+
+ typedef bgsd::pythagoras<P1, P2, CalculationType> strategy_type;
+
+ BOOST_CONCEPT_ASSERT( (bg::concept::PointDistanceStrategy<strategy_type>) );
+
+ typedef typename bgsd::services::return_type<strategy_type>::type return_type;
+
+ strategy_type strategy;
+ return_type result = strategy.apply(p1, p2);
+ BOOST_CHECK_CLOSE(result, return_type(expected), 0.001);
+
+ // 2: "similar" to construct a similar strategy (similar but with other template-parameters) for, e.g., the reverse P2/P1
+ // 2a: similar_type:
+ typedef typename services::similar_type<strategy_type, P2, P1>::type similar_type;
+ // 2b: get_similar
+ similar_type similar = services::get_similar<strategy_type, P2, P1>::apply(strategy);
+
+ //result = similar.apply(p1, p2); // should NOT compile because p1/p2 should also be reversed here
+ result = similar.apply(p2, p1);
+ BOOST_CHECK_CLOSE(result, return_type(expected), 0.001);
+
+
+ // 3: "comparable" to construct a "comparable strategy" for P1/P2
+ // a "comparable strategy" is a strategy which does not calculate the exact distance, but
+ // which returns results which can be mutually compared (e.g. avoid sqrt)
+
+ // 3a: "comparable_type"
+ typedef typename services::comparable_type<strategy_type>::type comparable_type;
+
+ // 3b: "get_comparable"
+ comparable_type comparable = bgsd::services::get_comparable<strategy_type>::apply(strategy);
+
+ return_type c_result = comparable.apply(p1, p2);
+ BOOST_CHECK_CLOSE(c_result, return_type(sqr_expected), 0.001);
+
+ // 4: the comparable_type should have a distance_strategy_constructor as well,
+ // knowing how to compare something with a fixed distance
+ return_type c_dist5 = services::result_from_distance<comparable_type>::apply(comparable, 5.0);
+ return_type c_dist6 = services::result_from_distance<comparable_type>::apply(comparable, 6.0);
+
+ // If this is the case:
+ BOOST_CHECK(c_dist5 < c_result && c_result < c_dist6);
+
+ // This should also be the case
+ return_type dist5 = services::result_from_distance<strategy_type>::apply(strategy, 5.0);
+ return_type dist6 = services::result_from_distance<strategy_type>::apply(strategy, 6.0);
+ BOOST_CHECK(dist5 < result && result < dist6);
+}
+
+
+template <typename CoordinateType, typename CalculationType, typename AssignType>
+void test_big_2d_with(AssignType const& x1, AssignType const& y1,
+ AssignType const& x2, AssignType const& y2)
+{
+ typedef bg::model::point<CoordinateType, 2, bg::cs::cartesian> point_type;
+ typedef bg::strategy::distance::pythagoras
+ <
+ point_type,
+ point_type,
+ CalculationType
+ > pythagoras_type;
+
+ pythagoras_type pythagoras;
+ typedef typename bg::strategy::distance::services::return_type<pythagoras_type>::type return_type;
+
+
+ point_type p1, p2;
+ bg::assign_values(p1, x1, y1);
+ bg::assign_values(p2, x2, y2);
+ return_type d = pythagoras.apply(p1, p2);
+
+ /***
+ std::cout << typeid(CalculationType).name()
+ << " " << std::fixed << std::setprecision(20) << d
+ << std::endl << std::endl;
+ ***/
+
+
+ BOOST_CHECK_CLOSE(d, return_type(1076554.5485833955678294387789057), 0.001);
+}
+
+template <typename CoordinateType, typename CalculationType>
+void test_big_2d()
+{
+ test_big_2d_with<CoordinateType, CalculationType>
+ (123456.78900001, 234567.89100001,
+ 987654.32100001, 876543.21900001);
+}
+
+template <typename CoordinateType, typename CalculationType>
+void test_big_2d_string()
+{
+ test_big_2d_with<CoordinateType, CalculationType>
+ ("123456.78900001", "234567.89100001",
+ "987654.32100001", "876543.21900001");
+}
+
+template <typename CoordinateType>
+void test_integer(bool check_types)
+{
+ typedef bg::model::point<CoordinateType, 2, bg::cs::cartesian> point_type;
+
+ point_type p1, p2;
+ bg::assign_values(p1, 12345678, 23456789);
+ bg::assign_values(p2, 98765432, 87654321);
+
+ typedef bg::strategy::distance::pythagoras
+ <
+ point_type
+ > pythagoras_type;
+ pythagoras_type pythagoras;
+ BOOST_AUTO(distance, pythagoras.apply(p1, p2));
+ BOOST_CHECK_CLOSE(distance, 107655455.02347542, 0.001);
+
+ typedef typename bg::strategy::distance::services::comparable_type
+ <
+ pythagoras_type
+ >::type comparable_type;
+ comparable_type comparable;
+ BOOST_AUTO(cdistance, comparable.apply(p1, p2));
+ BOOST_CHECK_EQUAL(cdistance, 11589696996311540);
+
+ typedef BOOST_TYPEOF(cdistance) cdistance_type;
+ typedef BOOST_TYPEOF(distance) distance_type;
+
+ distance_type distance2 = sqrt(distance_type(cdistance));
+ BOOST_CHECK_CLOSE(distance, distance2, 0.001);
+
+ if (check_types)
+ {
+ BOOST_CHECK((boost::is_same<distance_type, double>::type::value));
+ BOOST_CHECK((boost::is_same<cdistance_type, boost::long_long_type>::type::value));
+ }
+}
+
+
+template <typename P1, typename P2>
+void test_all_3d()
+{
+ test_null_distance_3d<P1, P2>();
+ test_axis_3d<P1, P2>();
+ test_arbitrary_3d<P1, P2>();
+}
+
+template <typename P>
+void test_all_3d()
+{
+ test_all_3d<P, int[3]>();
+ test_all_3d<P, float[3]>();
+ test_all_3d<P, double[3]>();
+ test_all_3d<P, test::test_point>();
+ test_all_3d<P, bg::model::point<int, 3, bg::cs::cartesian> >();
+ test_all_3d<P, bg::model::point<float, 3, bg::cs::cartesian> >();
+ test_all_3d<P, bg::model::point<double, 3, bg::cs::cartesian> >();
+}
+
+template <typename P, typename Strategy>
+void time_compare_s(int const n)
+{
+ boost::timer t;
+ P p1, p2;
+ bg::assign_values(p1, 1, 1);
+ bg::assign_values(p2, 2, 2);
+ Strategy strategy;
+ typename bg::strategy::distance::services::return_type<Strategy>::type s = 0;
+ for (int i = 0; i < n; i++)
+ {
+ for (int j = 0; j < n; j++)
+ {
+ bg::set<0>(p2, bg::get<0>(p2) + 0.001);
+ s += strategy.apply(p1, p2);
+ }
+ }
+ std::cout << "s: " << s << " t: " << t.elapsed() << std::endl;
+}
+
+template <typename P>
+void time_compare(int const n)
+{
+ time_compare_s<P, bg::strategy::distance::pythagoras<P> >(n);
+ time_compare_s<P, bg::strategy::distance::comparable::pythagoras<P> >(n);
+}
+
+int test_main(int, char* [])
+{
+ test_integer<int>(true);
+ test_integer<boost::long_long_type>(true);
+ test_integer<double>(false);
+
+ test_all_3d<int[3]>();
+ test_all_3d<float[3]>();
+ test_all_3d<double[3]>();
+
+ test_all_3d<test::test_point>();
+
+ test_all_3d<bg::model::point<int, 3, bg::cs::cartesian> >();
+ test_all_3d<bg::model::point<float, 3, bg::cs::cartesian> >();
+ test_all_3d<bg::model::point<double, 3, bg::cs::cartesian> >();
+
+ test_big_2d<float, float>();
+ test_big_2d<double, double>();
+ test_big_2d<long double, long double>();
+ test_big_2d<float, long double>();
+
+ test_services<bg::model::point<float, 3, bg::cs::cartesian>, double[3], long double>();
+ test_services<double[3], test::test_point, float>();
+
+
+ // TODO move this to another non-unit test
+ // time_compare<bg::model::point<double, 2, bg::cs::cartesian> >(10000);
+
+#if defined(HAVE_TTMATH)
+
+ typedef ttmath::Big<1,4> tt;
+ typedef bg::model::point<tt, 3, bg::cs::cartesian> tt_point;
+
+ //test_all_3d<tt[3]>();
+ test_all_3d<tt_point>();
+ test_all_3d<tt_point, tt_point>();
+ test_big_2d<tt, tt>();
+ test_big_2d_string<tt, tt>();
+#endif
+ return 0;
+}
diff --git a/libs/geometry/test/strategies/pythagoras.vcproj b/libs/geometry/test/strategies/pythagoras.vcproj
new file mode 100644
index 000000000..7dedcaaa0
--- /dev/null
+++ b/libs/geometry/test/strategies/pythagoras.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="pythagoras"
+ ProjectGUID="{763CA955-FC01-4AFD-9593-69D36836B3F7}"
+ RootNamespace="pythagoras"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\pythagoras"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\pythagoras"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\pythagoras.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/strategies/segment_intersection.cpp b/libs/geometry/test/strategies/segment_intersection.cpp
new file mode 100644
index 000000000..c0191c18f
--- /dev/null
+++ b/libs/geometry/test/strategies/segment_intersection.cpp
@@ -0,0 +1,374 @@
+// 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.
+
+// 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)
+
+
+#if defined(_MSC_VER)
+// We deliberately mix float/double's here so turn off warning
+#pragma warning( disable : 4244 )
+#endif // defined(_MSC_VER)
+
+#define HAVE_MATRIX_AS_STRING
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/assign.hpp>
+
+#include <boost/geometry/strategies/cartesian/cart_intersect.hpp>
+#include <boost/geometry/strategies/intersection_result.hpp>
+
+#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>
+
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/segment.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian);
+
+
+template <typename R>
+void print_is(R const& is)
+{
+#ifdef REPORT
+ for (int i = 0; i < is.count; i++)
+ {
+ std::cout
+ << " (" << bg::get<0>(is.intersections[i])
+ << "," << bg::get<1>(is.intersections[i])
+ << ")";
+ }
+#endif
+}
+/*
+void print_im(bg::de9im const& im)
+{
+#ifdef REPORT
+ if (im.equals()) std::cout << " EQUALS";
+ if (im.disjoint()) std::cout << " DISJOINT";
+ if (im.intersects()) std::cout << " INTERSECTS";
+ if (im.touches()) std::cout << " TOUCHES";
+ if (im.crosses()) std::cout << " CROSSES";
+ if (im.overlaps()) std::cout << " OVERLAPS";
+ if (im.within()) std::cout << " WITHIN";
+ if (im.contains()) std::cout << " CONTAINS";
+
+ //std::cout << " ra=" << im.ra << " rb=" << im.rb;
+#endif
+}
+*/
+
+template <typename P>
+static void test_segment_intersection(int caseno,
+ int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4,
+ std::string const& expected_matrix,
+ std::string const& expected_characteristic,
+ std::string const& expected_direction_a = "",
+ std::string const& expected_direction_b = "",
+ int expected_x1 = -99, int expected_y1 = -99,
+ int expected_x2 = -99, int expected_y2 = -99)
+{
+ using namespace boost::geometry;
+
+#ifdef REPORT
+ std::cout << "CASE " << caseno << std::endl;
+#endif
+
+ typedef typename bg::coordinate_type<P>::type coordinate_type;
+ typedef bg::model::referring_segment<const P> segment_type;
+
+ P p1, p2, p3, p4;
+ bg::assign_values(p1, x1, y1);
+ bg::assign_values(p2, x2, y2);
+ bg::assign_values(p3, x3, y3);
+ bg::assign_values(p4, x4, y4);
+
+ segment_type s12(p1,p2);
+ segment_type s34(p3,p4);
+
+ // Get the intersection point (or two points)
+ segment_intersection_points<P> is
+ = strategy::intersection::relate_cartesian_segments
+ <
+ policies::relate::segments_intersection_points
+ <
+ segment_type,
+ segment_type,
+ segment_intersection_points<P>
+ >
+ >::apply(s12, s34);
+
+ // Get the Dimension Extended 9 Intersection Matrix (de9im) for Segments
+ // (this one is extended by GGL having opposite)
+ /***
+ TODO TO BE UPDATED (if necessary) OR DELETED
+ de9im_segment matrix = strategy::intersection::relate_cartesian_segments
+ <
+ policies::relate::segments_de9im<segment_type, segment_type>
+ >::apply(s12, s34);
+ ***/
+
+ // Get just a character for Left/Right/intersects/etc, purpose is more for debugging
+ policies::relate::direction_type dir = strategy::intersection::relate_cartesian_segments
+ <
+ policies::relate::segments_direction<segment_type, segment_type>
+ >::apply(s12, s34);
+
+ int expected_count = 0;
+
+ if (expected_x1 != -99 && expected_y1 != -99)
+ {
+ expected_count++;
+
+ BOOST_CHECK(is.count >= 1);
+ BOOST_CHECK_CLOSE(bg::get<0>(is.intersections[0]),
+ coordinate_type(expected_x1), 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(is.intersections[0]),
+ coordinate_type(expected_y1), 0.001);
+ }
+ if (expected_x2 != -99 && expected_y2 != -99)
+ {
+ expected_count++;
+
+ BOOST_CHECK(is.count >= 2);
+ BOOST_CHECK_CLOSE(bg::get<0>(is.intersections[1]),
+ coordinate_type(expected_x2), 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(is.intersections[1]),
+ coordinate_type(expected_y2), 0.001);
+ }
+ BOOST_CHECK_EQUAL(is.count, expected_count);
+
+ //BOOST_CHECK_EQUAL(expected_matrix, matrix.matrix_as_string());
+
+ std::string characteristic;
+ characteristic += dir.how;
+
+ BOOST_CHECK_EQUAL(characteristic, expected_characteristic);
+
+ if (!expected_direction_a.empty())
+ {
+ BOOST_CHECK_EQUAL(dir.dir_a == 1 ? "L"
+ : dir.dir_a == -1 ? "R"
+ : "-", expected_direction_a);
+ }
+ if (!expected_direction_b.empty())
+ {
+ BOOST_CHECK_EQUAL(dir.dir_b == 1 ? "L"
+ : dir.dir_b == -1 ? "R"
+ : "-", expected_direction_b);
+ }
+
+
+
+ // Things can also be used together
+ // -> intersection is only once calculated, two results
+ /***
+ typedef boost::tuple
+ <
+ de9im_segment,
+ policies::relate::direction_type
+ > tup;
+
+ tup t = strategy::intersection::relate_cartesian_segments
+ <
+ policies::relate::segments_tupled
+ <
+ policies::relate::segments_de9im<segment_type, segment_type>,
+ policies::relate::segments_direction<segment_type, segment_type>
+ >
+ >::apply(segment_type(p1,p2), segment_type(p3,p4));
+
+
+ //BOOST_CHECK_EQUAL(t.get<0>().matrix_as_string(), matrix.matrix_as_string());
+ BOOST_CHECK_EQUAL(t.get<1>().how, dir.how);
+ */
+
+#ifdef REPORT
+ //std::cout << std::endl << "\t" << matrix.as_string() << " ";
+ std::cout << "METHOD=" << c << " ";
+ print_is(is);
+ //print_im(matrix);
+ std::cout << std::endl;
+#endif
+
+ /*
+ To check with a spatial database: issue this statement
+ std::cout << "select relate("
+ << "GeomFromText(LINESTRING('" << x1 << " " << y1 << "," << x2 << " " << y2 << ")')"
+ << ", "
+ << "GeomFromText(LINESTRING('" << x3 << " " << y3 << "," << x4 << " " << y4 << ")')"
+ << ");"
+ << std::endl;
+ */
+
+
+ // Now use generic intersection.
+ std::vector<P> out;
+ bg::detail::intersection::intersection_insert<P>(s12, s34, std::back_inserter(out));
+
+ BOOST_CHECK_EQUAL(boost::size(out), expected_count);
+
+ if (expected_x1 != -99 && expected_y1 != -99
+ && is.count >= 1
+ && boost::size(out) >= 1)
+ {
+ BOOST_CHECK_CLOSE(bg::get<0>(out[0]),
+ coordinate_type(expected_x1), 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(out[0]),
+ coordinate_type(expected_y1), 0.001);
+ }
+ if (expected_x2 != -99 && expected_y2 != -99
+ && is.count >= 2
+ && boost::size(out) >= 2)
+ {
+ BOOST_CHECK_CLOSE(bg::get<0>(out[1]),
+ coordinate_type(expected_x2), 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(out[1]),
+ coordinate_type(expected_y2), 0.001);
+ }
+}
+
+
+template <typename P>
+void test_all()
+{
+ test_segment_intersection<P>( 1, 0,2, 2,0, 0,0, 2,2, "0-1--0102",
+ "i", "R", "L", 1, 1);
+ test_segment_intersection<P>( 2, 2,2, 3,1, 0,0, 2,2, "--1-00102",
+ "a", "R", "R", 2, 2);
+ test_segment_intersection<P>( 3, 3,1, 2,2, 0,0, 2,2, "--1-00102",
+ "t", "R", "L", 2, 2);
+ test_segment_intersection<P>( 4, 0,2, 1,1, 0,0, 2,2, "--10-0102",
+ "m", "L", "L", 1, 1);
+#ifdef REPORT
+ std::cout << std::endl;
+#endif
+
+ test_segment_intersection<P>( 5, 1,1, 0,2, 0,0, 2,2, "--10-0102",
+ "s", "L", "R", 1, 1);
+ test_segment_intersection<P>( 6, 0,2, 2,0, 0,0, 1,1, "-01--0102",
+ "m", "R", "R", 1, 1);
+ test_segment_intersection<P>( 7, 2,0, 0,2, 0,0, 1,1, "-01--0102",
+ "m", "L", "L", 1, 1);
+ test_segment_intersection<P>( 8, 2,3, 3,2, 0,0, 2,2, "--1--0102",
+ "d");
+#ifdef REPORT
+ std::cout << std::endl;
+#endif
+
+ test_segment_intersection<P>( 9, 0,0, 2,2, 0,0, 2,2, "1---0---2",
+ "e", "-", "-", 0, 0, 2, 2);
+ test_segment_intersection<P>(10, 2,2, 0,0, 0,0, 2,2, "1---0---2",
+ "e", "-", "-", 2, 2, 0, 0);
+ test_segment_intersection<P>(11, 1,1, 3,3, 0,0, 2,2, "1010-0102",
+ "c", "-", "-", 1, 1, 2, 2);
+ test_segment_intersection<P>(12, 3,3, 1,1, 0,0, 2,2, "1010-0102",
+ "c", "-", "-", 1, 1, 2, 2);
+#ifdef REPORT
+ std::cout << std::endl;
+#endif
+
+ test_segment_intersection<P>(13, 0,2, 2,2, 2,1, 2,3, "--10-0102",
+ "m", "L", "L", 2, 2);
+ test_segment_intersection<P>(14, 2,2, 2,4, 2,0, 2,2, "--1-00102",
+ "C", "-", "-", 2, 2);
+ test_segment_intersection<P>(15, 2,2, 2,4, 2,0, 2,1, "--1--0102",
+ "d");
+ test_segment_intersection<P>(16, 2,4, 2,2, 2,0, 2,1, "--1--0102",
+ "d");
+
+ test_segment_intersection<P>(17, 2,1, 2,3, 2,2, 2,4, "1010-0102",
+ "c", "-", "-", 2, 3, 2, 2);
+ test_segment_intersection<P>(18, 2,3, 2,1, 2,2, 2,4, "1010-0102",
+ "c", "-", "-", 2, 3, 2, 2);
+ test_segment_intersection<P>(19, 0,2, 2,2, 4,2, 2,2, "--1-00102",
+ "C", "-", "-", 2, 2);
+ test_segment_intersection<P>(20, 0,2, 2,2, 2,2, 4,2, "--1-00102",
+ "C", "-", "-", 2, 2);
+
+ test_segment_intersection<P>(21, 1,2, 3,2, 2,1, 2,3, "0-1--0102",
+ "i", "R", "L", 2, 2);
+ test_segment_intersection<P>(22, 2,4, 2,1, 2,1, 2,3, "101-00--2",
+ "c", "-", "-", 2, 1, 2, 3);
+ test_segment_intersection<P>(23, 2,4, 2,1, 2,3, 2,1, "101-00--2",
+ "c", "-", "-", 2, 3, 2, 1);
+ test_segment_intersection<P>(24, 1,1, 3,3, 0,0, 3,3, "1--00-102",
+ "c", "-", "-", 1, 1, 3, 3);
+
+ test_segment_intersection<P>(25, 2,0, 2,4, 2,1, 2,3, "101--0--2",
+ "c", "-", "-", 2, 1, 2, 3);
+ test_segment_intersection<P>(26, 2,0, 2,4, 2,3, 2,1, "101--0--2",
+ "c", "-", "-", 2, 3, 2, 1);
+ test_segment_intersection<P>(27, 0,0, 4,4, 1,1, 3,3, "101--0--2",
+ "c", "-", "-", 1, 1, 3, 3);
+ test_segment_intersection<P>(28, 0,0, 4,4, 3,3, 1,1, "101--0--2",
+ "c", "-", "-", 3, 3, 1, 1);
+
+ test_segment_intersection<P>(29, 1,1, 3,3, 0,0, 4,4, "1--0--102",
+ "c", "-", "-", 1, 1, 3, 3);
+ test_segment_intersection<P>(30, 0,0, 2,2, 2,2, 3,1, "--1-00102",
+ "a", "R", "R", 2, 2);
+ test_segment_intersection<P>(31, 0,0, 2,2, 2,2, 1,3, "--1-00102",
+ "a", "L", "L", 2, 2);
+ test_segment_intersection<P>(32, 0,0, 2,2, 1,1, 2,0, "-01--0102",
+ "s", "L", "R", 1, 1);
+
+ test_segment_intersection<P>(33, 0,0, 2,2, 1,1, 0,2, "-01--0102",
+ "s", "R", "L", 1, 1);
+ test_segment_intersection<P>(34, 2,2, 1,3, 0,0, 2,2, "--1-00102",
+ "a", "L", "L", 2, 2);
+ test_segment_intersection<P>(35, 2,2, 3,1, 0,0, 2,2, "--1-00102",
+ "a", "R", "R", 2, 2);
+ test_segment_intersection<P>(36, 0,0, 2,2, 0,2, 1,1, "-01--0102",
+ "m", "L", "L", 1, 1);
+
+ test_segment_intersection<P>(37, 0,0, 2,2, 2,0, 1,1, "-01--0102",
+ "m", "R", "R", 1, 1);
+ test_segment_intersection<P>(38, 1,1, 0,2, 0,0, 2,2, "--10-0102",
+ "s", "L", "R", 1, 1);
+ test_segment_intersection<P>(39, 1,1, 2,0, 0,0, 2,2, "--10-0102",
+ "s", "R", "L", 1, 1);
+ test_segment_intersection<P>(40, 2,0, 1,1, 0,0, 2,2, "--10-0102",
+ "m", "R", "R", 1, 1);
+
+ test_segment_intersection<P>(41, 1,2, 0,2, 2,2, 0,2, "1--00-102",
+ "c", "-", "-", 1, 2, 0, 2);
+ test_segment_intersection<P>(42, 2,1, 1,1, 2,2, 0,2, "--1--0102",
+ "p");
+ test_segment_intersection<P>(43, 4,1, 3,1, 2,2, 0,2, "--1--0102",
+ "p");
+ test_segment_intersection<P>(44, 4,2, 3,2, 2,2, 0,2, "--1--0102",
+ "d");
+
+ test_segment_intersection<P>(45, 2,0, 0,2, 0,0, 2,2, "0-1--0102",
+ "i", "L", "R", 1, 1);
+
+ // In figure: times 2
+ test_segment_intersection<P>(46, 8,2, 4,6, 0,0, 8, 8, "0-1--0102",
+ "i", "L", "R", 5, 5);
+}
+
+int test_main(int, char* [])
+{
+ std::cout << "Note this test is out-of-date and either obsolete or should be updated" << std::endl;
+ test_all<boost::tuple<double, double> >();
+ test_all<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
+ return 0;
+}
diff --git a/libs/geometry/test/strategies/segment_intersection.vcproj b/libs/geometry/test/strategies/segment_intersection.vcproj
new file mode 100644
index 000000000..6ce11dee0
--- /dev/null
+++ b/libs/geometry/test/strategies/segment_intersection.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="segment_intersection"
+ ProjectGUID="{4CCCD6BD-E77F-4A7B-BD9D-89ED2E213309}"
+ RootNamespace="segment_intersection"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\segment_intersection"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\segment_intersection"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\segment_intersection.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/strategies/segment_intersection_collinear.cpp b/libs/geometry/test/strategies/segment_intersection_collinear.cpp
new file mode 100644
index 000000000..0466c0955
--- /dev/null
+++ b/libs/geometry/test/strategies/segment_intersection_collinear.cpp
@@ -0,0 +1,256 @@
+// 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.
+
+// 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/geometry/algorithms/assign.hpp>
+
+#include <boost/geometry/strategies/cartesian/cart_intersect.hpp>
+#include <boost/geometry/strategies/intersection_result.hpp>
+
+#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>
+
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/segment.hpp>
+
+template <typename IntersectionPoints>
+static int check(IntersectionPoints const& is,
+ std::size_t index, double expected_x, double expected_y)
+{
+ if (expected_x != -99 && expected_y != -99 && is.count > index)
+ {
+ double x = bg::get<0>(is.intersections[index]);
+ double y = bg::get<1>(is.intersections[index]);
+
+ BOOST_CHECK_CLOSE(x, expected_x, 0.001);
+ BOOST_CHECK_CLOSE(y, expected_y, 0.001);
+ return 1;
+ }
+ return 0;
+}
+
+
+template <typename P>
+static void test_segment_intersection(std::string const& case_id,
+ int x1, int y1, int x2, int y2,
+ int x3, int y3, int x4, int y4,
+ char expected_how, bool expected_opposite,
+ int expected_arrival1, int expected_arrival2,
+ int expected_x1, int expected_y1,
+ int expected_x2 = -99, int expected_y2 = -99)
+
+{
+ typedef typename bg::coordinate_type<P>::type coordinate_type;
+ typedef bg::model::referring_segment<const P> segment_type;
+
+ P p1, p2, p3, p4;
+ bg::assign_values(p1, x1, y1);
+ bg::assign_values(p2, x2, y2);
+ bg::assign_values(p3, x3, y3);
+ bg::assign_values(p4, x4, y4);
+
+ segment_type s12(p1,p2);
+ segment_type s34(p3,p4);
+
+ // Get the intersection point (or two points)
+ bg::segment_intersection_points<P> is
+ = bg::strategy::intersection::relate_cartesian_segments
+ <
+ bg::policies::relate::segments_intersection_points
+ <
+ segment_type,
+ segment_type,
+ bg::segment_intersection_points<P>
+ >
+ >::apply(s12, s34);
+
+ // Get just a character for Left/Right/intersects/etc, purpose is more for debugging
+ bg::policies::relate::direction_type dir
+ = bg::strategy::intersection::relate_cartesian_segments
+ <
+ bg::policies::relate::segments_direction
+ <
+ segment_type,
+ segment_type
+ >
+ >::apply(s12, s34);
+
+ int expected_count =
+ check(is, 0, expected_x1, expected_y1)
+ + check(is, 1, expected_x2, expected_y2);
+
+ BOOST_CHECK_EQUAL(is.count, expected_count);
+ BOOST_CHECK_EQUAL(dir.how, expected_how);
+ BOOST_CHECK_EQUAL(dir.opposite, expected_opposite);
+ BOOST_CHECK_EQUAL(dir.arrival[0], expected_arrival1);
+ BOOST_CHECK_EQUAL(dir.arrival[1], expected_arrival2);
+}
+
+
+template <typename P>
+void test_all()
+{
+ // Collinear - non opposite
+
+ // a1---------->a2
+ // b1--->b2
+ test_segment_intersection<P>("n1",
+ 2, 0, 6, 0,
+ 0, 0, 2, 0,
+ 'a', false, -1, 0,
+ 2, 0);
+
+ // a1---------->a2
+ // b1--->b2
+ test_segment_intersection<P>("n2",
+ 2, 0, 6, 0,
+ 1, 0, 3, 0,
+ 'c', false, -1, 1,
+ 2, 0, 3, 0);
+
+ // a1---------->a2
+ // b1--->b2
+ test_segment_intersection<P>("n3",
+ 2, 0, 6, 0,
+ 2, 0, 4, 0,
+ 'c', false, -1, 1,
+ 2, 0, 4, 0);
+
+ // a1---------->a2
+ // b1--->b2
+ test_segment_intersection<P>("n4",
+ 2, 0, 6, 0,
+ 3, 0, 5, 0,
+ 'c', false, -1, 1,
+ 3, 0, 5, 0);
+
+ // a1---------->a2
+ // b1--->b2
+ test_segment_intersection<P>("n5",
+ 2, 0, 6, 0,
+ 4, 0, 6, 0,
+ 'c', false, 0, 0,
+ 4, 0, 6, 0);
+
+ // a1---------->a2
+ // b1--->b2
+ test_segment_intersection<P>("n6",
+ 2, 0, 6, 0,
+ 5, 0, 7, 0,
+ 'c', false, 1, -1,
+ 5, 0, 6, 0);
+
+ // a1---------->a2
+ // b1--->b2
+ test_segment_intersection<P>("n7",
+ 2, 0, 6, 0,
+ 6, 0, 8, 0,
+ 'a', false, 0, -1,
+ 6, 0);
+
+ // Collinear - opposite
+ // a1---------->a2
+ // b2<---b1
+ test_segment_intersection<P>("o1",
+ 2, 0, 6, 0,
+ 2, 0, 0, 0,
+ 'f', true, -1, -1,
+ 2, 0);
+
+ // a1---------->a2
+ // b2<---b1
+ test_segment_intersection<P>("o2",
+ 2, 0, 6, 0,
+ 3, 0, 1, 0,
+ 'c', true, -1, -1,
+ 2, 0, 3, 0);
+
+ // a1---------->a2
+ // b2<---b1
+ test_segment_intersection<P>("o3",
+ 2, 0, 6, 0,
+ 4, 0, 2, 0,
+ 'c', true, -1, 0,
+ 2, 0, 4, 0);
+
+ // a1---------->a2
+ // b2<---b1
+ test_segment_intersection<P>("o4",
+ 2, 0, 6, 0,
+ 5, 0, 3, 0,
+ 'c', true, -1, 1,
+ 3, 0, 5, 0);
+
+ // a1---------->a2
+ // b2<---b1
+ test_segment_intersection<P>("o5",
+ 2, 0, 6, 0,
+ 6, 0, 4, 0,
+ 'c', true, 0, 1,
+ 4, 0, 6, 0);
+
+ // a1---------->a2
+ // b2<---b1
+ test_segment_intersection<P>("o6",
+ 2, 0, 6, 0,
+ 7, 0, 5, 0,
+ 'c', true, 1, 1,
+ 5, 0, 6, 0);
+
+ // a1---------->a2
+ // b2<---b1
+ test_segment_intersection<P>("o7",
+ 2, 0, 6, 0,
+ 8, 0, 6, 0,
+ 't', true, 0, 0,
+ 6, 0);
+
+ // a1---------->a2
+ // b1---------->b2
+ test_segment_intersection<P>("e1",
+ 2, 0, 6, 0,
+ 2, 0, 6, 0,
+ 'e', false, 0, 0,
+ 2, 0, 6, 0);
+
+ // a1---------->a2
+ // b2<----------b1
+ test_segment_intersection<P>("e1",
+ 2, 0, 6, 0,
+ 6, 0, 2, 0,
+ 'e', true, 0, 0,
+ 2, 0, 6, 0);
+
+ // a1---------->a2
+ // b2<----------b1
+ test_segment_intersection<P>("case_recursive_boxes_1",
+ 10, 7, 10, 6,
+ 10, 10, 10, 9,
+ 'd', false, 0, 0,
+ -1, -1, -1, -1);
+
+}
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
+ return 0;
+}
diff --git a/libs/geometry/test/strategies/segment_intersection_collinear.vcproj b/libs/geometry/test/strategies/segment_intersection_collinear.vcproj
new file mode 100644
index 000000000..0d479586f
--- /dev/null
+++ b/libs/geometry/test/strategies/segment_intersection_collinear.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="segment_intersection_collinear"
+ ProjectGUID="{2D0CB6D3-6ABC-4119-A235-66E6065A279E}"
+ RootNamespace="segment_intersection_collinear"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\segment_intersection_collinear"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\segment_intersection_collinear"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\segment_intersection_collinear.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/strategies/spherical_side.cpp b/libs/geometry/test/strategies/spherical_side.cpp
new file mode 100644
index 000000000..d2d114440
--- /dev/null
+++ b/libs/geometry/test/strategies/spherical_side.cpp
@@ -0,0 +1,142 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 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/assign.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/core/cs.hpp>
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/segment.hpp>
+
+
+namespace boost { namespace geometry {
+
+template <typename Vector, typename Point1, typename Point2>
+static inline Vector create_vector(Point1 const& p1, Point2 const& p2)
+{
+ Vector v;
+ convert(p1, v);
+ subtract_point(v, p2);
+ return v;
+}
+
+}}
+
+inline char side_char(int side)
+{
+ return side == 1 ? 'L'
+ : side == -1 ? 'R'
+ : '-'
+ ;
+}
+
+template <typename Point>
+void test_side1(std::string const& case_id, Point const& p1, Point const& p2, Point const& p3,
+ int expected, int expected_cartesian)
+{
+ // std::cout << case_id << ": ";
+ //int s = bg::strategy::side::side_via_plane<>::apply(p1, p2, p3);
+ int side_ssf = bg::strategy::side::spherical_side_formula<>::apply(p1, p2, p3);
+ //int side2 = bg::strategy::side::side_via_plane<>::apply(p1, p2, p3);
+ int side_ct = bg::strategy::side::side_by_cross_track<>::apply(p1, p2, p3);
+
+ typedef bg::strategy::side::services::default_strategy<bg::cartesian_tag>::type cartesian_strategy;
+ int side_cart = cartesian_strategy::apply(p1, p2, p3);
+
+
+ BOOST_CHECK_EQUAL(side_ssf, expected);
+ BOOST_CHECK_EQUAL(side_ct, expected);
+ BOOST_CHECK_EQUAL(side_cart, expected_cartesian);
+ /*
+ std::cout
+ << "exp: " << side_char(expected)
+ << " ssf: " << side_char(side1)
+ << " pln: " << side_char(side2)
+ << " ct: " << side_char(side3)
+ //<< " def: " << side_char(side4)
+ << " cart: " << side_char(side5)
+ << std::endl;
+ */
+}
+
+template <typename Point>
+void test_side(std::string const& case_id, Point const& p1, Point const& p2, Point const& p3,
+ int expected, int expected_cartesian = -999)
+{
+ if (expected_cartesian == -999)
+ {
+ expected_cartesian = expected;
+ }
+ test_side1(case_id, p1, p2, p3, expected, expected_cartesian);
+ test_side1(case_id, p2, p1, p3, -expected, -expected_cartesian);
+}
+
+
+template <typename Point>
+void test_all()
+{
+ typedef std::pair<double, double> pair;
+
+ Point amsterdam(5.9, 52.4);
+ Point barcelona(2.0, 41.0);
+ Point paris(2.0, 48.0);
+ Point milan(7.0, 45.0);
+
+ //goto wrong;
+
+ test_side<Point>("bp-m", barcelona, paris, milan, -1);
+ test_side<Point>("bm-p", barcelona, milan, paris, 1);
+ test_side<Point>("mp-b", milan, paris, barcelona, 1);
+
+ test_side<Point>("am-p", amsterdam, milan, paris, -1);
+ test_side<Point>("pm-a", paris, milan, amsterdam, 1);
+
+ // http://www.gcmap.com/mapui?P=30N+10E-50N+50E,39N+30E
+ Point gcmap_p1(10.0, 30.0);
+ Point gcmap_p2(50.0, 50.0);
+ test_side<Point>("blog1", gcmap_p1, gcmap_p2, Point(30.0, 41.0), -1, 1);
+ test_side<Point>("blog1", gcmap_p1, gcmap_p2, Point(30.0, 42.0), -1, 1);
+ test_side<Point>("blog1", gcmap_p1, gcmap_p2, Point(30.0, 43.0), -1, 1);
+ test_side<Point>("blog1", gcmap_p1, gcmap_p2, Point(30.0, 44.0), 1);
+
+ // http://www.gcmap.com/mapui?P=50N+80E-60N+50W,65N+30E
+ Point gcmap_np1(80.0, 50.0);
+ Point gcmap_np2(-50.0, 60.0);
+ // http://www.gcmap.com/mapui?P=50N+140E-60N+10E,65N+30E
+ //Point gcmap_np1(140.0, 50.0);
+ //Point gcmap_np2(10.0, 60.0);
+ //test_side<Point>(gcmap_np1, gcmap_np2, gcmap_np, 1);
+ test_side<Point>("40", gcmap_np1, gcmap_np2, Point(30.0, 60.0), 1, -1);
+ test_side<Point>("45", gcmap_np1, gcmap_np2, Point(30.0, 65.0), 1, -1);
+ test_side<Point>("70", gcmap_np1, gcmap_np2, Point(30.0, 70.0), 1, -1);
+ test_side<Point>("75", gcmap_np1, gcmap_np2, Point(30.0, 75.0), -1);
+}
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::point<int, 2, bg::cs::spherical<bg::degree> > >();
+ test_all<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> > >();
+
+#if defined(HAVE_TTMATH)
+ typedef ttmath::Big<1,4> tt;
+ test_all<bg::model::point<tt, 2, bg::cs::spherical_equatorial<bg::degree> > >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/strategies/spherical_side.vcproj b/libs/geometry/test/strategies/spherical_side.vcproj
new file mode 100644
index 000000000..70dd8689c
--- /dev/null
+++ b/libs/geometry/test/strategies/spherical_side.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="spherical_side"
+ ProjectGUID="{ADBE38D8-1828-48A2-BBA1-81F50B53C67C}"
+ RootNamespace="spherical_side"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\spherical_side"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\spherical_side"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\spherical_side.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/strategies/strategies_tests.sln b/libs/geometry/test/strategies/strategies_tests.sln
new file mode 100644
index 000000000..d29448213
--- /dev/null
+++ b/libs/geometry/test/strategies/strategies_tests.sln
@@ -0,0 +1,73 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythagoras", "pythagoras.vcproj", "{763CA955-FC01-4AFD-9593-69D36836B3F7}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "transformer", "transformer.vcproj", "{9B62EBF7-D444-4D67-BA00-48CAEAF92756}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "segment_intersection", "segment_intersection.vcproj", "{4CCCD6BD-E77F-4A7B-BD9D-89ED2E213309}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "haversine", "haversine.vcproj", "{AA654B76-E384-4E10-B367-4F51B5D3E96F}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cross_track", "cross_track.vcproj", "{4CE6F112-9EA1-4D7E-9AC6-907E77895263}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "projected_point", "projected_point.vcproj", "{A27A46D2-AAD2-47F9-86E2-21FF849EF2D4}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "segment_intersection_collinear", "segment_intersection_collinear.vcproj", "{2D0CB6D3-6ABC-4119-A235-66E6065A279E}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spherical_side", "spherical_side.vcproj", "{ADBE38D8-1828-48A2-BBA1-81F50B53C67C}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "within", "within.vcproj", "{AB13D2AC-FD34-4DE4-BD8E-4D463050E5DD}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "transform_cs", "transform_cs.vcproj", "{2128A5D9-C67E-4C00-A917-A79058C78FCC}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {763CA955-FC01-4AFD-9593-69D36836B3F7}.Debug|Win32.ActiveCfg = Debug|Win32
+ {763CA955-FC01-4AFD-9593-69D36836B3F7}.Debug|Win32.Build.0 = Debug|Win32
+ {763CA955-FC01-4AFD-9593-69D36836B3F7}.Release|Win32.ActiveCfg = Release|Win32
+ {763CA955-FC01-4AFD-9593-69D36836B3F7}.Release|Win32.Build.0 = Release|Win32
+ {9B62EBF7-D444-4D67-BA00-48CAEAF92756}.Debug|Win32.ActiveCfg = Debug|Win32
+ {9B62EBF7-D444-4D67-BA00-48CAEAF92756}.Debug|Win32.Build.0 = Debug|Win32
+ {9B62EBF7-D444-4D67-BA00-48CAEAF92756}.Release|Win32.ActiveCfg = Release|Win32
+ {9B62EBF7-D444-4D67-BA00-48CAEAF92756}.Release|Win32.Build.0 = Release|Win32
+ {4CCCD6BD-E77F-4A7B-BD9D-89ED2E213309}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4CCCD6BD-E77F-4A7B-BD9D-89ED2E213309}.Debug|Win32.Build.0 = Debug|Win32
+ {4CCCD6BD-E77F-4A7B-BD9D-89ED2E213309}.Release|Win32.ActiveCfg = Release|Win32
+ {4CCCD6BD-E77F-4A7B-BD9D-89ED2E213309}.Release|Win32.Build.0 = Release|Win32
+ {AA654B76-E384-4E10-B367-4F51B5D3E96F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {AA654B76-E384-4E10-B367-4F51B5D3E96F}.Debug|Win32.Build.0 = Debug|Win32
+ {AA654B76-E384-4E10-B367-4F51B5D3E96F}.Release|Win32.ActiveCfg = Release|Win32
+ {AA654B76-E384-4E10-B367-4F51B5D3E96F}.Release|Win32.Build.0 = Release|Win32
+ {4CE6F112-9EA1-4D7E-9AC6-907E77895263}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4CE6F112-9EA1-4D7E-9AC6-907E77895263}.Debug|Win32.Build.0 = Debug|Win32
+ {4CE6F112-9EA1-4D7E-9AC6-907E77895263}.Release|Win32.ActiveCfg = Release|Win32
+ {4CE6F112-9EA1-4D7E-9AC6-907E77895263}.Release|Win32.Build.0 = Release|Win32
+ {A27A46D2-AAD2-47F9-86E2-21FF849EF2D4}.Debug|Win32.ActiveCfg = Debug|Win32
+ {A27A46D2-AAD2-47F9-86E2-21FF849EF2D4}.Debug|Win32.Build.0 = Debug|Win32
+ {A27A46D2-AAD2-47F9-86E2-21FF849EF2D4}.Release|Win32.ActiveCfg = Release|Win32
+ {A27A46D2-AAD2-47F9-86E2-21FF849EF2D4}.Release|Win32.Build.0 = Release|Win32
+ {2D0CB6D3-6ABC-4119-A235-66E6065A279E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {2D0CB6D3-6ABC-4119-A235-66E6065A279E}.Debug|Win32.Build.0 = Debug|Win32
+ {2D0CB6D3-6ABC-4119-A235-66E6065A279E}.Release|Win32.ActiveCfg = Release|Win32
+ {2D0CB6D3-6ABC-4119-A235-66E6065A279E}.Release|Win32.Build.0 = Release|Win32
+ {ADBE38D8-1828-48A2-BBA1-81F50B53C67C}.Debug|Win32.ActiveCfg = Debug|Win32
+ {ADBE38D8-1828-48A2-BBA1-81F50B53C67C}.Debug|Win32.Build.0 = Debug|Win32
+ {ADBE38D8-1828-48A2-BBA1-81F50B53C67C}.Release|Win32.ActiveCfg = Release|Win32
+ {ADBE38D8-1828-48A2-BBA1-81F50B53C67C}.Release|Win32.Build.0 = Release|Win32
+ {AB13D2AC-FD34-4DE4-BD8E-4D463050E5DD}.Debug|Win32.ActiveCfg = Debug|Win32
+ {AB13D2AC-FD34-4DE4-BD8E-4D463050E5DD}.Debug|Win32.Build.0 = Debug|Win32
+ {AB13D2AC-FD34-4DE4-BD8E-4D463050E5DD}.Release|Win32.ActiveCfg = Release|Win32
+ {AB13D2AC-FD34-4DE4-BD8E-4D463050E5DD}.Release|Win32.Build.0 = Release|Win32
+ {2128A5D9-C67E-4C00-A917-A79058C78FCC}.Debug|Win32.ActiveCfg = Debug|Win32
+ {2128A5D9-C67E-4C00-A917-A79058C78FCC}.Debug|Win32.Build.0 = Debug|Win32
+ {2128A5D9-C67E-4C00-A917-A79058C78FCC}.Release|Win32.ActiveCfg = Release|Win32
+ {2128A5D9-C67E-4C00-A917-A79058C78FCC}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/strategies/transform_cs.cpp b/libs/geometry/test/strategies/transform_cs.cpp
new file mode 100644
index 000000000..36b327e3e
--- /dev/null
+++ b/libs/geometry/test/strategies/transform_cs.cpp
@@ -0,0 +1,149 @@
+// 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.
+
+// 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/geometry/strategies/strategy_transform.hpp>
+#include <boost/geometry/algorithms/transform.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+template <typename T, typename P>
+inline T check_distance(P const& p)
+{
+ T x = bg::get<0>(p);
+ T y = bg::get<1>(p);
+ T z = bg::get<2>(p);
+ return sqrt(x * x + y * y + z * z);
+}
+
+template <typename T>
+void test_transformations_spherical()
+{
+ T const input_long = 15.0;
+ T const input_lat = 5.0;
+
+ T const expected_long = 0.26179938779914943653855361527329;
+ T const expected_lat = 0.08726646259971647884618453842443;
+
+ // Can be checked using http://www.calc3d.com/ejavascriptcoordcalc.html
+ // (for phi use long, in radians, for theta use lat, in radians, they are listed there as "theta, phi")
+ T const expected_polar_x = 0.084186;
+ T const expected_polar_y = 0.0225576;
+ T const expected_polar_z = 0.996195;
+
+ // Can be checked with same URL using 90-theta for lat.
+ // So for theta use 85 degrees, in radians: 0.08726646259971647884618453842443
+ T const expected_equatorial_x = 0.962250;
+ T const expected_equatorial_y = 0.257834;
+ T const expected_equatorial_z = 0.0871557;
+
+ // 1: Spherical-polar (lat=5, so it is near the pole - on a unit sphere)
+ bg::model::point<T, 2, bg::cs::spherical<bg::degree> > sp(input_long, input_lat);
+
+ // 1a: to radian
+ bg::model::point<T, 2, bg::cs::spherical<bg::radian> > spr;
+ bg::transform(sp, spr);
+ BOOST_CHECK_CLOSE(bg::get<0>(spr), expected_long, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(spr), expected_lat, 0.001);
+
+ // 1b: to cartesian-3d
+ bg::model::point<T, 3, bg::cs::cartesian> pc3;
+ bg::transform(sp, pc3);
+ BOOST_CHECK_CLOSE(bg::get<0>(pc3), expected_polar_x, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(pc3), expected_polar_y, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<2>(pc3), expected_polar_z, 0.001);
+ BOOST_CHECK_CLOSE(check_distance<T>(pc3), 1.0, 0.001);
+
+ // 1c: back
+ bg::transform(pc3, spr);
+ BOOST_CHECK_CLOSE(bg::get<0>(spr), expected_long, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(spr), expected_lat, 0.001);
+
+ // 2: Spherical-equatorial (lat=5, so it is near the equator)
+ bg::model::point<T, 2, bg::cs::spherical_equatorial<bg::degree> > se(input_long, input_lat);
+
+ // 2a: to radian
+ bg::model::point<T, 2, bg::cs::spherical_equatorial<bg::radian> > ser;
+ bg::transform(se, ser);
+ BOOST_CHECK_CLOSE(bg::get<0>(ser), expected_long, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(ser), expected_lat, 0.001);
+
+ bg::transform(se, pc3);
+ BOOST_CHECK_CLOSE(bg::get<0>(pc3), expected_equatorial_x, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(pc3), expected_equatorial_y, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<2>(pc3), expected_equatorial_z, 0.001);
+ BOOST_CHECK_CLOSE(check_distance<T>(pc3), 1.0, 0.001);
+
+ // 2c: back
+ bg::transform(pc3, ser);
+ BOOST_CHECK_CLOSE(bg::get<0>(spr), expected_long, 0.001); // expected_long
+ BOOST_CHECK_CLOSE(bg::get<1>(spr), expected_lat, 0.001); // expected_lat
+
+
+ // 3: Spherical-polar including radius
+ bg::model::point<T, 3, bg::cs::spherical<bg::degree> > sp3(input_long, input_lat, 0.5);
+
+ // 3a: to radian
+ bg::model::point<T, 3, bg::cs::spherical<bg::radian> > spr3;
+ bg::transform(sp3, spr3);
+ BOOST_CHECK_CLOSE(bg::get<0>(spr3), expected_long, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(spr3), expected_lat, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<2>(spr3), 0.5, 0.001);
+
+ // 3b: to cartesian-3d
+ bg::transform(sp3, pc3);
+ BOOST_CHECK_CLOSE(bg::get<0>(pc3), expected_polar_x / 2.0, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(pc3), expected_polar_y / 2.0, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<2>(pc3), expected_polar_z / 2.0, 0.001);
+ BOOST_CHECK_CLOSE(check_distance<T>(pc3), 0.5, 0.001);
+
+ // 3c: back
+ bg::transform(pc3, spr3);
+ BOOST_CHECK_CLOSE(bg::get<0>(spr3), expected_long, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(spr3), expected_lat, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<2>(spr3), 0.5, 0.001);
+
+
+ // 4: Spherical-equatorial including radius
+ bg::model::point<T, 3, bg::cs::spherical_equatorial<bg::degree> > se3(input_long, input_lat, 0.5);
+
+ // 4a: to radian
+ bg::model::point<T, 3, bg::cs::spherical_equatorial<bg::radian> > ser3;
+ bg::transform(se3, ser3);
+ BOOST_CHECK_CLOSE(bg::get<0>(ser3), expected_long, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(ser3), expected_lat, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<2>(ser3), 0.5, 0.001);
+
+ // 4b: to cartesian-3d
+ bg::transform(se3, pc3);
+ BOOST_CHECK_CLOSE(bg::get<0>(pc3), expected_equatorial_x / 2.0, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(pc3), expected_equatorial_y / 2.0, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<2>(pc3), expected_equatorial_z / 2.0, 0.001);
+ BOOST_CHECK_CLOSE(check_distance<T>(pc3), 0.5, 0.001);
+
+ // 4c: back
+ bg::transform(pc3, ser3);
+ BOOST_CHECK_CLOSE(bg::get<0>(ser3), expected_long, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<1>(ser3), expected_lat, 0.001);
+ BOOST_CHECK_CLOSE(bg::get<2>(ser3), 0.5, 0.001);
+}
+
+int test_main(int, char* [])
+{
+ test_transformations_spherical<double>();
+
+ return 0;
+}
diff --git a/libs/geometry/test/strategies/transform_cs.vcproj b/libs/geometry/test/strategies/transform_cs.vcproj
new file mode 100644
index 000000000..ea115c56f
--- /dev/null
+++ b/libs/geometry/test/strategies/transform_cs.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="transform_cs"
+ ProjectGUID="{2128A5D9-C67E-4C00-A917-A79058C78FCC}"
+ RootNamespace="transform_cs"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\transform_cs"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\transform_cs"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\transform_cs.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/strategies/transformer.cpp b/libs/geometry/test/strategies/transformer.cpp
new file mode 100644
index 000000000..b469e08cc
--- /dev/null
+++ b/libs/geometry/test/strategies/transformer.cpp
@@ -0,0 +1,113 @@
+// 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.
+
+// 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/geometry/strategies/transform/inverse_transformer.hpp>
+#include <boost/geometry/strategies/transform/map_transformer.hpp>
+#include <boost/geometry/strategies/transform/matrix_transformers.hpp>
+
+
+#include <boost/geometry/algorithms/make.hpp>
+#include <boost/geometry/algorithms/transform.hpp>
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+template <typename P, typename T>
+void check_inverse(P const& p, T const& trans)
+{
+ bg::strategy::transform::inverse_transformer<P, P> inverse(trans);
+
+ P i;
+ bg::transform(p, i, inverse);
+
+ BOOST_CHECK_CLOSE(double(bg::get<0>(i)), 1.0, 0.001);
+ BOOST_CHECK_CLOSE(double(bg::get<1>(i)), 1.0, 0.001);
+}
+
+template <typename P>
+void test_all()
+{
+ P p;
+ bg::assign_values(p, 1, 1);
+
+ {
+ bg::strategy::transform::translate_transformer<P, P> trans(1, 1);
+ P tp;
+ bg::transform(p, tp, trans);
+
+ BOOST_CHECK_CLOSE(double(bg::get<0>(tp)), 2.0, 0.001);
+ BOOST_CHECK_CLOSE(double(bg::get<1>(tp)), 2.0, 0.001);
+
+ check_inverse(tp, trans);
+ }
+
+ {
+ bg::strategy::transform::scale_transformer<P, P> trans(10, 10);
+ P tp;
+ bg::transform(p, tp, trans);
+
+ BOOST_CHECK_CLOSE(double(bg::get<0>(tp)), 10.0, 0.001);
+ BOOST_CHECK_CLOSE(double(bg::get<1>(tp)), 10.0, 0.001);
+
+ check_inverse(tp, trans);
+ }
+
+ {
+ bg::strategy::transform::rotate_transformer<P, P, bg::degree> trans(90.0);
+ P tp;
+ bg::transform(p, tp, trans);
+
+ BOOST_CHECK_CLOSE(double(bg::get<0>(tp)), 1.0, 0.001);
+ BOOST_CHECK_CLOSE(double(bg::get<1>(tp)), -1.0, 0.001);
+ check_inverse(tp, trans);
+ }
+
+ {
+ // Map from 0,0,2,2 to 0,0,500,500
+ bg::strategy::transform::map_transformer<P, P, false> trans
+ (
+ 0.0, 0.0, 2.0, 2.0, 500, 500
+ );
+ P tp;
+ bg::transform(p, tp, trans);
+
+ BOOST_CHECK_CLOSE(double(bg::get<0>(tp)), 250.0, 0.001);
+ BOOST_CHECK_CLOSE(double(bg::get<1>(tp)), 250.0, 0.001);
+
+ check_inverse(tp, trans);
+ }
+}
+
+int test_main(int, char* [])
+{
+ //test_all<int[2]>();
+ //test_all<float[2]>();
+ //test_all<double[2]>();
+
+ test_all<boost::tuple<float, float> >();
+
+ //test_all<point<int, 2, cs::cartesian> >();
+ test_all<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/strategies/transformer.vcproj b/libs/geometry/test/strategies/transformer.vcproj
new file mode 100644
index 000000000..f9c02344a
--- /dev/null
+++ b/libs/geometry/test/strategies/transformer.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="transformer"
+ ProjectGUID="{9B62EBF7-D444-4D67-BA00-48CAEAF92756}"
+ RootNamespace="transformer"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\transformer"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\transformer"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\transformer.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/strategies/within.cpp b/libs/geometry/test/strategies/within.cpp
new file mode 100644
index 000000000..17cf8a33f
--- /dev/null
+++ b/libs/geometry/test/strategies/within.cpp
@@ -0,0 +1,194 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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)
+
+// Tests with-strategies, especially point-in-polygon
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/covered_by.hpp>
+#include <boost/geometry/algorithms/within.hpp>
+
+#include <boost/geometry/strategies/cartesian/point_in_poly_franklin.hpp>
+#include <boost/geometry/strategies/cartesian/point_in_poly_crossings_multiply.hpp>
+#include <boost/geometry/strategies/agnostic/point_in_poly_winding.hpp>
+#include <boost/geometry/strategies/cartesian/point_in_box.hpp>
+#include <boost/geometry/strategies/cartesian/box_in_box.hpp>
+#include <boost/geometry/strategies/agnostic/point_in_box_by_side.hpp>
+
+#include <boost/geometry/strategies/cartesian/side_by_triangle.hpp>
+
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+#include <boost/geometry/geometries/polygon.hpp>
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+
+
+
+
+
+
+template <typename Point, typename Polygon, typename Strategy>
+void test_point_in_polygon(std::string const& case_id,
+ Point const& point, Polygon const& polygon,
+ Strategy const& strategy, std::string const& strategy_id,
+ bool expected)
+{
+ BOOST_CONCEPT_ASSERT( (bg::concept::WithinStrategyPolygonal<Strategy>) );
+ bool detected = bg::within(point, polygon, strategy);
+
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "within: " << case_id
+ << " strategy: " << strategy_id // typeid(strategy).name() is too long
+ << " output expected: " << int(expected)
+ << " detected: " << int(detected)
+ );
+}
+
+template <typename Point, typename Polygon>
+void test_geometry(std::string const& case_id, std::string const& wkt_point
+ , std::string const& wkt_polygon
+ , bool expected
+ , std::string const& deviations = ""
+ )
+{
+ Point point;
+ Polygon polygon;
+ bg::read_wkt(wkt_point, point);
+ bg::read_wkt(wkt_polygon, polygon);
+
+ namespace sw = bg::strategy::within;
+ test_point_in_polygon(case_id, point, polygon, sw::winding<Point>(),
+ "winding", expected);
+ test_point_in_polygon(case_id, point, polygon, sw::franklin<Point>(),
+ "franklin", boost::contains(deviations, "f") ? !expected : expected);
+ test_point_in_polygon(case_id, point, polygon, sw::crossings_multiply<Point>(),
+ "cross.mult", boost::contains(deviations, "c") ? !expected : expected);
+}
+
+template <typename Point>
+void test_box_of(std::string const& wkt_point, std::string const& wkt_box,
+ bool expected_within, bool expected_covered_by)
+{
+ typedef bg::model::box<Point> box_type;
+
+ Point point;
+ box_type box;
+ bg::read_wkt(wkt_point, point);
+ bg::read_wkt(wkt_box, box);
+
+ bool detected_within = bg::within(point, box);
+ bool detected_covered_by = bg::covered_by(point, box);
+ BOOST_CHECK_EQUAL(detected_within, expected_within);
+ BOOST_CHECK_EQUAL(detected_covered_by, expected_covered_by);
+
+ // Also test with the non-default agnostic side version
+ namespace wi = bg::strategy::within;
+ wi::point_in_box_by_side<Point, box_type> within_strategy;
+ wi::point_in_box_by_side<Point, box_type, wi::decide_covered_by> covered_by_strategy;
+
+ detected_within = bg::within(point, box, within_strategy);
+ detected_covered_by = bg::covered_by(point, box, covered_by_strategy);
+ BOOST_CHECK_EQUAL(detected_within, expected_within);
+ BOOST_CHECK_EQUAL(detected_covered_by, expected_covered_by);
+
+ // We might exchange strategies between within/covered by.
+ // So the lines below might seem confusing, but are as intended
+ detected_within = bg::covered_by(point, box, within_strategy);
+ detected_covered_by = bg::within(point, box, covered_by_strategy);
+ BOOST_CHECK_EQUAL(detected_within, expected_within);
+ BOOST_CHECK_EQUAL(detected_covered_by, expected_covered_by);
+
+ // Finally we call the strategies directly
+ detected_within = within_strategy.apply(point, box);
+ detected_covered_by = covered_by_strategy.apply(point, box);
+ BOOST_CHECK_EQUAL(detected_within, expected_within);
+ BOOST_CHECK_EQUAL(detected_covered_by, expected_covered_by);
+}
+
+template <typename Point>
+void test_box()
+{
+ test_box_of<Point>("POINT(1 1)", "BOX(0 0,2 2)", true, true);
+ test_box_of<Point>("POINT(0 0)", "BOX(0 0,2 2)", false, true);
+ test_box_of<Point>("POINT(2 2)", "BOX(0 0,2 2)", false, true);
+ test_box_of<Point>("POINT(0 1)", "BOX(0 0,2 2)", false, true);
+ test_box_of<Point>("POINT(1 0)", "BOX(0 0,2 2)", false, true);
+ test_box_of<Point>("POINT(3 3)", "BOX(0 0,2 2)", false, false);
+}
+
+
+template <typename Point>
+void test_all()
+{
+ test_box<Point>();
+
+ typedef bg::model::polygon<Point> polygon;
+
+ std::string const box = "POLYGON((0 0,0 2,2 2,2 0,0 0))";
+ std::string const triangle = "POLYGON((0 0,0 4,6 0,0 0))";
+ std::string const with_hole = "POLYGON((0 0,0 3,3 3,3 0,0 0),(1 1,2 1,2 2,1 2,1 1))";
+
+
+ test_geometry<Point, polygon>("b1", "POINT(1 1)", box, true);
+ test_geometry<Point, polygon>("b2", "POINT(3 3)", box, false);
+
+ // Test ALL corners (officialy false but some strategies might answer true)
+ test_geometry<Point, polygon>("b3a", "POINT(0 0)", box, false, "f");
+ test_geometry<Point, polygon>("b3b", "POINT(0 2)", box, false);
+ test_geometry<Point, polygon>("b3c", "POINT(2 2)", box, false);
+ test_geometry<Point, polygon>("b3d", "POINT(2 0)", box, false);
+
+ // Test ALL sides (officialy false but some strategies might answer true)
+ test_geometry<Point, polygon>("b4a", "POINT(0 1)", box, false, "f");
+ test_geometry<Point, polygon>("b4b", "POINT(1 2)", box, false, "c");
+ test_geometry<Point, polygon>("b4c", "POINT(2 1)", box, false);
+ test_geometry<Point, polygon>("b4d", "POINT(1 0)", box, false, "f");
+
+
+ test_geometry<Point, polygon>("t1", "POINT(1 1)", triangle, true);
+ test_geometry<Point, polygon>("t2", "POINT(3 3)", triangle, false);
+
+ test_geometry<Point, polygon>("t3a", "POINT(0 0)", triangle, false, "f");
+ test_geometry<Point, polygon>("t3b", "POINT(0 4)", triangle, false, "c");
+ test_geometry<Point, polygon>("t3c", "POINT(5 0)", triangle, false, "f");
+
+ test_geometry<Point, polygon>("t4a", "POINT(0 2)", triangle, false, "f");
+ test_geometry<Point, polygon>("t4b", "POINT(3 2)", triangle, false);
+ test_geometry<Point, polygon>("t4c", "POINT(2 0)", triangle, false, "f");
+
+
+ test_geometry<Point, polygon>("h1", "POINT(0.5 0.5)", with_hole, true);
+ test_geometry<Point, polygon>("h2a", "POINT(1.5 1.5)", with_hole, false);
+ test_geometry<Point, polygon>("h2b", "POINT(5 5)", with_hole, false);
+
+ test_geometry<Point, polygon>("h3a", "POINT(1 1)", with_hole, false, "c");
+ test_geometry<Point, polygon>("h3b", "POINT(2 2)", with_hole, false, "f");
+ test_geometry<Point, polygon>("h3c", "POINT(0 0)", with_hole, false, "f");
+
+ test_geometry<Point, polygon>("h4a", "POINT(1 1.5)", with_hole, false);
+ test_geometry<Point, polygon>("h4b", "POINT(1.5 2)", with_hole, false, "f");
+
+ // Lying ON (one of the sides of) interior ring
+ test_geometry<Point, polygon>("#77-1", "POINT(6 3.5)", "POLYGON((5 3,5 4,4 4,4 5,3 5,3 6,5 6,5 5,7 5,7 6,8 6,8 5,9 5,9 2,8 2,8 1,7 1,7 2,5 2,5 3),(6 3,8 3,8 4,6 4,6 3))", false);
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+#if defined(HAVE_TTMATH)
+ test_all<bg::model::point<ttmath_big, 2, bg::cs::cartesian> >();
+#endif
+
+ return 0;
+}
diff --git a/libs/geometry/test/strategies/within.vcproj b/libs/geometry/test/strategies/within.vcproj
new file mode 100644
index 000000000..8ad1dbc87
--- /dev/null
+++ b/libs/geometry/test/strategies/within.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="within"
+ ProjectGUID="{AB13D2AC-FD34-4DE4-BD8E-4D463050E5DD}"
+ RootNamespace="within"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\within"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\within"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\within.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/test_common/test_point.hpp b/libs/geometry/test/test_common/test_point.hpp
new file mode 100644
index 000000000..5a19d6c3c
--- /dev/null
+++ b/libs/geometry/test/test_common/test_point.hpp
@@ -0,0 +1,94 @@
+// 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.
+// 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 GEOMETRY_TEST_TEST_COMMON_TEST_POINT_HPP
+#define GEOMETRY_TEST_TEST_COMMON_TEST_POINT_HPP
+
+#include <boost/geometry/core/access.hpp>
+#include <boost/geometry/core/coordinate_type.hpp>
+#include <boost/geometry/core/coordinate_system.hpp>
+#include <boost/geometry/core/coordinate_dimension.hpp>
+#include <boost/geometry/core/cs.hpp>
+#include <boost/geometry/core/tag.hpp>
+
+// NOTE: since Boost 1.51 the Point type may always be a pointer.
+// Therefore the traits class don't need to add a pointer.
+// This obsoletes this whole test-point-type
+
+namespace test
+{
+
+// Test point class
+
+struct test_point
+{
+ float c1, c2, c3;
+};
+
+
+} // namespace test
+
+
+namespace boost { namespace geometry { namespace traits {
+
+template<>
+struct tag<test::test_point> { typedef point_tag type; };
+
+template<>
+struct coordinate_type<test::test_point> { typedef float type; };
+
+template<>
+struct coordinate_system<test::test_point> { typedef cs::cartesian type; };
+
+template<>
+struct dimension<test::test_point>: boost::mpl::int_<3> {};
+
+template<> struct access<test::test_point, 0>
+{
+ static inline const float& get(const test::test_point& p)
+ {
+ return p.c1;
+ }
+
+ static inline void set(test::test_point& p, const float& value)
+ {
+ p.c1 = value;
+ }
+};
+
+template<> struct access<test::test_point, 1>
+{
+ static inline const float& get(const test::test_point& p)
+ {
+ return p.c2;
+ }
+
+ static inline void set(test::test_point& p, const float& value)
+ {
+ p.c2 = value;
+ }
+};
+
+template<> struct access<test::test_point, 2>
+{
+ static inline const float& get(const test::test_point& p)
+ {
+ return p.c3;
+ }
+
+ static inline void set(test::test_point& p, const float& value)
+ {
+ p.c3 = value;
+ }
+};
+
+}}} // namespace bg::traits
+
+#endif // GEOMETRY_TEST_TEST_COMMON_TEST_POINT_HPP
diff --git a/libs/geometry/test/test_common/with_pointer.hpp b/libs/geometry/test/test_common/with_pointer.hpp
new file mode 100644
index 000000000..22edbdef5
--- /dev/null
+++ b/libs/geometry/test/test_common/with_pointer.hpp
@@ -0,0 +1,87 @@
+// 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.
+// 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 GEOMETRY_TEST_COMMON_WITH_POINTER_HPP
+#define GEOMETRY_TEST_COMMON_WITH_POINTER_HPP
+
+
+#include <boost/geometry/core/access.hpp>
+#include <boost/geometry/core/coordinate_type.hpp>
+#include <boost/geometry/core/coordinate_system.hpp>
+#include <boost/geometry/core/coordinate_dimension.hpp>
+#include <boost/geometry/core/cs.hpp>
+#include <boost/geometry/core/tag.hpp>
+
+// NOTE: since Boost 1.51 the Point type may always be a pointer.
+// Therefore the traits class don't need to add a pointer.
+// This obsoletes this whole test-point-type
+
+
+
+namespace test
+{
+
+// Sample point, having x/y
+struct test_point_xy
+{
+ float x,y;
+};
+
+}
+
+
+namespace boost { namespace geometry { namespace traits {
+
+template<> struct tag<test::test_point_xy>
+{ typedef point_tag type; };
+
+template<> struct coordinate_type<test::test_point_xy>
+{ typedef double type; };
+
+template<> struct coordinate_system<test::test_point_xy>
+{ typedef cs::cartesian type; };
+
+template<> struct dimension<test::test_point_xy> : boost::mpl::int_<2> {};
+
+template<>
+struct access<test::test_point_xy, 0>
+{
+ static double get(test::test_point_xy const& p)
+ {
+ return p.x;
+ }
+
+ static void set(test::test_point_xy& p, double const& value)
+ {
+ p.x = value;
+ }
+
+};
+
+
+template<>
+struct access<test::test_point_xy, 1>
+{
+ static double get(test::test_point_xy const& p)
+ {
+ return p.y;
+ }
+
+ static void set(test::test_point_xy& p, double const& value)
+ {
+ p.y = value;
+ }
+
+};
+
+}}} // namespace bg::traits
+
+
+#endif // #ifndef GEOMETRY_TEST_COMMON_WITH_POINTER_HPP
diff --git a/libs/geometry/test/test_geometries/all_custom_container.hpp b/libs/geometry/test/test_geometries/all_custom_container.hpp
new file mode 100644
index 000000000..7f4a83012
--- /dev/null
+++ b/libs/geometry/test/test_geometries/all_custom_container.hpp
@@ -0,0 +1,137 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2011-2012 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 GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_CONTAINER_HPP
+#define GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_CONTAINER_HPP
+
+#include <cstddef>
+#include <deque>
+
+
+template <typename Item>
+class all_custom_container
+{
+private :
+ std::deque<Item> m_hidden_deque;
+
+public :
+ typedef typename std::deque<Item>::iterator custom_iterator_type;
+ typedef typename std::deque<Item>::const_iterator custom_const_iterator_type;
+
+ inline std::size_t custom_size() const { return m_hidden_deque.size(); }
+
+ inline custom_const_iterator_type custom_begin() const { return m_hidden_deque.begin(); }
+ inline custom_const_iterator_type custom_end() const { return m_hidden_deque.end(); }
+ inline custom_iterator_type custom_begin() { return m_hidden_deque.begin(); }
+ inline custom_iterator_type custom_end() { return m_hidden_deque.end(); }
+
+ inline void custom_clear() { m_hidden_deque.clear(); }
+ inline void custom_push_back(Item const& p) { m_hidden_deque.push_back(p); }
+ inline void custom_resize(std::size_t new_size) { m_hidden_deque.resize(new_size); }
+};
+
+
+// 1. Adapt to Boost.Geometry (for e.g. inner rings)
+namespace boost { namespace geometry
+{
+
+namespace traits
+{
+ template <typename Item>
+ struct clear<all_custom_container<Item> >
+ {
+ static inline void apply(all_custom_container<Item>& container)
+ {
+ container.custom_clear();
+ }
+ };
+
+ template <typename Item>
+ struct push_back<all_custom_container<Item> >
+ {
+ static inline void apply(all_custom_container<Item>& container, Item const& item)
+ {
+ container.custom_push_back(item);
+ }
+ };
+
+ template <typename Item>
+ struct resize<all_custom_container<Item> >
+ {
+ static inline void apply(all_custom_container<Item>& container, std::size_t new_size)
+ {
+ container.custom_resize(new_size);
+ }
+ };
+
+} // namespace traits
+
+}} // namespace boost::geometry
+
+
+// 2a. Adapt to Boost.Range, meta-functions
+namespace boost
+{
+ template<typename Item>
+ struct range_mutable_iterator<all_custom_container<Item> >
+ {
+ typedef typename all_custom_container<Item>::custom_iterator_type type;
+ };
+
+ template<typename Item>
+ struct range_const_iterator<all_custom_container<Item> >
+ {
+ typedef typename all_custom_container<Item>::custom_const_iterator_type type;
+ };
+
+} // namespace boost
+
+
+// 2b. Adapt to Boost.Range, part 2, ADP
+
+template<typename Item>
+inline typename all_custom_container<Item>::custom_iterator_type
+ range_begin(all_custom_container<Item>& container)
+{
+ return container.custom_begin();
+}
+
+template<typename Item>
+inline typename all_custom_container<Item>::custom_const_iterator_type
+ range_begin(all_custom_container<Item> const& container)
+{
+ return container.custom_begin();
+}
+
+template<typename Item>
+inline typename all_custom_container<Item>::custom_iterator_type
+ range_end(all_custom_container<Item>& container)
+{
+ return container.custom_end();
+}
+
+template<typename Item>
+inline typename all_custom_container<Item>::custom_const_iterator_type
+ range_end(all_custom_container<Item> const& container)
+{
+ return container.custom_end();
+}
+
+// (Optional)
+template<typename Item>
+inline std::size_t range_calculate_size(all_custom_container<Item> const& container)
+{
+ return container.custom_size();
+}
+
+
+
+
+#endif // GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_CONTAINER_HPP
diff --git a/libs/geometry/test/test_geometries/all_custom_linestring.hpp b/libs/geometry/test/test_geometries/all_custom_linestring.hpp
new file mode 100644
index 000000000..01b5ae4b0
--- /dev/null
+++ b/libs/geometry/test/test_geometries/all_custom_linestring.hpp
@@ -0,0 +1,137 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2011-2012 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 GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_LINESTRING_HPP
+#define GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_LINESTRING_HPP
+
+#include <cstddef>
+
+#include <boost/range.hpp>
+
+
+#include <boost/geometry/core/mutable_range.hpp>
+#include <boost/geometry/core/tag.hpp>
+#include <boost/geometry/core/tags.hpp>
+
+#include <test_geometries/all_custom_container.hpp>
+
+
+template <typename P>
+class all_custom_linestring : public all_custom_container<P>
+{};
+
+
+// 1. Adapt to Boost.Geometry
+namespace boost { namespace geometry
+{
+
+namespace traits
+{
+ template <typename Point>
+ struct tag<all_custom_linestring<Point> >
+ {
+ typedef linestring_tag type;
+ };
+
+
+ // Implement traits for the mutable als
+ // These are all optional traits (normally / default they are implemented
+ // conforming std:: functionality)
+
+ template <typename Point>
+ struct clear<all_custom_linestring<Point> >
+ {
+ static inline void apply(all_custom_linestring<Point>& als)
+ {
+ als.custom_clear();
+ }
+ };
+
+ template <typename Point>
+ struct push_back<all_custom_linestring<Point> >
+ {
+ static inline void apply(all_custom_linestring<Point>& als, Point const& point)
+ {
+ als.custom_push_back(point);
+ }
+ };
+
+ template <typename Point>
+ struct resize<all_custom_linestring<Point> >
+ {
+ static inline void apply(all_custom_linestring<Point>& als, std::size_t new_size)
+ {
+ als.custom_resize(new_size);
+ }
+ };
+
+} // namespace traits
+
+}} // namespace boost::geometry
+
+
+// 2a. Adapt to Boost.Range, meta-functions
+namespace boost
+{
+ template<typename Point>
+ struct range_mutable_iterator<all_custom_linestring<Point> >
+ {
+ typedef typename all_custom_linestring<Point>::custom_iterator_type type;
+ };
+
+ template<typename Point>
+ struct range_const_iterator<all_custom_linestring<Point> >
+ {
+ typedef typename all_custom_linestring<Point>::custom_const_iterator_type type;
+ };
+
+} // namespace boost
+
+
+// 2b. Adapt to Boost.Range, part 2, ADP
+
+template<typename Point>
+inline typename all_custom_linestring<Point>::custom_iterator_type
+ range_begin(all_custom_linestring<Point>& als)
+{
+ return als.custom_begin();
+}
+
+template<typename Point>
+inline typename all_custom_linestring<Point>::custom_const_iterator_type
+ range_begin(all_custom_linestring<Point> const& als)
+{
+ return als.custom_begin();
+}
+
+template<typename Point>
+inline typename all_custom_linestring<Point>::custom_iterator_type
+ range_end(all_custom_linestring<Point>& als)
+{
+ return als.custom_end();
+}
+
+template<typename Point>
+inline typename all_custom_linestring<Point>::custom_const_iterator_type
+ range_end(all_custom_linestring<Point> const& als)
+{
+ return als.custom_end();
+}
+
+// (Optional)
+template<typename Point>
+inline std::size_t range_calculate_size(all_custom_linestring<Point> const& als)
+{
+ return als.custom_size();
+}
+
+
+// 3. There used to be a std::back_insert adaption but that is now done using push_back
+
+
+#endif // GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_LINESTRING_HPP
diff --git a/libs/geometry/test/test_geometries/all_custom_polygon.hpp b/libs/geometry/test/test_geometries/all_custom_polygon.hpp
new file mode 100644
index 000000000..62da9ecf8
--- /dev/null
+++ b/libs/geometry/test/test_geometries/all_custom_polygon.hpp
@@ -0,0 +1,130 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2011-2012 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 GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_POLYGON_HPP
+#define GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_POLYGON_HPP
+
+#include <cstddef>
+
+#include <boost/range.hpp>
+
+
+#include <boost/geometry/core/mutable_range.hpp>
+#include <boost/geometry/core/tag.hpp>
+#include <boost/geometry/core/tags.hpp>
+
+#include <test_geometries/all_custom_container.hpp>
+#include <test_geometries/all_custom_ring.hpp>
+
+
+template <typename P>
+class all_custom_polygon
+{
+public :
+ typedef all_custom_ring<P> custom_ring_type;
+ typedef all_custom_container<custom_ring_type> custom_int_type;
+
+ custom_ring_type& custom_ext() { return m_ext; }
+ custom_int_type& custom_int() { return m_int; }
+
+ custom_ring_type const& custom_ext() const { return m_ext; }
+ custom_int_type const& custom_int() const { return m_int; }
+
+private :
+ custom_ring_type m_ext;
+ custom_int_type m_int;
+};
+
+
+
+namespace boost { namespace geometry
+{
+
+namespace traits
+{
+
+
+
+template <typename Point>
+struct tag<all_custom_polygon<Point> >
+{
+ typedef polygon_tag type;
+};
+
+template <typename Point>
+struct ring_const_type<all_custom_polygon<Point> >
+{
+ typedef typename all_custom_polygon<Point>::custom_ring_type const& type;
+};
+
+template <typename Point>
+struct ring_mutable_type<all_custom_polygon<Point> >
+{
+ typedef typename all_custom_polygon<Point>::custom_ring_type& type;
+};
+
+
+template <typename Point>
+struct interior_const_type<all_custom_polygon<Point> >
+{
+ typedef typename all_custom_polygon<Point>::custom_int_type const& type;
+};
+
+template <typename Point>
+struct interior_mutable_type<all_custom_polygon<Point> >
+{
+ typedef typename all_custom_polygon<Point>::custom_int_type& type;
+};
+
+
+
+template <typename Point>
+struct exterior_ring<all_custom_polygon<Point> >
+{
+ typedef all_custom_polygon<Point> polygon_type;
+ typedef typename polygon_type::custom_ring_type ring_type;
+
+ static inline ring_type& get(polygon_type& p)
+ {
+ return p.custom_ext();
+ }
+
+ static inline ring_type const& get(polygon_type const& p)
+ {
+ return p.custom_ext();
+ }
+};
+
+template <typename Point>
+struct interior_rings<all_custom_polygon<Point> >
+{
+ typedef all_custom_polygon<Point> polygon_type;
+ typedef typename polygon_type::custom_int_type int_type;
+
+ static inline int_type& get(polygon_type& p)
+ {
+ return p.custom_int();
+ }
+
+ static inline int_type const& get(polygon_type const& p)
+ {
+ return p.custom_int();
+ }
+};
+
+
+} // namespace traits
+
+}} // namespace boost::geometry
+
+
+
+
+
+#endif // GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_POLYGON_HPP
diff --git a/libs/geometry/test/test_geometries/all_custom_ring.hpp b/libs/geometry/test/test_geometries/all_custom_ring.hpp
new file mode 100644
index 000000000..c7c2b78df
--- /dev/null
+++ b/libs/geometry/test/test_geometries/all_custom_ring.hpp
@@ -0,0 +1,142 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2011-2012 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 GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_RING_HPP
+#define GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_RING_HPP
+
+#include <cstddef>
+
+#include <boost/range.hpp>
+
+
+#include <boost/geometry/core/mutable_range.hpp>
+#include <boost/geometry/core/tag.hpp>
+#include <boost/geometry/core/tags.hpp>
+
+#include <test_geometries/all_custom_container.hpp>
+
+
+template <typename P>
+class all_custom_ring : public all_custom_container<P>
+{};
+
+
+// Note that the things below are nearly all identical to implementation
+// in *linestring, but it seems not possible to re-use this (without macro's)
+// (the only thing DIFFERENT is the tag)
+
+
+// 1. Adapt to Boost.Geometry
+namespace boost { namespace geometry
+{
+
+namespace traits
+{
+ template <typename Point>
+ struct tag<all_custom_ring<Point> >
+ {
+ typedef ring_tag type;
+ };
+
+
+ // Implement traits for mutable actions
+ // These are all optional traits (normally / default they are implemented
+ // conforming std:: functionality)
+
+ template <typename Point>
+ struct clear<all_custom_ring<Point> >
+ {
+ static inline void apply(all_custom_ring<Point>& acr)
+ {
+ acr.custom_clear();
+ }
+ };
+
+ template <typename Point>
+ struct push_back<all_custom_ring<Point> >
+ {
+ static inline void apply(all_custom_ring<Point>& acr, Point const& point)
+ {
+ acr.custom_push_back(point);
+ }
+ };
+
+ template <typename Point>
+ struct resize<all_custom_ring<Point> >
+ {
+ static inline void apply(all_custom_ring<Point>& acr, std::size_t new_size)
+ {
+ acr.custom_resize(new_size);
+ }
+ };
+
+} // namespace traits
+
+}} // namespace boost::geometry
+
+
+// 2a. Adapt to Boost.Range, meta-functions
+namespace boost
+{
+ template<typename Point>
+ struct range_mutable_iterator<all_custom_ring<Point> >
+ {
+ typedef typename all_custom_ring<Point>::custom_iterator_type type;
+ };
+
+ template<typename Point>
+ struct range_const_iterator<all_custom_ring<Point> >
+ {
+ typedef typename all_custom_ring<Point>::custom_const_iterator_type type;
+ };
+
+} // namespace boost
+
+
+// 2b. Adapt to Boost.Range, part 2, ADP
+
+template<typename Point>
+inline typename all_custom_ring<Point>::custom_iterator_type
+ range_begin(all_custom_ring<Point>& acr)
+{
+ return acr.custom_begin();
+}
+
+template<typename Point>
+inline typename all_custom_ring<Point>::custom_const_iterator_type
+ range_begin(all_custom_ring<Point> const& acr)
+{
+ return acr.custom_begin();
+}
+
+template<typename Point>
+inline typename all_custom_ring<Point>::custom_iterator_type
+ range_end(all_custom_ring<Point>& acr)
+{
+ return acr.custom_end();
+}
+
+template<typename Point>
+inline typename all_custom_ring<Point>::custom_const_iterator_type
+ range_end(all_custom_ring<Point> const& acr)
+{
+ return acr.custom_end();
+}
+
+// (Optional)
+template<typename Point>
+inline std::size_t range_calculate_size(all_custom_ring<Point> const& acr)
+{
+ return acr.custom_size();
+}
+
+
+
+
+#endif // GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_RING_HPP
diff --git a/libs/geometry/test/test_geometries/custom_segment.hpp b/libs/geometry/test/test_geometries/custom_segment.hpp
new file mode 100644
index 000000000..740377742
--- /dev/null
+++ b/libs/geometry/test/test_geometries/custom_segment.hpp
@@ -0,0 +1,58 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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 GEOMETRY_TEST_TEST_GEOMETRIES_CUSTOM_SEGMENT_HPP
+#define GEOMETRY_TEST_TEST_GEOMETRIES_CUSTOM_SEGMENT_HPP
+
+
+#include <boost/geometry/geometries/register/point.hpp>
+#include <boost/geometry/geometries/register/segment.hpp>
+
+#include <boost/geometry/core/tag.hpp>
+#include <boost/geometry/core/tags.hpp>
+
+
+namespace test
+{
+
+struct custom_point_for_segment
+{
+ double x, y;
+};
+
+
+struct custom_segment
+{
+ custom_point_for_segment one, two;
+};
+
+template <typename P>
+struct custom_segment_of
+{
+ P p1, p2;
+};
+
+struct custom_segment_4
+{
+ double a, b, c, d;
+};
+
+
+} // namespace test
+
+
+BOOST_GEOMETRY_REGISTER_POINT_2D(test::custom_point_for_segment, double, cs::cartesian, x, y)
+
+BOOST_GEOMETRY_REGISTER_SEGMENT(test::custom_segment, test::custom_point_for_segment, one, two)
+BOOST_GEOMETRY_REGISTER_SEGMENT_TEMPLATIZED(test::custom_segment_of, p1, p2)
+BOOST_GEOMETRY_REGISTER_SEGMENT_2D_4VALUES(test::custom_segment_4, test::custom_point_for_segment, a, b, c, d)
+
+
+#endif // GEOMETRY_TEST_TEST_GEOMETRIES_CUSTOM_SEGMENT_HPP
diff --git a/libs/geometry/test/test_geometries/wrapped_boost_array.hpp b/libs/geometry/test/test_geometries/wrapped_boost_array.hpp
new file mode 100644
index 000000000..961e593a4
--- /dev/null
+++ b/libs/geometry/test/test_geometries/wrapped_boost_array.hpp
@@ -0,0 +1,151 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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 GEOMETRY_TEST_TEST_GEOMETRIES_WRAPPED_BOOST_ARRAY_HPP
+#define GEOMETRY_TEST_TEST_GEOMETRIES_WRAPPED_BOOST_ARRAY_HPP
+
+#include <cstddef>
+
+#include <boost/array.hpp>
+#include <boost/range.hpp>
+
+#include <boost/geometry/core/mutable_range.hpp>
+#include <boost/geometry/core/tag.hpp>
+#include <boost/geometry/core/tags.hpp>
+
+
+namespace test
+{
+
+template <typename Point, std::size_t Count>
+struct wrapped_boost_array
+{
+ inline wrapped_boost_array() : size(0) {}
+
+ boost::array<Point, Count> array;
+ int size;
+};
+
+
+} // namespace test
+
+
+// 1a: adapt to Boost.Range
+namespace boost
+{
+ using namespace test;
+
+ template <typename Point, std::size_t Count>
+ struct range_mutable_iterator<wrapped_boost_array<Point, Count> >
+ : public range_mutable_iterator<boost::array<Point, Count> >
+ {};
+
+ template <typename Point, std::size_t Count>
+ struct range_const_iterator<wrapped_boost_array<Point, Count> >
+ : public range_const_iterator<boost::array<Point, Count> >
+ {};
+
+
+} // namespace 'boost'
+
+
+// 1b) adapt to Boost.Range with ADP
+namespace test
+{
+ template <typename Point, std::size_t Count>
+ inline typename boost::range_iterator
+ <
+ wrapped_boost_array<Point, Count>
+ >::type range_begin(wrapped_boost_array<Point, Count>& ar)
+ {
+ return ar.array.begin();
+ }
+
+ template <typename Point, std::size_t Count>
+ inline typename boost::range_iterator
+ <
+ wrapped_boost_array<Point, Count> const
+ >::type range_begin(wrapped_boost_array<Point, Count> const& ar)
+ {
+ return ar.array.begin();
+ }
+
+ template <typename Point, std::size_t Count>
+ inline typename boost::range_iterator
+ <
+ wrapped_boost_array<Point, Count>
+ >::type range_end(wrapped_boost_array<Point, Count>& ar)
+ {
+ typename boost::range_iterator
+ <
+ wrapped_boost_array<Point, Count>
+ >::type it = ar.array.begin();
+ return it + ar.size;
+ }
+
+ template <typename Point, std::size_t Count>
+ inline typename boost::range_iterator
+ <
+ wrapped_boost_array<Point, Count> const
+ >::type range_end(wrapped_boost_array<Point, Count> const& ar)
+ {
+ typename boost::range_iterator
+ <
+ wrapped_boost_array<Point, Count> const
+ >::type it = ar.array.begin();
+ return it + ar.size;
+ }
+
+}
+
+
+// 2: adapt to Boost.Geometry
+namespace boost { namespace geometry { namespace traits
+{
+
+ template <typename Point, std::size_t Count>
+ struct tag< wrapped_boost_array<Point, Count> >
+ {
+ typedef linestring_tag type;
+ };
+
+ template <typename Point, std::size_t Count>
+ struct clear< wrapped_boost_array<Point, Count> >
+ {
+ static inline void apply(wrapped_boost_array<Point, Count>& ar)
+ {
+ ar.size = 0;
+ }
+ };
+
+ template <typename Point, std::size_t Count>
+ struct push_back< wrapped_boost_array<Point, Count> >
+ {
+ static inline void apply(wrapped_boost_array<Point, Count>& ar, Point const& point)
+ {
+ // BOOST_ASSERT((ar.size < Count));
+ ar.array[ar.size++] = point;
+ }
+ };
+
+ template <typename Point, std::size_t Count>
+ struct resize< wrapped_boost_array<Point, Count> >
+ {
+ static inline void apply(wrapped_boost_array<Point, Count>& ar, std::size_t new_size)
+ {
+ BOOST_ASSERT(new_size < Count);
+ ar.size = new_size;
+ }
+ };
+
+}}} // namespace bg::traits
+
+
+#endif // GEOMETRY_TEST_TEST_GEOMETRIES_WRAPPED_BOOST_ARRAY_HPP
diff --git a/libs/geometry/test/ttmath.vsprops b/libs/geometry/test/ttmath.vsprops
new file mode 100644
index 000000000..e01e29698
--- /dev/null
+++ b/libs/geometry/test/ttmath.vsprops
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="ttmath"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="&quot;$(TTMATH_ROOT)&quot;;&quot;../$(TTMATH_ROOT)&quot;;&quot;../../$(TTMATH_ROOT)&quot;"
+ />
+ <UserMacro
+ Name="TTMATH_ROOT"
+ Value="..\..\..\boost\geometry\extensions\contrib\ttmath"
+ />
+</VisualStudioPropertySheet>
diff --git a/libs/geometry/test/util/Jamfile.v2 b/libs/geometry/test/util/Jamfile.v2
new file mode 100644
index 000000000..bf706df73
--- /dev/null
+++ b/libs/geometry/test/util/Jamfile.v2
@@ -0,0 +1,18 @@
+# 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-util
+ :
+ [ run calculation_type.cpp ]
+ [ run for_each_coordinate.cpp ]
+ [ run rational.cpp ]
+ [ run select_most_precise.cpp ]
+ [ run write_dsv.cpp ]
+ ;
diff --git a/libs/geometry/test/util/as_range.cpp b/libs/geometry/test/util/as_range.cpp
new file mode 100644
index 000000000..f8696eeca
--- /dev/null
+++ b/libs/geometry/test/util/as_range.cpp
@@ -0,0 +1,79 @@
+// 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.
+
+// 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/geometry/views/detail/range_type.hpp>
+#include <boost/geometry/util/as_range.hpp>
+
+#include <boost/geometry/core/cs.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+
+template <int D, typename Range>
+double sum(Range const& range)
+{
+ double s = 0.0;
+ for (typename boost::range_const_iterator<Range>::type it = boost::begin(range);
+ it != boost::end(range); ++it)
+ {
+ s += bg::get<D>(*it);
+ }
+ return s;
+}
+
+template <typename G>
+void test_geometry(std::string const& wkt, double expected_x, double expected_y)
+{
+ G geometry;
+
+ // Declare a range-type, compatible with boost::range,
+ // such that range_iterator etc could be called
+ typedef typename bg::detail::range_type<G>::type range_type;
+
+ bg::read_wkt(wkt, geometry);
+
+ double s = sum<0>(bg::as_range<range_type>(geometry));
+ BOOST_CHECK_CLOSE(s, expected_x, 0.001);
+
+ s = sum<1>(bg::as_range<range_type>(geometry));
+ BOOST_CHECK_CLOSE(s, expected_y, 0.001);
+}
+
+
+template <typename P>
+void test_all()
+{
+ // As-range utility should consider a geometry as a range, so
+ // linestring stays linestring
+ test_geometry<bg::model::linestring<P> >("LINESTRING(1 2,3 4)", 4, 6);
+
+ // polygon will only be outer-ring
+ test_geometry<bg::model::polygon<P> >("POLYGON((1 2,3 4))", 4, 6);
+ test_geometry<bg::model::polygon<P> >("POLYGON((1 2,3 4),(5 6,7 8,9 10))", 4, 6);
+
+ // the utility is useful for:
+ // - convex hull (holes do not count)
+ // - envelope (idem)
+}
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/util/as_range.vcproj b/libs/geometry/test/util/as_range.vcproj
new file mode 100644
index 000000000..cc96fd53b
--- /dev/null
+++ b/libs/geometry/test/util/as_range.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="as_range"
+ ProjectGUID="{A36D8426-67EB-405C-B6E8-3FBB3374A59B}"
+ RootNamespace="as_range"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\as_range"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\as_range"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\as_range.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/util/calculation_type.cpp b/libs/geometry/test/util/calculation_type.cpp
new file mode 100644
index 000000000..34523e8af
--- /dev/null
+++ b/libs/geometry/test/util/calculation_type.cpp
@@ -0,0 +1,206 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2012 Bruno Lalande, Paris, France.
+// Copyright (c) 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)
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/util/calculation_type.hpp>
+
+template <typename G1, typename G2>
+inline std::string helper()
+{
+ std::string result;
+ result += typeid(typename bg::coordinate_type<G1>::type).name();
+ result += "/";
+ result += typeid(typename bg::coordinate_type<G2>::type).name();
+ return result;
+}
+
+template <typename G1, typename G2, typename G3>
+inline std::string helper3()
+{
+ std::string result;
+ result += typeid(typename bg::coordinate_type<G1>::type).name();
+ result += "/";
+ result += typeid(typename bg::coordinate_type<G2>::type).name();
+ result += "/";
+ result += typeid(typename bg::coordinate_type<G3>::type).name();
+ return result;
+}
+
+template
+<
+ typename G1,
+ typename G2,
+ typename DefaultFP,
+ typename DefaultInt,
+ typename ExpectedType
+>
+void test()
+{
+ typedef typename bg::util::calculation_type::geometric::binary
+ <
+ G1,
+ G2,
+ void,
+ DefaultFP,
+ DefaultInt
+ >::type type;
+
+ std::string const caption = helper<G1, G2>();
+
+ BOOST_CHECK_MESSAGE((boost::is_same<type, ExpectedType>::type::value),
+ "Failure, types do not agree;"
+ << " input: " << caption
+ << " defaults: " << typeid(DefaultFP).name()
+ << "/" << typeid(DefaultInt).name()
+ << " expected: " << typeid(ExpectedType).name()
+ << " detected: " << typeid(type).name()
+ );
+}
+
+template
+<
+ typename G1,
+ typename G2,
+ typename CalculationType,
+ typename ExpectedType
+>
+void test_with_calculation_type()
+{
+ typedef typename bg::util::calculation_type::geometric::binary
+ <
+ G1,
+ G2,
+ CalculationType,
+ double,
+ int
+ >::type type;
+
+ std::string const caption = helper<G1, G2>();
+
+ BOOST_CHECK_MESSAGE((boost::is_same<type, ExpectedType>::type::value),
+ "Failure, types do not agree;"
+ << " input: " << caption
+ << " calculation type: " << typeid(CalculationType).name()
+ << " expected: " << typeid(ExpectedType).name()
+ << " detected: " << typeid(type).name()
+ );
+}
+
+template
+<
+ typename Geometry,
+ typename DefaultFP,
+ typename DefaultInt,
+ typename ExpectedType
+>
+void test_unary()
+{
+ typedef typename bg::util::calculation_type::geometric::unary
+ <
+ Geometry,
+ void,
+ DefaultFP,
+ DefaultInt
+ >::type type;
+
+ BOOST_CHECK_MESSAGE((boost::is_same<type, ExpectedType>::type::value),
+ "Failure, types do not agree;"
+ << " input: " << typeid(typename bg::coordinate_type<Geometry>::type).name()
+ << " defaults: " << typeid(DefaultFP).name()
+ << "/" << typeid(DefaultInt).name()
+ << " expected: " << typeid(ExpectedType).name()
+ << " detected: " << typeid(type).name()
+ );
+}
+
+
+template
+<
+ typename G1,
+ typename G2,
+ typename G3,
+ typename DefaultFP,
+ typename DefaultInt,
+ typename ExpectedType
+>
+void test_ternary()
+{
+ typedef typename bg::util::calculation_type::geometric::ternary
+ <
+ G1,
+ G2,
+ G3,
+ void,
+ DefaultFP,
+ DefaultInt
+ >::type type;
+
+ std::string const caption = helper3<G1, G2, G3>();
+
+ BOOST_CHECK_MESSAGE((boost::is_same<type, ExpectedType>::type::value),
+ "Failure, types do not agree;"
+ << " input: " << caption
+ << " defaults: " << typeid(DefaultFP).name()
+ << "/" << typeid(DefaultInt).name()
+ << " expected: " << typeid(ExpectedType).name()
+ << " detected: " << typeid(type).name()
+ );
+}
+
+
+struct user_defined {};
+
+int test_main(int, char* [])
+{
+ using namespace boost::geometry;
+ typedef model::point<double, 2, cs::cartesian> d;
+ typedef model::point<float, 2, cs::cartesian> f;
+ typedef model::point<int, 2, cs::cartesian> i;
+ typedef model::point<char, 2, cs::cartesian> c;
+ typedef model::point<short int, 2, cs::cartesian> s;
+ typedef model::point<boost::long_long_type, 2, cs::cartesian> ll;
+ typedef model::point<user_defined, 2, cs::cartesian> u;
+
+ // Calculation type "void" so
+ test<f, f, double, int, double>();
+ test<d, d, double, int, double>();
+ test<f, d, double, int, double>();
+
+ // FP/int mixed
+ test<i, f, double, int, double>();
+
+ // integers
+ test<i, i, double, int, int>();
+ test<c, i, double, int, int>();
+ test<c, c, double, char, char>();
+ test<c, c, double, int, int>();
+ test<i, i, double, boost::long_long_type, boost::long_long_type>();
+
+ // Even if we specify "int" as default-calculation-type, it should never go downwards.
+ // So it will select "long long"
+ test<ll, ll, double, int, boost::long_long_type>();
+
+ // user defined
+ test<u, i, double, char, user_defined>();
+ test<u, d, double, double, user_defined>();
+
+ test_with_calculation_type<i, i, double, double>();
+ test_with_calculation_type<u, u, double, double>();
+
+ test_unary<i, double, int, int>();
+ test_unary<u, double, double, user_defined>();
+ test_ternary<u, u, u, double, double, user_defined>();
+
+ return 0;
+}
diff --git a/libs/geometry/test/util/calculation_type.vcproj b/libs/geometry/test/util/calculation_type.vcproj
new file mode 100644
index 000000000..9c2920035
--- /dev/null
+++ b/libs/geometry/test/util/calculation_type.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="calculation_type"
+ ProjectGUID="{CF8FE803-A26B-4553-B605-9C28225B5595}"
+ RootNamespace="calculation_type"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\calculation_type"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\calculation_type"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\calculation_type.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/util/for_each_coordinate.cpp b/libs/geometry/test/util/for_each_coordinate.cpp
new file mode 100644
index 000000000..140d6f6cb
--- /dev/null
+++ b/libs/geometry/test/util/for_each_coordinate.cpp
@@ -0,0 +1,84 @@
+// 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.
+
+// 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 <sstream>
+
+#include <geometry_test_common.hpp>
+
+
+#include <boost/geometry/util/for_each_coordinate.hpp>
+
+#include <boost/geometry/algorithms/assign.hpp>
+
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include <test_common/test_point.hpp>
+
+BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+
+struct test_operation
+{
+ template <typename P, int I>
+ static void apply(P& p)
+ {
+ bg::set<I>(p, bg::get<I>(p) * 10);
+ }
+};
+
+struct get_operation
+{
+ std::string s;
+
+ template <typename P, int I>
+ inline void apply(P const& p)
+ {
+ std::ostringstream out;
+ out << bg::get<I>(p);
+ s += out.str();
+ }
+};
+
+
+template <typename P>
+void test_all()
+{
+ P p;
+ bg::assign_values(p, 1, 2, 3);
+ bg::for_each_coordinate(p, test_operation());
+ BOOST_CHECK(bg::get<0>(p) == 10);
+ BOOST_CHECK(bg::get<1>(p) == 20);
+ BOOST_CHECK(bg::get<2>(p) == 30);
+
+ P const& cp = p;
+ get_operation op;
+ op = bg::for_each_coordinate(cp, op);
+ BOOST_CHECK(op.s == std::string("102030"));
+}
+
+int test_main(int, char* [])
+{
+ test_all<int[3]>();
+ test_all<float[3]>();
+ test_all<double[3]>();
+ test_all<test::test_point>();
+ test_all<bg::model::point<int, 3, bg::cs::cartesian> >();
+ test_all<bg::model::point<float, 3, bg::cs::cartesian> >();
+ test_all<bg::model::point<double, 3, bg::cs::cartesian> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/util/for_each_coordinate.vcproj b/libs/geometry/test/util/for_each_coordinate.vcproj
new file mode 100644
index 000000000..5afce6532
--- /dev/null
+++ b/libs/geometry/test/util/for_each_coordinate.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="for_each_coordinate"
+ ProjectGUID="{900CD32E-1B78-40E3-887F-9BCCC0A1041E}"
+ RootNamespace="for_each_coordinate"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\for_each_coordinate"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\for_each_coordinate"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\for_each_coordinate.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/util/rational.cpp b/libs/geometry/test/util/rational.cpp
new file mode 100644
index 000000000..595d391e2
--- /dev/null
+++ b/libs/geometry/test/util/rational.cpp
@@ -0,0 +1,61 @@
+// 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.
+
+// 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/geometry/geometries/geometries.hpp>
+#include <boost/geometry/io/wkt/wkt.hpp>
+#include <boost/geometry/util/rational.hpp>
+
+void test_coordinate_cast(std::string const& s, int expected_nom, int expected_denom)
+{
+ boost::rational<int> a = bg::detail::coordinate_cast<boost::rational<int> >::apply(s);
+ BOOST_CHECK_EQUAL(a.numerator(), expected_nom);
+ BOOST_CHECK_EQUAL(a.denominator(), expected_denom);
+}
+
+
+void test_wkt(std::string const& wkt, std::string const expected_wkt)
+{
+ bg::model::point<boost::rational<int>, 2, bg::cs::cartesian> p;
+ bg::read_wkt(wkt, p);
+ std::ostringstream out;
+ out << bg::wkt(p);
+
+ BOOST_CHECK_EQUAL(out.str(), expected_wkt);
+}
+
+int test_main(int, char* [])
+{
+ test_coordinate_cast("0", 0, 1);
+ test_coordinate_cast("1", 1, 1);
+ test_coordinate_cast("-1", -1, 1);
+ test_coordinate_cast("-0.5", -1, 2);
+ test_coordinate_cast("-1.5", -3, 2);
+ test_coordinate_cast("0.5", 1, 2);
+ test_coordinate_cast("1.5", 3, 2);
+ test_coordinate_cast("2.12345", 42469, 20000);
+ test_coordinate_cast("1.", 1, 1);
+
+ test_coordinate_cast("3/2", 3, 2);
+ test_coordinate_cast("-3/2", -3, 2);
+
+ test_wkt("POINT(1.5 2.75)", "POINT(3/2 11/4)");
+ test_wkt("POINT(3/2 11/4)", "POINT(3/2 11/4)");
+ test_wkt("POINT(-1.5 2.75)", "POINT(-3/2 11/4)");
+ test_wkt("POINT(-3/2 11/4)", "POINT(-3/2 11/4)");
+
+ return 0;
+}
diff --git a/libs/geometry/test/util/rational.vcproj b/libs/geometry/test/util/rational.vcproj
new file mode 100644
index 000000000..28ad0a237
--- /dev/null
+++ b/libs/geometry/test/util/rational.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="rational"
+ ProjectGUID="{6ABF6324-C1DC-4687-9895-B4CE2B27446F}"
+ RootNamespace="rational"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\rational"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\rational"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\rational.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/util/select_most_precise.cpp b/libs/geometry/test/util/select_most_precise.cpp
new file mode 100644
index 000000000..11b066fa3
--- /dev/null
+++ b/libs/geometry/test/util/select_most_precise.cpp
@@ -0,0 +1,69 @@
+// 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.
+
+// 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/geometry/util/select_most_precise.hpp>
+
+
+struct user_defined {};
+
+template <typename T1, typename T2, typename ExpectedType>
+void test()
+{
+ typedef typename bg::select_most_precise<T1, T2>::type type;
+
+ BOOST_CHECK((boost::is_same<type, ExpectedType>::type::value));
+}
+
+int test_main(int, char* [])
+{
+ // fp only
+ test<float, float, float>();
+ test<float, double, double>();
+ test<double, float, double>();
+ test<double, double, double>();
+
+ // integer only
+ test<int, int, int>();
+ test<int, short int, int>();
+ test<short int, int, int>();
+ test<short int, short int, short int>();
+
+ // int/fp
+ test<double, int, double>();
+ test<int, double, double>();
+ test<long double, long double, long double>();
+ test<float, int, float>();
+ test<int, float, float>();
+
+#ifndef _MSC_VER
+ // This cannot be done for MSVC because double/long double is the same
+ test<double, long double, long double>();
+ test<long double, double, long double>();
+#endif
+
+ // with any other non-integer/float class
+ test<int, user_defined, user_defined>();
+ test<user_defined, int, user_defined>();
+ test<long double, user_defined, user_defined>();
+ test<user_defined, long double, user_defined>();
+ test<user_defined, user_defined, user_defined>();
+
+ // should not compile
+ //test<void, void, void>();
+
+ return 0;
+}
diff --git a/libs/geometry/test/util/select_most_precise.vcproj b/libs/geometry/test/util/select_most_precise.vcproj
new file mode 100644
index 000000000..ebe824503
--- /dev/null
+++ b/libs/geometry/test/util/select_most_precise.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="select_most_precise"
+ ProjectGUID="{D0982142-D3B1-4084-B724-83FB7E49EB98}"
+ RootNamespace="select_most_precise"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\select_most_precise"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\select_most_precise"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\select_most_precise.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/util/util_tests.sln b/libs/geometry/test/util/util_tests.sln
new file mode 100644
index 000000000..1e140df83
--- /dev/null
+++ b/libs/geometry/test/util/util_tests.sln
@@ -0,0 +1,49 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "for_each_coordinate", "for_each_coordinate.vcproj", "{900CD32E-1B78-40E3-887F-9BCCC0A1041E}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "select_most_precise", "select_most_precise.vcproj", "{D0982142-D3B1-4084-B724-83FB7E49EB98}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "write_dsv", "write_dsv.vcproj", "{FC796B9D-2FC4-46C1-B733-9C2C5BB48094}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "as_range", "as_range.vcproj", "{A36D8426-67EB-405C-B6E8-3FBB3374A59B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rational", "rational.vcproj", "{6ABF6324-C1DC-4687-9895-B4CE2B27446F}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "calculation_type", "calculation_type.vcproj", "{CF8FE803-A26B-4553-B605-9C28225B5595}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {900CD32E-1B78-40E3-887F-9BCCC0A1041E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {900CD32E-1B78-40E3-887F-9BCCC0A1041E}.Debug|Win32.Build.0 = Debug|Win32
+ {900CD32E-1B78-40E3-887F-9BCCC0A1041E}.Release|Win32.ActiveCfg = Release|Win32
+ {900CD32E-1B78-40E3-887F-9BCCC0A1041E}.Release|Win32.Build.0 = Release|Win32
+ {D0982142-D3B1-4084-B724-83FB7E49EB98}.Debug|Win32.ActiveCfg = Debug|Win32
+ {D0982142-D3B1-4084-B724-83FB7E49EB98}.Debug|Win32.Build.0 = Debug|Win32
+ {D0982142-D3B1-4084-B724-83FB7E49EB98}.Release|Win32.ActiveCfg = Release|Win32
+ {D0982142-D3B1-4084-B724-83FB7E49EB98}.Release|Win32.Build.0 = Release|Win32
+ {FC796B9D-2FC4-46C1-B733-9C2C5BB48094}.Debug|Win32.ActiveCfg = Debug|Win32
+ {FC796B9D-2FC4-46C1-B733-9C2C5BB48094}.Debug|Win32.Build.0 = Debug|Win32
+ {FC796B9D-2FC4-46C1-B733-9C2C5BB48094}.Release|Win32.ActiveCfg = Release|Win32
+ {FC796B9D-2FC4-46C1-B733-9C2C5BB48094}.Release|Win32.Build.0 = Release|Win32
+ {A36D8426-67EB-405C-B6E8-3FBB3374A59B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {A36D8426-67EB-405C-B6E8-3FBB3374A59B}.Debug|Win32.Build.0 = Debug|Win32
+ {A36D8426-67EB-405C-B6E8-3FBB3374A59B}.Release|Win32.ActiveCfg = Release|Win32
+ {A36D8426-67EB-405C-B6E8-3FBB3374A59B}.Release|Win32.Build.0 = Release|Win32
+ {6ABF6324-C1DC-4687-9895-B4CE2B27446F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {6ABF6324-C1DC-4687-9895-B4CE2B27446F}.Debug|Win32.Build.0 = Debug|Win32
+ {6ABF6324-C1DC-4687-9895-B4CE2B27446F}.Release|Win32.ActiveCfg = Release|Win32
+ {6ABF6324-C1DC-4687-9895-B4CE2B27446F}.Release|Win32.Build.0 = Release|Win32
+ {CF8FE803-A26B-4553-B605-9C28225B5595}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CF8FE803-A26B-4553-B605-9C28225B5595}.Debug|Win32.Build.0 = Debug|Win32
+ {CF8FE803-A26B-4553-B605-9C28225B5595}.Release|Win32.ActiveCfg = Release|Win32
+ {CF8FE803-A26B-4553-B605-9C28225B5595}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/util/write_dsv.cpp b/libs/geometry/test/util/write_dsv.cpp
new file mode 100644
index 000000000..ebb70636a
--- /dev/null
+++ b/libs/geometry/test/util/write_dsv.cpp
@@ -0,0 +1,73 @@
+// 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.
+
+// 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 <sstream>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/io/dsv/write.hpp>
+
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+
+
+
+template <typename G>
+void test_dsv(std::string const& wkt, std::string const& dsv)
+{
+ G geometry;
+
+ bg::read_wkt(wkt, geometry);
+
+ std::ostringstream out;
+ out << bg::dsv(geometry);
+ BOOST_CHECK_EQUAL(out.str(), dsv);
+}
+
+
+#ifndef GEOMETRY_TEST_MULTI
+template <typename T>
+void test_all()
+{
+ using namespace boost::geometry;
+ typedef model::point<T, 2, cs::cartesian> P;
+
+ test_dsv<P >("POINT(1 2)", "(1, 2)");
+ test_dsv<model::linestring<P> >(
+ "LINESTRING(1 1,2 2,3 3)",
+ "((1, 1), (2, 2), (3, 3))");
+ test_dsv<model::polygon<P> >("POLYGON((0 0,0 4,4 4,4 0,0 0))",
+ "(((0, 0), (0, 4), (4, 4), (4, 0), (0, 0)))");
+
+ test_dsv<model::ring<P> >("POLYGON((0 0,0 4,4 4,4 0,0 0))",
+ "((0, 0), (0, 4), (4, 4), (4, 0), (0, 0))");
+
+ test_dsv<model::box<P> >("BOX(0 0,1 1)",
+ "((0, 0), (1, 1))");
+}
+#endif
+
+
+int test_main(int, char* [])
+{
+ test_all<double>();
+ test_all<int>();
+
+
+ return 0;
+}
+
diff --git a/libs/geometry/test/util/write_dsv.vcproj b/libs/geometry/test/util/write_dsv.vcproj
new file mode 100644
index 000000000..8525f7393
--- /dev/null
+++ b/libs/geometry/test/util/write_dsv.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="write_dsv"
+ ProjectGUID="{FC796B9D-2FC4-46C1-B733-9C2C5BB48094}"
+ RootNamespace="write_dsv"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\write_dsv"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\write_dsv"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\write_dsv.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/views/Jamfile.v2 b/libs/geometry/test/views/Jamfile.v2
new file mode 100644
index 000000000..cb2f5fb5a
--- /dev/null
+++ b/libs/geometry/test/views/Jamfile.v2
@@ -0,0 +1,18 @@
+# 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-views
+ :
+ [ run segment_view.cpp ]
+ [ run box_view.cpp ]
+ [ run reversible_view.cpp ]
+ [ run closeable_view.cpp ]
+ [ run reversible_closeable.cpp ]
+ ;
diff --git a/libs/geometry/test/views/box_view.cpp b/libs/geometry/test/views/box_view.cpp
new file mode 100644
index 000000000..e2eab5d21
--- /dev/null
+++ b/libs/geometry/test/views/box_view.cpp
@@ -0,0 +1,81 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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 <algorithm>
+#include <iterator>
+#include <sstream>
+#include <string>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/views/box_view.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
+
+
+
+template <typename Box, bool Reverse>
+void test_geometry(std::string const& wkt, std::string const& expected,
+ bg::order_selector expected_order)
+{
+
+ Box box;
+ bg::read_wkt(wkt, box);
+
+ typedef bg::box_view<Box, Reverse> view_type;
+ view_type range(box);
+
+ {
+ std::ostringstream out;
+ for (typename boost::range_iterator<view_type>::type it = boost::begin(range);
+ it != boost::end(range); ++it)
+ {
+ out << " " << bg::get<0>(*it) << bg::get<1>(*it);
+ }
+ BOOST_CHECK_EQUAL(out.str(), expected);
+ }
+
+ {
+ // Check forward/backward behaviour
+ typename boost::range_iterator<view_type>::type it = boost::begin(range);
+ it++;
+ it--;
+ // Not verified further, same as segment
+ }
+
+ {
+ // Check random access behaviour
+ int const n = boost::size(range);
+ BOOST_CHECK_EQUAL(n, 5);
+ }
+
+ // Check Boost.Range concept
+ BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<view_type>) );
+
+ // Check order
+ bg::order_selector order = bg::point_order<view_type>::value;
+ BOOST_CHECK_EQUAL(order, expected_order);
+}
+
+
+template <typename P>
+void test_all()
+{
+ test_geometry<bg::model::box<P>, true> ("polygon((1 1,2 2))", " 11 12 22 21 11", bg::clockwise);
+ test_geometry<bg::model::box<P>, false>("polygon((1 1,2 2))", " 11 21 22 12 11", bg::counterclockwise);
+ test_geometry<bg::model::box<P>, true> ("polygon((3 3,5 5))", " 33 35 55 53 33", bg::clockwise);
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<double> >();
+ return 0;
+}
diff --git a/libs/geometry/test/views/box_view.vcproj b/libs/geometry/test/views/box_view.vcproj
new file mode 100644
index 000000000..ab1036bee
--- /dev/null
+++ b/libs/geometry/test/views/box_view.vcproj
@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="box_view"
+ ProjectGUID="{34A1F53A-DA46-41E6-9E26-740D22D662DC}"
+ RootNamespace="box_view"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\box_view"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\box_view"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\box_view.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/views/closeable_view.cpp b/libs/geometry/test/views/closeable_view.cpp
new file mode 100644
index 000000000..dde61a067
--- /dev/null
+++ b/libs/geometry/test/views/closeable_view.cpp
@@ -0,0 +1,134 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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 <algorithm>
+#include <iterator>
+#include <sstream>
+#include <string>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/views/closeable_view.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/io/dsv/write.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian);
+
+
+
+// The closeable view should also work on normal std:: containers
+void test_non_geometry()
+{
+ typedef bg::closeable_view
+ <
+ std::vector<int> const, bg::open
+ >::type view_type;
+
+ std::vector<int> v;
+ v.push_back(1);
+ v.push_back(2);
+ v.push_back(3);
+
+ view_type view(v);
+
+ typedef boost::range_iterator<view_type const>::type iterator;
+ iterator it = boost::begin(view);
+ iterator end = boost::end(view);
+
+ std::ostringstream out;
+ for ( ; it != end; ++it)
+ {
+ out << *it;
+ }
+ BOOST_CHECK_EQUAL(out.str(), "1231");
+
+ // Check operators =, ++, --, +=, -=
+ it = boost::begin(view);
+ BOOST_CHECK_EQUAL(*it, 1);
+ it += 2;
+ BOOST_CHECK_EQUAL(*it, 3);
+ it -= 2;
+ BOOST_CHECK_EQUAL(*it, 1);
+ it++;
+ BOOST_CHECK_EQUAL(*it, 2);
+ it--;
+ BOOST_CHECK_EQUAL(*it, 1);
+
+ // Also check them in the last regions
+ it = boost::begin(view) + 3;
+ BOOST_CHECK_EQUAL(*it, 1);
+ it--;
+ BOOST_CHECK_EQUAL(*it, 3);
+ it++;
+ BOOST_CHECK_EQUAL(*it, 1);
+ it -= 2;
+ BOOST_CHECK_EQUAL(*it, 2);
+ it += 2;
+ BOOST_CHECK_EQUAL(*it, 1);
+
+ BOOST_CHECK_EQUAL(boost::size(view), 4u);
+}
+
+
+template <bg::closure_selector Closure, typename Range>
+void test_optionally_closing(Range const& range, std::string const& expected)
+{
+ typedef typename bg::closeable_view<Range const, Closure>::type view_type;
+ typedef typename boost::range_iterator<view_type const>::type iterator;
+
+ view_type view(range);
+
+ bool first = true;
+ std::ostringstream out;
+ iterator end = boost::end(view);
+ for (iterator it = boost::begin(view); it != end; ++it, first = false)
+ {
+ out << (first ? "" : " ") << bg::dsv(*it);
+ }
+ BOOST_CHECK_EQUAL(out.str(), expected);
+}
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt,
+ std::string const& expected_false,
+ std::string const& expected_true)
+{
+ Geometry geo;
+ bg::read_wkt(wkt, geo);
+
+ test_optionally_closing<bg::closed>(geo, expected_false);
+ test_optionally_closing<bg::open>(geo, expected_true);
+}
+
+
+template <typename P>
+void test_all()
+{
+ test_geometry<bg::model::ring<P> >(
+ "POLYGON((1 1,1 4,4 4,4 1))",
+ "(1, 1) (1, 4) (4, 4) (4, 1)",
+ "(1, 1) (1, 4) (4, 4) (4, 1) (1, 1)");
+}
+
+
+int test_main(int, char* [])
+{
+ test_non_geometry();
+
+ test_all<bg::model::d2::point_xy<double> >();
+ test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_all<boost::tuple<double, double> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/views/closeable_view.vcproj b/libs/geometry/test/views/closeable_view.vcproj
new file mode 100644
index 000000000..204e1ac30
--- /dev/null
+++ b/libs/geometry/test/views/closeable_view.vcproj
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="closeable_view"
+ ProjectGUID="{5C40995A-B6FC-4C94-B552-0D80EC9E2049}"
+ RootNamespace="closeable_view"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\closeable_view"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\closeable_view"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\closeable_view.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/views/reversible_closeable.cpp b/libs/geometry/test/views/reversible_closeable.cpp
new file mode 100644
index 000000000..9cd2421b6
--- /dev/null
+++ b/libs/geometry/test/views/reversible_closeable.cpp
@@ -0,0 +1,165 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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 <algorithm>
+#include <iterator>
+#include <sstream>
+#include <string>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/views/closeable_view.hpp>
+#include <boost/geometry/views/reversible_view.hpp>
+
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/io/dsv/write.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian);
+
+
+template <typename View>
+void test_option(View const& view, std::string const& expected)
+{
+
+ bool first = true;
+ std::ostringstream out;
+
+ typedef typename boost::range_iterator<View const>::type iterator;
+
+ iterator end = boost::end(view);
+ for (iterator it = boost::begin(view); it != end; ++it, first = false)
+ {
+ out << (first ? "" : " ") << bg::dsv(*it);
+ }
+ BOOST_CHECK_EQUAL(out.str(), expected);
+}
+
+template <bg::closure_selector Closure, bg::iterate_direction Direction, typename Range>
+void test_close_reverse(Range const& range, std::string const& expected)
+{
+ typedef typename bg::reversible_view<Range const, Direction>::type rview;
+ typedef typename bg::closeable_view<rview const, Closure>::type cview;
+
+ rview view1(range);
+ cview view2(view1);
+
+ test_option(view2, expected);
+}
+
+
+template <bg::iterate_direction Direction, bg::closure_selector Closure, typename Range>
+void test_reverse_close(Range const& range, std::string const& expected)
+{
+ typedef typename bg::closeable_view<Range const, Closure>::type cview;
+ typedef typename bg::reversible_view<cview const, Direction>::type rview;
+
+ cview view1(range);
+ rview view2(view1);
+ test_option(view2, expected);
+}
+
+
+template
+<
+ bg::iterate_direction Direction1,
+ bg::iterate_direction Direction2,
+ typename Range
+>
+void test_reverse_reverse(Range const& range, std::string const& expected)
+{
+ typedef typename bg::reversible_view<Range const, Direction1>::type rview1;
+ typedef typename bg::reversible_view<rview1 const, Direction2>::type rview2;
+
+ rview1 view1(range);
+ rview2 view2(view1);
+ test_option(view2, expected);
+}
+
+template
+<
+ bg::closure_selector Closure1,
+ bg::closure_selector Closure2,
+ typename Range
+>
+void test_close_close(Range const& range, std::string const& expected)
+{
+ typedef typename bg::closeable_view<Range const, Closure1>::type cview1;
+ typedef typename bg::closeable_view<cview1 const, Closure2>::type cview2;
+
+ cview1 view1(range);
+ cview2 view2(view1);
+ test_option(view2, expected);
+}
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt,
+ std::string const& expected_n,
+ std::string const& expected_r,
+ std::string const& closing,
+ std::string const& rclosing
+ )
+{
+ std::string expected;
+ Geometry geo;
+ bg::read_wkt(wkt, geo);
+
+ test_close_reverse<bg::closed, bg::iterate_forward>(geo, expected_n);
+ test_close_reverse<bg::open, bg::iterate_forward>(geo, expected_n + closing);
+ test_close_reverse<bg::closed, bg::iterate_reverse>(geo, expected_r);
+
+ // 13-12-2010, this case was problematic in MSVC
+ // SOLVED: caused by IMPLICIT constructor! It is now explicit and should be kept like that.
+ test_close_reverse<bg::open, bg::iterate_reverse>(geo, expected_r + rclosing);
+
+ test_reverse_close<bg::iterate_forward, bg::closed>(geo, expected_n);
+ test_reverse_close<bg::iterate_forward, bg::open>(geo, expected_n + closing);
+ test_reverse_close<bg::iterate_reverse, bg::closed>(geo, expected_r);
+
+ // first closed, then reversed:
+ expected = boost::trim_copy(closing + " " + expected_r);
+ test_reverse_close<bg::iterate_reverse, bg::open>(geo, expected);
+
+ test_reverse_reverse<bg::iterate_forward, bg::iterate_forward>(geo, expected_n);
+ test_reverse_reverse<bg::iterate_reverse, bg::iterate_reverse>(geo, expected_n);
+ test_reverse_reverse<bg::iterate_forward, bg::iterate_reverse>(geo, expected_r);
+ test_reverse_reverse<bg::iterate_reverse, bg::iterate_forward>(geo, expected_r);
+
+ test_close_close<bg::closed, bg::closed>(geo, expected_n);
+ test_close_close<bg::open, bg::closed>(geo, expected_n + closing);
+ test_close_close<bg::closed, bg::open>(geo, expected_n + closing);
+ test_close_close<bg::open, bg::open>(geo, expected_n + closing + closing);
+}
+
+
+template <typename P>
+void test_all()
+{
+ test_geometry<bg::model::ring<P> >(
+ "POLYGON((1 1,1 4,4 4,4 1))",
+ "(1, 1) (1, 4) (4, 4) (4, 1)",
+ "(4, 1) (4, 4) (1, 4) (1, 1)",
+ " (1, 1)", // closing
+ " (4, 1)" // rclosing
+ );
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<double> >();
+ test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_all<boost::tuple<double, double> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/views/reversible_closeable.vcproj b/libs/geometry/test/views/reversible_closeable.vcproj
new file mode 100644
index 000000000..b2a3846b1
--- /dev/null
+++ b/libs/geometry/test/views/reversible_closeable.vcproj
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="reversible_closeable"
+ ProjectGUID="{AAA72638-34CD-4A34-8329-984DFC766E24}"
+ RootNamespace="reversible_closeable"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\reversible_closeable"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\reversible_closeable"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\reversible_closeable.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/views/reversible_view.cpp b/libs/geometry/test/views/reversible_view.cpp
new file mode 100644
index 000000000..ba9c5ef0f
--- /dev/null
+++ b/libs/geometry/test/views/reversible_view.cpp
@@ -0,0 +1,81 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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 <algorithm>
+#include <iterator>
+#include <sstream>
+#include <string>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/views/reversible_view.hpp>
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+#include <boost/geometry/io/dsv/write.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian);
+
+
+template <bg::iterate_direction Direction, typename Range>
+void test_forward_or_reverse(Range const& range, std::string const& expected)
+{
+ typedef typename bg::reversible_view
+ <
+ Range const,
+ Direction
+ >::type view_type;
+
+ view_type view(range);
+
+ bool first = true;
+ std::ostringstream out;
+ for (typename boost::range_iterator<view_type const>::type
+ it = boost::begin(view);
+ it != boost::end(view);
+ ++it, first = false)
+ {
+ out << (first ? "" : " ") << bg::dsv(*it);
+ }
+ BOOST_CHECK_EQUAL(out.str(), expected);
+}
+
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt,
+ std::string const& expected_forward, std::string const& expected_reverse)
+{
+ Geometry geo;
+ bg::read_wkt(wkt, geo);
+
+ test_forward_or_reverse<bg::iterate_forward>(geo, expected_forward);
+ test_forward_or_reverse<bg::iterate_reverse>(geo, expected_reverse);
+}
+
+template <typename P>
+void test_all()
+{
+ test_geometry<bg::model::linestring<P> >(
+ "linestring(1 1,2 2,3 3)",
+ "(1, 1) (2, 2) (3, 3)",
+ "(3, 3) (2, 2) (1, 1)");
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<double> >();
+ test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_all<boost::tuple<double, double> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/views/reversible_view.vcproj b/libs/geometry/test/views/reversible_view.vcproj
new file mode 100644
index 000000000..f81885210
--- /dev/null
+++ b/libs/geometry/test/views/reversible_view.vcproj
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="reversible_view"
+ ProjectGUID="{BFB08FEE-76D6-4F3D-9184-BE03CC3F7968}"
+ RootNamespace="reversible_view"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\reversible_view"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\reversible_view"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\reversible_view.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/views/segment_view.cpp b/libs/geometry/test/views/segment_view.cpp
new file mode 100644
index 000000000..adc9535bd
--- /dev/null
+++ b/libs/geometry/test/views/segment_view.cpp
@@ -0,0 +1,86 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 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 <algorithm>
+#include <iterator>
+#include <sstream>
+#include <string>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/views/segment_view.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
+
+
+
+template <typename Segment>
+void test_geometry(std::string const& wkt, std::string const& expected)
+{
+
+ Segment segment;
+ bg::read_wkt(wkt, segment);
+
+ typedef bg::segment_view<Segment> range_type;
+ range_type range(segment);
+
+ {
+ std::ostringstream out;
+ for (typename boost::range_iterator<range_type>::type it = boost::begin(range);
+ it != boost::end(range); ++it)
+ {
+ out << " " << bg::get<0>(*it) << bg::get<1>(*it);
+ }
+ BOOST_CHECK_EQUAL(out.str(), expected);
+ }
+
+ {
+ // Check forward/backward behaviour
+ std::ostringstream out;
+ typename boost::range_iterator<range_type>::type it = boost::begin(range);
+ it++;
+ it--;
+ out << " " << bg::get<0>(*it) << bg::get<1>(*it);
+ typename boost::range_iterator<range_type>::type it2 = boost::end(range);
+ it2--;
+ out << " " << bg::get<0>(*it2) << bg::get<1>(*it2);
+ BOOST_CHECK_EQUAL(out.str(), expected);
+ }
+
+ {
+ // Check random access behaviour
+ int const n = boost::size(range);
+ BOOST_CHECK_EQUAL(n, 2);
+ }
+
+ // Check Boost.Range concept
+ BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<range_type>) );
+
+}
+
+
+template <typename P>
+void test_all()
+{
+ test_geometry<bg::model::segment<P> >("linestring(1 1,2 2)", " 11 22");
+ test_geometry<bg::model::segment<P> >("linestring(4 4,3 3)", " 44 33");
+}
+
+
+int test_main(int, char* [])
+{
+ std::vector<int> a;
+ a.push_back(1);
+ boost::range_iterator<std::vector<int> const>::type it = a.end();
+ --it;
+ std::cout << *it << std::endl;
+ test_all<bg::model::d2::point_xy<double> >();
+ return 0;
+}
diff --git a/libs/geometry/test/views/segment_view.vcproj b/libs/geometry/test/views/segment_view.vcproj
new file mode 100644
index 000000000..9b8840193
--- /dev/null
+++ b/libs/geometry/test/views/segment_view.vcproj
@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="segment_view"
+ ProjectGUID="{B49AC3E2-3497-465B-88C2-BCADA4B4ADAF}"
+ RootNamespace="segment_view"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\segment_view"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\segment_view"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\segment_view.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/views/views.sln b/libs/geometry/test/views/views.sln
new file mode 100644
index 000000000..7fcf73665
--- /dev/null
+++ b/libs/geometry/test/views/views.sln
@@ -0,0 +1,43 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "closeable_view", "closeable_view.vcproj", "{5C40995A-B6FC-4C94-B552-0D80EC9E2049}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reversible_closeable", "reversible_closeable.vcproj", "{AAA72638-34CD-4A34-8329-984DFC766E24}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reversible_view", "reversible_view.vcproj", "{BFB08FEE-76D6-4F3D-9184-BE03CC3F7968}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "box_view", "box_view.vcproj", "{34A1F53A-DA46-41E6-9E26-740D22D662DC}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "segment_view", "segment_view.vcproj", "{B49AC3E2-3497-465B-88C2-BCADA4B4ADAF}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {5C40995A-B6FC-4C94-B552-0D80EC9E2049}.Debug|Win32.ActiveCfg = Debug|Win32
+ {5C40995A-B6FC-4C94-B552-0D80EC9E2049}.Debug|Win32.Build.0 = Debug|Win32
+ {5C40995A-B6FC-4C94-B552-0D80EC9E2049}.Release|Win32.ActiveCfg = Release|Win32
+ {5C40995A-B6FC-4C94-B552-0D80EC9E2049}.Release|Win32.Build.0 = Release|Win32
+ {AAA72638-34CD-4A34-8329-984DFC766E24}.Debug|Win32.ActiveCfg = Debug|Win32
+ {AAA72638-34CD-4A34-8329-984DFC766E24}.Debug|Win32.Build.0 = Debug|Win32
+ {AAA72638-34CD-4A34-8329-984DFC766E24}.Release|Win32.ActiveCfg = Release|Win32
+ {AAA72638-34CD-4A34-8329-984DFC766E24}.Release|Win32.Build.0 = Release|Win32
+ {BFB08FEE-76D6-4F3D-9184-BE03CC3F7968}.Debug|Win32.ActiveCfg = Debug|Win32
+ {BFB08FEE-76D6-4F3D-9184-BE03CC3F7968}.Debug|Win32.Build.0 = Debug|Win32
+ {BFB08FEE-76D6-4F3D-9184-BE03CC3F7968}.Release|Win32.ActiveCfg = Release|Win32
+ {BFB08FEE-76D6-4F3D-9184-BE03CC3F7968}.Release|Win32.Build.0 = Release|Win32
+ {34A1F53A-DA46-41E6-9E26-740D22D662DC}.Debug|Win32.ActiveCfg = Debug|Win32
+ {34A1F53A-DA46-41E6-9E26-740D22D662DC}.Debug|Win32.Build.0 = Debug|Win32
+ {34A1F53A-DA46-41E6-9E26-740D22D662DC}.Release|Win32.ActiveCfg = Release|Win32
+ {34A1F53A-DA46-41E6-9E26-740D22D662DC}.Release|Win32.Build.0 = Release|Win32
+ {B49AC3E2-3497-465B-88C2-BCADA4B4ADAF}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B49AC3E2-3497-465B-88C2-BCADA4B4ADAF}.Debug|Win32.Build.0 = Debug|Win32
+ {B49AC3E2-3497-465B-88C2-BCADA4B4ADAF}.Release|Win32.ActiveCfg = Release|Win32
+ {B49AC3E2-3497-465B-88C2-BCADA4B4ADAF}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal