diff --git a/doc/compiling.qbk b/doc/compiling.qbk index 01c99fb74..1cde2c6a0 100644 --- a/doc/compiling.qbk +++ b/doc/compiling.qbk @@ -35,22 +35,42 @@ __boost_geometry__ library has been successfully tested with the following compilers: * __msvc__ (including Express Editions) + * 14.0 (__msvc__ 14 CTP) [/reported by develop report on March, 2015] + * 12.0 (__msvc__ 2013) [/reported by develop report on March, 2015] + * 11.0 (__msvc__ 2012) [/reported by develop report on March, 2015] * 10.0 (__msvc__ 2010) [/reported by Trunk report May 8, 2011] * 9.0 (__msvc__ 2008) [/reported by Trunk report May 8, 2011] * 8.0 (__msvc__ 2005) [/reported by Trunk report May 8, 2011] * gcc + * gcc 5.0.0 [/reported by develop report on March, 2015] + * gcc 4.9.2 [/reported by develop report on March, 2015] + * gcc 4.9.0 [/reported by develop report on March, 2015] + * gcc 4.8.4 [/reported by develop report on March, 2015] + * gcc 4.8.1 [/reported by develop report on March, 2015] + * gcc 4.8.0 [/reported by develop report on March, 2015] + * gcc 4.7.3 [/reported by develop report on March, 2015] + * gcc 4.7.2 [/reported by develop report on March, 2015] * gcc 4.7.0 [/reported by Trunk report February 12, 2012] + * gcc 4.6.4 [/reported by develop report on March, 2015] * gcc 4.6.2 [/reported by Trunk report February 12, 2012] * gcc 4.6.1 [/reported by Trunk report May 8, 2011] * gcc 4.6.0 [/reported by Trunk report May 8, 2011] + * gcc 4.5.3 [/reported by develop report on March, 2015] * gcc 4.5.2 [/reported by Trunk report May 8, 2011] + * gcc 4.4.7 [/reported by develop report on March, 2015] * gcc 4.4.0 [/reported by Trunk report May 8, 2011] * gcc 4.3.4 [/reported by Trunk report March 26, 2011] * gcc 4.2.1 [/reported by Trunk report May 8, 2011] * gcc 3.4.6 [/reported by Trunk report March 26, 2011] * clang + * clang 3.6 [/reported by develop report on March, 2015] + * clang 3.5 [/reported by develop report on March, 2015] + * clang 3.4 [/reported by develop report on March, 2015] * clang 3.3 [/reported by mloskot on October, 2013] * clang 3.2 [/reported by Trunk report March 26, 2011] + * clang 3.1 [/reported by develop report on March, 2015] + * clang 3.0 [/reported by develop report on March, 2015] + * clang 2.9 [/reported by develop report on March, 2015] * darwin * darwin 4.0.1 [/reported by Trunk report March 26, 2011] * darwin 4.4 [/reported by Trunk report March 26, 2011] diff --git a/doc/index/introduction.qbk b/doc/index/introduction.qbk index daf2e39f3..e0c5b03e0 100644 --- a/doc/index/introduction.qbk +++ b/doc/index/introduction.qbk @@ -56,8 +56,10 @@ The examples of structures of trees created by use of different algorithms and e [[*100k knn queries*] [6.37s] [2.09s] [0.64s] [0.52s]] ] +The configuration of the machine used for testing was: /Intel(R) Core(TM) i7 870 @ 2.93GHz, 8GB RAM, MS Windows 7 x64/. +The code was compiled with optimization for speed (`O2`). + The performance of the R-tree for different values of Max parameter and Min=0.5*Max is presented in the table below. -The configuration of the machine used for testing is: /Intel(R) Core(TM) i7 870 @ 2.93GHz, 8GB RAM, MS Windows 7 x64/. In the two upper figures you can see the performance of the __rtree__ storing random, relatively small, non-overlapping, 2d boxes. In the lower ones, the performance of the __rtree__ also storing random, 2d boxes, but this time quite big and possibly overlapping. As you can see, the __rtree__ performance is different in both cases. diff --git a/doc/release_notes.qbk b/doc/release_notes.qbk index 57dd261b0..63b3cde39 100644 --- a/doc/release_notes.qbk +++ b/doc/release_notes.qbk @@ -37,8 +37,11 @@ [*Solved tickets] +* [@https://svn.boost.org/trac/boost/ticket/8379 8379] Invalid comparison of the result of determinant * [@https://svn.boost.org/trac/boost/ticket/10108 10108] Error in overlay operations in specific cases where geometries touch at one point +* [@https://svn.boost.org/trac/boost/ticket/10201 10201] Suggestion to use different function to compare coordinates [wontfix] * [@https://svn.boost.org/trac/boost/ticket/10467 10467] Template parameter name coliding with B0 macro name defined in termios.h +* [@https://svn.boost.org/trac/boost/ticket/10640 10640] Invalid result of buffer() for CCW Polygons. * [@https://svn.boost.org/trac/boost/ticket/10666 10666] MSVC compiler warning C4127: conditional expression is constant * [@https://svn.boost.org/trac/boost/ticket/10747 10747] Error in rescaling causing errors in areal/areal set operations * [@https://svn.boost.org/trac/boost/ticket/10770 10770] Buffer fails for large distances, or rough round joins, where concavities where not intersected properly @@ -48,11 +51,13 @@ * [@https://svn.boost.org/trac/boost/ticket/10890 10890] Invalid result of disjoint() for Point/Segment. * [@https://svn.boost.org/trac/boost/ticket/10904 10904] Invalid calculation of most significant Dimension of a segment in relate_cartesian_segments strategy * [@https://svn.boost.org/trac/boost/ticket/10912 10912] Invalid result of within() and relate() for Areal/Areal +* [@https://svn.boost.org/trac/boost/ticket/10951 10951] Tests failing on windows with intel compiler due to lack of /bigobj flag. * [@https://svn.boost.org/trac/boost/ticket/10957 10957] Assertion failure and invalid results of various relational operations. * [@https://svn.boost.org/trac/boost/ticket/10958 10958] Invalid results of disjoint() L/L and L/A. * [@https://svn.boost.org/trac/boost/ticket/10959 10959] Assertion failure in get_turns() used with no_rescale_policy. * [@https://svn.boost.org/trac/boost/ticket/10960 10960] Invalid result of get_turns() for L/A, missing turn. * [@https://svn.boost.org/trac/boost/ticket/10961 10961] Invalid result of get_turns() for L/A, invalid turn for a Linear spike. +* [@https://svn.boost.org/trac/boost/ticket/11112 11112] Compilation failure on Solaris due to a CS name clash (used for a macro on this platform) [*Bugfixes] @@ -68,6 +73,9 @@ * Bug in buffers for interior rings with large negative buffer distances * Bug in closing_iterator not working properly when the input range is empty * Bug in is_simple, not handling properly closed simple linestrings within multilinestrings +* Bug in rtree constructors taking a pair of Iterators or a Range (packing algorithm), the use of reference to destroyed temporary when Iterator's reference is not true reference, e.g. for some of the Range Adaptors. It also affects distance() and comparable_distance(). This bug may cause unexpected behavior of the rtree or distance() algorithm, e.g. an assertion failure or a SEGFAULT. +* Bug in rtree count() member function, the use of reference to destroyed temporary when object of type convertible but not the same as value_type or indexable_type is passed. If this happens, wrong result may be returned, in most cases 0. +* Bugs related to the handling of Ranges, preventing compilation of Geometries using non-Container Ranges in some algorithms (thanks to Samuel Debionne) [/=================] [heading Boost 1.57] diff --git a/include/boost/geometry/algorithms/detail/relate/result.hpp b/include/boost/geometry/algorithms/detail/relate/result.hpp index c32877852..e26bda67f 100644 --- a/include/boost/geometry/algorithms/detail/relate/result.hpp +++ b/include/boost/geometry/algorithms/detail/relate/result.hpp @@ -236,11 +236,11 @@ struct interrupt_dispatch static inline bool apply(Mask const& mask) { char m = mask.template get(); - return check(m); + return check_element(m); } template - static inline bool check(char m) + static inline bool check_element(char m) { if ( BOOST_GEOMETRY_CONDITION(V >= '0' && V <= '9') ) { @@ -395,7 +395,7 @@ inline bool may_update(Mask const& mask, Matrix const& matrix) ::template apply(mask, matrix); } -// check() +// check_matrix() template struct check_dispatch @@ -486,7 +486,7 @@ struct check_dispatch< boost::tuples::cons > }; template -inline bool check(Mask const& mask, Matrix const& matrix) +inline bool check_matrix(Mask const& mask, Matrix const& matrix) { return check_dispatch::apply(mask, matrix); } @@ -547,7 +547,7 @@ public: result_type result() const { return !interrupt - && check(m_mask, static_cast(*this)); + && check_matrix(m_mask, static_cast(*this)); } template @@ -965,7 +965,7 @@ struct static_check_dispatch }; template -struct static_check +struct static_check_matrix { template static inline bool apply(Matrix const& matrix) @@ -998,7 +998,7 @@ public: result_type result() const { return (!Interrupt || !interrupt) - && static_check:: + && static_check_matrix:: apply(static_cast(*this)); } diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 1d65ceabf..9d5d57d05 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -96,12 +96,13 @@ namespace boost { namespace geometry { namespace index { /*! \brief The R-tree spatial index. -This is self-balancing spatial index capable to store various types of Values and balancing algorithms. +This is self-balancing spatial index capable to store various types of Values +and balancing algorithms. \par Parameters The user must pass a type defining the Parameters which will -be used in rtree creation process. This type is used e.g. to specify balancing algorithm -with specific parameters like min and max number of elements in node. +be used in rtree creation process. This type is used e.g. to specify balancing +algorithm with specific parameters like min and max number of elements in node. \par Predefined algorithms with compile-time parameters are: @@ -116,23 +117,31 @@ Predefined algorithms with run-time parameters are: \li \c boost::geometry::index::dynamic_rstar. \par IndexableGetter -The object of IndexableGetter type translates from Value to Indexable each time r-tree requires it. Which means that this -operation is done for each Value access. Therefore the IndexableGetter should return the Indexable by -const reference instead of a value. Default one can translate all types adapted to Point, Box or Segment -concepts (called Indexables). It also handles std::pair and -boost::tuple. For example, if std::pair is stored in the -container, the default IndexableGetter translates from std::pair const& to Box const&. +The object of IndexableGetter type translates from Value to Indexable each time +r-tree requires it. This means that this operation is done for each Value +access. Therefore the IndexableGetter should return the Indexable by +a reference type. The Indexable should not be calculated since it could harm +the performance. The default IndexableGetter can translate all types adapted +to Point, Box or Segment concepts (called Indexables). Furthermore, it can +handle std::pair, boost::tuple +and std::tuple when possible. For example, for Value +of type std::pair, the default IndexableGetter translates +from std::pair const& to Box const&. \par EqualTo -The object of EqualTo type compares Values and returns true if they're equal. It's similar to std::equal_to<>. -The default EqualTo returns the result of boost::geometry::equals() for types adapted to some Geometry concept -defined in Boost.Geometry and the result of operator= for other types. Components of Pairs and Tuples are compared left-to-right. +The object of EqualTo type compares Values and returns true if they +are equal. It's similar to std::equal_to<>. The default EqualTo +returns the result of boost::geometry::equals() for types adapted to +some Geometry concept defined in Boost.Geometry and the result of +operator== for other types. Components of Pairs and Tuples are +compared left-to-right. \tparam Value The type of objects stored in the container. \tparam Parameters Compile-time parameters. \tparam IndexableGetter The function object extracting Indexable from Value. \tparam EqualTo The function object comparing objects of type Value. -\tparam Allocator The allocator used to allocate/deallocate memory, construct/destroy nodes and Values. +\tparam Allocator The allocator used to allocate/deallocate memory, + construct/destroy nodes and Values. */ template < typename Value, @@ -1088,6 +1097,8 @@ public: template size_type count(ValueOrIndexable const& vori) const { + // the input should be convertible to Value or Indexable type + enum { as_val = 0, as_ind, dont_know }; typedef boost::mpl::int_ < @@ -1113,15 +1124,9 @@ public: indexable_type >::type value_or_indexable; - if ( !m_members.root ) - return 0; - - detail::rtree::visitors::count - count_v(vori, m_members.translator()); - - detail::rtree::apply_visitor(count_v, *m_members.root); - - return count_v.found_count; + // NOTE: If an object of convertible but not the same type is passed + // into the function, here a temporary will be created. + return this->template raw_count(vori); } /*! @@ -1493,6 +1498,33 @@ private: return distance_v.finish(); } + + /*! + \brief Count elements corresponding to value or indexable. + + \par Exception-safety + strong + */ + template + size_type raw_count(ValueOrIndexable const& vori) const + { + if ( !m_members.root ) + return 0; + + detail::rtree::visitors::count + < + ValueOrIndexable, + value_type, + options_type, + translator_type, + box_type, + allocators_type + > count_v(vori, m_members.translator()); + + detail::rtree::apply_visitor(count_v, *m_members.root); + + return count_v.found_count; + } struct members_holder : public translator_type diff --git a/index/test/Jamfile.v2 b/index/test/Jamfile.v2 index fc45a830e..f19f6834c 100644 --- a/index/test/Jamfile.v2 +++ b/index/test/Jamfile.v2 @@ -15,13 +15,15 @@ project boost-geometry-index-test ../../test # libs/geometry/test #../../../../boost/geometry/extensions/contrib/ttmath msvc:on + msvc:/bigobj + windows,intel:/bigobj /boost/timer//boost_timer ; test-suite boost-geometry-index-varray : [ run varray_old.cpp ] - [ run varray.cpp : : : msvc:/bigobj ] + [ run varray.cpp ] ; build-project algorithms ; diff --git a/index/test/rtree/exceptions/Jamfile.v2 b/index/test/rtree/exceptions/Jamfile.v2 index 1728b245b..84855c4fd 100644 --- a/index/test/rtree/exceptions/Jamfile.v2 +++ b/index/test/rtree/exceptions/Jamfile.v2 @@ -17,6 +17,7 @@ rule test_all : # test-files : # requirements msvc:/bigobj + windows,intel:/bigobj ] ; } diff --git a/index/test/rtree/generated/Jamfile.v2 b/index/test/rtree/generated/Jamfile.v2 index f3900741b..a5a6f3e41 100644 --- a/index/test/rtree/generated/Jamfile.v2 +++ b/index/test/rtree/generated/Jamfile.v2 @@ -17,6 +17,7 @@ rule test_all : # test-files : # requirements msvc:/bigobj + windows,intel:/bigobj ] ; } diff --git a/index/test/rtree/interprocess/Jamfile.v2 b/index/test/rtree/interprocess/Jamfile.v2 index f5b9de66c..1a52eb953 100644 --- a/index/test/rtree/interprocess/Jamfile.v2 +++ b/index/test/rtree/interprocess/Jamfile.v2 @@ -23,7 +23,8 @@ rule test_all gcc,windows:"-lole32 -loleaut32 -lpsapi -ladvapi32" windows,clang:"-lole32 -loleaut32 -lpsapi -ladvapi32" msvc:/bigobj - linux:"-lrt" + windows,intel:/bigobj + linux:"-lrt" ] ; } diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index b49361e55..7ba3fa4b6 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -18,6 +18,7 @@ project boost-geometry-test msvc:on msvc:/bigobj clang:-Wno-unneeded-internal-declaration # supress warning by Boost.None + windows,intel:/bigobj ; build-project core ; diff --git a/test/algorithms/buffer/country_buffer.cpp b/test/algorithms/buffer/country_buffer.cpp index 66e985728..b4e56f675 100644 --- a/test/algorithms/buffer/country_buffer.cpp +++ b/test/algorithms/buffer/country_buffer.cpp @@ -148,80 +148,80 @@ void test_all() std::string no = read_from_file("data/no.wkt"); std::string uk = read_from_file("data/uk.wkt"); - test_one("gr10", gr, 336274443102, 10); - test_one("gr20", gr, 442303404970, 20); - test_one("gr50", gr, 680414236746, 50); - test_one("gr100", gr, 910435136622, 100); + test_one("gr10", gr, 336279815057, 10); + test_one("gr20", gr, 442317493728, 20); + test_one("gr50", gr, 680442278144, 50); + test_one("gr100", gr, 910474619262, 100); - test_one("gr10", gr, 139315436711, -10); - test_one("gr20", gr, 96996694672, -20); - test_one("gr50", gr, 31400319981, -50); - test_one("gr100", gr, 2038866888, -100); + test_one("gr10", gr, 139313148239, -10); + test_one("gr20", gr, 96991352461, -20); + test_one("gr50", gr, 31391928703, -50); + test_one("gr100", gr, 2035400463, -100); - test_one("it1", it, 569862957683, 1); - test_one("it2", it, 579239031444, 2); - test_one("it5", it, 607624450258, 5); - test_one("it10", it, 655015072045, 10); - test_one("it20", it, 749341988637, 20); - test_one("it50", it, 1018283833002, 50); - test_one("it100", it, 1436371098919, 100); + test_one("it1", it, 569863002352, 1); + test_one("it2", it, 579239205460, 2); + test_one("it5", it, 607625467971, 5); + test_one("it10", it, 655018590164, 10); + test_one("it20", it, 749353300126, 20); + test_one("it50", it, 1018323108593, 50); + test_one("it100", it, 1436451405440, 100); - test_one("it1", it, 551474452673, -1); - test_one("it2", it, 542617896207, -2); - test_one("it5", it, 517403395015, -5); - test_one("it10", it, 477948804826, -10); - test_one("it20", it, 404704185411, -20); - test_one("it50", it, 238775955402, -50); - test_one("it100", it, 69800921399, -100); + test_one("it1", it, 551474409670, -1); + test_one("it2", it, 542617726944, -2); + test_one("it5", it, 517402446347, -5); + test_one("it10", it, 477945526913, -10); + test_one("it20", it, 404693994961, -20); + test_one("it50", it, 238748456044, -50); + test_one("it100", it, 69768639974, -100); test_one("it200", it, 0, -200); - test_one("nl1", nl, 97391149343, 1); - test_one("nl2", nl, 100816629886, 2); - test_one("nl5", nl, 110239413808, 5); - test_one("nl10", nl, 123407160072, 10); - test_one("nl20", nl, 145044379084, 20); - test_one("nl50", nl, 201197559681, 50); - test_one("nl100", nl, 303275571989, 100); + test_one("nl1", nl, 97391171492, 1); + test_one("nl2", nl, 100816708947, 2); + test_one("nl5", nl, 110239800198, 5); + test_one("nl10", nl, 123408276767, 10); + test_one("nl20", nl, 145046916470, 20); + test_one("nl50", nl, 201207309280, 50); + test_one("nl100", nl, 303300936130, 100); - test_one("nl1", nl, 90095062551, -1); - test_one("nl2", nl, 86601922962, -2); - test_one("nl5", nl, 77308154694, -5); - test_one("nl10", nl, 64669734511, -10); - test_one("nl20", nl, 46685545338, -20); - test_one("nl50", nl, 10248593002, -50); + test_one("nl1", nl, 90095047258, -1); + test_one("nl2", nl, 86601864925, -2); + test_one("nl5", nl, 77307843491, -5); + test_one("nl10", nl, 64668873412, -10); + test_one("nl20", nl, 46683532991, -20); + test_one("nl50", nl, 10244522894, -50); test_one("nl100", nl, 0, -100); - test_one("no1", no, 1819566431968, 1); - test_one("no2", no, 1865040587680, 2); - test_one("no5", no, 1973612505198, 5); - test_one("no10", no, 2102026964987, 10); - test_one("no20", no, 2292154347925, 20); - test_one("no50", no, 2725424299143, 50); - test_one("no100", no, 3374865875758, 100); + test_one("no1", no, 1819566643132, 1); + test_one("no2", no, 1865041330273, 2); + test_one("no5", no, 1973615513085, 5); + test_one("no10", no, 2102034197635, 10); + test_one("no20", no, 2292171193871, 20); + test_one("no50", no, 2725475412131, 50); + test_one("no100", no, 3374987097497, 100); - test_one("no1", no, 1725145481020, -1); - test_one("no2", no, 1678942941890, -2); - test_one("no5", no, 1547331904374, -5); - test_one("no10", no, 1361206959153, -10); - test_one("no20", no, 1089865725529, -20); - test_one("no50", no, 649657900609, -50); - test_one("no100", no, 306772606713, -100); + test_one("no1", no, 1725145365167, -1); + test_one("no2", no, 1678942477834, -2); + test_one("no5", no, 1547329288139, -5); + test_one("no10", no, 1361198992659, -10); + test_one("no20", no, 1089847769281, -20); + test_one("no50", no, 649622185906, -50); + test_one("no100", no, 306739135037, -100); - test_one("uk1", uk, 733080699236, 1); - test_one("uk2", uk, 749555588975, 2); - test_one("uk5", uk, 793750965288, 5); - test_one("uk10", uk, 857677152435, 10); - test_one("uk20", uk, 970474644257, 20); - test_one("uk50", uk, 1247789678698, 50); - test_one("uk100", uk, 1659782604299, 100); + test_one("uk1", uk, 733080792661, 1); + test_one("uk2", uk, 749555934157, 2); + test_one("uk5", uk, 793752670139, 5); + test_one("uk10", uk, 857682293758, 10); + test_one("uk20", uk, 970488073372, 20); + test_one("uk50", uk, 1247830326998, 50); + test_one("uk100", uk, 1659861947865, 100); - test_one("uk1", uk, 699378162790, -1); - test_one("uk2", uk, 683086653377, -2); - test_one("uk5", uk, 637326518646, -5); - test_one("uk10", uk, 572560284244, -10); - test_one("uk20", uk, 479267296848, -20); - test_one("uk50", uk, 274851268903, -50); - test_one("uk100", uk, 78225232337, -100); + test_one("uk1", uk, 699378105887, -1); + test_one("uk2", uk, 683086430553, -2); + test_one("uk5", uk, 637325270073, -5); + test_one("uk10", uk, 572556645697, -10); + test_one("uk20", uk, 479258135850, -20); + test_one("uk50", uk, 274828075226, -50); + test_one("uk100", uk, 78205462121, -100); } int test_main(int, char* []) diff --git a/test/algorithms/buffer/test_buffer.hpp b/test/algorithms/buffer/test_buffer.hpp index dc0177d15..6b0d91105 100644 --- a/test/algorithms/buffer/test_buffer.hpp +++ b/test/algorithms/buffer/test_buffer.hpp @@ -542,13 +542,17 @@ void test_buffer(std::string const& caseid, Geometry const& geometry, if (expected_area > -0.1) { + double const difference = area - expected_area; BOOST_CHECK_MESSAGE ( - bg::math::abs(area - expected_area) < tolerance, + bg::math::abs(difference) < tolerance, complete.str() << " not as expected. " << std::setprecision(18) - << " Expected: " << expected_area - << " Detected: " << area + << " Expected: " << expected_area + << " Detected: " << area + << " Diff: " << difference + << std::setprecision(3) + << " , " << 100.0 * (difference / expected_area) << "%" ); if (check_self_intersections) diff --git a/test/strategies/douglas_peucker.cpp b/test/strategies/douglas_peucker.cpp index 3306dbcc4..b8b09f348 100644 --- a/test/strategies/douglas_peucker.cpp +++ b/test/strategies/douglas_peucker.cpp @@ -168,11 +168,11 @@ template struct test_one_case { template - static inline void apply(std::string const& wkt, + static inline void apply(std::string const& case_id, + std::string const& wkt, double max_distance, Strategy const& strategy, - Range const& expected_result, - std::string const& case_id) + Range const& expected_result) { typedef typename bg::point_type::type point_type; std::vector result; @@ -197,16 +197,20 @@ struct test_one_case "output: "); std::cout << std::endl << std::endl; #endif - std::stringstream sstr; - print_point_range(sstr, boost::begin(expected_result), + std::stringstream stream_expected; + print_point_range(stream_expected, boost::begin(expected_result), boost::end(expected_result), ""); + std::stringstream stream_detected; + print_point_range(stream_detected, boost::begin(result), + boost::end(result), + ""); BOOST_CHECK_MESSAGE(equals::apply(result, expected_result), "case id: " << case_id << " - " << typeid_name << ", geometry: " << wkt - << ", Expected: " << sstr.str() - << " - Detected: " << bg::wkt(result)); + << ", Expected: " << stream_expected.str() + << " - Detected: " << stream_detected.str()); #ifdef BOOST_GEOMETRY_TEST_DEBUG std::cout << "---------------" << std::endl; @@ -218,7 +222,7 @@ struct test_one_case template -inline void test_with_strategy() +inline void test_with_strategy(std::string label) { std::cout.precision(20); Strategy strategy; @@ -228,45 +232,52 @@ inline void test_with_strategy() typedef bg::model::segment segment_type; typedef test_one_case tester; + label = " (" + label + ")"; + { point_type const p1(-6,-13), p2(0,-15); segment_type const s(point_type(12,-3), point_type(-12,5)); if (bg::comparable_distance(p1, s) >= bg::comparable_distance(p2, s)) { - tester::apply("LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -15,-12 5)", + tester::apply("l01c1" + label, + "LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -15,-12 5)", 10, strategy, - ba::tuple_list_of(12,-3)(4,8)(-6,-13)(-12,5), - "l01"); + ba::tuple_list_of(12,-3)(4,8)(-6,-13)(-12,5) + ); } else { - tester::apply("LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -15,-12 5)", + tester::apply("l01c2" + label, + "LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -15,-12 5)", 10, strategy, - ba::tuple_list_of(12,-3)(4,8)(-6,-13)(-9,4)(0,-15)(-12,5), - "l01"); + ba::tuple_list_of(12,-3)(4,8)(-6,-13)(-9,4)(0,-15)(-12,5) + ); } } - tester::apply("LINESTRING(-6 -13,-9 4,0 -15,-12 5)", + tester::apply("l02" + label, + "LINESTRING(-6 -13,-9 4,0 -15,-12 5)", 10, strategy, - ba::tuple_list_of(-6,-13)(-12,5), - "l02"); + ba::tuple_list_of(-6,-13)(-12,5) + ); - tester::apply("LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -14,-12 5)", + tester::apply("l03" + label, + "LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -14,-12 5)", 10, strategy, - ba::tuple_list_of(12,-3)(4,8)(-6,-13)(-12,5), - "l03"); + ba::tuple_list_of(12,-3)(4,8)(-6,-13)(-12,5) + ); - tester::apply("LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -14,-12 5)", + tester::apply("l04" + label, + "LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -14,-12 5)", 14, strategy, - ba::tuple_list_of(12,-3)(-6,-13)(-12,5), - "l04"); + ba::tuple_list_of(12,-3)(-6,-13)(-12,5) + ); { segment_type const s(point_type(0,-1), point_type(5,-4)); @@ -308,29 +319,33 @@ inline void test_with_strategy() if (bg::comparable_distance(p1, s) >= bg::comparable_distance(p2, s)) { - tester::apply(wkt, + tester::apply("l05c1" + label, + wkt, 1, strategy, - ba::tuple_list_of(0,0)(5,0)(0,-1)(5,-1)(0,-2)(5,-2)(0,-3)(5,-4)(0,0), - "l05"); - tester::apply(wkt, + ba::tuple_list_of(0,0)(5,0)(0,-1)(5,-1)(0,-2)(5,-2)(0,-3)(5,-4)(0,0) + ); + tester::apply("l05c1a" + label, + wkt, 2, strategy, - ba::tuple_list_of(0,0)(5,0)(0,-1)(5,-1)(0,-2)(5,-4)(0,0), - "l05a"); + ba::tuple_list_of(0,0)(5,0)(0,-1)(5,-1)(0,-2)(5,-4)(0,0) + ); } else { - tester::apply(wkt, + tester::apply("l05c2" + label, + wkt, 1, strategy, - ba::tuple_list_of(0,0)(5,0)(0,-1)(5,-1)(0,-2)(5,-2)(0,-4)(5,-4)(0,0), - "l05"); - tester::apply(wkt, + ba::tuple_list_of(0,0)(5,0)(0,-1)(5,-1)(0,-2)(5,-2)(0,-4)(5,-4)(0,0) + ); + tester::apply("l05c2a" + label, + wkt, 2, strategy, - ba::tuple_list_of(0,0)(5,0)(0,-1)(5,-1)(0,-4)(5,-4)(0,0), - "l05a"); + ba::tuple_list_of(0,0)(5,0)(0,-1)(5,-1)(0,-4)(5,-4)(0,0) + ); } } @@ -346,14 +361,14 @@ inline void test_with_strategy() BOOST_AUTO_TEST_CASE( test_default_strategy ) { - test_with_strategy::type>(); - test_with_strategy::type>(); - test_with_strategy::type>(); + test_with_strategy::type>("i"); + test_with_strategy::type>("f"); + test_with_strategy::type>("d"); test_with_strategy < long double, default_simplify_strategy::type - >(); + >("ld"); } BOOST_AUTO_TEST_CASE( test_with_regular_distance_strategy ) @@ -362,24 +377,24 @@ BOOST_AUTO_TEST_CASE( test_with_regular_distance_strategy ) < int, simplify_regular_distance_strategy::type - >(); + >("i"); test_with_strategy < float, simplify_regular_distance_strategy::type - >(); + >("f"); test_with_strategy < double, simplify_regular_distance_strategy::type - >(); + >("d"); test_with_strategy < long double, simplify_regular_distance_strategy::type - >(); + >("ld"); } BOOST_AUTO_TEST_CASE( test_with_comparable_distance_strategy ) @@ -388,20 +403,20 @@ BOOST_AUTO_TEST_CASE( test_with_comparable_distance_strategy ) < int, simplify_comparable_distance_strategy::type - >(); + >("i"); test_with_strategy < float, simplify_comparable_distance_strategy::type - >(); + >("f"); test_with_strategy < double, simplify_comparable_distance_strategy::type - >(); + >("d"); test_with_strategy < long double, simplify_comparable_distance_strategy::type - >(); + >("ld"); }