|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r63706 - in sandbox/geometry: boost/geometry/algorithms boost/geometry/extensions/algorithms boost/geometry/extensions/gis/geographic/strategies boost/geometry/extensions/nsphere/algorithms boost/geometry/multi/algorithms boost/geometry/strategies boost/geometry/strategies/agnostic boost/geometry/strategies/cartesian boost/geometry/strategies/concepts boost/geometry/strategies/spherical libs/geometry/example libs/geometry/test/strategies
From: barend.gehrels_at_[hidden]
Date: 2010-07-06 16:16:02
Author: barendgehrels
Date: 2010-07-06 16:15:59 EDT (Tue, 06 Jul 2010)
New Revision: 63706
URL: http://svn.boost.org/trac/boost/changeset/63706
Log:
Replaced member-type return_type by meta-function return_type
Added:
sandbox/geometry/libs/geometry/example/c09_custom_fusion_example.cpp (contents, props changed)
sandbox/geometry/libs/geometry/example/c09_custom_fusion_example.vcproj (contents, props changed)
Text files modified:
sandbox/geometry/boost/geometry/algorithms/distance.hpp | 36 +++++++++++++++--------
sandbox/geometry/boost/geometry/extensions/algorithms/selected.hpp | 2
sandbox/geometry/boost/geometry/extensions/gis/geographic/strategies/andoyer.hpp | 9 +++++
sandbox/geometry/boost/geometry/extensions/gis/geographic/strategies/vincenty.hpp | 7 ++++
sandbox/geometry/boost/geometry/extensions/nsphere/algorithms/within.hpp | 2
sandbox/geometry/boost/geometry/multi/algorithms/distance.hpp | 4 +-
sandbox/geometry/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp | 4 +-
sandbox/geometry/boost/geometry/strategies/cartesian/distance_projected_point.hpp | 11 ++++++-
sandbox/geometry/boost/geometry/strategies/cartesian/distance_pythagoras.hpp | 34 ++++++++++++++++------
sandbox/geometry/boost/geometry/strategies/concepts/distance_concept.hpp | 8 ++--
sandbox/geometry/boost/geometry/strategies/distance.hpp | 1
sandbox/geometry/boost/geometry/strategies/distance_result.hpp | 15 +++++----
sandbox/geometry/boost/geometry/strategies/spherical/distance_cross_track.hpp | 59 +++++++++++++++++++++++++--------------
sandbox/geometry/boost/geometry/strategies/spherical/distance_haversine.hpp | 56 +++++++++++++++++++++++--------------
sandbox/geometry/libs/geometry/test/strategies/haversine.cpp | 4 +-
sandbox/geometry/libs/geometry/test/strategies/pythagoras.cpp | 14 ++++----
16 files changed, 172 insertions(+), 94 deletions(-)
Modified: sandbox/geometry/boost/geometry/algorithms/distance.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/distance.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/distance.hpp 2010-07-06 16:15:59 EDT (Tue, 06 Jul 2010)
@@ -67,10 +67,13 @@
namespace detail { namespace distance
{
+// To avoid spurious namespaces here:
+using strategy::distance::services::return_type;
+
template <typename P1, typename P2, typename Strategy>
struct point_to_point
{
- static inline typename Strategy::return_type apply(P1 const& p1,
+ static inline typename return_type<Strategy>::type apply(P1 const& p1,
P2 const& p2, Strategy const& strategy)
{
return strategy.apply(p1, p2);
@@ -81,7 +84,7 @@
template<typename Point, typename Segment, typename Strategy>
struct point_to_segment
{
- static inline typename Strategy::return_type apply(Point const& point,
+ static inline typename return_type<Strategy>::type apply(Point const& point,
Segment const& segment, Strategy const& strategy)
{
typename strategy::distance::services::default_strategy
@@ -101,7 +104,7 @@
template<typename Point, typename Range, typename PPStrategy, typename PSStrategy>
struct point_to_range
{
- typedef typename PSStrategy::return_type return_type;
+ typedef typename return_type<PSStrategy>::type return_type;
static inline return_type apply(Point const& point, Range const& range,
PPStrategy const& pp_strategy, PSStrategy const& ps_strategy)
@@ -155,7 +158,10 @@
template<typename Point, typename Ring, typename PPStrategy, typename PSStrategy>
struct point_to_ring
{
- typedef std::pair<typename PPStrategy::return_type, bool> distance_containment;
+ typedef std::pair
+ <
+ typename return_type<PPStrategy>::type, bool
+ > distance_containment;
static inline distance_containment apply(Point const& point,
Ring const& ring,
@@ -180,8 +186,8 @@
template<typename Point, typename Polygon, typename PPStrategy, typename PSStrategy>
struct point_to_polygon
{
- typedef typename PPStrategy::return_type return_type;
- typedef std::pair<typename PPStrategy::return_type, bool> distance_containment;
+ typedef typename return_type<PPStrategy>::type return_type;
+ typedef std::pair<return_type, bool> distance_containment;
static inline distance_containment apply(Point const& point,
Polygon const& polygon,
@@ -232,6 +238,9 @@
namespace dispatch
{
+using strategy::distance::services::return_type;
+
+
template
<
typename GeometryTag1, typename GeometryTag2,
@@ -264,7 +273,7 @@
>
{
- static inline typename Strategy::return_type apply(Point const& point,
+ static inline typename return_type<Strategy>::type apply(Point const& point,
Linestring const& linestring,
Strategy const& strategy)
{
@@ -293,7 +302,7 @@
false, false
>
{
- static inline typename Strategy::return_type apply(Point const& point,
+ static inline typename return_type<Strategy>::type apply(Point const& point,
Linestring const& linestring,
Strategy const& strategy)
{
@@ -315,7 +324,7 @@
false, false
>
{
- typedef typename Strategy::return_type return_type;
+ typedef typename return_type<Strategy>::type return_type;
static inline return_type apply(Point const& point,
Polygon const& polygon,
@@ -361,7 +370,7 @@
false, false
>
{
- static inline typename Strategy::return_type apply(Point const& point,
+ static inline typename return_type<Strategy>::type apply(Point const& point,
Segment const& segment, Strategy const& strategy)
{
// TODO: We cannot use .first and .second here.
@@ -388,7 +397,7 @@
>
struct distance_reversed
{
- static inline typename Strategy::return_type apply(G1 const& g1,
+ static inline typename return_type<Strategy>::type apply(G1 const& g1,
G2 const& g2, Strategy const& strategy)
{
return distance
@@ -424,8 +433,9 @@
\until }
*/
template <typename Geometry1, typename Geometry2, typename Strategy>
-inline typename Strategy::return_type distance(Geometry1 const& geometry1,
- Geometry2 const& geometry2, Strategy const& strategy)
+inline typename strategy::distance::services::return_type<Strategy>::type distance(
+ Geometry1 const& geometry1,
+ Geometry2 const& geometry2, Strategy const& strategy)
{
concept::check<Geometry1 const>();
concept::check<Geometry2 const>();
Modified: sandbox/geometry/boost/geometry/extensions/algorithms/selected.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/extensions/algorithms/selected.hpp (original)
+++ sandbox/geometry/boost/geometry/extensions/algorithms/selected.hpp 2010-07-06 16:15:59 EDT (Tue, 06 Jul 2010)
@@ -153,7 +153,7 @@
<
segment_tag, P, PS
>::type strategy_type;
- typedef typename strategy_type::return_type return_type;
+ typedef typename strategy::distance::services::return_type<strategy_type>::type return_type;
strategy_type strategy;
return_type result = strategy.apply(selection_point, seg1, seg2);
Modified: sandbox/geometry/boost/geometry/extensions/gis/geographic/strategies/andoyer.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/extensions/gis/geographic/strategies/andoyer.hpp (original)
+++ sandbox/geometry/boost/geometry/extensions/gis/geographic/strategies/andoyer.hpp 2010-07-06 16:15:59 EDT (Tue, 06 Jul 2010)
@@ -136,6 +136,13 @@
};
+template <typename Point1, typename Point2>
+struct return_type<strategy::distance::andoyer<Point1, Point2> >
+{
+ typedef typename strategy::distance::andoyer<Point1, Point2>::return_type type;
+};
+
+
template <typename Point1, typename Point2, typename P1, typename P2>
struct similar_type<andoyer<Point1, Point2>, P1, P2>
{
@@ -172,7 +179,7 @@
struct result_from_distance<andoyer<Point1, Point2> >
{
template <typename T>
- static inline typename andoyer<Point1, Point2>::return_type apply(andoyer<Point1, Point2> const& , T const& value)
+ static inline typename return_type<andoyer<Point1, Point2> >::type apply(andoyer<Point1, Point2> const& , T const& value)
{
return value;
}
Modified: sandbox/geometry/boost/geometry/extensions/gis/geographic/strategies/vincenty.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/extensions/gis/geographic/strategies/vincenty.hpp (original)
+++ sandbox/geometry/boost/geometry/extensions/gis/geographic/strategies/vincenty.hpp 2010-07-06 16:15:59 EDT (Tue, 06 Jul 2010)
@@ -207,6 +207,13 @@
};
+template <typename Point1, typename Point2>
+struct return_type<strategy::distance::vincenty<Point1, Point2> >
+{
+ typedef typename strategy::distance::vincenty<Point1, Point2>::return_type type;
+};
+
+
template <typename Point1, typename Point2, typename P1, typename P2>
struct similar_type<vincenty<Point1, Point2>, P1, P2>
{
Modified: sandbox/geometry/boost/geometry/extensions/nsphere/algorithms/within.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/extensions/nsphere/algorithms/within.hpp (original)
+++ sandbox/geometry/boost/geometry/extensions/nsphere/algorithms/within.hpp 2010-07-06 16:15:59 EDT (Tue, 06 Jul 2010)
@@ -46,7 +46,7 @@
<
point_tag, P, point_type
>::type strategy_type;
- typedef typename strategy_type::return_type return_type;
+ typedef typename strategy::distance::services::return_type<strategy_type>::type return_type;
P const center = geometry::make<P>(get<0>(c), get<1>(c));
return_type const r = geometry::distance(p, center);
Modified: sandbox/geometry/boost/geometry/multi/algorithms/distance.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/multi/algorithms/distance.hpp (original)
+++ sandbox/geometry/boost/geometry/multi/algorithms/distance.hpp 2010-07-06 16:15:59 EDT (Tue, 06 Jul 2010)
@@ -33,7 +33,7 @@
template<typename Geometry, typename MultiGeometry, typename Strategy>
struct distance_single_to_multi
{
- typedef typename Strategy::return_type return_type;
+ typedef typename strategy::distance::services::return_type<Strategy>::type return_type;
static inline return_type apply(Geometry const& geometry,
MultiGeometry const& multi,
@@ -63,7 +63,7 @@
template<typename Multi1, typename Multi2, typename Strategy>
struct distance_multi_to_multi
{
- typedef typename Strategy::return_type return_type;
+ typedef typename strategy::distance::services::return_type<Strategy>::type return_type;
static inline return_type apply(Multi1 const& multi1,
Multi2 const& multi2, Strategy const& strategy)
Modified: sandbox/geometry/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp (original)
+++ sandbox/geometry/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp 2010-07-06 16:15:59 EDT (Tue, 06 Jul 2010)
@@ -91,7 +91,7 @@
public :
typedef typename strategy::distance::services::comparable_type<PointDistanceStrategy>::type distance_strategy_type;
- typedef typename distance_strategy_type::return_type return_type;
+ typedef typename strategy::distance::services::return_type<distance_strategy_type>::type return_type;
private :
typedef detail::douglas_peucker_point<Point> dp_point_type;
@@ -189,7 +189,7 @@
// Get points, recursively, including them if they are further away
// than the specified distance
- typedef typename distance_strategy_type::return_type return_type;
+ typedef typename strategy::distance::services::return_type<distance_strategy_type>::type return_type;
consider(boost::begin(ref_candidates), boost::end(ref_candidates), max_distance, n, strategy);
Modified: sandbox/geometry/boost/geometry/strategies/cartesian/distance_projected_point.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/strategies/cartesian/distance_projected_point.hpp (original)
+++ sandbox/geometry/boost/geometry/strategies/cartesian/distance_projected_point.hpp 2010-07-06 16:15:59 EDT (Tue, 06 Jul 2010)
@@ -74,7 +74,7 @@
PointOfSegment
>::type coordinate_type;
- typedef typename Strategy::return_type return_type;
+ typedef typename strategy::distance::services::return_type<Strategy>::type return_type;
typedef Strategy point_strategy_type;
@@ -183,6 +183,13 @@
};
+template <typename Point, typename PointOfSegment, typename CalculationType, typename Strategy>
+struct return_type<projected_point<Point, PointOfSegment, CalculationType, Strategy> >
+{
+ typedef typename projected_point<Point, PointOfSegment, CalculationType, Strategy>::return_type type;
+};
+
+
template
<
typename Point,
@@ -253,7 +260,7 @@
struct result_from_distance<projected_point<Point, PointOfSegment, CalculationType, Strategy> >
{
private :
- typedef typename projected_point<Point, PointOfSegment, CalculationType, Strategy>::return_type return_type;
+ typedef typename return_type<projected_point<Point, PointOfSegment, CalculationType, Strategy> >::type return_type;
public :
template <typename T>
static inline return_type apply(projected_point<Point, PointOfSegment, CalculationType, Strategy> const& , T const& value)
Modified: sandbox/geometry/boost/geometry/strategies/cartesian/distance_pythagoras.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/strategies/cartesian/distance_pythagoras.hpp (original)
+++ sandbox/geometry/boost/geometry/strategies/cartesian/distance_pythagoras.hpp 2010-07-06 16:15:59 EDT (Tue, 06 Jul 2010)
@@ -84,12 +84,12 @@
Point1,
Point2,
CalculationType
- >::type return_type;
+ >::type calculation_type;
typedef Point1 first_point_type;
typedef Point2 second_point_type;
- static inline return_type apply(Point1 const& p1, Point2 const& p2)
+ static inline calculation_type apply(Point1 const& p1, Point2 const& p2)
{
BOOST_CONCEPT_ASSERT( (concept::ConstPoint<Point1>) );
BOOST_CONCEPT_ASSERT( (concept::ConstPoint<Point2>) );
@@ -103,7 +103,7 @@
<
Point1, Point2,
dimension<Point1>::value,
- return_type
+ calculation_type
>::apply(p1, p2);
}
};
@@ -130,15 +130,15 @@
typedef comparable::pythagoras<Point1, Point2, CalculationType> comparable_type;
typedef typename promote_floating_point
<
- typename comparable_type::return_type
- >::type return_type;
+ typename services::return_type<comparable_type>::type
+ >::type calculation_type;
typedef Point1 first_point_type;
typedef Point2 second_point_type;
- static inline return_type apply(Point1 const& p1, Point2 const& p2)
+ static inline calculation_type apply(Point1 const& p1, Point2 const& p2)
{
- return_type const t = comparable_type::apply(p1, p2);
+ calculation_type const t = comparable_type::apply(p1, p2);
return sqrt(t);
}
};
@@ -155,6 +155,13 @@
};
+template <typename Point1, typename Point2, typename CalculationType>
+struct return_type<pythagoras<Point1, Point2, CalculationType> >
+{
+ typedef typename pythagoras<Point1, Point2, CalculationType>::calculation_type type;
+};
+
+
template
<
typename Point1,
@@ -212,7 +219,7 @@
struct result_from_distance<pythagoras<Point1, Point2, CalculationType> >
{
private :
- typedef typename pythagoras<Point1, Point2, CalculationType>::return_type return_type;
+ typedef typename return_type<pythagoras<Point1, Point2, CalculationType> >::type return_type;
public :
template <typename T>
static inline return_type apply(pythagoras<Point1, Point2, CalculationType> const& , T const& value)
@@ -230,6 +237,15 @@
};
+template <typename Point1, typename Point2, typename CalculationType>
+struct return_type<comparable::pythagoras<Point1, Point2, CalculationType> >
+{
+ typedef typename comparable::pythagoras<Point1, Point2, CalculationType>::calculation_type type;
+};
+
+
+
+
template
<
typename Point1,
@@ -287,7 +303,7 @@
struct result_from_distance<comparable::pythagoras<Point1, Point2, CalculationType> >
{
private :
- typedef typename comparable::pythagoras<Point1, Point2, CalculationType>::return_type return_type;
+ typedef typename return_type<comparable::pythagoras<Point1, Point2, CalculationType> >::type return_type;
public :
template <typename T>
static inline return_type apply(comparable::pythagoras<Point1, Point2, CalculationType> const& , T const& value)
Modified: sandbox/geometry/boost/geometry/strategies/concepts/distance_concept.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/strategies/concepts/distance_concept.hpp (original)
+++ sandbox/geometry/boost/geometry/strategies/concepts/distance_concept.hpp 2010-07-06 16:15:59 EDT (Tue, 06 Jul 2010)
@@ -45,8 +45,8 @@
(concept::ConstPoint<ptype2>)
);
- // 3) must define return_type
- typedef typename Strategy::return_type rtype;
+ // 3) must define meta-function return_type
+ typedef typename strategy::distance::services::return_type<Strategy>::type rtype;
// 4) must implement apply with arguments
struct apply_checker
@@ -145,8 +145,8 @@
(concept::ConstPoint<sptype>)
);
- // 3) must define return_type
- typedef typename Strategy::return_type rtype;
+ // 3) must define meta-function return_type
+ typedef typename strategy::distance::services::return_type<Strategy>::type rtype;
// 4) must define underlying point-distance-strategy
typedef typename Strategy::point_strategy_type stype;
Modified: sandbox/geometry/boost/geometry/strategies/distance.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/strategies/distance.hpp (original)
+++ sandbox/geometry/boost/geometry/strategies/distance.hpp 2010-07-06 16:15:59 EDT (Tue, 06 Jul 2010)
@@ -24,6 +24,7 @@
{
template <typename Strategy> struct tag {};
+template <typename Strategy> struct return_type {};
/*!
Modified: sandbox/geometry/boost/geometry/strategies/distance_result.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/strategies/distance_result.hpp (original)
+++ sandbox/geometry/boost/geometry/strategies/distance_result.hpp 2010-07-06 16:15:59 EDT (Tue, 06 Jul 2010)
@@ -31,14 +31,15 @@
template <typename Geometry1, typename Geometry2>
struct distance_result
{
- typedef typename strategy::distance::services::default_strategy
+ typedef typename strategy::distance::services::return_type
<
- point_tag,
- typename point_type<Geometry1>::type,
- typename point_type<Geometry2>::type
- >::type strategy_type;
-
- typedef typename strategy_type::return_type type;
+ typename strategy::distance::services::default_strategy
+ <
+ point_tag,
+ typename point_type<Geometry1>::type,
+ typename point_type<Geometry2>::type
+ >::type
+ >::type type;
};
Modified: sandbox/geometry/boost/geometry/strategies/spherical/distance_cross_track.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/strategies/spherical/distance_cross_track.hpp (original)
+++ sandbox/geometry/boost/geometry/strategies/spherical/distance_cross_track.hpp 2010-07-06 16:15:59 EDT (Tue, 06 Jul 2010)
@@ -134,23 +134,32 @@
namespace services
{
-template <typename Point, typename PointOfSegment>
-struct tag<cross_track<Point, PointOfSegment> >
+template <typename Point, typename PointOfSegment, typename CalculationType, typename Strategy>
+struct tag<cross_track<Point, PointOfSegment, CalculationType, Strategy> >
{
typedef strategy_tag_distance_point_segment type;
};
+template <typename Point, typename PointOfSegment, typename CalculationType, typename Strategy>
+struct return_type<cross_track<Point, PointOfSegment, CalculationType, Strategy> >
+{
+ typedef typename cross_track<Point, PointOfSegment, CalculationType, Strategy>::return_type type;
+};
+
+
template
<
typename Point,
typename PointOfSegment,
+ typename CalculationType,
+ typename Strategy,
typename P,
typename PS
>
-struct similar_type<cross_track<Point, PointOfSegment>, P, PS>
+struct similar_type<cross_track<Point, PointOfSegment, CalculationType, Strategy>, P, PS>
{
- typedef cross_track<Point, PointOfSegment> type;
+ typedef cross_track<Point, PointOfSegment, CalculationType, Strategy> type;
};
@@ -158,52 +167,60 @@
<
typename Point,
typename PointOfSegment,
+ typename CalculationType,
+ typename Strategy,
typename P,
typename PS
>
-struct get_similar<cross_track<Point, PointOfSegment>, P, PS>
+struct get_similar<cross_track<Point, PointOfSegment, CalculationType, Strategy>, P, PS>
{
static inline typename similar_type
<
- cross_track<Point, PointOfSegment>, P, PS
- >::type apply(cross_track<Point, PointOfSegment> const& strategy)
+ cross_track<Point, PointOfSegment, CalculationType, Strategy>, P, PS
+ >::type apply(cross_track<Point, PointOfSegment, CalculationType, Strategy> const& strategy)
{
- return cross_track<P, PS>(strategy.radius());
+ return cross_track<P, PS, CalculationType, Strategy>(strategy.radius());
}
};
-template <typename Point, typename PointOfSegment>
-struct comparable_type<cross_track<Point, PointOfSegment> >
+template <typename Point, typename PointOfSegment, typename CalculationType, typename Strategy>
+struct comparable_type<cross_track<Point, PointOfSegment, CalculationType, Strategy> >
{
// Comparable type is here just the strategy
- typedef typename similar_type<cross_track<Point, PointOfSegment>, Point, PointOfSegment>::type type;
+ typedef typename similar_type
+ <
+ cross_track
+ <
+ Point, PointOfSegment, CalculationType, Strategy
+ >, Point, PointOfSegment
+ >::type type;
};
-template <typename Point, typename PointOfSegment>
-struct get_comparable<cross_track<Point, PointOfSegment> >
+template <typename Point, typename PointOfSegment, typename CalculationType, typename Strategy>
+struct get_comparable<cross_track<Point, PointOfSegment, CalculationType, Strategy> >
{
typedef typename comparable_type
<
- cross_track<Point, PointOfSegment>
+ cross_track<Point, PointOfSegment, CalculationType, Strategy>
>::type comparable_type;
public :
- static inline comparable_type apply(cross_track<Point, PointOfSegment> const& strategy)
+ static inline comparable_type apply(cross_track<Point, PointOfSegment, CalculationType, Strategy> const& strategy)
{
return comparable_type(strategy.radius());
}
};
-template <typename Point, typename PointOfSegment>
-struct result_from_distance<cross_track<Point, PointOfSegment> >
+template <typename Point, typename PointOfSegment, typename CalculationType, typename Strategy>
+struct result_from_distance<cross_track<Point, PointOfSegment, CalculationType, Strategy> >
{
private :
- typedef typename cross_track<Point, PointOfSegment>::return_type return_type;
+ typedef typename cross_track<Point, PointOfSegment, CalculationType, Strategy>::return_type return_type;
public :
template <typename T>
- static inline return_type apply(cross_track<Point, PointOfSegment> const& , T const& distance)
+ static inline return_type apply(cross_track<Point, PointOfSegment, CalculationType, Strategy> const& , T const& distance)
{
return distance;
}
@@ -212,7 +229,7 @@
template <typename Point, typename PointOfSegment>
struct default_strategy<segment_tag, Point, PointOfSegment, spherical_tag, spherical_tag>
{
- typedef strategy::distance::cross_track<Point, PointOfSegment> type;
+ typedef cross_track<Point, PointOfSegment> type;
};
@@ -220,7 +237,7 @@
template <typename Point, typename PointOfSegment>
struct default_strategy<segment_tag, Point, PointOfSegment, geographic_tag, geographic_tag>
{
- typedef strategy::distance::cross_track<Point, PointOfSegment> type;
+ typedef cross_track<Point, PointOfSegment> type;
};
Modified: sandbox/geometry/boost/geometry/strategies/spherical/distance_haversine.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/strategies/spherical/distance_haversine.hpp (original)
+++ sandbox/geometry/boost/geometry/strategies/spherical/distance_haversine.hpp 2010-07-06 16:15:59 EDT (Tue, 06 Jul 2010)
@@ -55,41 +55,40 @@
Point2,
CalculationType
>::type
- >::type return_type;
+ >::type calculation_type;
typedef Point1 first_point_type;
typedef Point2 second_point_type;
- inline haversine(return_type const& r = 1.0)
+ inline haversine(calculation_type const& r = 1.0)
: m_radius(r)
{}
- static inline return_type apply(Point1 const& p1, Point2 const& p2)
+ static inline calculation_type apply(Point1 const& p1, Point2 const& p2)
{
return calculate(get_as_radian<0>(p1), get_as_radian<1>(p1),
get_as_radian<0>(p2), get_as_radian<1>(p2));
}
- inline return_type radius() const
+ inline calculation_type radius() const
{
return m_radius;
}
private :
- typedef return_type promoted_type;
- static inline return_type calculate(promoted_type const& lon1,
- promoted_type const& lat1,
- promoted_type const& lon2,
- promoted_type const& lat2)
+ static inline calculation_type calculate(calculation_type const& lon1,
+ calculation_type const& lat1,
+ calculation_type const& lon2,
+ calculation_type const& lat2)
{
return math::hav(lat2 - lat1)
+ cos(lat1) * cos(lat2) * math::hav(lon2 - lon1);
}
- return_type m_radius;
+ calculation_type m_radius;
};
@@ -127,26 +126,26 @@
typedef Point1 first_point_type;
typedef Point2 second_point_type;
- typedef typename comparable_type::return_type return_type;
+ typedef typename services::return_type<comparable_type>::type calculation_type;
- inline haversine(return_type const& r = 1.0)
+ inline haversine(calculation_type const& r = 1.0)
: m_radius(r)
{}
- inline return_type apply(Point1 const& p1, Point2 const& p2) const
+ inline calculation_type apply(Point1 const& p1, Point2 const& p2) const
{
- return_type const a = comparable_type::apply(p1, p2);
- return_type const c = return_type(2.0) * asin(sqrt(a));
+ calculation_type const a = comparable_type::apply(p1, p2);
+ calculation_type const c = calculation_type(2.0) * asin(sqrt(a));
return m_radius * c;
}
- inline return_type radius() const
+ inline calculation_type radius() const
{
return m_radius;
}
private :
- return_type m_radius;
+ calculation_type m_radius;
};
@@ -161,6 +160,13 @@
};
+template <typename Point1, typename Point2, typename CalculationType>
+struct return_type<haversine<Point1, Point2, CalculationType> >
+{
+ typedef typename haversine<Point1, Point2, CalculationType>::calculation_type type;
+};
+
+
template <typename Point1, typename Point2, typename CalculationType, typename P1, typename P2>
struct similar_type<haversine<Point1, Point2, CalculationType>, P1, P2>
{
@@ -205,16 +211,16 @@
{
private :
typedef haversine<Point1, Point2, CalculationType> this_type;
+ typedef typename return_type<this_type>::type return_type;
public :
template <typename T>
- static inline typename this_type::return_type apply(this_type const& , T const& value)
+ static inline return_type apply(this_type const& , T const& value)
{
- return typename this_type::return_type(value);
+ return return_type(value);
}
};
-
// Specializations for comparable::haversine
template <typename Point1, typename Point2, typename CalculationType>
struct tag<comparable::haversine<Point1, Point2, CalculationType> >
@@ -223,6 +229,13 @@
};
+template <typename Point1, typename Point2, typename CalculationType>
+struct return_type<comparable::haversine<Point1, Point2, CalculationType> >
+{
+ typedef typename comparable::haversine<Point1, Point2, CalculationType>::calculation_type type;
+};
+
+
template <typename Point1, typename Point2, typename CalculationType, typename P1, typename P2>
struct similar_type<comparable::haversine<Point1, Point2, CalculationType>, P1, P2>
{
@@ -267,7 +280,7 @@
{
private :
typedef comparable::haversine<Point1, Point2, CalculationType> strategy_type;
- typedef typename strategy_type::return_type return_type;
+ typedef typename return_type<strategy_type>::type return_type;
public :
template <typename T>
static inline return_type apply(strategy_type const& strategy, T const& distance)
@@ -286,7 +299,6 @@
};
-
} // namespace services
#endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
Added: sandbox/geometry/libs/geometry/example/c09_custom_fusion_example.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/c09_custom_fusion_example.cpp 2010-07-06 16:15:59 EDT (Tue, 06 Jul 2010)
@@ -0,0 +1,53 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2010, Geodan, Amsterdam, the Netherlands
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// Custom point / fusion Example
+
+#include <iostream>
+
+#include <boost/fusion/adapted/struct/adapt_struct_named.hpp>
+#include <boost/fusion/include/adapt_struct_named.hpp>
+#include <boost/fusion/include/sequence.hpp>
+#include <boost/fusion/include/make_vector.hpp>
+#include <boost/fusion/include/next.hpp>
+
+
+#include <boost/geometry/algorithms/distance.hpp>
+#include <boost/geometry/algorithms/make.hpp>
+#include <boost/geometry/geometries/register/point.hpp>
+
+#include <boost/geometry/geometries/adapted/fusion.hpp>
+#include <boost/geometry/geometries/adapted/fusion_cartesian.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+#include <boost/geometry/util/write_dsv.hpp>
+
+
+// Sample point, having x/y
+struct my_2d
+{
+ float x,y;
+};
+
+
+BOOST_FUSION_ADAPT_STRUCT(my_2d,
+ (float, x)
+ (float, y))
+
+
+
+int main()
+{
+ my_2d p1 = {1, 5};
+ my_2d p2 = {3, 4};
+
+ std::cout << boost::fusion::at_c<1>(p1) << std::endl;
+
+ std::cout << boost::geometry::get<1>(p1) << std::endl;
+
+ return 0;
+}
Added: sandbox/geometry/libs/geometry/example/c09_custom_fusion_example.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/c09_custom_fusion_example.vcproj 2010-07-06 16:15:59 EDT (Tue, 06 Jul 2010)
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="c09_custom_fusion_example"
+ ProjectGUID="{DA36AD55-E448-43DE-A974-EA765AE3967A}"
+ RootNamespace="c09_custom_fusion_example"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\c09_custom_fusion_example"
+ ConfigurationType="1"
+ InheritedPropertySheets=".\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ RuntimeLibrary="1"
+ DisableLanguageExtensions="false"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\c09_custom_fusion_example"
+ ConfigurationType="1"
+ InheritedPropertySheets=".\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\c09_custom_fusion_example.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Modified: sandbox/geometry/libs/geometry/test/strategies/haversine.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/test/strategies/haversine.cpp (original)
+++ sandbox/geometry/libs/geometry/test/strategies/haversine.cpp 2010-07-06 16:15:59 EDT (Tue, 06 Jul 2010)
@@ -41,7 +41,7 @@
BOOST_CONCEPT_ASSERT( (boost::geometry::concept::PointDistanceStrategy<haversine_type>) );
- typedef typename haversine_type::return_type return_type;
+ typedef typename bg::strategy::distance::services::return_type<haversine_type>::type return_type;
BOOST_CONCEPT_ASSERT
(
@@ -113,7 +113,7 @@
// 1: normal, calculate distance:
typedef bgsd::haversine<P1, P2, CalculationType> strategy_type;
- typedef typename strategy_type::return_type return_type;
+ typedef typename bgsd::services::return_type<strategy_type>::type return_type;
strategy_type strategy(average_earth_radius);
return_type result = strategy.apply(p1, p2);
Modified: sandbox/geometry/libs/geometry/test/strategies/pythagoras.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/test/strategies/pythagoras.cpp (original)
+++ sandbox/geometry/libs/geometry/test/strategies/pythagoras.cpp 2010-07-06 16:15:59 EDT (Tue, 06 Jul 2010)
@@ -45,7 +45,7 @@
bg::assign(p2, 1, 2, 3);
typedef bg::strategy::distance::pythagoras<P1, P2> pythagoras_type;
- typedef typename pythagoras_type::return_type return_type;
+ typedef typename bg::strategy::distance::services::return_type<pythagoras_type>::type return_type;
pythagoras_type pythagoras;
return_type result = pythagoras.apply(p1, p2);
@@ -62,7 +62,7 @@
bg::assign(p2, 1, 0, 0);
typedef bg::strategy::distance::pythagoras<P1, P2> pythagoras_type;
- typedef typename pythagoras_type::return_type return_type;
+ typedef typename bg::strategy::distance::services::return_type<pythagoras_type>::type return_type;
pythagoras_type pythagoras;
@@ -88,7 +88,7 @@
{
typedef bg::strategy::distance::pythagoras<P1, P2> strategy_type;
- typedef typename strategy_type::return_type return_type;
+ typedef typename bg::strategy::distance::services::return_type<strategy_type>::type return_type;
strategy_type strategy;
return_type result = strategy.apply(p1, p2);
@@ -98,7 +98,7 @@
{
// Check comparable distance
typedef bg::strategy::distance::comparable::pythagoras<P1, P2> strategy_type;
- typedef typename strategy_type::return_type return_type;
+ typedef typename bg::strategy::distance::services::return_type<strategy_type>::type return_type;
strategy_type strategy;
return_type result = strategy.apply(p1, p2);
@@ -134,7 +134,7 @@
BOOST_CONCEPT_ASSERT( (boost::geometry::concept::PointDistanceStrategy<strategy_type>) );
- typedef typename strategy_type::return_type return_type;
+ typedef typename bgsd::services::return_type<strategy_type>::type return_type;
strategy_type strategy;
return_type result = strategy.apply(p1, p2);
@@ -192,7 +192,7 @@
> pythagoras_type;
pythagoras_type pythagoras;
- typedef typename pythagoras_type::return_type return_type;
+ typedef typename bg::strategy::distance::services::return_type<pythagoras_type>::type return_type;
point_type p1, p2;
@@ -259,7 +259,7 @@
bg::assign(p1, 1, 1);
bg::assign(p2, 2, 2);
Strategy strategy;
- typename Strategy::return_type s = 0;
+ typename bg::strategy::distance::services::return_type<Strategy>::type s = 0;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
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