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 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758
|
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
#ifndef BOOST_TEST_MODULE
#define BOOST_TEST_MODULE test_segment_iterator
#endif
#include <algorithm>
#include <iostream>
#include <iterator>
#include <string>
#include <vector>
#include <boost/test/included/unit_test.hpp>
#include <boost/concept_check.hpp>
#include <boost/core/ignore_unused.hpp>
#include <boost/iterator/iterator_concepts.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/equals.hpp>
#include <boost/geometry/algorithms/num_segments.hpp>
#include <boost/geometry/core/closure.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
#include <boost/geometry/geometries/register/linestring.hpp>
#include <boost/geometry/geometries/register/multi_linestring.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/io/dsv/write.hpp>
#include <boost/geometry/iterators/segment_iterator.hpp>
#include <boost/geometry/policies/compare.hpp>
#include <test_common/with_pointer.hpp>
#include <test_geometries/copy_on_dereference_geometries.hpp>
namespace bg = ::boost::geometry;
namespace bgm = bg::model;
typedef bgm::point<double, 2, bg::cs::cartesian> point_type;
typedef bgm::linestring<point_type> linestring_type;
typedef bgm::ring<point_type, true, true> ring_cw_closed_type;
typedef bgm::ring<point_type, true, false> ring_cw_open_type;
typedef bgm::polygon<point_type, true, true> polygon_cw_closed_type;
typedef bgm::polygon<point_type, true, false> polygon_cw_open_type;
// multi-geometries
typedef bgm::multi_linestring<linestring_type> multi_linestring_type;
typedef bgm::multi_polygon<polygon_cw_closed_type> multi_polygon_cw_closed_type;
typedef bgm::multi_polygon<polygon_cw_open_type> multi_polygon_cw_open_type;
// tuple-based geometries
typedef boost::tuple<double, double> tuple_point_type;
typedef std::vector<tuple_point_type> tuple_linestring_type;
typedef std::vector<tuple_linestring_type> tuple_multi_linestring_type;
BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
BOOST_GEOMETRY_REGISTER_LINESTRING(tuple_linestring_type)
BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING(tuple_multi_linestring_type)
BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
template <typename Geometry>
inline Geometry from_wkt(std::string const& wkt)
{
Geometry geometry;
bg::read_wkt(wkt, geometry);
return geometry;
}
template <typename Iterator>
inline std::ostream& print_geometry_range(std::ostream& os,
Iterator first,
Iterator beyond,
std::string const& header)
{
os << header << "(";
for (Iterator it = first; it != beyond; ++it)
{
os << " " << bg::dsv(*it);
}
os << " )";
return os;
}
template <typename Geometry>
struct test_iterator_concepts
{
typedef bg::segment_iterator<Geometry> iterator;
BOOST_CONCEPT_ASSERT(( boost::BidirectionalIteratorConcept<iterator> ));
BOOST_CONCEPT_ASSERT(( boost_concepts::ReadableIteratorConcept<iterator> ));
BOOST_CONCEPT_ASSERT
(( boost_concepts::BidirectionalTraversalConcept<iterator> ));
};
struct equals
{
template <typename Iterator>
static inline std::size_t number_of_elements(Iterator begin,
Iterator end)
{
std::size_t size = std::distance(begin, end);
std::size_t num_elems(0);
for (Iterator it = begin; it != end; ++it)
{
++num_elems;
}
BOOST_CHECK(size == num_elems);
num_elems = 0;
for (Iterator it = end; it != begin; --it)
{
++num_elems;
}
BOOST_CHECK(size == num_elems);
return num_elems;
}
template <typename Iterator1, typename Iterator2>
static inline bool apply(Iterator1 begin1, Iterator1 end1,
Iterator2 begin2, Iterator2 end2)
{
std::size_t num_points1 = number_of_elements(begin1, end1);
std::size_t num_points2 = number_of_elements(begin2, end2);
if (num_points1 != num_points2)
{
return false;
}
Iterator1 it1 = begin1;
Iterator2 it2 = begin2;
for (; it1 != end1; ++it1, ++it2)
{
if (! bg::equals(*it1, *it2))
{
return false;
}
}
return true;
}
};
template <typename Geometry, typename SegmentRange>
struct test_segment_iterator_of_geometry
{
template <typename G>
static inline void base_test(G const& geometry,
SegmentRange const& segment_range,
std::string const& header,
bool check_num_segments)
{
boost::ignore_unused(header);
typedef bg::segment_iterator<G const> segment_iterator;
test_iterator_concepts<G const>();
segment_iterator begin = bg::segments_begin(geometry);
segment_iterator end = bg::segments_end(geometry);
if (check_num_segments)
{
BOOST_CHECK(std::size_t(std::distance(begin, end))
==
bg::num_segments(geometry));
}
BOOST_CHECK(equals::apply(begin, end,
bg::segments_begin(segment_range),
bg::segments_end(segment_range))
);
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::string closure
= (
(bg::closure<Geometry>::value == bg::closed)
? "closed"
: "open"
);
std::cout << header << " geometry (WKT): "
<< bg::wkt(geometry) << std::endl;
std::cout << header << " geometry (DSV): "
<< bg::dsv(geometry) << std::endl;
std::cout << "geometry's closure: " << closure << std::endl;
print_geometry_range(std::cout, begin, end, "segment range: ");
std::cout << std::endl;
print_geometry_range(std::cout,
bg::segments_begin(segment_range),
bg::segments_end(segment_range),
"expected segment range: ");
std::cout << std::endl;
#endif
// testing dereferencing
typedef typename std::iterator_traits
<
segment_iterator
>::value_type value_type;
if (bg::segments_begin(geometry) != bg::segments_end(geometry))
{
value_type first_segment = *bg::segments_begin(geometry);
boost::ignore_unused(first_segment);
#ifdef BOOST_GEOMETRY_TEST_DEBUG
typedef bg::model::segment
<
bg::model::point<double, 2, bg::cs::cartesian>
> other_segment;
other_segment other_seg;
// convert is used as a workaround for geometries whose
// point is a pointer. WKT does not seem to work for
// segment iterators created this way.
bg::convert(first_segment, other_seg);
std::cout << "first segment in geometry: "
<< bg::wkt(other_seg)
<< std::endl;
std::cout << "first segment in geometry (DSV): "
<< bg::dsv(first_segment)
<< std::endl;
std::cout << std::endl << std::endl;
#endif
}
// test copying all segments to a vector
std::vector<value_type> segments;
std::copy(bg::segments_begin(geometry),
bg::segments_end(geometry),
std::back_inserter(segments));
BOOST_CHECK(std::size_t( std::distance(bg::segments_begin(geometry),
bg::segments_end(geometry)) )
==
segments.size());
}
static inline void apply(Geometry geometry,
SegmentRange const& segment_range,
bool check_num_segments = true)
{
base_test<Geometry>(geometry, segment_range, "const",
check_num_segments);
}
};
//======================================================================
//======================================================================
template <typename ClosedGeometry, typename ExpectedResult>
struct dual_tester
{
template <typename OpenGeometry>
static inline void apply(OpenGeometry const& open_g,
ExpectedResult expected,
bool check_num_segments = true)
{
typedef test_segment_iterator_of_geometry
<
OpenGeometry, ExpectedResult
> otester;
typedef test_segment_iterator_of_geometry
<
ClosedGeometry, ExpectedResult
> ctester;
otester::apply(open_g, expected, check_num_segments);
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << std::endl << std::endl;
#endif
ClosedGeometry closed_g;
bg::convert(open_g, closed_g);
ctester::apply(closed_g, expected, check_num_segments);
}
};
//======================================================================
//======================================================================
BOOST_AUTO_TEST_CASE( test_linestring_segment_iterator )
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << "*** LINESTRING ***" << std::endl;
#endif
typedef tuple_multi_linestring_type TML;
typedef linestring_type G;
typedef test_segment_iterator_of_geometry<G, TML> tester;
tester::apply(from_wkt<G>("LINESTRING(0 0,1 1,2 2,3 3,4 4)"),
TML{
{{0,0},{1,1}},
{{1,1},{2,2}},
{{2,2},{3,3}},
{{3,3},{4,4}}
});
// linestring with no points
tester::apply(from_wkt<G>("LINESTRING()"),
TML()
);
// linestring with a single point
tester::apply(from_wkt<G>("LINESTRING(1 0)"),
TML{
{{1,0},{1,0}}
},
false
);
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << std::endl << std::endl << std::endl;
#endif
}
//======================================================================
//======================================================================
BOOST_AUTO_TEST_CASE( test_ring_segment_iterator )
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << "*** RING ***" << std::endl;
#endif
typedef tuple_multi_linestring_type TML;
typedef ring_cw_open_type OG;
typedef ring_cw_closed_type CG;
typedef dual_tester<CG, TML> tester;
tester::apply(from_wkt<OG>("POLYGON((0 0,0 10,10 10,10 0))"),
TML{
{{0,0},{0,10}},
{{0,10},{10,10}},
{{10,10},{10,0}},
{{10,0},{0,0}}
});
// open ring with no points
tester::apply(from_wkt<OG>("POLYGON(())"),
TML()
);
// open ring with a single point (one segment)
tester::apply(from_wkt<OG>("POLYGON((0 0))"),
TML{
{{0,0},{0,0}}
},
false
);
// open ring with a two points (two segments)
tester::apply(from_wkt<OG>("POLYGON((0 0,0 10))"),
TML{
{{0,0},{0,10}},
{{0,10},{0,0}}
});
// open ring with a three points (three segments)
tester::apply(from_wkt<OG>("POLYGON((0 0,0 10,10 10))"),
TML{
{{0,0},{0,10}},
{{0,10},{10,10}},
{{10,10},{0,0}}
});
tester::apply(from_wkt<CG>("POLYGON((0 0,0 10,10 10,10 0,0 0))"),
TML{
{{0,0},{0,10}},
{{0,10},{10,10}},
{{10,10},{10,0}},
{{10,0},{0,0}}
});
// closed ring with no points
tester::apply(from_wkt<CG>("POLYGON(())"),
TML()
);
// closed ring with a single point (one segment)
tester::apply(from_wkt<CG>("POLYGON((0 0))"),
TML{
{{0,0},{0,0}}
},
false
);
// closed ring with two points (one segment)
tester::apply(from_wkt<CG>("POLYGON((0 0,0 0))"),
TML{
{{0,0},{0,0}}
});
// closed ring with three points (two segments)
tester::apply(from_wkt<CG>("POLYGON((0 0,0 10,0 0))"),
TML{
{{0,0},{0,10}},
{{0,10},{0,0}}
});
// closed ring with four points (three segments)
tester::apply(from_wkt<CG>("POLYGON((0 0,0 10,10 10,0 0))"),
TML{
{{0,0},{0,10}},
{{0,10},{10,10}},
{{10,10},{0,0}}
});
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << std::endl << std::endl << std::endl;
#endif
}
//======================================================================
//======================================================================
BOOST_AUTO_TEST_CASE( test_polygon_segment_iterator )
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << "*** POLYGON ***" << std::endl;
#endif
typedef tuple_multi_linestring_type TML;
typedef polygon_cw_open_type OG;
typedef polygon_cw_closed_type CG;
typedef dual_tester<CG, TML> tester;
tester::apply(from_wkt<OG>("POLYGON((0 0,0 10,10 10,10 0),(1 1,9 1,9 9,1 9))"),
TML{
{{0,0},{0,10}},
{{0,10},{10,10}},
{{10,10},{10,0}},
{{10,0},{0,0}},
{{1,1},{9,1}},
{{9,1},{9,9}},
{{9,9},{1,9}},
{{1,9},{1,1}}
});
// open polygon with no points
tester::apply(from_wkt<OG>("POLYGON(())"),
TML()
);
// open polygons with single-point rings
tester::apply(from_wkt<OG>("POLYGON((0 0,0 10,10 10,10 0),(1 1))"),
TML{
{{0,0},{0,10}},
{{0,10},{10,10}},
{{10,10},{10,0}},
{{10,0},{0,0}},
{{1,1},{1,1}}
},
false
);
tester::apply(from_wkt<OG>("POLYGON((0 0),(1 1,9 1,9 9,1 9))"),
TML{
{{0,0},{0,0}},
{{1,1},{9,1}},
{{9,1},{9,9}},
{{9,9},{1,9}},
{{1,9},{1,1}}
},
false
);
tester::apply(from_wkt<CG>("POLYGON((0 0,0 10,10 10,10 0,0 0),(1 1,9 1,9 9,1 9,1 1))"),
TML{
{{0,0},{0,10}},
{{0,10},{10,10}},
{{10,10},{10,0}},
{{10,0},{0,0}},
{{1,1},{9,1}},
{{9,1},{9,9}},
{{9,9},{1,9}},
{{1,9},{1,1}}
});
// closed polygons with no points
tester::apply(from_wkt<CG>("POLYGON(())"),
TML()
);
tester::apply(from_wkt<CG>("POLYGON((),())"),
TML()
);
tester::apply(from_wkt<CG>("POLYGON((),(),())"),
TML()
);
// closed polygons with single-point rings
tester::apply(from_wkt<CG>("POLYGON((0 0,0 10,10 10,10 0,0 0),(1 1))"),
TML{
{{0,0},{0,10}},
{{0,10},{10,10}},
{{10,10},{10,0}},
{{10,0},{0,0}},
{{1,1},{1,1}},
},
false
);
tester::apply(from_wkt<CG>("POLYGON((0 0),(1 1,9 1,9 9,1 9,1 1))"),
TML{
{{0,0},{0,0}},
{{1,1},{9,1}},
{{9,1},{9,9}},
{{9,9},{1,9}},
{{1,9},{1,1}}
},
false
);
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << std::endl << std::endl << std::endl;
#endif
}
//======================================================================
//======================================================================
BOOST_AUTO_TEST_CASE( test_multi_linestring_segment_iterator )
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << "*** MULTILINESTRING ***" << std::endl;
#endif
typedef tuple_multi_linestring_type TML;
typedef multi_linestring_type G;
typedef test_segment_iterator_of_geometry<G, TML> tester;
tester::apply(from_wkt<G>("MULTILINESTRING((0 0,1 1,2 2,3 3,4 4),(5 5,6 6,7 7,8 8),(9 9,10 10))"),
TML{
{{0,0},{1,1}},
{{1,1},{2,2}},
{{2,2},{3,3}},
{{3,3},{4,4}},
{{5,5},{6,6}},
{{6,6},{7,7}},
{{7,7},{8,8}},
{{9,9},{10,10}}
});
// empty multi-linestrings
tester::apply(from_wkt<G>("MULTILINESTRING()"),
TML()
);
tester::apply(from_wkt<G>("MULTILINESTRING(())"),
TML()
);
tester::apply(from_wkt<G>("MULTILINESTRING((),())"),
TML()
);
// multi-linestring with a linestring with one point
tester::apply(from_wkt<G>("MULTILINESTRING((0 0,1 1,2 2,3 3,4 4),(5 5),(9 9,10 10))"),
TML{
{{0,0},{1,1}},
{{1,1},{2,2}},
{{2,2},{3,3}},
{{3,3},{4,4}},
{{5,5},{5,5}},
{{9,9},{10,10}}
},
false
);
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << std::endl << std::endl << std::endl;
#endif
}
//======================================================================
//======================================================================
BOOST_AUTO_TEST_CASE( test_multi_polygon_segment_iterator )
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << "*** MULTIPOLYGON ***" << std::endl;
#endif
typedef tuple_multi_linestring_type TML;
typedef multi_polygon_cw_open_type OG;
typedef multi_polygon_cw_closed_type CG;
typedef dual_tester<CG, TML> tester;
tester::apply(from_wkt<OG>("MULTIPOLYGON(((0 0,0 10,10 10,10 0),(1 1,9 1,9 9,1 9)),((20 0,20 10,30 10,30 0),(21 1,29 1,29 9,21 9)))"),
TML{
{{0,0},{0,10}},
{{0,10},{10,10}},
{{10,10},{10,0}},
{{10,0},{0,0}},
{{1,1},{9,1}},
{{9,1},{9,9}},
{{9,9},{1,9}},
{{1,9},{1,1}},
{{20,0},{20,10}},
{{20,10},{30,10}},
{{30,10},{30,0}},
{{30,0},{20,0}},
{{21,1},{29,1}},
{{29,1},{29,9}},
{{29,9},{21,9}},
{{21,9},{21,1}}
});
tester::apply(from_wkt<CG>("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(1 1,9 1,9 9,1 9,1 1)),((20 0,20 10,30 10,30 0,20 0),(21 1,29 1,29 9,21 9,21 1)))"),
TML{
{{0,0},{0,10}},
{{0,10},{10,10}},
{{10,10},{10,0}},
{{10,0},{0,0}},
{{1,1},{9,1}},
{{9,1},{9,9}},
{{9,9},{1,9}},
{{1,9},{1,1}},
{{20,0},{20,10}},
{{20,10},{30,10}},
{{30,10},{30,0}},
{{30,0},{20,0}},
{{21,1},{29,1}},
{{29,1},{29,9}},
{{29,9},{21,9}},
{{21,9},{21,1}}
});
// test empty closed multi-polygons
tester::apply(from_wkt<CG>("MULTIPOLYGON()"),
TML()
);
tester::apply(from_wkt<CG>("MULTIPOLYGON((()))"),
TML()
);
tester::apply(from_wkt<CG>("MULTIPOLYGON(((),()))"),
TML()
);
tester::apply(from_wkt<CG>("MULTIPOLYGON(((),(),()))"),
TML()
);
tester::apply(from_wkt<CG>("MULTIPOLYGON(((),(),()),(()))"),
TML()
);
tester::apply(from_wkt<CG>("MULTIPOLYGON(((),(),()),((),()))"),
TML()
);
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << std::endl << std::endl << std::endl;
#endif
}
//======================================================================
//======================================================================
BOOST_AUTO_TEST_CASE( test_linestring_of_point_pointers )
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << "*** LINESTRING OF POINT POINTERS ***" << std::endl;
#endif
typedef tuple_multi_linestring_type TML;
typedef std::vector<test::test_point_xy*> L;
std::vector<test::test_point_xy*> linestring;
for (int i = 1; i < 10; i++)
{
test::test_point_xy* p = new test::test_point_xy;
p->x = i;
p->y = -i;
linestring.push_back(p);
}
test::test_point_xy* zero = new test::test_point_xy;
zero->x = 0;
zero->y = 0;
delete zero;
typedef test_segment_iterator_of_geometry<L, TML> tester;
tester::apply(linestring,
TML{
{{1,-1},{2,-2}},
{{2,-2},{3,-3}},
{{3,-3},{4,-4}},
{{4,-4},{5,-5}},
{{5,-5},{6,-6}},
{{6,-6},{7,-7}},
{{7,-7},{8,-8}},
{{8,-8},{9,-9}}
});
for (unsigned int i = 0; i < linestring.size(); i++)
{
delete linestring[i];
}
}
//======================================================================
//======================================================================
BOOST_AUTO_TEST_CASE( test_linestring_copy_on_dereference )
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << "*** LINESTRING WITH COPY-ON-DEREFERENCE ITERATOR ***"
<< std::endl;
#endif
typedef tuple_multi_linestring_type TML;
typedef linestring_copy_on_dereference<point_type> L;
typedef test_segment_iterator_of_geometry<L, TML> tester;
tester::apply(from_wkt<L>("LINESTRING(1 -1,2 -2,3 -3,4 -4,5 -5,6 -6, 7 -7,8 -8,9 -9)"),
TML{
{{1,-1},{2,-2}},
{{2,-2},{3,-3}},
{{3,-3},{4,-4}},
{{4,-4},{5,-5}},
{{5,-5},{6,-6}},
{{6,-6},{7,-7}},
{{7,-7},{8,-8}},
{{8,-8},{9,-9}}
});
}
|