1 // Boost.Geometry (aka GGL, Generic Geometry Library)
4 // Copyright (c) 2015, Oracle and/or its affiliates.
6 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
8 // Licensed under the Boost Software License version 1.0.
9 // http://www.boost.org/users/license.html
11 #ifndef BOOST_TEST_MODULE
12 #define BOOST_TEST_MODULE test_expand_on_spheroid
15 #include <boost/test/included/unit_test.hpp>
22 #include <geometry_test_common.hpp>
23 #include <from_wkt.hpp>
25 #include <boost/type_traits/is_same.hpp>
27 #include <boost/geometry/core/coordinate_dimension.hpp>
28 #include <boost/geometry/core/tag.hpp>
29 #include <boost/geometry/core/tags.hpp>
31 #include <boost/geometry/geometries/geometries.hpp>
33 #include <boost/geometry/views/detail/indexed_point_view.hpp>
35 #include <boost/geometry/util/condition.hpp>
37 #include <boost/geometry/io/dsv/write.hpp>
38 #include <boost/geometry/io/wkt/wkt.hpp>
40 #include <boost/geometry/algorithms/assign.hpp>
41 #include <boost/geometry/algorithms/envelope.hpp>
42 #include <boost/geometry/algorithms/expand.hpp>
43 #include <boost/geometry/algorithms/transform.hpp>
45 #include "test_envelope_expand_on_spheroid.hpp"
48 class test_expand_on_spheroid
54 typename Tag
= typename
bg::tag
<Geometry
>::type
58 template <typename OutputStream
>
59 static inline OutputStream
& apply(OutputStream
& os
,
60 Geometry
const& geometry
)
62 os
<< bg::wkt(geometry
);
67 template <typename Segment
>
68 struct write_geometry
<Segment
, bg::segment_tag
>
70 template <typename OutputStream
>
71 static inline OutputStream
& apply(OutputStream
& os
,
72 Segment
const& segment
)
74 os
<< "SEGMENT" << bg::dsv(segment
);
79 template <typename Box
>
80 struct write_geometry
<Box
, bg::box_tag
>
82 template <typename OutputStream
>
83 static inline OutputStream
& apply(OutputStream
& os
,
86 os
<< "BOX" << bg::dsv(box
);
91 template <typename Box
, typename Geometry
>
92 static inline void check_message(bool same_boxes
,
93 std::string
const& case_id
,
94 std::string
const& units_str
,
96 Geometry
const& geometry
,
97 bool expected_are_different
,
102 std::ostringstream stream
;
103 stream
<< "case ID: " << case_id
<< ", "
104 << "MBR units: " << units_str
<< "; "
105 << "input box: BOX" << bg::dsv(box
) << ", "
108 write_geometry
<Geometry
>::apply(stream
, geometry
);
110 stream
<< std::setprecision(17);
112 stream
<< "; " << "expected: " << bg::dsv(expected1
);
114 if (expected_are_different
)
116 stream
<< " or: " << bg::dsv(expected2
);
118 stream
<< ", " << "detected: " << bg::dsv(detected
);
120 BOOST_CHECK_MESSAGE(same_boxes
, stream
.str());
124 template <bool Reverse
= false, typename
= void>
127 template <typename Box
, typename Geometry
>
128 static inline void base_test(std::string
const& case_id
,
130 Geometry
const& geometry
,
131 double lon_min1
, double lat_min1
,
133 double lon_max1
, double lat_max1
,
135 double lon_min2
, double lat_min2
,
137 double lon_max2
, double lat_max2
,
141 typedef typename
bg::coordinate_system
144 >::type::units box_units_type
;
146 std::string
const units_str
= units2string
<box_units_type
>();
149 bg::convert(box
, detected
);
150 bg::expand(detected
, geometry
);
152 bool expected_are_different
=
153 (lon_min1
!= lon_min2
) || (lat_min1
!= lat_min2
)
154 || (lon_max1
!= lon_max2
) || (lat_max1
!= lat_max2
);
157 initialize_box
<Box
>::apply(expected1
,
158 lon_min1
, lat_min1
, height_min1
,
159 lon_max1
, lat_max1
, height_max1
);
162 initialize_box
<Box
>::apply(expected2
,
163 lon_min2
, lat_min2
, height_min2
,
164 lon_max2
, lat_max2
, height_max2
);
166 #ifdef BOOST_GEOMETRY_TEST_DEBUG
167 std::cout
<< "input box: BOX" << bg::dsv(box
) << std::endl
;
169 std::cout
<< "geometry: ";
170 write_geometry
<Geometry
>::apply(std::cout
, geometry
);
172 std::cout
<< std::endl
173 << "MBR units: " << units_str
175 << "expected: " << bg::dsv(expected1
);
177 if (expected_are_different
)
179 std::cout
<< " or: " << bg::dsv(expected2
);
182 std::cout
<< std::endl
183 << "detected: " << bg::dsv(detected
)
184 << std::endl
<< std::endl
;
187 = box_equals
<Box
>::apply(detected
, expected1
, tolerance
);
189 if (expected_are_different
)
191 same_boxes
= same_boxes
192 || box_equals
<Box
>::apply(detected
, expected2
, tolerance
);
195 check_message(same_boxes
, case_id
, units_str
,
196 box
, geometry
, expected_are_different
,
197 expected1
, expected2
, detected
);
200 template <typename Box
, typename Geometry
>
201 static inline void apply(std::string
const& case_id
,
203 Geometry
const& geometry
,
204 double lon_min1
, double lat_min1
,
206 double lon_max1
, double lat_max1
,
208 double lon_min2
, double lat_min2
,
210 double lon_max2
, double lat_max2
,
214 typedef other_system_info
216 typename
bg::coordinate_system
<Box
>::type
219 typedef bg::model::box
223 typename
bg::coordinate_type
<Box
>::type
,
224 bg::dimension
<Box
>::value
,
229 #ifdef BOOST_GEOMETRY_TEST_DEBUG
230 std::cout
<< "case ID: " << case_id
231 << std::endl
<< std::endl
;
234 base_test(case_id
, box
, geometry
,
235 lon_min1
, lat_min1
, height_min1
,
236 lon_max1
, lat_max1
, height_max1
,
237 lon_min2
, lat_min2
, height_min2
,
238 lon_max2
, lat_max2
, height_max2
,
241 other_mbr_type other_box
;
242 bg::detail::indexed_point_view
<Box
const, 0> p_min(box
);
243 bg::detail::indexed_point_view
<Box
const, 1> p_max(box
);
244 bg::detail::indexed_point_view
247 > other_min(other_box
);
249 bg::detail::indexed_point_view
252 > other_max(other_box
);
254 bg::transform(p_min
, other_min
);
255 bg::transform(p_max
, other_max
);
257 base_test(case_id
, other_box
, geometry
,
258 other::convert(lon_min1
),
259 other::convert(lat_min1
),
261 other::convert(lon_max1
),
262 other::convert(lat_max1
),
264 other::convert(lon_min2
),
265 other::convert(lat_min2
),
267 other::convert(lon_max2
),
268 other::convert(lat_max2
),
272 #ifdef BOOST_GEOMETRY_TEST_DEBUG
273 std::cout
<< "=================="
274 << std::endl
<< std::endl
;
279 template <typename Dummy
>
280 struct basic_tester
<true, Dummy
>
282 template <typename Box
, typename Geometry
>
283 static inline void apply(std::string
const& case_id
,
285 Geometry
const& geometry
,
286 double lon_min1
, double lat_min1
,
288 double lon_max1
, double lat_max1
,
290 double lon_min2
, double lat_min2
,
292 double lon_max2
, double lat_max2
,
299 >::apply(case_id
, box
, geometry
,
300 lon_min1
, lat_min1
, height_min1
,
301 lon_max1
, lat_max1
, height_max1
,
302 lon_min2
, lat_min2
, height_min1
,
303 lon_max2
, lat_max2
, height_max2
,
306 std::string case_id_r
= case_id
+ "[R]";
311 >::apply(case_id_r
, geometry
, box
,
312 lon_min1
, lat_min1
, height_min1
,
313 lon_max1
, lat_max1
, height_max1
,
314 lon_min2
, lat_min2
, height_min2
,
315 lon_max2
, lat_max2
, height_max2
,
322 template <typename Box
, typename Geometry
>
323 static inline void apply(std::string
const& case_id
,
325 Geometry
const& geometry
,
326 double lon_min1
, double lat_min1
, double height_min1
,
327 double lon_max1
, double lat_max1
, double height_max1
,
328 double lon_min2
, double lat_min2
, double height_min2
,
329 double lon_max2
, double lat_max2
, double height_max2
,
330 double tolerance
= std::numeric_limits
<double>::epsilon())
337 typename
bg::tag
<Geometry
>::type
,
340 >::apply(case_id
, box
, geometry
,
341 lon_min1
, lat_min1
, height_min1
,
342 lon_max1
, lat_max1
, height_max1
,
343 lon_min2
, lat_min2
, height_min2
,
344 lon_max2
, lat_max2
, height_max2
,
348 template <typename Box
, typename Geometry
>
349 static inline void apply(std::string
const& case_id
,
351 Geometry
const& geometry
,
352 double lon_min1
, double lat_min1
,
353 double lon_max1
, double lat_max1
,
354 double lon_min2
, double lat_min2
,
355 double lon_max2
, double lat_max2
,
356 double tolerance
= std::numeric_limits
<double>::epsilon())
358 apply(case_id
, box
, geometry
,
359 lon_min1
, lat_min1
, 0, lon_max1
, lat_max1
, 0,
360 lon_min2
, lat_min2
, 0, lon_max2
, lat_max2
, 0,
364 template <typename Box
, typename Geometry
>
365 static inline void apply(std::string
const& case_id
,
367 Geometry
const& geometry
,
368 double lon_min
, double lat_min
,
369 double lon_max
, double lat_max
,
370 double tolerance
= std::numeric_limits
<double>::epsilon())
372 apply(case_id
, box
, geometry
,
373 lon_min
, lat_min
, 0, lon_max
, lat_max
, 0,
374 lon_min
, lat_min
, 0, lon_max
, lat_max
, 0,
378 template <typename Box
, typename Geometry
>
379 static inline void apply(std::string
const& case_id
,
381 Geometry
const& geometry
,
382 double lon_min
, double lat_min
, double height_min
,
383 double lon_max
, double lat_max
, double height_max
,
384 double tolerance
= std::numeric_limits
<double>::epsilon())
386 apply(case_id
, box
, geometry
,
387 lon_min
, lat_min
, height_min
, lon_max
, lat_max
, height_max
,
388 lon_min
, lat_min
, height_min
, lon_max
, lat_max
, height_max
,
394 template <typename CoordinateSystem
>
395 void test_expand_point()
397 typedef bg::model::point
<double, 2, CoordinateSystem
> point_type
;
398 typedef bg::model::box
<point_type
> B
;
399 typedef point_type G
;
400 typedef test_expand_on_spheroid tester
;
403 from_wkt
<B
>("BOX(0 0,5 5)"),
404 from_wkt
<G
>("POINT(10 10)"),
408 from_wkt
<B
>("BOX(0 0,5 5)"),
409 from_wkt
<G
>("POINT(370 10)"),
413 from_wkt
<B
>("BOX(10 10,10 10)"),
414 from_wkt
<G
>("POINT(20 20)"),
418 from_wkt
<B
>("BOX(10 10,10 10)"),
419 from_wkt
<G
>("POINT(10 20)"),
422 // there are two possible valid longitude ranges:
423 // [10, 190] and [-170, 10]
425 from_wkt
<B
>("BOX(10 10,10 10)"),
426 from_wkt
<G
>("POINT(190 20)"),
429 // there are two possible valid longitude ranges:
430 // [10, 190] and [-170, 10]
431 tester::apply("p05a",
432 from_wkt
<B
>("BOX(10 10,10 10)"),
433 from_wkt
<G
>("POINT(-170 20)"),
438 from_wkt
<B
>("BOX(170 10,175 20)"),
439 from_wkt
<G
>("POINT(-170 15)"),
442 tester::apply("p06a",
443 from_wkt
<B
>("BOX(170 10,175 20)"),
444 from_wkt
<G
>("POINT(-170 -6)"),
447 tester::apply("p06b",
448 from_wkt
<B
>("BOX(170 10,175 20)"),
449 from_wkt
<G
>("POINT(-170 36)"),
452 // point is inside box
454 from_wkt
<B
>("BOX(-30 -45,60 55)"),
455 from_wkt
<G
>("POINT(0 0)"),
458 // point is inside box
459 tester::apply("p07a",
460 from_wkt
<B
>("BOX(-30 -45,60 55)"),
461 from_wkt
<G
>("POINT(360 0)"),
465 from_wkt
<B
>("BOX(-100 -45,-90 55)"),
466 from_wkt
<G
>("POINT(80 60)"),
470 from_wkt
<B
>("BOX(-100 -45,-90 55)"),
471 from_wkt
<G
>("POINT(170 60)"),
474 // point is north pole
476 from_wkt
<B
>("BOX(-100 -45,-90 55)"),
477 from_wkt
<G
>("POINT(-80 90)"),
480 // point is north pole
481 tester::apply("p10a",
482 from_wkt
<B
>("BOX(-100 -45,-90 55)"),
483 from_wkt
<G
>("POINT(170 90)"),
486 tester::apply("p10b",
487 from_wkt
<B
>("BOX(-100 -45,-90 55)"),
488 from_wkt
<G
>("POINT(170 80)"),
493 from_wkt
<B
>("BOX(10 90,20 90)"),
494 from_wkt
<G
>("POINT(15 89)"),
498 tester::apply("p11a",
499 from_wkt
<B
>("BOX(10 -90,20 -90)"),
500 from_wkt
<G
>("POINT(15 89)"),
503 // point is south pole
505 from_wkt
<B
>("BOX(10 80,20 85)"),
506 from_wkt
<G
>("POINT(15 -90)"),
509 // point is south pole
510 tester::apply("p12a",
511 from_wkt
<B
>("BOX(10 80,20 85)"),
512 from_wkt
<G
>("POINT(25 -90)"),
515 // box is north pole and point is south pole
517 from_wkt
<B
>("BOX(10 90,20 90)"),
518 from_wkt
<G
>("POINT(25 -90)"),
521 // box contains north pole and point is south pole
523 from_wkt
<B
>("BOX(10 80,20 90)"),
524 from_wkt
<G
>("POINT(25 -90)"),
527 // box contains south pole and point is north pole
529 from_wkt
<B
>("BOX(10 -90,30 0)"),
530 from_wkt
<G
>("POINT(25 90)"),
533 // box and point are north pole
535 from_wkt
<B
>("BOX(10 90,20 90)"),
536 from_wkt
<G
>("POINT(25 90)"),
539 // box and point are south pole
541 from_wkt
<B
>("BOX(10 -90,20 -90)"),
542 from_wkt
<G
>("POINT(-25 -90)"),
545 // box contains both poles
547 from_wkt
<B
>("BOX(10 -90,10 90)"),
548 from_wkt
<G
>("POINT(10 80)"),
551 // box contains both poles
552 tester::apply("p17a",
553 from_wkt
<B
>("BOX(10 -90,10 90)"),
554 from_wkt
<G
>("POINT(25 80)"),
557 // box contains both poles
559 from_wkt
<B
>("BOX(10 -90,100 90)"),
560 from_wkt
<G
>("POINT(25 80)"),
563 // box contains both poles
564 tester::apply("p18a",
565 from_wkt
<B
>("BOX(10 -90,100 90)"),
566 from_wkt
<G
>("POINT(-175 80)"),
569 // box contains both poles
570 tester::apply("p18b",
571 from_wkt
<B
>("BOX(10 -90,100 90)"),
572 from_wkt
<G
>("POINT(-95 80)"),
575 // box contains both poles and point is north pole
577 from_wkt
<B
>("BOX(10 -90,100 90)"),
578 from_wkt
<G
>("POINT(-95 90)"),
581 // box contains both poles and point is south pole
583 from_wkt
<B
>("BOX(10 -90,100 90)"),
584 from_wkt
<G
>("POINT(-95 -90)"),
588 BOOST_AUTO_TEST_CASE( expand_point
)
590 test_expand_point
<bg::cs::spherical_equatorial
<bg::degree
> >();
591 test_expand_point
<bg::cs::geographic
<bg::degree
> >();
595 template <typename CoordinateSystem
>
596 void test_expand_point_with_height()
598 typedef bg::model::point
<double, 3, CoordinateSystem
> point_type
;
599 typedef bg::model::box
<point_type
> B
;
600 typedef point_type G
;
601 typedef test_expand_on_spheroid tester
;
603 // deactivate this for now
604 tester::apply("ph01",
605 from_wkt
<B
>("BOX(0 0 20,5 5 100)"),
606 from_wkt
<G
>("POINT(10 10 80)"),
607 0, 0, 20, 10, 10, 100);
609 tester::apply("ph02",
610 from_wkt
<B
>("BOX(0 0 20,5 5 100)"),
611 from_wkt
<G
>("POINT(10 10 120)"),
612 0, 0, 20, 10, 10, 120);
614 tester::apply("ph03",
615 from_wkt
<B
>("BOX(0 0 20,5 5 100)"),
616 from_wkt
<G
>("POINT(10 10 5)"),
617 0, 0, 5, 10, 10, 100);
620 BOOST_AUTO_TEST_CASE( expand_point_with_height
)
622 test_expand_point_with_height
<bg::cs::spherical_equatorial
<bg::degree
> >();
623 test_expand_point_with_height
<bg::cs::geographic
<bg::degree
> >();
627 BOOST_AUTO_TEST_CASE( expand_segment
)
629 typedef bg::cs::spherical_equatorial
<bg::degree
> coordinate_system_type
;
630 typedef bg::model::point
<double, 2, coordinate_system_type
> point_type
;
631 typedef bg::model::box
<point_type
> B
;
632 typedef bg::model::segment
<point_type
> G
;
633 typedef test_expand_on_spheroid tester
;
636 from_wkt
<B
>("BOX(20 20,50 50)"),
637 from_wkt
<G
>("SEGMENT(10 10,40 40)"),
641 from_wkt
<B
>("BOX(20 20,50 50)"),
642 from_wkt
<G
>("SEGMENT(10 10,40 10)"),
646 from_wkt
<B
>("BOX(5 5,50 10)"),
647 from_wkt
<G
>("SEGMENT(40 10,10 10)"),
648 5, 5, 50, 10.34527004614999,
649 4.0 * std::numeric_limits
<double>::epsilon());
651 // segment ending at the north pole
653 from_wkt
<B
>("BOX(5 15,50 50)"),
654 from_wkt
<G
>("SEGMENT(40 45,80 90)"),
657 // segment ending at the north pole
658 tester::apply("s04a",
659 from_wkt
<B
>("BOX(5 15,30 30)"),
660 from_wkt
<G
>("SEGMENT(40 45,80 90)"),
663 // segment starting at the north pole
665 from_wkt
<B
>("BOX(5 15,50 50)"),
666 from_wkt
<G
>("SEGMENT(80 90,40 45)"),
669 // segment starting at the north pole
670 tester::apply("s05a",
671 from_wkt
<B
>("BOX(5 15,30 30)"),
672 from_wkt
<G
>("SEGMENT(80 90,40 45)"),
675 // segment passing through the south pole
677 from_wkt
<B
>("BOX(5 15,30 40)"),
678 from_wkt
<G
>("SEGMENT(-170 -45,10 -30)"),
681 // segment degenerating to the north pole
683 from_wkt
<B
>("BOX(5 15,30 40)"),
684 from_wkt
<G
>("SEGMENT(10 90,20 90)"),
687 // segment degenerating to the south pole
689 from_wkt
<B
>("BOX(5 15,30 40)"),
690 from_wkt
<G
>("SEGMENT(10 -90,20 -90)"),
693 // box degenerating to the south pole
695 from_wkt
<B
>("BOX(10 -90,30 -90)"),
696 from_wkt
<G
>("SEGMENT(10 -30,100 45)"),
699 // box degenerating to the south pole
700 tester::apply("s09a",
701 from_wkt
<B
>("BOX(10 -90,130 -90)"),
702 from_wkt
<G
>("SEGMENT(10 -30,100 45)"),
707 BOOST_AUTO_TEST_CASE( expand_segment_with_height
)
709 typedef bg::cs::spherical_equatorial
<bg::degree
> coordinate_system_type
;
710 typedef bg::model::point
<double, 3, coordinate_system_type
> point_type
;
711 typedef bg::model::box
<point_type
> B
;
712 typedef bg::model::segment
<point_type
> G
;
713 typedef test_expand_on_spheroid tester
;
715 tester::apply("sh01",
716 from_wkt
<B
>("BOX(20 20 100,50 50 1000)"),
717 from_wkt
<G
>("SEGMENT(10 10 150,40 40 500)"),
718 10, 10, 100, 50, 50, 1000);
720 tester::apply("sh02",
721 from_wkt
<B
>("BOX(20 20 100,50 50 1000)"),
722 from_wkt
<G
>("SEGMENT(10 10 60,40 40 1500)"),
723 10, 10, 60, 50, 50, 1500);
725 tester::apply("sh03",
726 from_wkt
<B
>("BOX(20 20 100,50 50 1000)"),
727 from_wkt
<G
>("SEGMENT(10 10 150,40 40 1500)"),
728 10, 10, 100, 50, 50, 1500);
730 tester::apply("sh04",
731 from_wkt
<B
>("BOX(20 20 100,50 50 1000)"),
732 from_wkt
<G
>("SEGMENT(10 10 60,40 40 800)"),
733 10, 10, 60, 50, 50, 1000);
737 template <typename CoordinateSystem
>
738 void test_expand_box()
740 typedef bg::model::point
<double, 2, CoordinateSystem
> point_type
;
741 typedef bg::model::box
<point_type
> B
;
742 typedef bg::model::box
<point_type
> G
;
743 typedef test_expand_on_spheroid tester
;
746 from_wkt
<B
>("BOX(11 11,19 19)"),
747 from_wkt
<G
>("BOX(10 10,20 20)"),
751 from_wkt
<B
>("BOX(11 11,29 29)"),
752 from_wkt
<G
>("BOX(10 10,20 20)"),
756 from_wkt
<B
>("BOX(21 21,29 29)"),
757 from_wkt
<G
>("BOX(10 10,20 20)"),
761 from_wkt
<B
>("BOX(150 -10,200 60)"),
762 from_wkt
<G
>("BOX(-175 -20,-150 55)"),
765 tester::apply("b04a",
766 from_wkt
<B
>("BOX(150 -10,200 60)"),
767 from_wkt
<G
>("BOX(-175 -20,-170 55)"),
770 tester::apply("b04b",
771 from_wkt
<B
>("BOX(150 -10,200 60)"),
772 from_wkt
<G
>("BOX(-175 -20,-140 55)"),
776 from_wkt
<B
>("BOX(150 -10,170 60)"),
777 from_wkt
<G
>("BOX(179 -20,535 55)"),
781 from_wkt
<B
>("BOX(150 -10,170 60)"),
782 from_wkt
<G
>("BOX(179 -20,520 55)"),
786 from_wkt
<B
>("BOX(-100 -10,170 60)"),
787 from_wkt
<G
>("BOX(100 -20,400 55)"),
791 from_wkt
<B
>("BOX(-100 -10,100 60)"),
792 from_wkt
<G
>("BOX(150 -20,150 55)"),
796 from_wkt
<B
>("BOX(100 -10,400 60)"),
797 from_wkt
<G
>("BOX(0 -20,0 55)"),
800 // this is a border case:
801 // there are two possible MBRs with longitude intervals:
802 // [100, 430] and [70, 400]
804 from_wkt
<B
>("BOX(100 -10,400 60)"),
805 from_wkt
<G
>("BOX(70 -20,70 55)"),
809 tester::apply("b10a",
810 from_wkt
<B
>("BOX(100 -10,400 60)"),
811 from_wkt
<G
>("BOX(71 -20,71 55)"),
814 tester::apply("b10b",
815 from_wkt
<B
>("BOX(100 -10,400 60)"),
816 from_wkt
<G
>("BOX(69 -20,69 55)"),
820 from_wkt
<B
>("BOX(-90 -10,-90 60)"),
821 from_wkt
<G
>("BOX(90 -20,90 55)"),
824 // first box is the south pole
826 from_wkt
<B
>("BOX(-90 -90,80 -90)"),
827 from_wkt
<G
>("BOX(90 -20,90 55)"),
830 // first box is the south pole
831 tester::apply("b12a",
832 from_wkt
<B
>("BOX(-90 -90,80 -90)"),
833 from_wkt
<G
>("BOX(90 -20,130 55)"),
836 // first box is the north pole
838 from_wkt
<B
>("BOX(-90 90,80 90)"),
839 from_wkt
<G
>("BOX(90 -20,90 55)"),
842 // first box is the north pole
843 tester::apply("b13a",
844 from_wkt
<B
>("BOX(-90 90,80 90)"),
845 from_wkt
<G
>("BOX(90 -20,190 55)"),
848 // both boxes are the north pole
850 from_wkt
<B
>("BOX(-90 90,80 90)"),
851 from_wkt
<G
>("BOX(90 90,190 90)"),
854 // both boxes are the south pole
856 from_wkt
<B
>("BOX(-90 -90,80 -90)"),
857 from_wkt
<G
>("BOX(90 -90,190 -90)"),
860 // one box is the south pole and the other the north pole
862 from_wkt
<B
>("BOX(-90 -90,80 -90)"),
863 from_wkt
<G
>("BOX(90 90,190 90)"),
866 // both boxes contain both poles but at different longitudes
868 from_wkt
<B
>("BOX(10 -90,10 90)"),
869 from_wkt
<G
>("BOX(20 -90,20 90)"),
872 // both boxes contain both poles but at different longitude ranges
874 from_wkt
<B
>("BOX(10 -90,20 90)"),
875 from_wkt
<G
>("BOX(40 -90,60 90)"),
879 // first box is a band
881 from_wkt
<B
>("BOX(0 10,360 20)"),
882 from_wkt
<G
>("BOX(-10 -40,20 10)"),
885 // first box contains south and north pole and is a band
886 // (box covers the entire spheroid)
888 from_wkt
<B
>("BOX(0 -90,360 90)"),
889 from_wkt
<G
>("BOX(-10 -40,20 10)"),
892 // the envelope of the two boxes is a band
894 from_wkt
<B
>("BOX(-180 -40,0 -30)"),
895 from_wkt
<G
>("BOX(0 -10,180 50)"),
898 // the envelope of the two boxes is a band
899 tester::apply("b20a",
900 from_wkt
<B
>("BOX(-180 -40,0 -30)"),
901 from_wkt
<G
>("BOX(0 -10,185 50)"),
904 // the envelope of the two boxes is a band
905 tester::apply("b20b",
906 from_wkt
<B
>("BOX(-179 -40,0 -30)"),
907 from_wkt
<G
>("BOX(0 -10,185 50)"),
911 BOOST_AUTO_TEST_CASE( expand_box
)
913 test_expand_box
<bg::cs::spherical_equatorial
<bg::degree
> >();
914 test_expand_box
<bg::cs::geographic
<bg::degree
> >();
918 template <typename CoordinateSystem
>
919 void test_expand_box_with_height()
921 typedef bg::model::point
<double, 3, CoordinateSystem
> point_type
;
922 typedef bg::model::box
<point_type
> B
;
923 typedef bg::model::box
<point_type
> G
;
924 typedef test_expand_on_spheroid tester
;
926 tester::apply("bh01",
927 from_wkt
<B
>("BOX(11 11 100,19 19 1000)"),
928 from_wkt
<G
>("BOX(10 10 200,20 20 800)"),
929 10, 10, 100, 20, 20, 1000);
931 tester::apply("bh02",
932 from_wkt
<B
>("BOX(11 11 200,19 19 1000)"),
933 from_wkt
<G
>("BOX(10 10 100,20 20 800)"),
934 10, 10, 100, 20, 20, 1000);
936 tester::apply("bh03",
937 from_wkt
<B
>("BOX(11 11 100,19 19 800)"),
938 from_wkt
<G
>("BOX(10 10 200,20 20 1000)"),
939 10, 10, 100, 20, 20, 1000);
941 tester::apply("bh04",
942 from_wkt
<B
>("BOX(11 11 200,19 19 1000)"),
943 from_wkt
<G
>("BOX(10 10 100,20 20 800)"),
944 10, 10, 100, 20, 20, 1000);
947 BOOST_AUTO_TEST_CASE( expand_box_with_height
)
949 test_expand_box_with_height
<bg::cs::spherical_equatorial
<bg::degree
> >();
950 test_expand_box_with_height
<bg::cs::geographic
<bg::degree
> >();