Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68239 - in trunk: boost/geometry/core boost/geometry/geometries boost/geometry/geometries/adapted libs/geometry/example libs/geometry/test/geometries
From: barend.gehrels_at_[hidden]
Date: 2011-01-18 13:52:00


Author: barendgehrels
Date: 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
New Revision: 68239
URL: http://svn.boost.org/trac/boost/changeset/68239

Log:
Added Boost.Fusion points adapted to Boost.Geometry (effectively by Akira Takahashi)
Added MPL-assertions to traits classes not yet having them
Added constructors for linear_ring/linestring to support Boost.Assign better

Added:
   trunk/boost/geometry/geometries/adapted/fusion.hpp (contents, props changed)
   trunk/boost/geometry/geometries/adapted/fusion_cartesian.hpp (contents, props changed)
   trunk/boost/geometry/geometries/adapted/fusion_geographic.hpp (contents, props changed)
   trunk/libs/geometry/test/geometries/boost_fusion.cpp (contents, props changed)
   trunk/libs/geometry/test/geometries/boost_fusion.vcproj (contents, props changed)
Text files modified:
   trunk/boost/geometry/core/access.hpp | 11 +++++++++--
   trunk/boost/geometry/core/coordinate_dimension.hpp | 24 ++++++++++++++++--------
   trunk/boost/geometry/core/coordinate_system.hpp | 15 +++++++--------
   trunk/boost/geometry/core/coordinate_type.hpp | 16 ++++++++--------
   trunk/boost/geometry/core/interior_rings.hpp | 1 -
   trunk/boost/geometry/core/point_type.hpp | 14 +++++++-------
   trunk/boost/geometry/core/tag.hpp | 3 ++-
   trunk/boost/geometry/geometries/linear_ring.hpp | 12 ++++++++++++
   trunk/boost/geometry/geometries/linestring.hpp | 38 +++++++++++++++++++++++++-------------
   trunk/libs/geometry/example/Jamfile.v2 | 2 +-
   trunk/libs/geometry/example/c09_custom_fusion_example.cpp | 31 ++++++++++++++++++-------------
   trunk/libs/geometry/example/custom_examples.sln | 6 ++++++
   trunk/libs/geometry/test/geometries/Jamfile.v2 | 1 +
   trunk/libs/geometry/test/geometries/geometries_tests.sln | 6 ++++++
   14 files changed, 118 insertions(+), 62 deletions(-)

Modified: trunk/boost/geometry/core/access.hpp
==============================================================================
--- trunk/boost/geometry/core/access.hpp (original)
+++ trunk/boost/geometry/core/access.hpp 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
@@ -12,6 +12,7 @@
 
 #include <cstddef>
 
+#include <boost/mpl/assert.hpp>
 #include <boost/type_traits/remove_const.hpp>
 #include <boost/concept_check.hpp>
 
@@ -41,8 +42,14 @@
 /// @li static inline void set(G&, T const&)
 /// @tparam Geometry geometry-type
 /// @tparam Dimension dimension to access
-template <typename Geometry, std::size_t Dimension>
-struct access {};
+template <typename Geometry, std::size_t Dimension, typename Enable = void>
+struct access
+{
+ BOOST_MPL_ASSERT_MSG
+ (
+ false, NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE, (types<Geometry>)
+ );
+};
 
 
 /*!

Modified: trunk/boost/geometry/core/coordinate_dimension.hpp
==============================================================================
--- trunk/boost/geometry/core/coordinate_dimension.hpp (original)
+++ trunk/boost/geometry/core/coordinate_dimension.hpp 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
@@ -9,8 +9,10 @@
 #ifndef BOOST_GEOMETRY_CORE_COORDINATE_DIMENSION_HPP
 #define BOOST_GEOMETRY_CORE_COORDINATE_DIMENSION_HPP
 
+
 #include <cstddef>
 
+#include <boost/mpl/assert.hpp>
 #include <boost/mpl/equal_to.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/type_traits/remove_const.hpp>
@@ -25,15 +27,21 @@
 {
 
 /*!
- \brief Traits class indicating the number of dimensions of a point
- \par Geometries:
- - point
- \par Specializations should provide:
- - value (should be derived from boost::mpl::int_<D>
- \ingroup traits
+\brief Traits class indicating the number of dimensions of a point
+\par Geometries:
+ - point
+\par Specializations should provide:
+ - value (should be derived from boost::mpl::int_<D>
+\ingroup traits
 */
-template <typename P>
-struct dimension {};
+template <typename Point, typename Enable = void>
+struct dimension
+{
+ BOOST_MPL_ASSERT_MSG
+ (
+ false, NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE, (types<Point>)
+ );
+};
 
 } // namespace traits
 

Modified: trunk/boost/geometry/core/coordinate_system.hpp
==============================================================================
--- trunk/boost/geometry/core/coordinate_system.hpp (original)
+++ trunk/boost/geometry/core/coordinate_system.hpp 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
@@ -6,7 +6,6 @@
 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-
 #ifndef BOOST_GEOMETRY_CORE_COORDINATE_SYSTEM_HPP
 #define BOOST_GEOMETRY_CORE_COORDINATE_SYSTEM_HPP
 
@@ -24,14 +23,14 @@
 {
 
 /*!
- \brief Traits class defining the coordinate system of a point, important for strategy selection
- \ingroup traits
- \par Geometries:
- - point
- \par Specializations should provide:
- - typedef CS type; (cs::cartesian, cs::spherical, etc)
+\brief Traits class defining the coordinate system of a point, important for strategy selection
+\ingroup traits
+\par Geometries:
+ - point
+\par Specializations should provide:
+ - typedef CS type; (cs::cartesian, cs::spherical, etc)
 */
-template <typename Point>
+template <typename Point, typename Enable = void>
 struct coordinate_system
 {
     BOOST_MPL_ASSERT_MSG

Modified: trunk/boost/geometry/core/coordinate_type.hpp
==============================================================================
--- trunk/boost/geometry/core/coordinate_type.hpp (original)
+++ trunk/boost/geometry/core/coordinate_type.hpp 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
@@ -24,15 +24,15 @@
 {
 
 /*!
- \brief Traits class which indicate the coordinate type (double,float,...) of a point
- \ingroup traits
- \par Geometries:
- - point
- \par Specializations should provide:
- - typedef T type; (double,float,int,etc)
+\brief Traits class which indicate the coordinate type (double,float,...) of a point
+\ingroup traits
+\par Geometries:
+ - point
+\par Specializations should provide:
+ - typedef T type; (double,float,int,etc)
 */
-template <typename Point>
-struct coordinate_type
+template <typename Point, typename Enable = void>
+struct coordinate_type
 {
     BOOST_MPL_ASSERT_MSG
         (

Modified: trunk/boost/geometry/core/interior_rings.hpp
==============================================================================
--- trunk/boost/geometry/core/interior_rings.hpp (original)
+++ trunk/boost/geometry/core/interior_rings.hpp 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
@@ -6,7 +6,6 @@
 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-
 #ifndef BOOST_GEOMETRY_CORE_INTERIOR_RINGS_HPP
 #define BOOST_GEOMETRY_CORE_INTERIOR_RINGS_HPP
 

Modified: trunk/boost/geometry/core/point_type.hpp
==============================================================================
--- trunk/boost/geometry/core/point_type.hpp (original)
+++ trunk/boost/geometry/core/point_type.hpp 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
@@ -25,13 +25,13 @@
 {
 
 /*!
- \brief Traits class indicating the type of contained points
- \ingroup traits
- \par Geometries:
- - all geometries except point
- \par Specializations should provide:
- - typedef P type (where P should fulfil the Point concept)
- \tparam G geometry
+\brief Traits class indicating the type of contained points
+\ingroup traits
+\par Geometries:
+ - all geometries except point
+\par Specializations should provide:
+ - typedef P type (where P should fulfil the Point concept)
+\tparam Geometry geometry
 */
 template <typename Geometry>
 struct point_type

Modified: trunk/boost/geometry/core/tag.hpp
==============================================================================
--- trunk/boost/geometry/core/tag.hpp (original)
+++ trunk/boost/geometry/core/tag.hpp 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
@@ -9,6 +9,7 @@
 #ifndef BOOST_GEOMETRY_CORE_TAG_HPP
 #define BOOST_GEOMETRY_CORE_TAG_HPP
 
+
 #include <boost/mpl/assert.hpp>
 #include <boost/type_traits/remove_const.hpp>
 
@@ -32,7 +33,7 @@
         - typedef XXX_tag type; (point_tag, box_tag, ...)
     \tparam Geometry geometry
 */
-template <typename Geometry>
+template <typename Geometry, typename Enable = void>
 struct tag
 {
     BOOST_MPL_ASSERT_MSG

Added: trunk/boost/geometry/geometries/adapted/fusion.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/geometries/adapted/fusion.hpp 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
@@ -0,0 +1,159 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Akira Takahashi 2011
+// Copyright Barend Gehrels 2011, Geodan, Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2011
+// 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)
+
+#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_HPP
+#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_HPP
+
+
+#include <cstddef>
+
+#include <boost/fusion/include/is_sequence.hpp>
+#include <boost/fusion/include/size.hpp>
+#include <boost/fusion/include/tag_of.hpp>
+#include <boost/fusion/include/front.hpp>
+#include <boost/fusion/include/at.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#include <boost/fusion/mpl.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/count_if.hpp>
+#include <boost/mpl/pop_front.hpp>
+#include <boost/mpl/size.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/front.hpp>
+
+#include <boost/geometry/core/access.hpp>
+#include <boost/geometry/core/coordinate_dimension.hpp>
+#include <boost/geometry/core/coordinate_system.hpp>
+#include <boost/geometry/core/coordinate_type.hpp>
+#include <boost/geometry/core/point_type.hpp>
+#include <boost/geometry/core/tags.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+namespace fusion_adapt_detail
+{
+
+template <class Sequence>
+struct all_same :
+ boost::mpl::bool_<
+ boost::mpl::count_if<
+ Sequence,
+ boost::is_same<
+ typename boost::mpl::front<Sequence>::type,
+ boost::mpl::_
+ >
+ >::value == boost::mpl::size<Sequence>::value
+ >
+{};
+
+template <class Sequence>
+struct is_coordinate_size : boost::mpl::bool_<
+ boost::fusion::result_of::size<Sequence>::value == 2 ||
+ boost::fusion::result_of::size<Sequence>::value == 3> {};
+
+template<typename Sequence>
+struct is_fusion_sequence
+ : mpl::and_<boost::fusion::traits::is_sequence<Sequence>,
+ fusion_adapt_detail::is_coordinate_size<Sequence>,
+ fusion_adapt_detail::all_same<Sequence> >
+{};
+
+
+} // namespace fusion_adapt_detail
+
+
+#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
+namespace traits
+{
+
+// Boost Fusion Sequence, 2D or 3D
+template <typename Sequence>
+struct coordinate_type
+ <
+ Sequence,
+ typename boost::enable_if
+ <
+ fusion_adapt_detail::is_fusion_sequence<Sequence>
+ >::type
+ >
+{
+ typedef typename boost::mpl::front<Sequence>::type type;
+};
+
+
+template <typename Sequence>
+struct dimension
+ <
+ Sequence,
+ typename boost::enable_if
+ <
+ fusion_adapt_detail::is_fusion_sequence<Sequence>
+ >::type
+ > : boost::mpl::size<Sequence>
+{};
+
+
+template <typename Sequence, std::size_t Dimension>
+struct access
+ <
+ Sequence,
+ Dimension,
+ typename boost::enable_if
+ <
+ fusion_adapt_detail::is_fusion_sequence<Sequence>
+ >::type
+ >
+{
+ typedef typename coordinate_type<Sequence>::type ctype;
+
+ static inline ctype get(Sequence const& point)
+ {
+ return boost::fusion::at_c<Dimension>(point);
+ }
+
+ template <class CoordinateType>
+ static inline void set(Sequence& point, CoordinateType const& value)
+ {
+ boost::fusion::at_c<Dimension>(point) = value;
+ }
+};
+
+// The library user has
+// 1) either to specify the coordinate system using a traits class
+// 2) or include <boost/geometry/geometries/adapted/fusion__at_.hpp>
+// where @=cartesian,geographic,...
+
+template <typename Sequence>
+struct tag
+ <
+ Sequence,
+ typename boost::enable_if
+ <
+ fusion_adapt_detail::is_fusion_sequence<Sequence>
+ >::type
+ >
+{
+ typedef point_tag type;
+};
+
+} // namespace traits
+
+#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
+
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_HPP
+

Added: trunk/boost/geometry/geometries/adapted/fusion_cartesian.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/geometries/adapted/fusion_cartesian.hpp 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
@@ -0,0 +1,44 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Akira Takahashi 2011
+// Copyright Barend Gehrels 2011, Geodan, Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2011
+// 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)
+
+#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_CARTESIAN_HPP
+#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_CARTESIAN_HPP
+
+#ifdef BOOST_GEOMETRY_ADAPTED_FUSION_COORDINATE_SYSTEM_DEFINED
+#error Include only one headerfile to register coordinate coordinate_system for adapted fusion
+#endif
+
+#define BOOST_GEOMETRY_ADAPTED_FUSION_COORDINATE_SYSTEM_DEFINED
+
+
+#include <boost/geometry/geometries/adapted/fusion.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
+namespace traits
+{
+ template <typename Sequence>
+ struct coordinate_system<
+ Sequence,
+ typename boost::enable_if<
+ fusion_adapt_detail::is_fusion_sequence<Sequence> >::type>
+ { typedef cs::cartesian type; };
+
+} // namespace traits
+#endif
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_CARTESIAN_HPP

Added: trunk/boost/geometry/geometries/adapted/fusion_geographic.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/geometries/adapted/fusion_geographic.hpp 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
@@ -0,0 +1,44 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Akira Takahashi 2011
+// Copyright Barend Gehrels 2011, Geodan, Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2011
+// 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)
+
+#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_GEOGRAPHIC_HPP
+#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_GEOGRAPHIC_HPP
+
+#ifdef BOOST_GEOMETRY_ADAPTED_FUSION_COORDINATE_SYSTEM_DEFINED
+#error Include only one headerfile to register coordinate coordinate_system for adapted fusion
+#endif
+
+#define BOOST_GEOMETRY_ADAPTED_FUSION_COORDINATE_SYSTEM_DEFINED
+
+
+#include <boost/geometry/geometries/adapted/fusion.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
+namespace traits
+{
+ template <typename Sequence>
+ struct coordinate_system<
+ Sequence,
+ typename boost::enable_if<
+ fusion_adapt_detail::is_fusion_sequence<Sequence> >::type>
+ { typedef cs::geographic<degree> type; };
+
+} // namespace traits
+#endif
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_GEOGRAPHIC_HPP

Modified: trunk/boost/geometry/geometries/linear_ring.hpp
==============================================================================
--- trunk/boost/geometry/geometries/linear_ring.hpp (original)
+++ trunk/boost/geometry/geometries/linear_ring.hpp 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
@@ -44,6 +44,18 @@
 class linear_ring : public Container<Point, Allocator<Point> >
 {
     BOOST_CONCEPT_ASSERT( (concept::Point<Point>) );
+
+ typedef Container<Point, Allocator<Point> > base_type;
+
+public :
+ inline linear_ring()
+ : base_type()
+ {}
+
+ template <typename Iterator>
+ inline linear_ring(Iterator begin, Iterator end)
+ : base_type(begin, end)
+ {}
 };
 
 } // namespace model

Modified: trunk/boost/geometry/geometries/linestring.hpp
==============================================================================
--- trunk/boost/geometry/geometries/linestring.hpp (original)
+++ trunk/boost/geometry/geometries/linestring.hpp 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
@@ -28,11 +28,11 @@
 {
 
 /*!
- \brief A linestring (named so by OGC) is a collection (default a vector) of points.
+ \brief Allocator linestring (named so by OGC) is a collection (default a vector) of points.
     \ingroup geometries
- \tparam P point type
- \tparam V optional container type, for example std::vector, std::list, std::deque
- \tparam A optional container-allocator-type
+ \tparam Point point type
+ \tparam Container optional container type, for example std::vector, std::list, std::deque
+ \tparam Allocator optional container-allocator-type
     (see http://accu.org/index.php/journals/427#ftn.d0e249 )
     \par Concepts:
     All algorithms work on ranges, based on a container with point types fulfilling
@@ -40,13 +40,25 @@
 */
 template
 <
- typename P,
- template<typename,typename> class V = std::vector,
- template<typename> class A = std::allocator
+ typename Point,
+ template<typename,typename> class Container = std::vector,
+ template<typename> class Allocator = std::allocator
>
-class linestring : public V<P, A<P> >
+class linestring : public Container<Point, Allocator<Point> >
 {
- BOOST_CONCEPT_ASSERT( (concept::Point<P>) );
+ BOOST_CONCEPT_ASSERT( (concept::Point<Point>) );
+
+ typedef Container<Point, Allocator<Point> > base_type;
+
+public :
+ inline linestring()
+ : base_type()
+ {}
+
+ template <typename Iterator>
+ inline linestring(Iterator begin, Iterator end)
+ : base_type(begin, end)
+ {}
 };
 
 } // namespace model
@@ -57,11 +69,11 @@
 
 template
 <
- typename P,
- template<typename,typename> class V,
- template<typename> class A
+ typename Point,
+ template<typename,typename> class Container,
+ template<typename> class Allocator
>
-struct tag<model::linestring<P, V, A> >
+struct tag<model::linestring<Point, Container, Allocator> >
 {
     typedef linestring_tag type;
 };

Modified: trunk/libs/geometry/example/Jamfile.v2
==============================================================================
--- trunk/libs/geometry/example/Jamfile.v2 (original)
+++ trunk/libs/geometry/example/Jamfile.v2 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
@@ -31,7 +31,7 @@
 exe c07_custom_ring_pointer_example : c07_custom_ring_pointer_example.cpp ;
 
 # exe c08_custom_non_std_example : c08_custom_non_std_example.cpp ;
-# c09 is not yet finished
+exe c09_custom_fusion_example : c09_custom_fusion_example.cpp ;
 
 exe c10_custom_cs_example : c10_custom_cs_example.cpp ;
 exe c11_custom_cs_transform_example : c11_custom_cs_transform_example.cpp ;

Modified: trunk/libs/geometry/example/c09_custom_fusion_example.cpp
==============================================================================
--- trunk/libs/geometry/example/c09_custom_fusion_example.cpp (original)
+++ trunk/libs/geometry/example/c09_custom_fusion_example.cpp 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
@@ -5,21 +5,13 @@
 // 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
-// NOT FINISHED
+// Custom point / Boost.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>
@@ -40,15 +32,28 @@
     (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;
+ std::cout << "Coordinate using direct access: "
+ << p1.x
+ << std::endl;
+ std::cout << "Coordinate using Boost.Fusion: "
+ << boost::fusion::at_c<0>(p1)
+ << std::endl;
+ std::cout << "Coordinate using Boost.Geometry: "
+ << boost::geometry::get<0>(p1)
+ << std::endl;
+
+ std::cout << "Two points are: "
+ << boost::geometry::dsv(p1) << " "
+ << boost::geometry::dsv(p2) << std::endl;
+
+ std::cout << "Distance: "
+ << boost::geometry::distance(p1, p2)
+ << std::endl;
 
     return 0;
 }

Modified: trunk/libs/geometry/example/custom_examples.sln
==============================================================================
--- trunk/libs/geometry/example/custom_examples.sln (original)
+++ trunk/libs/geometry/example/custom_examples.sln 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
@@ -22,6 +22,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "c11_custom_cs_transform_example", "c11_custom_cs_transform_example.vcproj", "{E73E52EC-9BDC-4777-ABB2-DB14FAF27AA5}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "c09_custom_fusion_example", "c09_custom_fusion_example.vcproj", "{DA36AD55-E448-43DE-A974-EA765AE3967A}"
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -72,6 +74,10 @@
                 {E73E52EC-9BDC-4777-ABB2-DB14FAF27AA5}.Debug|Win32.Build.0 = Debug|Win32
                 {E73E52EC-9BDC-4777-ABB2-DB14FAF27AA5}.Release|Win32.ActiveCfg = Release|Win32
                 {E73E52EC-9BDC-4777-ABB2-DB14FAF27AA5}.Release|Win32.Build.0 = Release|Win32
+ {DA36AD55-E448-43DE-A974-EA765AE3967A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {DA36AD55-E448-43DE-A974-EA765AE3967A}.Debug|Win32.Build.0 = Debug|Win32
+ {DA36AD55-E448-43DE-A974-EA765AE3967A}.Release|Win32.ActiveCfg = Release|Win32
+ {DA36AD55-E448-43DE-A974-EA765AE3967A}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE

Modified: trunk/libs/geometry/test/geometries/Jamfile.v2
==============================================================================
--- trunk/libs/geometry/test/geometries/Jamfile.v2 (original)
+++ trunk/libs/geometry/test/geometries/Jamfile.v2 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
@@ -9,6 +9,7 @@
 test-suite boost-geometry-geometries
     :
     [ run boost_array_as_point.cpp ]
+ [ run boost_fusion.cpp ]
     [ run boost_polygon.cpp ]
     [ run boost_range.cpp ]
     [ run box.cpp ]

Added: trunk/libs/geometry/test/geometries/boost_fusion.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/geometries/boost_fusion.cpp 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
@@ -0,0 +1,65 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library) test file
+//
+// Copyright Barend Gehrels 2011, Geodan, Amsterdam, the Netherlands
+// Copyright Akira Takahashi 2011
+// 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)
+
+#include <geometry_test_common.hpp>
+
+#include <boost/fusion/include/adapt_struct_named.hpp>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/geometries/adapted/fusion.hpp>
+#include <boost/geometry/geometries/adapted/fusion_cartesian.hpp>
+#include<boost/geometry/geometries/adapted/c_array_cartesian.hpp>
+#include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
+#include <iostream>
+
+struct for_fusion_2d
+{
+ float x,y;
+};
+struct for_fusion_3d
+{
+ double x,y,z;
+};
+
+BOOST_FUSION_ADAPT_STRUCT(for_fusion_2d, (float, x) (float, y))
+BOOST_FUSION_ADAPT_STRUCT(for_fusion_3d, (double, x) (double, y) (double, z))
+
+
+void test_2d()
+{
+ bg::model::point<double, 2, bg::cs::cartesian> p1(1, 2);
+ double p2[2] = {3, 4};
+ boost::tuple<double, double> p3(5,6);
+
+ for_fusion_2d pf = {7, 8};
+
+ BOOST_CHECK_CLOSE(bg::distance(p1, pf), 8.4852813742385695, 0.01);
+ BOOST_CHECK_CLOSE(bg::distance(p2, pf), 5.6568542494923806, 0.01);
+ BOOST_CHECK_CLOSE(bg::distance(p3, pf), 2.82843, 0.01);
+}
+
+void test_3d()
+{
+ bg::model::point<double, 3, bg::cs::cartesian> p1(1, 2, 3);
+ double p2[3] = {4, 5, 6};
+ boost::tuple<double, double, double> p3(7, 8, 9);
+
+ for_fusion_3d pf = {10, 11, 12};
+
+ BOOST_CHECK_CLOSE(bg::distance(p1, pf), 15.58845726811, 0.01);
+ BOOST_CHECK_CLOSE(bg::distance(p2, pf), 10.392304845413, 0.01);
+ BOOST_CHECK_CLOSE(bg::distance(p3, pf), 5.196152, 0.01);
+}
+
+int test_main(int, char* [])
+{
+ test_2d();
+ test_3d();
+ return 0;
+}
+

Added: trunk/libs/geometry/test/geometries/boost_fusion.vcproj
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/geometries/boost_fusion.vcproj 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="boost_fusion"
+ ProjectGUID="{C218C979-890F-4690-84E0-837DC661CE57}"
+ RootNamespace="boost_fusion"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\boost_fusion"
+ 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"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ 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)\boost_fusion"
+ 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"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ 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=".\boost_fusion.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Modified: trunk/libs/geometry/test/geometries/geometries_tests.sln
==============================================================================
--- trunk/libs/geometry/test/geometries/geometries_tests.sln (original)
+++ trunk/libs/geometry/test/geometries/geometries_tests.sln 2011-01-18 13:51:57 EST (Tue, 18 Jan 2011)
@@ -12,6 +12,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_range", "boost_range.vcproj", "{8E719071-B525-4F58-832A-AB75FCA8BEA0}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_fusion", "boost_fusion.vcproj", "{C218C979-890F-4690-84E0-837DC661CE57}"
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -42,6 +44,10 @@
                 {8E719071-B525-4F58-832A-AB75FCA8BEA0}.Debug|Win32.Build.0 = Debug|Win32
                 {8E719071-B525-4F58-832A-AB75FCA8BEA0}.Release|Win32.ActiveCfg = Release|Win32
                 {8E719071-B525-4F58-832A-AB75FCA8BEA0}.Release|Win32.Build.0 = Release|Win32
+ {C218C979-890F-4690-84E0-837DC661CE57}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C218C979-890F-4690-84E0-837DC661CE57}.Debug|Win32.Build.0 = Debug|Win32
+ {C218C979-890F-4690-84E0-837DC661CE57}.Release|Win32.ActiveCfg = Release|Win32
+ {C218C979-890F-4690-84E0-837DC661CE57}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE


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