|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r66211 - sandbox/geometry/boost/geometry/geometries/adapted
From: barend.gehrels_at_[hidden]
Date: 2010-10-27 06:43:39
Author: barendgehrels
Date: 2010-10-27 06:43:31 EDT (Wed, 27 Oct 2010)
New Revision: 66211
URL: http://svn.boost.org/trac/boost/changeset/66211
Log:
Added Boost Array point adapter created by Alfredo Correa
Added:
sandbox/geometry/boost/geometry/geometries/adapted/boost_array.hpp (contents, props changed)
sandbox/geometry/boost/geometry/geometries/adapted/boost_array_cartesian.hpp (contents, props changed)
sandbox/geometry/boost/geometry/geometries/adapted/boost_array_geographic.hpp (contents, props changed)
Added: sandbox/geometry/boost/geometry/geometries/adapted/boost_array.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/geometries/adapted/boost_array.hpp 2010-10-27 06:43:31 EDT (Wed, 27 Oct 2010)
@@ -0,0 +1,102 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Alfredo Correa 2010
+// Copyright Bruno Lalande 2008, 2009
+// Copyright Barend Gehrels 2007-2009, 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)
+
+#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ARRAY_HPP
+#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ARRAY_HPP
+
+#include <cstddef>
+
+#include <boost/type_traits/is_arithmetic.hpp>
+
+#include <boost/geometry/core/access.hpp>
+#include <boost/geometry/core/cs.hpp>
+#include <boost/geometry/core/coordinate_dimension.hpp>
+#include <boost/geometry/core/coordinate_type.hpp>
+#include <boost/geometry/core/tags.hpp>
+
+#include <boost/array.hpp>
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
+namespace traits
+{
+
+
+#ifndef DOXYGEN_NO_DETAIL
+namespace detail
+{
+
+
+// Create class and specialization to indicate the tag
+// for normal cases and the case that the type of the c-array is arithmetic
+template <bool>
+struct boost_array_tag
+{
+ typedef geometry_not_recognized_tag type;
+};
+
+
+template <>
+struct boost_array_tag<true>
+{
+ typedef point_tag type;
+};
+
+
+} // namespace detail
+#endif // DOXYGEN_NO_DETAIL
+
+
+// Assign the point-tag, preventing arrays of points getting a point-tag
+template <typename CoordinateType, std::size_t DimensionCount>
+struct tag<boost::array<CoordinateType, DimensionCount> >
+ : detail::boost_array_tag<boost::is_arithmetic<CoordinateType>::value> {};
+
+
+template <typename CoordinateType, std::size_t DimensionCount>
+struct coordinate_type<boost::array<CoordinateType, DimensionCount> >
+{
+ typedef CoordinateType type;
+};
+
+
+template <typename CoordinateType, std::size_t DimensionCount>
+struct dimension<boost::array<CoordinateType, DimensionCount> >: boost::mpl::int_<DimensionCount> {};
+
+
+template <typename CoordinateType, std::size_t DimensionCount, std::size_t Dimension>
+struct access<boost::array<CoordinateType, DimensionCount>, Dimension>
+{
+ static inline CoordinateType get(boost::array<CoordinateType, DimensionCount> const& a)
+ {
+ return a[Dimension];
+ }
+
+ static inline void set(boost::array<CoordinateType, DimensionCount>& a,
+ CoordinateType const& value)
+ {
+ a[Dimension] = value;
+ }
+};
+
+// The library user has
+// 1) either to specify the coordinate system
+// 2) or include <boost/geometry/geometries/adapted/boost_array__at_.hpp> where @=cartesian,geographic,...
+
+} // namespace traits
+#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
+
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ARRAY_HPP
+
Added: sandbox/geometry/boost/geometry/geometries/adapted/boost_array_cartesian.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/geometries/adapted/boost_array_cartesian.hpp 2010-10-27 06:43:31 EDT (Wed, 27 Oct 2010)
@@ -0,0 +1,42 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Alfredo Correa 2010
+// Copyright Bruno Lalande 2008, 2009
+// Copyright Barend Gehrels 2007-2009, 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)
+
+#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ARRAY_CARTESIAN_HPP
+#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ARRAY_CARTESIAN_HPP
+
+#ifdef BOOST_GEOMETRY_ADAPTED_BOOST_ARRAY_COORDINATE_SYSTEM_DEFINED
+#error Include only one headerfile to register coordinate coordinate_system for adapted boost array
+#endif
+
+#define BOOST_GEOMETRY_ADAPTED_BOOST_ARRAY_COORDINATE_SYSTEM_DEFINED
+
+
+#include <boost/geometry/geometries/adapted/boost_array.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
+namespace traits
+{
+ template <typename T, std::size_t N>
+ struct coordinate_system<boost::array<T, N> >
+ { typedef cs::cartesian type; };
+
+}
+#endif
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ARRAY_CARTESIAN_HPP
+
Added: sandbox/geometry/boost/geometry/geometries/adapted/boost_array_geographic.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/geometries/adapted/boost_array_geographic.hpp 2010-10-27 06:43:31 EDT (Wed, 27 Oct 2010)
@@ -0,0 +1,40 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Alfredo Correa 2010
+// Copyright Bruno Lalande 2008, 2009
+// Copyright Barend Gehrels 2007-2009, 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)
+
+#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ARRAY_GEOGRAPHIC_HPP
+#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ARRAY_GEOGRAPHIC_HPP
+
+#ifdef BOOST_GEOMETRY_ADAPTED_BOOST_ARRAY_COORDINATE_SYSTEM_DEFINED
+#error Include only one headerfile to register coordinate coordinate_system for adapted boost array
+#endif
+
+#define BOOST_GEOMETRY_ADAPTED_BOOST_ARRAY_COORDINATE_SYSTEM_DEFINED
+
+
+#include <boost/geometry/geometries/adapted/boost_array.hpp>
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
+namespace traits
+{
+ template <typename T, std::size_t N>
+ struct coordinate_system<boost::array<T, N> >
+ { typedef cs::geographic type; };
+
+}
+#endif
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ARRAY_GEOGRAPHIC_HPP
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