File: distance_se_geo_pl_ar.cpp

package info (click to toggle)
boost1.74 1.74.0-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 464,084 kB
  • sloc: cpp: 3,338,324; xml: 131,293; python: 33,088; ansic: 14,336; asm: 4,034; sh: 3,351; makefile: 1,193; perl: 1,036; yacc: 478; php: 212; ruby: 102; lisp: 24; sql: 13; csh: 6
file content (687 lines) | stat: -rw-r--r-- 24,887 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test

// Copyright (c) 2017-2018, Oracle and/or its affiliates.

// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle

// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html

#include <iostream>

#ifndef BOOST_TEST_MODULE
#define BOOST_TEST_MODULE test_distance_geographic_pointlike_areal
#endif

#include <boost/range.hpp>
#include <boost/type_traits/is_same.hpp>

#include <boost/test/included/unit_test.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/strategies/strategies.hpp>

#include "test_distance_geo_common.hpp"
#include "test_empty_geometry.hpp"

template
<
        typename Point,
        typename Strategy_pp,
        typename Strategy_ps
>
void test_distance_point_ring(Strategy_pp const& strategy_pp,
                              Strategy_ps const& strategy_ps)
{

#ifdef BOOST_GEOMETRY_TEST_DEBUG
    std::cout << std::endl;
    std::cout << "point/ring distance tests" << std::endl;
#endif
    typedef bg::model::ring<Point> ring_type;
    typedef test_distance_of_geometries<Point, ring_type> tester;

    std::string const ring = "POLYGON((10 10,0 20, 15 30, 20 15, 15 10, 10 10))";

    tester::apply("pr1", "POINT(0 10)", ring,
                  ps_distance<Point>("POINT(0 10)",
                                     "SEGMENT(0 20, 10 10)", strategy_ps),
                  strategy_ps, true, true, false);
    tester::apply("pr2", "POINT(10 0)", ring,
                  pp_distance<Point>("POINT(10 10)", "POINT(10 0)", strategy_pp),
                  strategy_ps, true, true, false);
    tester::apply("pr3", "POINT(0 20)", ring,
                  0, strategy_ps, true, true, false);
    tester::apply("pr4", "POINT(10 10)", ring,
                  0, strategy_ps, true, true, false);
    tester::apply("pr4", "POINT(10 11)", ring,
                  0, strategy_ps, true, true, false);
}

//===========================================================================

template
<
        typename Point,
        typename Strategy_ps
>
void test_distance_multipoint_ring(Strategy_ps const& strategy_ps)
{

#ifdef BOOST_GEOMETRY_TEST_DEBUG
    std::cout << std::endl;
    std::cout << "multipoint/ring distance tests" << std::endl;
#endif
    typedef bg::model::ring<Point> ring_type;
    typedef bg::model::multi_point<Point> multi_point_type;
    typedef test_distance_of_geometries<multi_point_type, ring_type> tester;

    std::string const ring = "POLYGON((10 10,0 20, 15 30, 20 15, 15 10, 10 10))";

    tester::apply("pr1", "MULTIPOINT(0 10,10 0,0 0)", ring,
                  ps_distance<Point>("POINT(0 10)",
                                     "SEGMENT(0 20, 10 10)", strategy_ps),
                  strategy_ps, true, true, false);
}


//===========================================================================

template
<
        typename Point,
        typename Strategy_pp,
        typename Strategy_ps
>
void test_distance_point_polygon(Strategy_pp const& strategy_pp,
                                 Strategy_ps const& strategy_ps)
{

#ifdef BOOST_GEOMETRY_TEST_DEBUG
    std::cout << std::endl;
    std::cout << "point/polygon distance tests" << std::endl;
#endif
    typedef bg::model::polygon<Point> polygon_type;
    typedef test_distance_of_geometries<Point, polygon_type> tester;

    std::string const polygon =
            "POLYGON((10 10,0 20, 15 30, 20 15, 15 10, 10 10))";

    tester::apply("pr1", "POINT(0 10)", polygon,
                  ps_distance<Point>("POINT(0 10)",
                                     "SEGMENT(0 20, 10 10)", strategy_ps),
                  strategy_ps, true, true, false);
    tester::apply("pr2", "POINT(10 0)", polygon,
                  pp_distance<Point>("POINT(10 10)", "POINT(10 0)", strategy_pp),
                  strategy_ps, true, true, false);
    tester::apply("pr3", "POINT(0 20)", polygon,
                  0, strategy_ps, true, true, false);
    tester::apply("pr4", "POINT(10 10)", polygon,
                  0, strategy_ps, true, true, false);
    tester::apply("pr5", "POINT(10 10.1)", polygon,
                  0, strategy_ps, false, false, false);
}

//===========================================================================

template
<
        typename Point,
        typename Strategy_pp,
        typename Strategy_ps
>
void test_distance_multipoint_polygon(Strategy_pp const& strategy_pp,
                                      Strategy_ps const& strategy_ps)
{

#ifdef BOOST_GEOMETRY_TEST_DEBUG
    std::cout << std::endl;
    std::cout << "multipoint/polygon distance tests" << std::endl;
#endif
    typedef bg::model::polygon<Point> polygon_type;
    typedef bg::model::multi_point<Point> multi_point_type;
    typedef test_distance_of_geometries<multi_point_type, polygon_type> tester;

    std::string const polygon = "POLYGON((10 10,0 20,15 30,20 15,15 10,10 10))";

    tester::apply("mpp1", "MULTIPOINT(0 10,10 0,0 0)", polygon,
                  ps_distance<Point>("POINT(0 10)",
                                     "SEGMENT(0 20, 10 10)", strategy_ps),
                  strategy_ps, true, true, false);

    tester::apply("mpp2", "MULTIPOINT(0 10,10 0,0 0,20.1 15)", polygon,
                  pp_distance<Point>("POINT(20 15)",
                                     "POINT(20.1 15)", strategy_pp),
                  strategy_ps, true, true, false);

    tester::apply("mpp3", "MULTIPOINT(0 10,10 0,0 0,20.1 15,10 10)", polygon,
                  0, strategy_ps, true, true, false);

    tester::apply("mpp4", "MULTIPOINT(0 10,10 0,0 0,20.1 15,10 11)", polygon,
                  0, strategy_ps, true, true, false);
}


//===========================================================================

template
<
        typename Point,
        typename Strategy_pp,
        typename Strategy_ps
>
void test_distance_point_multipolygon(Strategy_pp const& strategy_pp,
                                      Strategy_ps const& strategy_ps)
{

#ifdef BOOST_GEOMETRY_TEST_DEBUG
    std::cout << std::endl;
    std::cout << "point/multipolygon distance tests" << std::endl;
#endif
    typedef bg::model::polygon<Point> polygon_type;
    typedef bg::model::multi_polygon<polygon_type> multipolygon_type;
    typedef test_distance_of_geometries<Point, multipolygon_type> tester;

    std::string const mpoly = "MULTIPOLYGON(((20 20, 20 30, 30 40, 20 20)),\
                                     ((10 10,0 20, 15 30, 20 15, 15 10, 10 10)))";

    tester::apply("pmp1", "POINT(0 10)", mpoly,
                  ps_distance<Point>("POINT(0 10)",
                                     "SEGMENT(0 20, 10 10)", strategy_ps),
                  strategy_ps, true, true, false);


    tester::apply("pmp2", "POINT(10 9.9)", mpoly,
                  pp_distance<Point>("POINT(10 9.9)",
                                     "POINT(10 10)", strategy_pp),
                  strategy_ps, true, true, false);

    tester::apply("pmp3", "POINT(10 11)", mpoly,
                  0, strategy_ps, true, true, false);
}

//===========================================================================

template
<
        typename Point,
        typename Strategy_pp,
        typename Strategy_ps
>
void test_distance_multipoint_multipolygon(Strategy_pp const& strategy_pp,
                                           Strategy_ps const& strategy_ps)
{

#ifdef BOOST_GEOMETRY_TEST_DEBUG
    std::cout << std::endl;
    std::cout << "multipoint/multipolygon distance tests" << std::endl;
#endif
    typedef bg::model::polygon<Point> polygon_type;
    typedef bg::model::multi_polygon<polygon_type> multipolygon_type;
    typedef bg::model::multi_point<Point> multi_point_type;
    typedef test_distance_of_geometries<multi_point_type, multipolygon_type> tester;

    std::string const mpoly = "MULTIPOLYGON(((20 20, 20 30, 30 40, 20 20)),\
                                  ((10 10,0 20, 15 30, 20 15, 15 10, 10 10)))";

    tester::apply("pr1", "MULTIPOINT(0 10,10 0,0 0)", mpoly,
                  ps_distance<Point>("POINT(0 10)",
                                     "SEGMENT(0 20, 10 10)", strategy_ps),
                  strategy_ps, true, true, false);

    tester::apply("pmp2", "MULTIPOINT(0 10,10 0,0 0,10 9.9)", mpoly,
                  pp_distance<Point>("POINT(10 9.9)",
                                     "POINT(10 10)", strategy_pp),
                  strategy_ps, true, true, false);

    tester::apply("pmp3", "MULTIPOINT(0 10,10 0,0 0,10 9.9,10 11)", mpoly,
                  0, strategy_ps, true, true, false);
}


//===========================================================================
// Cases for relative location of a point wrt to a box
//
//           |         |
//           |    3    |
//           |         |
//           +---------+
//           |         |
//       1   |    5    |   2
//           |         |
//           +---------+
//           |         |
//           |    4    |
//           |         |
//
// and also the following cases
//
//           |         |
//           A         B
//           |         |
//           +----C----+
//           |         |
//           D         E
//           |         |
//           +----F----+
//           |         |
//           G         H
//           |         |
//
// and finally we have the corners
//
//           |         |
//           |         |
//           |         |
//           a---------b
//           |         |
//           |         |
//           |         |
//           c---------d
//           |         |
//           |         |
//           |         |
//
// for each relative position we also have to test the shifted point
// (this is due to the fact that boxes have longitudes in the
// range [-180, 540)
//===========================================================================

template
<
        typename Point,
        typename Strategy_pp,
        typename Strategy_ps,
        typename Strategy_pb
>
void test_distance_point_box(Strategy_pp const& strategy_pp,
                             Strategy_ps const& strategy_ps,
                             Strategy_pb const& strategy_pb)
{

#ifdef BOOST_GEOMETRY_TEST_DEBUG
    std::cout << std::endl;
    std::cout << "point/box distance tests" << std::endl;
#endif
    typedef bg::model::box<Point> box_type;
    typedef test_distance_of_geometries<Point, box_type> tester;

    std::string const box1 = "BOX(10 10,20 20)";

    // case 1
    tester::apply("pb1-1a", "POINT(5 25)", box1,
                  pp_distance<Point>("POINT(5 25)", "POINT(10 20)", strategy_pp),
                  strategy_pb);

    // case 1
    tester::apply("pb1-1b", "POINT(3 12)", box1,
                  ps_distance<Point>("POINT(3 12)",
                                     "SEGMENT(10 10,10 20)", strategy_ps),
                  strategy_pb);

    // case 1
    tester::apply("pb1-1c", "POINT(3 17)", box1,
                  ps_distance<Point>("POINT(3 17)",
                                     "SEGMENT(10 10,10 20)", strategy_ps),
                  strategy_pb);

    // case 1
    tester::apply("pb1-1d", "POINT(5 4)", box1,
                  pp_distance<Point>("POINT(5 4)", "POINT(10 10)", strategy_pp),
                  strategy_pb);

    // case 1
    tester::apply("pb1-1e", "POINT(-100 20)", box1,
                  pp_distance<Point>("POINT(-100 20)",
                                     "POINT(10 20)", strategy_pp),
                  strategy_pb);

    // case 1
    tester::apply("pb1-1g", "POINT(-100 10)", box1,
                  ps_distance<Point>("POINT(-100 10)",
                                     "SEGMENT(10 10,10 20)", strategy_ps),
                  strategy_pb);

    // case 2
    tester::apply("pb1-2a", "POINT(31 25)", box1,
                  pp_distance<Point>("POINT(31 25)",
                                     "POINT(20 20)", strategy_pp),
                  strategy_pb);

    // case 2
    tester::apply("pb1-2b", "POINT(23 17)", box1,
                  ps_distance<Point>("POINT(23 17)",
                                     "SEGMENT(20 10,20 20)", strategy_ps),
                  strategy_pb);

    // case 2
    tester::apply("pb1-2c", "POINT(29 3)", box1,
                  pp_distance<Point>("POINT(29 3)",
                                     "POINT(20 10)", strategy_pp),
                  strategy_pb);

    // case 2
    tester::apply("pb1-2d", "POINT(131 65)", box1,
                  pp_distance<Point>("POINT(131 65)",
                                     "POINT(20 20)", strategy_pp),
                  strategy_pb);

    // case 2
    tester::apply("pb1-2e", "POINT(110 10)", box1,
                  ps_distance<Point>("POINT(110 10)",
                                     "SEGMENT(20 10,20 20)", strategy_ps),
                  strategy_pb);

    // case 2
    tester::apply("pb1-2f", "POINT(150 20)", box1,
                  pp_distance<Point>("POINT(150 20)",
                                     "POINT(20 20)", strategy_pp),
                  strategy_pb);

    // case 3
    tester::apply("pb1-3a", "POINT(11 25)", box1,
                  pp_distance<Point>("POINT(11 25)",
                                     "POINT(11 20)", strategy_pp),
                  strategy_pb);

    // case 3
    tester::apply("pb1-3b", "POINT(15 25)", box1,
                  pp_distance<Point>("POINT(15 25)",
                                     "POINT(15 20)", strategy_pp),
                  strategy_pb);

    // case 3
    tester::apply("pb1-3c", "POINT(18 25)", box1,
                  pp_distance<Point>("POINT(18 25)",
                                     "POINT(18 20)", strategy_pp),
                  strategy_pb);

    // case 4
    tester::apply("pb1-4a", "POINT(13 4)", box1,
                  pp_distance<Point>("POINT(13 4)",
                                     "POINT(13 10)", strategy_pp),
                  strategy_pb);

    // case 4
    tester::apply("pb1-4b", "POINT(19 4)", box1,
                  pp_distance<Point>("POINT(19 4)",
                                     "POINT(19 10)", strategy_pp),
                  strategy_pb);

    // case 5
    tester::apply("pb1-5", "POINT(15 14)", box1, 0, strategy_pb);

    // case A
    tester::apply("pb1-A", "POINT(10 28)", box1,
                  pp_distance<Point>("POINT(10 28)",
                                     "POINT(10 20)", strategy_pp),
                  strategy_pb);

    // case B
    tester::apply("pb1-B", "POINT(20 28)", box1,
                  pp_distance<Point>("POINT(20 28)",
                                     "POINT(20 20)", strategy_pp),
                  strategy_pb);


    // case C
    tester::apply("pb1-C", "POINT(14 20)", box1, 0, strategy_pb);

    // case D
    tester::apply("pb1-D", "POINT(10 17)", box1, 0, strategy_pb);

    // case E
    tester::apply("pb1-E", "POINT(20 11)", box1, 0, strategy_pb);

    // case F
    tester::apply("pb1-F", "POINT(19 10)", box1, 0, strategy_pb);

    // case G
    tester::apply("pb1-G", "POINT(10 -40)", box1,
                  pp_distance<Point>("POINT(10 -40)",
                                     "POINT(10 10)", strategy_pp),
                  strategy_pb);

    // case H
    tester::apply("pb1-H", "POINT(20 -50)", box1,
                  pp_distance<Point>("POINT(20 -50)",
                                     "POINT(20 10)", strategy_pp),
                  strategy_pb);

    // case a
    tester::apply("pb1-a", "POINT(10 20)", box1, 0, strategy_pb);
    // case b
    tester::apply("pb1-b", "POINT(20 20)", box1, 0, strategy_pb);
    // case c
    tester::apply("pb1-c", "POINT(10 10)", box1, 0, strategy_pb);
    // case d
    tester::apply("pb1-d", "POINT(20 10)", box1, 0, strategy_pb);


    std::string const box2 = "BOX(170 -60,400 80)";

    // case 1 - point is closer to western meridian
    tester::apply("pb2-1a", "POINT(160 0)", box2,
                  ps_distance<Point>("POINT(160 0)",
                                     "SEGMENT(170 -60,170 80)", strategy_ps),
                  strategy_pb);

    // case 1 - point is closer to eastern meridian
    tester::apply("pb2-1b", "POINT(50 0)", box2,
                  ps_distance<Point>("POINT(50 0)",
                                     "SEGMENT(40 -60,40 80)", strategy_ps),
                  strategy_pb);

    // case 3 - equivalent point POINT(390 85) is above the box
    tester::apply("pb2-3", "POINT(30 85)", box2,
                  pp_distance<Point>("POINT(30 85)",
                                     "POINT(30 80)", strategy_pp),
                  strategy_pb);

    // case 4 - equivalent point POINT(390 -75) is below the box
    tester::apply("pb2-4", "POINT(30 -75)", box2,
                  pp_distance<Point>("POINT(30 -75)",
                                     "POINT(30 -60)", strategy_pp),
                  strategy_pb);

    // case 5 - equivalent point POINT(390 0) is inside box
    tester::apply("pb2-5", "POINT(30 0)", box2, 0, strategy_pb);


    std::string const box3 = "BOX(-150 -50,-40 70)";

    // case 1 - point is closer to western meridian
    tester::apply("pb3-1a", "POINT(-170 10)", box3,
                  ps_distance<Point>("POINT(-170 10)",
                                     "SEGMENT(-150 -50,-150 70)", strategy_ps),
                  strategy_pb);

    // case 2 - point is closer to eastern meridian
    tester::apply("pb3-2a", "POINT(5 10)", box3,
                  ps_distance<Point>("POINT(5 10)",
                                     "SEGMENT(-40 -50,-40 70)", strategy_ps),
                  strategy_pb);

    // case 2 - point is closer to western meridian
    tester::apply("pb3-2a", "POINT(160 10)", box3,
                  ps_distance<Point>("POINT(160 10)",
                                     "SEGMENT(-150 -50,-150 70)", strategy_ps),
                  strategy_pb);

    // case 2 - point is at equal distance from eastern and western meridian
    tester::apply("pb3-2c1", "POINT(85 20)", box3,
                  ps_distance<Point>("POINT(85 20)",
                                     "SEGMENT(-150 -50,-150 70)", strategy_ps),
                  strategy_pb);

    // case 2 - point is at equal distance from eastern and western meridian
    tester::apply("pb3-2c2", "POINT(85 20)", box3,
                  ps_distance<Point>("POINT(85 20)",
                                     "SEGMENT(-40 -50,-40 70)", strategy_ps),
                  strategy_pb);

    // box that is symmetric wrt the prime meridian
    std::string const box4 = "BOX(-75 -45,75 65)";

    // case 1 - point is closer to western meridian
    tester::apply("pb4-1a", "POINT(-100 10)", box4,
                  ps_distance<Point>("POINT(-100 10)",
                                     "SEGMENT(-75 -45,-75 65)", strategy_ps),
                  strategy_pb);

    // case 2 - point is closer to eastern meridian
    tester::apply("pb4-2a", "POINT(90 15)", box4,
                  ps_distance<Point>("POINT(90 15)",
                                     "SEGMENT(75 -45,75 65)", strategy_ps),
                  strategy_pb);

    // case 2 - point is at equal distance from eastern and western meridian
    tester::apply("pb4-2c1", "POINT(-180 20)", box4,
                  ps_distance<Point>("POINT(-180 20)",
                                     "SEGMENT(-75 -45,-75 65)", strategy_ps),
                  strategy_pb);

    // case 2 - point is at equal distance from eastern and western meridian
    tester::apply("pb4-2c2", "POINT(-180 20)", box4,
                  ps_distance<Point>("POINT(-180 20)",
                                     "SEGMENT(75 -45,75 65)", strategy_ps),
                  strategy_pb);


    //box degenerates to a meridian segment
    std::string const boxdeg1 = "BOX(0 10,0 20)";

    tester::apply("pbd1", "POINT(1 10)", boxdeg1,
                  ps_distance<Point>("POINT(1 10)",
                                     "SEGMENT(0 10, 0 20)", strategy_ps),
                  strategy_pb);
    tester::apply("pbd2", "POINT(1 5)", boxdeg1,
                  ps_distance<Point>("POINT(1 5)",
                                     "SEGMENT(0 10, 0 20)", strategy_ps),
                  strategy_pb);
    tester::apply("pbd3", "POINT(1 15)", boxdeg1,
                  ps_distance<Point>("POINT(1 15)",
                                     "SEGMENT(0 10, 0 20)", strategy_ps),
                  strategy_pb);
    tester::apply("pbd4", "POINT(1 25)", boxdeg1,
                  ps_distance<Point>("POINT(1 25)",
                                     "SEGMENT(0 10, 0 20)", strategy_ps),
                  strategy_pb);

    //box degenerates to a horizontal line; that is not a geodesic segment
    std::string const boxdeg2 = "BOX(10 10,20 10)";

    tester::apply("pbd5", "POINT(15 15)", boxdeg2,
                  pp_distance<Point>("POINT(15 15)",
                                     "POINT(15 10)", strategy_pp),
                  strategy_pb);
    tester::apply("pbd6", "POINT(5 15)", boxdeg2,
                  pp_distance<Point>("POINT(5 15)",
                                     "POINT(10 10)", strategy_pp),
                  strategy_pb);
    tester::apply("pbd7", "POINT(25 15)", boxdeg2,
                  pp_distance<Point>("POINT(25 15)",
                                     "POINT(20 10)", strategy_pp),
                  strategy_pb);

    //box degenerates to a point
    std::string const boxdeg3 = "BOX(0 10,0 10)";

    tester::apply("pbd8", "POINT(1 11)", boxdeg3,
                  pp_distance<Point>("POINT(1 11)",
                                     "POINT(0 10)", strategy_pp),
                  strategy_pb);
}

template
<
        typename Point,
        typename Strategy_pp,
        typename Strategy_ps,
        typename Strategy_pb
>
void test_distance_multipoint_box(Strategy_pp const& strategy_pp,
                                  Strategy_ps const& strategy_ps,
                                  Strategy_pb const& strategy_pb)
{

#ifdef BOOST_GEOMETRY_TEST_DEBUG
    std::cout << std::endl;
    std::cout << "multipoint/box distance tests" << std::endl;
#endif
    typedef bg::model::box<Point> box_type;
    typedef bg::model::multi_point<Point> multi_point_type;
    typedef test_distance_of_geometries<multi_point_type, box_type> tester;

    std::string const box1 = "BOX(10 10,20 20)";

    tester::apply("mpb1", "MULTIPOINT(5 25,25 26)", box1,
                  pp_distance<Point>("POINT(5 25)", "POINT(10 20)", strategy_pp),
                  strategy_pb, true, false, false);

    tester::apply("mpb2", "MULTIPOINT(110 10,110 9,110 0)", box1,
                  ps_distance<Point>("POINT(110 10)",
                                     "SEGMENT(20 10,20 20)", strategy_ps),
                  strategy_pb, true, false, false);

    tester::apply("mpb3", "MULTIPOINT(110 10,110 9,110 0,10 20)", box1,
                  0, strategy_pb, true, false, false);

    tester::apply("mpb3", "MULTIPOINT(110 10,110 9,110 0,15 15)", box1,
                  0, strategy_pb, true, false, false);
}

//===========================================================================
//===========================================================================
//===========================================================================

template
<
    typename Point,
    typename Strategy_pp,
    typename Strategy_ps,
    typename Strategy_pb
>
void test_all_pl_ar(Strategy_pp pp_strategy,
                    Strategy_ps ps_strategy,
                    Strategy_pb pb_strategy)
{
    test_distance_point_ring<Point>(pp_strategy, ps_strategy);
    test_distance_multipoint_ring<Point>(ps_strategy);

    test_distance_point_polygon<Point>(pp_strategy, ps_strategy);
    test_distance_multipoint_polygon<Point>(pp_strategy, ps_strategy);

    test_distance_point_multipolygon<Point>(pp_strategy, ps_strategy);
    test_distance_multipoint_multipolygon<Point>(pp_strategy, ps_strategy);

    test_distance_point_box<Point>(pp_strategy, ps_strategy, pb_strategy);
    test_distance_multipoint_box<Point>(pp_strategy, ps_strategy, pb_strategy);

    test_more_empty_input_pointlike_areal<Point>(ps_strategy);
}

BOOST_AUTO_TEST_CASE( test_all_pointlike_areal )
{
    typedef bg::model::point
            <
                double, 2,
                bg::cs::spherical_equatorial<bg::degree>
            > sph_point;

    test_all_pl_ar<sph_point>(spherical_pp(), spherical_ps(), spherical_pb());

    typedef bg::model::point
            <
                double, 2,
                bg::cs::geographic<bg::degree>
            > geo_point;

    test_all_pl_ar<geo_point>(vincenty_pp(), vincenty_ps(), vincenty_pb());
    test_all_pl_ar<geo_point>(thomas_pp(), thomas_ps(), thomas_pb());
    test_all_pl_ar<geo_point>(andoyer_pp(), andoyer_ps(), andoyer_pb());

    // test with different spheroid
    stype spheroid(6372000, 6370000);
    test_all_pl_ar<geo_point>(andoyer_pp(spheroid), andoyer_ps(spheroid),  andoyer_pb(spheroid));
}