|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r65214 - in sandbox/geometry/boost/geometry: algorithms extensions/algorithms iterators
From: barend.gehrels_at_[hidden]
Date: 2010-09-03 06:26:02
Author: barendgehrels
Date: 2010-09-03 06:25:59 EDT (Fri, 03 Sep 2010)
New Revision: 65214
URL: http://svn.boost.org/trac/boost/changeset/65214
Log:
Added model::segment (preparing model namespace)
Text files modified:
sandbox/geometry/boost/geometry/algorithms/sym_difference.hpp | 17 +++++++++--------
sandbox/geometry/boost/geometry/extensions/algorithms/connect.hpp | 28 ++++++++++++++++++++--------
sandbox/geometry/boost/geometry/iterators/segment_range_iterator.hpp | 10 +++++++++-
3 files changed, 38 insertions(+), 17 deletions(-)
Modified: sandbox/geometry/boost/geometry/algorithms/sym_difference.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/sym_difference.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/sym_difference.hpp 2010-09-03 06:25:59 EDT (Fri, 03 Sep 2010)
@@ -20,14 +20,15 @@
/*!
- \ingroup sym_difference
- \tparam Geometry1 first geometry type
- \tparam Geometry2 second geometry type
- \tparam Collection output collection, either a multi-geometry,
- or a std::vector<Geometry> / std::deque<Geometry> etc
- \param geometry1 first geometry
- \param geometry2 second geometry
- \param output_collection the output collection
+\brief \brief_calc2{symmetric difference}
+\ingroup sym_difference
+\tparam Geometry1 \tparam_geometry
+\tparam Geometry2 \tparam_geometry
+\tparam Collection output collection, either a multi-geometry,
+ or a std::vector<Geometry> / std::deque<Geometry> etc
+\param geometry1 \param_geometry
+\param geometry2 \param_geometry
+\param output_collection the output collection
*/
template
<
Modified: sandbox/geometry/boost/geometry/extensions/algorithms/connect.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/extensions/algorithms/connect.hpp (original)
+++ sandbox/geometry/boost/geometry/extensions/algorithms/connect.hpp 2010-09-03 06:25:59 EDT (Fri, 03 Sep 2010)
@@ -15,6 +15,7 @@
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/algorithms/distance.hpp>
+#include <boost/geometry/algorithms/comparable_distance.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/strategies/distance_result.hpp>
#include <boost/geometry/policies/compare.hpp>
@@ -56,6 +57,10 @@
template <typename Point>
struct map_policy
{
+ typedef typename strategy::distance::services::default_strategy
+ <
+ point_tag, Point
+ >::type strategy_type;
// Have a map<point, <index,start/end> > such that we can find
// the corresponding point on each end. Note that it uses the
@@ -143,17 +148,18 @@
}
// 2c: for all candidates get closest one
+ strategy_type strategy;
+
+ distance_result_type min_dist = strategy::distance::services
+ ::result_from_distance<strategy_type>::apply(strategy, 100);
- // TODO: make utility to initalize distance result with large value
- distance_result_type min_dist
- = make_distance_result<distance_result_type>(100);
for (vector_iterator_type it = boost::begin(range);
it != boost::end(range);
++it)
{
if (! included[it->index])
{
- distance_result_type d = geometry::distance(p1, it->point);
+ distance_result_type d = geometry::comparable_distance(p1, it->point);
if (d < min_dist)
{
closest = *it;
@@ -172,6 +178,10 @@
template <typename Point>
struct fuzzy_policy
{
+ typedef typename strategy::distance::services::default_strategy
+ <
+ point_tag, Point
+ >::type strategy_type;
// Have a map<point, <index,start/end> > such that we can find
// the corresponding point on each end. Note that it uses the
@@ -290,6 +300,8 @@
inline node<Point> find_closest(Point const& p1, std::map<int, bool>& included)
{
+ namespace services = strategy::distance::services;
+
node<Point> closest;
typename boost::range_iterator<map_type>::type it = fuzzy_closest(p1);
@@ -310,17 +322,17 @@
}
// 2c: for all candidates get closest one
+ strategy_type strategy;
+ distance_result_type min_dist = strategy::distance::services
+ ::result_from_distance<strategy_type>::apply(strategy, 100);
- // TODO: make utility to initalize distance result with large value
- distance_result_type min_dist
- = make_distance_result<distance_result_type>(100);
for (vector_iterator_type it = boost::begin(range);
it != boost::end(range);
++it)
{
if (! included[it->index])
{
- distance_result_type d = geometry::distance(p1, it->point);
+ distance_result_type d = geometry::comparable_distance(p1, it->point);
if (d < min_dist)
{
closest = *it;
Modified: sandbox/geometry/boost/geometry/iterators/segment_range_iterator.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/iterators/segment_range_iterator.hpp (original)
+++ sandbox/geometry/boost/geometry/iterators/segment_range_iterator.hpp 2010-09-03 06:25:59 EDT (Fri, 03 Sep 2010)
@@ -43,6 +43,14 @@
{
}
+ // Operator= is required to check concept of Range
+ inline segment_range_iterator<Segment>& operator=(segment_range_iterator<Segment> const& source)
+ {
+ m_index = source.m_index;
+ m_segment_address = source.m_segment_address;
+ return *this;
+ }
+
explicit inline segment_range_iterator(Segment const& segment)
: m_index(0)
@@ -108,7 +116,7 @@
// and we are expected to return a point here
point_type m_points[2];
int m_index;
- Segment const* const m_segment_address;
+ Segment const* m_segment_address;
};
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