Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74761 - in trunk: boost/geometry/strategies/agnostic libs/geometry/test/multi/algorithms
From: barend.gehrels_at_[hidden]
Date: 2011-10-06 13:06:30


Author: barendgehrels
Date: 2011-10-06 13:06:30 EDT (Thu, 06 Oct 2011)
New Revision: 74761
URL: http://svn.boost.org/trac/boost/changeset/74761

Log:
Fix ticket 5954, use strategy directly, not the comparable strategy (unless fixed otherwise)
Text files modified:
   trunk/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp | 9 +++++++--
   trunk/libs/geometry/test/multi/algorithms/multi_simplify.cpp | 9 +++++++++
   2 files changed, 16 insertions(+), 2 deletions(-)

Modified: trunk/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp
==============================================================================
--- trunk/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp (original)
+++ trunk/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp 2011-10-06 13:06:30 EDT (Thu, 06 Oct 2011)
@@ -94,7 +94,12 @@
 {
 public :
 
- typedef typename strategy::distance::services::comparable_type<PointDistanceStrategy>::type distance_strategy_type;
+ // See also ticket 5954 https://svn.boost.org/trac/boost/ticket/5954
+ // Comparable is currently not possible here because it has to be compared to the squared of max_distance, and more.
+ // For now we have to take the real distance.
+ typedef PointDistanceStrategy distance_strategy_type;
+ // typedef typename strategy::distance::services::comparable_type<PointDistanceStrategy>::type distance_strategy_type;
+
     typedef typename strategy::distance::services::return_type<distance_strategy_type>::type return_type;
 
 private :
@@ -145,7 +150,7 @@
 #ifdef GL_DEBUG_DOUGLAS_PEUCKER
             std::cout << "consider " << dsv(it->p)
                 << " at " << double(dist)
- << ((dist > max_dist) ? " maybe" : " no") // FIXME: shouldn't it read dist >148 md? --mloskot
+ << ((dist > max_dist) ? " maybe" : " no")
                 << std::endl;
 
 #endif

Modified: trunk/libs/geometry/test/multi/algorithms/multi_simplify.cpp
==============================================================================
--- trunk/libs/geometry/test/multi/algorithms/multi_simplify.cpp (original)
+++ trunk/libs/geometry/test/multi/algorithms/multi_simplify.cpp 2011-10-06 13:06:30 EDT (Thu, 06 Oct 2011)
@@ -44,6 +44,15 @@
     test_geometry<mp>(
         "MULTIPOLYGON(((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0),(7 3,7 6,1 6,1 3,4 3,7 3)))",
         "MULTIPOLYGON(((4 0,8 2,8 7,4 9,0 7,0 2,4 0),(7 3,7 6,1 6,1 3,7 3)))", 1.0);
+
+ // Ticket 5954 https://svn.boost.org/trac/boost/ticket/5954
+ test_geometry<mp>(
+ "MULTIPOLYGON(((0.561648 1,1 1,1 0,0.468083 0,0.52758 0.00800554,0.599683 0.0280924,0.601611 0.265374,0.622693 0.316765,0.69507 0.357497,0.695623 0.429711,0.655111 0.502298,0.696467 0.543147,0.840712 0.593546,0.882583 0.66546,0.852357 0.748213,0.84264 0.789567,0.832667 0.841202,0.832667 0.841202,0.740538 0.873004,0.617349 0.905045,0.566576 0.977697,0.561648 1)),((0 0.801979,0.0308575 0.786234,0.0705513 0.631135,0.141616 0.527248,0.233985 0.505872,0.264777 0.526263,0.336631 0.505009,0.356603 0.422321,0.355803 0.350038,0.375252 0.205364,0.415206 0.0709182,0.45479 0,0 0,0 0,0 0.801979)))",
+ "MULTIPOLYGON(((0.561648 1,1 1,1 0,0.468083 0,0.52758 0.00800554,0.599683 0.0280924,0.601611 0.265374,0.622693 0.316765,0.69507 0.357497,0.695623 0.429711,0.655111 0.502298,0.696467 0.543147,0.840712 0.593546,0.882583 0.66546,0.852357 0.748213,0.84264 0.789567,0.832667 0.841202,0.740538 0.873004,0.617349 0.905045,0.566576 0.977697,0.561648 1)),((0 0.801979,0.0308575 0.786234,0.0705513 0.631135,0.141616 0.527248,0.233985 0.505872,0.264777 0.526263,0.336631 0.505009,0.356603 0.422321,0.355803 0.350038,0.375252 0.205364,0.415206 0.0709182,0.45479 0,0 0,0 0.801979)))", 1.0 / 2048.0);
+ test_geometry<mp>(
+ "MULTIPOLYGON(((1149.69 2047,2047 2047,2047 0,958.166 0,1079.96 16.3873,1227.55 57.5051,1231.5 543.221,1274.65 648.418,1422.81 731.796,1423.94 879.618,1341.01 1028.2,1425.67 1111.82,1720.94 1214.99,1806.65 1362.2,1744.77 1531.59,1724.88 1616.24,1704.47 1721.94,1704.47 1721.94,1515.88 1787.04,1263.71 1852.63,1159.78 2001.35,1149.69 2047)),((0 1641.65,63.1653 1609.42,144.419 1291.93,289.888 1079.28,478.967 1035.52,541.999 1077.26,689.084 1033.75,729.966 864.491,728.329 716.528,768.141 420.38,849.927 145.17,930.955 0,0 0,0 0,0 1641.65)))",
+ "MULTIPOLYGON(((1149.69 2047,2047 2047,2047 0,958.166 0,1079.96 16.3873,1227.55 57.5051,1231.5 543.221,1274.65 648.418,1422.81 731.796,1423.94 879.618,1341.01 1028.2,1425.67 1111.82,1720.94 1214.99,1806.65 1362.2,1744.77 1531.59,1724.88 1616.24,1704.47 1721.94,1515.88 1787.04,1263.71 1852.63,1159.78 2001.35,1149.69 2047)),((0 1641.65,63.1653 1609.42,144.419 1291.93,289.888 1079.28,478.967 1035.52,541.999 1077.26,689.084 1033.75,729.966 864.491,728.329 716.528,768.141 420.38,849.927 145.17,930.955 0,0 0,0 1641.65)))", 1.0);
+ // End ticket 5954
 }
 
 int test_main( int , char* [] )


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk