Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59783 - in sandbox/geometry/boost/geometry: algorithms algorithms/detail/buffer geometries/adapted geometries/register iterators policies/relate strategies util
From: barend.gehrels_at_[hidden]
Date: 2010-02-20 11:40:15


Author: barendgehrels
Date: 2010-02-20 11:40:13 EST (Sat, 20 Feb 2010)
New Revision: 59783
URL: http://svn.boost.org/trac/boost/changeset/59783

Log:
Added algorithms (a.o. buffer) and geometries/registration macros
Added:
   sandbox/geometry/boost/geometry/algorithms/buffer.hpp (contents, props changed)
   sandbox/geometry/boost/geometry/algorithms/detail/buffer/
   sandbox/geometry/boost/geometry/algorithms/detail/buffer/remove_within_distance.hpp (contents, props changed)
   sandbox/geometry/boost/geometry/geometries/adapted/c_array_geographic.hpp (contents, props changed)
   sandbox/geometry/boost/geometry/geometries/adapted/tuple_geographic.hpp (contents, props changed)
   sandbox/geometry/boost/geometry/geometries/register/register_box.hpp (contents, props changed)
   sandbox/geometry/boost/geometry/geometries/register/register_point.hpp (contents, props changed)
   sandbox/geometry/boost/geometry/iterators/section_iterators.hpp (contents, props changed)
   sandbox/geometry/boost/geometry/policies/relate/de9im.hpp (contents, props changed)
   sandbox/geometry/boost/geometry/strategies/buffer.hpp (contents, props changed)
   sandbox/geometry/boost/geometry/util/get_cs_as_radian.hpp (contents, props changed)
   sandbox/geometry/boost/geometry/util/readme.txt (contents, props changed)

Added: sandbox/geometry/boost/geometry/algorithms/buffer.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/algorithms/buffer.hpp 2010-02-20 11:40:13 EST (Sat, 20 Feb 2010)
@@ -0,0 +1,402 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// 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_ALGORITHMS_BUFFER_HPP
+#define BOOST_GEOMETRY_ALGORITHMS_BUFFER_HPP
+
+#include <cstddef>
+
+#include <boost/numeric/conversion/cast.hpp>
+
+
+#include <boost/geometry/algorithms/clear.hpp>
+#include <boost/geometry/algorithms/detail/disjoint.hpp>
+#include <boost/geometry/arithmetic/arithmetic.hpp>
+#include <boost/geometry/geometries/concepts/check.hpp>
+#include <boost/geometry/geometries/segment.hpp>
+#include <boost/geometry/util/math.hpp>
+
+
+/*!
+\defgroup buffer buffer: calculate buffer of a geometry
+\par Source description:
+- OGC: Returns a geometric object that represents all Points whose distance
+from this geometric object is less than or equal to distance. Calculations are in the spatial reference system of
+this geometric object. Because of the limitations of linear interpolation, there will often be some relatively
+small error in this distance, but it should be near the resolution of the coordinates used
+\see http://en.wikipedia.org/wiki/Buffer_(GIS)
+*/
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_DETAIL
+namespace detail { namespace buffer
+{
+
+template <typename BoxIn, typename BoxOut, typename T, std::size_t C, std::size_t D, std::size_t N>
+struct box_loop
+{
+ typedef typename coordinate_type<BoxOut>::type coordinate_type;
+
+ static inline void apply(BoxIn const& box_in, T const& distance, BoxOut& box_out)
+ {
+ coordinate_type d = distance;
+ set<C, D>(box_out, get<C, D>(box_in) + d);
+ box_loop<BoxIn, BoxOut, T, C, D + 1, N>::apply(box_in, distance, box_out);
+ }
+};
+
+template <typename BoxIn, typename BoxOut, typename T, std::size_t C, std::size_t N>
+struct box_loop<BoxIn, BoxOut, T, C, N, N>
+{
+ static inline void apply(BoxIn const&, T const&, BoxOut&) {}
+};
+
+// Extends a box with the same amount in all directions
+template<typename BoxIn, typename BoxOut, typename T>
+inline void buffer_box(BoxIn const& box_in, T const& distance, BoxOut& box_out)
+{
+ assert_dimension_equal<BoxIn, BoxOut>();
+
+ static const std::size_t N = dimension<BoxIn>::value;
+
+ box_loop<BoxIn, BoxOut, T, min_corner, 0, N>::apply(box_in, -distance, box_out);
+ box_loop<BoxIn, BoxOut, T, max_corner, 0, N>::apply(box_in, +distance, box_out);
+}
+
+
+
+
+template <typename RingInput, typename RingOutput, typename JoinStrategy>
+struct ring_buffer
+{
+ template <typename Point, typename Line1, typename Line2 = Line1>
+ struct line_line_intersection
+ {
+ template <typename A, typename B, typename C, typename D>
+ static inline A det(A const& a, B const& b, C const& c, D const& d)
+ {
+ return a * d - b * c;
+ }
+
+ static inline bool apply(Line1 const& line1, Line2 const& line2, Point& p)
+ {
+ // See http://mathworld.wolfram.com/Line-LineIntersection.html
+ typedef typename coordinate_type<Point>::type coordinate_type;
+ coordinate_type x1 = get<0,0>(line1), y1 = get<0,1>(line1);
+ coordinate_type x2 = get<1,0>(line1), y2 = get<1,1>(line1);
+ coordinate_type x3 = get<0,0>(line2), y3 = get<0,1>(line2);
+ coordinate_type x4 = get<1,0>(line2), y4 = get<1,1>(line2);
+
+ coordinate_type denominator = det(x1 - x2, y1 - y2, x3 - x4, y3 - y4);
+
+ // If denominator is zero, segments are parallel.
+ // We have context information, so know that it should then
+ // be the case that line1.p2 == line2.p1, and that is the
+ // intersection point.
+ if (geometry::math::equals(denominator, 0.0))
+ {
+ set<0>(p, x2);
+ set<1>(p, y2);
+ return true;
+ }
+
+ coordinate_type d1 = det(x1, y1, x2, y2);
+ coordinate_type d2 = det(x3, y3, x4, y4);
+ coordinate_type px = det(d1, x1 - x2, d2, x3 - x4) / denominator;
+ coordinate_type py = det(d1, y1 - y2, d2, y3 - y4) / denominator;
+
+ set<0>(p, px);
+ set<1>(p, py);
+
+ if (abs(denominator) < 1e-7)
+ {
+ std::cout << "small " << denominator << std::endl;
+ }
+ return abs(denominator) > 1e-7;
+ }
+ };
+
+
+
+#ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER
+ template <typename Mapper>
+#endif
+ static inline void apply(RingInput const& ring, RingOutput& buffered,
+ double distance, // TODO: change coordinate type
+ JoinStrategy const& join_strategy
+#ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER
+ , Mapper& mapper
+#endif
+ )
+ {
+ typedef typename point_type<RingOutput>::type output_point_type;
+ typedef segment<output_point_type const> segment_type;
+ typedef typename boost::range_iterator
+ <
+ RingInput const
+ >::type iterator_type;
+
+ output_point_type previous_p1, previous_p2;
+ output_point_type first_p1, first_p2;
+ bool first = true;
+
+ int index = 0;
+
+ iterator_type it = boost::begin(ring);
+ for (iterator_type prev = it++;
+ it != boost::end(ring); ++it)
+ {
+ if (! detail::equals::equals_point_point(*prev, *it))
+ {
+ bool skip = false;
+
+ // Generate a block along (int most cases to the left of) the segment
+ typedef typename coordinate_type<output_point_type>::type coordinate_type;
+
+ // Simulate a vector d (dx,dy)
+ coordinate_type dx = get<0>(*it) - get<0>(*prev);
+ coordinate_type dy = get<1>(*it) - get<1>(*prev);
+
+
+ // For normalization [0,1] (=dot product d.d, sqrt)
+ coordinate_type length = sqrt(dx * dx + dy * dy);
+
+ // Because coordinates are not equal, length should not be zero
+ BOOST_ASSERT((! geometry::math::equals(length, 0)));
+
+ // Generate the normalized perpendicular p, to the left (ccw)
+ coordinate_type px = -dy / length;
+ coordinate_type py = dx / length;
+
+ output_point_type p1, p2;
+
+ coordinate_type d = distance;
+
+ set<0>(p2, get<0>(*it) + px * d);
+ set<1>(p2, get<1>(*it) + py * d);
+
+ set<0>(p1, get<0>(*prev) + px * d);
+ set<1>(p1, get<1>(*prev) + py * d);
+
+ {
+ RingOutput block;
+ block.push_back(*prev);
+ block.push_back(*it);
+ block.push_back(p2);
+ block.push_back(p1);
+ block.push_back(*prev);
+
+ #ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER
+ mapper.map(block, "opacity:0.4;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1");
+ #endif
+ }
+
+ if (! first)
+ {
+ output_point_type p;
+ segment_type s1(p1, p2);
+ segment_type s2(previous_p1, previous_p2);
+ if (line_line_intersection<output_point_type, segment_type>::apply(s1, s2, p))
+ {
+ join_strategy.apply(p, *prev, previous_p2, p1, distance, buffered);
+ {
+ #ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER
+ mapper.map(p, "fill:rgb(0,0,0);", 3);
+
+ std::ostringstream out;
+ out << index++;
+ mapper.text(p, out.str(), "fill:rgb(0,0,0);font-family='Arial';", 5, 5);
+ #endif
+ }
+ }
+ else
+ {
+ skip = false;
+ }
+ }
+ else
+ {
+ first = false;
+ first_p1 = p1;
+ first_p2 = p2;
+ }
+
+ if (! skip)
+ {
+ previous_p1 = p1;
+ previous_p2 = p2;
+ prev = it;
+ }
+ }
+ }
+
+ // Last one
+ {
+ output_point_type p;
+ segment_type s1(previous_p1, previous_p2);
+ segment_type s2(first_p1, first_p2);
+ line_line_intersection<output_point_type, segment_type>::apply(s1, s2, p);
+
+ join_strategy.apply(p, *boost::begin(ring), previous_p2, first_p1, distance, buffered);
+
+#ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER
+ mapper.map(p, "fill:rgb(0,0,0);", 3);
+ std::ostringstream out;
+ out << index++;
+ mapper.text(p, out.str(), "fill:rgb(0,0,0);font-family='Arial';", 5, 5);
+#endif
+ }
+
+ // Close the generated buffer
+ {
+ output_point_type p = *boost::begin(buffered);
+ buffered.push_back(p);
+ }
+ }
+};
+
+
+
+template <typename PolygonInput, typename PolygonOutput, typename JoinStrategy>
+struct polygon_buffer
+{
+#ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER
+ template <typename Mapper>
+#endif
+ static inline void apply(PolygonInput const& polygon, PolygonOutput& buffered,
+ double distance, JoinStrategy const& join_strategy
+#ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER
+ , Mapper& mapper
+#endif
+ )
+ {
+ boost::geometry::clear(buffered);
+
+ typedef typename ring_type<PolygonInput>::type input_ring_type;
+ typedef typename ring_type<PolygonOutput>::type output_ring_type;
+
+ typedef ring_buffer<input_ring_type, output_ring_type, JoinStrategy> policy;
+ policy::apply(exterior_ring(polygon), exterior_ring(buffered),
+ distance, join_strategy
+#ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER
+ , mapper
+#endif
+ );
+
+ for (typename boost::range_iterator
+ <
+ typename interior_type<PolygonInput>::type const
+ >::type it = boost::begin(interior_rings(polygon));
+ it != boost::end(interior_rings(polygon));
+ ++it)
+ {
+ output_ring_type ring;
+ policy::apply(*it, ring, distance, join_strategy
+#ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER
+ , mapper
+#endif
+ );
+ interior_rings(buffered).push_back(ring);
+ }
+ }
+};
+
+
+
+}} // namespace detail::buffer
+#endif // DOXYGEN_NO_DETAIL
+
+#ifndef DOXYGEN_NO_DISPATCH
+namespace dispatch
+{
+
+template <typename TagIn, typename TagOut, typename Input, typename T, typename Output>
+struct buffer {};
+
+
+template <typename BoxIn, typename T, typename BoxOut>
+struct buffer<box_tag, box_tag, BoxIn, T, BoxOut>
+{
+ static inline void apply(BoxIn const& box_in, T const& distance,
+ T const& chord_length, BoxIn& box_out)
+ {
+ detail::buffer::buffer_box(box_in, distance, box_out);
+ }
+};
+
+// Many things to do. Point is easy, other geometries require self intersections
+// For point, note that it should output as a polygon (like the rest). Buffers
+// of a set of geometries are often lateron combined using a "dissolve" operation.
+// Two points close to each other get a combined kidney shaped buffer then.
+
+} // namespace dispatch
+#endif // DOXYGEN_NO_DISPATCH
+
+
+/*!
+ \brief Calculate buffer (= new geometry) around specified distance of geometry
+ \ingroup buffer
+ \param geometry_in input geometry
+ \param distance the distance used in buffer
+ \param chord_length length of the chord's in the generated arcs around points or bends
+ \param geometry_out buffered geometry
+ \note Currently only implemented for box, the trivial case, but still useful
+ \par Use case:
+ BOX + distance -> BOX: it is allowed that "geometry_out" the same object as "geometry_in"
+ */
+template <typename Input, typename Output, typename T>
+inline void buffer(Input const& geometry_in, Output& geometry_out,
+ T const& distance, T const& chord_length = -1)
+{
+ concept::check<const Input>();
+ concept::check<Output>();
+
+ dispatch::buffer
+ <
+ typename tag<Input>::type,
+ typename tag<Output>::type,
+ Input,
+ T,
+ Output
+ >::apply(geometry_in, distance, chord_length, geometry_out);
+}
+
+/*!
+ \brief Calculate and return buffer (= new geometry) around specified distance of geometry
+ \ingroup buffer
+ \param geometry input geometry
+ \param distance the distance used in buffer
+ \param chord_length length of the chord's in the generated arcs around points or bends
+ \return the buffered geometry
+ \note See also: buffer
+ */
+template <typename Output, typename Input, typename T>
+Output make_buffer(Input const& geometry, T const& distance, T const& chord_length = -1)
+{
+ concept::check<const Input>();
+ concept::check<Output>();
+
+ Output geometry_out;
+
+ dispatch::buffer
+ <
+ typename tag<Input>::type,
+ typename tag<Output>::type,
+ Input,
+ T,
+ Output
+ >::apply(geometry, distance, chord_length, geometry_out);
+
+ return geometry_out;
+}
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_ALGORITHMS_BUFFER_HPP

Added: sandbox/geometry/boost/geometry/algorithms/detail/buffer/remove_within_distance.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/algorithms/detail/buffer/remove_within_distance.hpp 2010-02-20 11:40:13 EST (Sat, 20 Feb 2010)
@@ -0,0 +1,147 @@
+// 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)
+
+#ifndef BOOST_GEOMETRY_ALGORITHM_REMOVE_WITHIN_DISTANCE_HPP
+#define BOOST_GEOMETRY_ALGORITHM_REMOVE_WITHIN_DISTANCE_HPP
+
+#include <algorithm>
+
+#include <boost/geometry/algorithms/distance.hpp>
+#include <boost/geometry/algorithms/detail/point_on_border.hpp>
+
+#include <boost/geometry/core/interior_rings.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+
+
+#ifndef DOXYGEN_NO_DETAIL
+namespace detail { namespace buffer
+{
+
+
+template<typename Geometry, typename GeometryInput, typename T>
+struct remove_false_ring_predicate
+{
+private :
+ typedef typename point_type<Geometry>::type point_type;
+
+ GeometryInput const& m_input;
+ T m_distance;
+
+public :
+ remove_false_ring_predicate(GeometryInput const& input,
+ T const& distance)
+ : m_input(input)
+ , m_distance(distance)
+ {
+ }
+
+ inline bool operator()(Geometry const& geometry)
+ {
+ point_type point, point_input;
+ if (geometry::point_on_border(point, geometry, false)
+ && geometry::point_on_border(point_input, m_input, false))
+ {
+ if (m_distance > T())
+ {
+ // If the input is within the output, it is acceptable
+ if (geometry::within(point_input, geometry))
+ {
+ return false;
+ }
+
+ // Check the distance to the input geometry
+ // (for a polygon, this is: the distance from OUTSIDE
+ // to the border
+ T d = geometry::distance(point, m_input);
+ if (d < m_distance)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+};
+
+
+
+template<typename Polygon, typename Geometry>
+struct polygon_remove_false_rings
+{
+ template <typename T>
+ static inline void apply(Polygon& polygon, Geometry const& input, T const& distance)
+ {
+ interior_rings(polygon).erase
+ (
+ std::remove_if
+ (
+ boost::begin(interior_rings(polygon)),
+ boost::end(interior_rings(polygon)),
+ remove_false_ring_predicate
+ <
+ typename ring_type<Polygon>::type,
+ Geometry,
+ T
+ >(input, distance)
+ ),
+ boost::end(interior_rings(polygon))
+ );
+
+ }
+};
+
+
+template<typename Collection, typename Geometry, typename T>
+inline void collection_remove_within_distance(Collection& dissolved,
+ Geometry const& input,
+ T const& distance)
+{
+ typedef typename boost::range_value<Collection>::type polygon_type;
+ // 1: remove all polygons which are false positive (positive,
+ // but too close to the input geometry
+ dissolved.erase
+ (
+ std::remove_if(boost::begin(dissolved), boost::end(dissolved),
+ remove_false_ring_predicate
+ <
+ polygon_type,
+ Geometry,
+ T
+ >(input, distance)),
+ boost::end(dissolved)
+ );
+
+ // 2: within all polygons, remove false negative interior rings
+ for (typename boost::range_iterator<Collection>::type
+ it = boost::begin(dissolved);
+ it != boost::end(dissolved);
+ ++it)
+ {
+ polygon_remove_false_rings
+ <
+ typename boost::range_value<Collection>::type,
+ Geometry
+ >::apply(*it, input, distance);
+ }
+}
+
+
+}} // namespace detail::buffer
+
+
+#endif // DOXYGEN_NO_DETAIL
+
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_ALGORITHM_REMOVE_WITHIN_DISTANCE_HPP

Added: sandbox/geometry/boost/geometry/geometries/adapted/c_array_geographic.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/geometries/adapted/c_array_geographic.hpp 2010-02-20 11:40:13 EST (Sat, 20 Feb 2010)
@@ -0,0 +1,38 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// 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_C_ARRAY_GEOGRAPHIC_HPP
+#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_C_ARRAY_GEOGRAPHIC_HPP
+
+#ifdef BOOST_GEOMETRY_ADAPTED_C_ARRAY_COORDINATE_SYSTEM_DEFINED
+#error Include only one headerfile to register coordinate coordinate_system for adapted c array
+#endif
+
+#define BOOST_GEOMETRY_ADAPTED_C_ARRAY_COORDINATE_SYSTEM_DEFINED
+
+#include <boost/geometry/geometries/adapted/c_array.hpp>
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
+namespace traits
+{
+ template <typename T, int N>
+ struct coordinate_system<T[N]>
+ { typedef cs::geographic type; };
+
+}
+#endif
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_C_ARRAY_GEOGRAPHIC_HPP

Added: sandbox/geometry/boost/geometry/geometries/adapted/tuple_geographic.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/geometries/adapted/tuple_geographic.hpp 2010-02-20 11:40:13 EST (Sat, 20 Feb 2010)
@@ -0,0 +1,44 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// 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_TUPLE_GEOGRAPHIC_HPP
+#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_TUPLE_GEOGRAPHIC_HPP
+
+#ifdef BOOST_GEOMETRY_ADAPTED_TUPLE_COORDINATE_SYSTEM_DEFINED
+#error Include only one headerfile to register coordinate coordinate_system for adapted tuple
+#endif
+
+#define BOOST_GEOMETRY_ADAPTED_TUPLE_COORDINATE_SYSTEM_DEFINED
+
+
+#include <boost/geometry/geometries/adapted/tuple.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
+namespace traits
+{
+ template <typename T>
+ struct coordinate_system<boost::tuple<T, T> >
+ { typedef cs::geographic<degree> type; };
+
+ template <typename T>
+ struct coordinate_system<boost::tuple<T, T, T> >
+ { typedef cs::geographic<degree> type; };
+
+}
+#endif
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_TUPLE_GEOGRAPHIC_HPP

Added: sandbox/geometry/boost/geometry/geometries/register/register_box.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/geometries/register/register_box.hpp 2010-02-20 11:40:13 EST (Sat, 20 Feb 2010)
@@ -0,0 +1,22 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// 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_REGISTER_REGISTER_BOX_HPP
+#define BOOST_GEOMETRY_GEOMETRIES_REGISTER_REGISTER_BOX_HPP
+
+#include <boost/geometry/geometries/register/box.hpp>
+
+#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__)
+# pragma message ("Warning: This header is deprecated. Please use: boost/geometry/geometries/register/box.hpp")
+#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
+# warning "This header is deprecated. Please use: boost/geometry/geometries/register/box.hpp")
+#endif
+
+
+#endif // BOOST_GEOMETRY_GEOMETRIES_REGISTER_REGISTER_BOX_HPP

Added: sandbox/geometry/boost/geometry/geometries/register/register_point.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/geometries/register/register_point.hpp 2010-02-20 11:40:13 EST (Sat, 20 Feb 2010)
@@ -0,0 +1,22 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// 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_REGISTER_REGISTER_POINT_HPP
+#define BOOST_GEOMETRY_GEOMETRIES_REGISTER_REGISTER_POINT_HPP
+
+#include <boost/geometry/geometries/register/point.hpp>
+
+#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__)
+# pragma message ("Warning: This header is deprecated. Please use: boost/geometry/geometries/register/point.hpp")
+#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
+# warning "This header is deprecated. Please use: boost/geometry/geometries/register/point.hpp")
+#endif
+
+
+#endif // BOOST_GEOMETRY_GEOMETRIES_REGISTER_REGISTER_POINT_HPP

Added: sandbox/geometry/boost/geometry/iterators/section_iterators.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/iterators/section_iterators.hpp 2010-02-20 11:40:13 EST (Sat, 20 Feb 2010)
@@ -0,0 +1,217 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// 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_ITERATORS_SECTION_ITERATORS_HPP
+#define BOOST_GEOMETRY_ITERATORS_SECTION_ITERATORS_HPP
+
+#include <iterator>
+
+#include <boost/geometry/core/access.hpp>
+#include <boost/geometry/iterators/base.hpp>
+#include <boost/geometry/algorithms/overlaps.hpp>
+
+
+// FILE WILL BE SPLITTED
+
+namespace boost { namespace geometry
+{
+namespace detail
+{
+ template <size_t D, typename P, typename B>
+ inline bool exceeding(short int dir, const P& point, const B& box)
+ {
+ return (dir == 1 && get<D>(point) > get<1, D>(box))
+ || (dir == -1 && get<D>(point) < get<0, D>(box));
+ }
+
+ template <size_t D, typename P, typename B>
+ inline bool preceding(short int dir, const P& point, const B& box)
+ {
+ return (dir == 1 && get<D>(point) < get<0, D>(box))
+ || (dir == -1 && get<D>(point) > get<1, D>(box));
+ }
+}
+
+
+// Iterator walking through ring/sections, delivering only those points of the ring
+// which are inside the specified box (using the sections)
+template<typename G, typename S, typename B, size_t D>
+struct section_iterator : public detail::iterators::iterator_base<
+ section_iterator<G, S, B, D>,
+ typename boost::range_const_iterator<G>::type
+ >
+{
+ friend class boost::iterator_core_access;
+
+ inline section_iterator(const G& ring, const S& sections, const B& box)
+ : m_ring(ring)
+ , m_sections(sections)
+ , m_box(box)
+ , m_section_iterator(boost::begin(m_sections))
+ {
+ stay_within_box();
+ }
+
+
+ private :
+
+ inline void increment()
+ {
+ (this->base_reference())++;
+
+ // If end or exceeding specified box, go to next section
+ if (this->base() == m_end
+ || detail::exceeding<D>(m_section_iterator->directions[0], *this->base(), m_box))
+ {
+ m_section_iterator++;
+ stay_within_box();
+ }
+
+ }
+
+ // Check if iterator is still in box and if not, go to the next section and advance until it is in box
+ void stay_within_box()
+ {
+ // Find section having overlap with specified box
+ while (m_section_iterator != boost::end(m_sections)
+ && ! overlaps(m_section_iterator->bounding_box, m_box))
+ {
+ m_section_iterator++;
+ }
+ if (m_section_iterator != boost::end(m_sections))
+ {
+ this->base_reference() = boost::begin(m_ring) + m_section_iterator->begin_index;
+ m_end = boost::begin(m_ring) + m_section_iterator->end_index + 1;
+
+ // While not yet at box, advance
+ while(this->base() != m_end
+ && detail::preceding<D>(m_section_iterator->directions[0], *this->base(), m_box))
+ {
+ ++(this->base_reference());
+ }
+
+ if (this->base() == m_end)
+ {
+ // This should actually not occur because of bbox check, but to be sure
+ m_section_iterator++;
+ stay_within_box();
+ }
+ }
+ else
+ {
+ this->base_reference() = boost::end(m_ring);
+ m_end = boost::end(m_ring);
+ }
+ }
+
+
+ typedef typename boost::range_const_iterator<G>::type IT;
+ typedef typename boost::range_const_iterator<S>::type SIT;
+
+ const G& m_ring;
+ const S& m_sections;
+ const B& m_box;
+
+ IT m_end;
+ SIT m_section_iterator;
+};
+
+
+// Iterator walking through ring/sections, delivering only those points of the ring
+// which are inside the specified box (using the sections)
+template<typename G, typename SEC, typename B, size_t D>
+struct one_section_segment_iterator : public detail::iterators::iterator_base<
+ one_section_segment_iterator<G, SEC, B, D>
+ , typename boost::range_const_iterator<G>::type>
+{
+ friend class boost::iterator_core_access;
+ typedef typename boost::range_const_iterator<G>::type normal_iterator;
+
+ inline one_section_segment_iterator(const G& ring, const SEC& section, const B& box)
+ : m_box(&box)
+ , m_dir(section.directions[0])
+ {
+ init(section, ring);
+ }
+
+ inline one_section_segment_iterator(normal_iterator end)
+ : m_section_end(end)
+ , m_ring_end(end)
+ , m_box(NULL)
+ , m_dir(0)
+ {
+ this->base_reference() = end;
+ }
+
+
+ private :
+
+ inline void increment()
+ {
+ m_previous = (this->base_reference())++;
+
+ if (this->base() == m_section_end
+ || detail::exceeding<D>(m_dir, *m_previous, *m_box))
+ {
+ this->base_reference() = m_ring_end;
+ }
+ }
+
+ // Check if iterator is still in box and if not, go to the next section and advance until it is in box
+ void init(const SEC& section, const G& ring)
+ {
+ //this->base_reference();
+ m_section_end = boost::begin(ring) + section.end_index + 1;
+ m_ring_end = boost::end(ring);
+
+ this->base_reference() = boost::begin(ring) + section.begin_index;
+
+ /* Performance, TO BE CHECKED!
+ normal_iterator next = boost::begin(ring) + section.begin_index;
+ if (next != m_section_end && next != m_ring_end)
+ {
+
+ // While (not end and) not yet at box, advance
+ normal_iterator it = next++;
+ while(next != m_section_end && next != m_ring_end
+ && detail::preceding<D>(m_dir, *next, *m_box))
+ {
+ it = next++;
+ }
+
+
+ if (it == m_section_end)
+ {
+ this->base_reference() = m_ring_end;
+ }
+ else
+ {
+ this->base_reference() = it;
+ }
+ }
+ else
+ {
+ this->base_reference() = m_ring_end;
+ }
+ */
+
+ m_previous = this->base();
+ }
+
+
+ const B* m_box;
+ short int m_dir;
+
+ normal_iterator m_previous;
+ normal_iterator m_section_end;
+ normal_iterator m_ring_end;
+};
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_ITERATORS_SECTION_ITERATORS_HPP

Added: sandbox/geometry/boost/geometry/policies/relate/de9im.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/policies/relate/de9im.hpp 2010-02-20 11:40:13 EST (Sat, 20 Feb 2010)
@@ -0,0 +1,184 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// 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_GEOMETRY_POLICIES_RELATE_DE9IM_HPP
+#define BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_DE9IM_HPP
+
+
+#include <boost/geometry/strategies/intersection_result.hpp>
+#include <boost/geometry/util/math.hpp>
+#include <boost/geometry/util/select_coordinate_type.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+namespace policies { namespace relate {
+
+
+template <typename S1, typename S2>
+struct segments_de9im
+{
+ typedef de9im_segment return_type;
+ typedef S1 segment_type1;
+ typedef S2 segment_type2;
+ typedef typename select_coordinate_type<S1, S2>::type coordinate_type;
+
+ static inline return_type rays_intersect(bool on_segment,
+ double ra, double rb,
+ coordinate_type const& dx1, coordinate_type const& dy1,
+ coordinate_type const& dx2, coordinate_type const& dy2,
+ coordinate_type const& wx, coordinate_type const& wy,
+ S1 const& s1, S2 const& s2)
+ {
+ if(on_segment)
+ {
+ // 0 <= ra <= 1 and 0 <= rb <= 1
+ // Now check if one of them is 0 or 1, these are "touch" cases
+ bool a = math::equals(ra, 0.0) || math::equals(ra, 1.0);
+ bool b = math::equals(rb, 0.0) || math::equals(rb, 1.0);
+ if (a && b)
+ {
+ // Touch boundary/boundary: i-i == -1, i-b == -1, b-b == 0
+ // Opposite: if both are equal they touch in opposite direction
+ return de9im_segment(ra,rb,
+ -1, -1, 1,
+ -1, 0, 0,
+ 1, 0, 2, false, math::equals(ra,rb));
+ }
+ else if (a || b)
+ {
+ // Touch boundary/interior: i-i == -1, i-b == -1 or 0, b-b == -1
+ int A = a ? 0 : -1;
+ int B = b ? 0 : -1;
+ return de9im_segment(ra,rb,
+ -1, B, 1,
+ A, -1, 0,
+ 1, 0, 2);
+ }
+
+ // Intersects: i-i == 0, i-b == -1, i-e == 1
+ return de9im_segment(ra,rb,
+ 0, -1, 1,
+ -1, -1, 0,
+ 1, 0, 2);
+ }
+
+ // Not on segment, disjoint
+ return de9im_segment(ra,rb,
+ -1, -1, 1,
+ -1, -1, 0,
+ 1, 0, 2);
+ }
+
+ static inline return_type collinear_touch(coordinate_type const& x,
+ coordinate_type const& y, bool opposite, char)
+ {
+ return de9im_segment(0,0,
+ -1, -1, 1,
+ -1, 0, 0,
+ 1, 0, 2,
+ true, opposite);
+ }
+
+ template <typename S>
+ static inline return_type collinear_interior_boundary_intersect(S const& s,
+ bool a_within_b, bool opposite)
+ {
+ return a_within_b
+ ? de9im_segment(0,0,
+ 1, -1, -1,
+ 0, 0, -1,
+ 1, 0, 2,
+ true, opposite)
+ : de9im_segment(0,0,
+ 1, 0, 1,
+ -1, 0, 0,
+ -1, -1, 2,
+ true, opposite);
+ }
+
+
+
+ static inline return_type collinear_a_in_b(S1 const& s, bool opposite)
+ {
+ return de9im_segment(0,0,
+ 1, -1, -1,
+ 0, -1, -1,
+ 1, 0, 2,
+ true, opposite);
+ }
+ static inline return_type collinear_b_in_a(const S2& s, bool opposite)
+ {
+ return de9im_segment(0,0,
+ 1, 0, 1,
+ -1, -1, 0,
+ -1, -1, 2,
+ true, opposite);
+ }
+
+ static inline return_type collinear_overlaps(
+ coordinate_type const& x1, coordinate_type const& y1,
+ coordinate_type const& x2, coordinate_type const& y2, bool opposite)
+ {
+ return de9im_segment(0,0,
+ 1, 0, 1,
+ 0, -1, 0,
+ 1, 0, 2,
+ true, opposite);
+ }
+
+ static inline return_type segment_equal(S1 const& s, bool opposite)
+ {
+ return de9im_segment(0,0,
+ 1, -1, -1,
+ -1, 0, -1,
+ -1, -1, 2,
+ true, opposite);
+ }
+
+ static inline return_type degenerate(S1 const& segment, bool a_degenerate)
+ {
+ return a_degenerate
+ ? de9im_segment(0,0,
+ 0, -1, -1,
+ -1, -1, -1,
+ 1, 0, 2,
+ false, false, false, true)
+ : de9im_segment(0,0,
+ 0, -1, 1,
+ -1, -1, 0,
+ -1, -1, 2,
+ false, false, false, true);
+ }
+
+ static inline return_type collinear_disjoint()
+ {
+ return de9im_segment(0,0,
+ -1, -1, 1,
+ -1, -1, 0,
+ 1, 0, 2,
+ true);
+ }
+
+
+ static inline return_type parallel()
+ {
+ return de9im_segment(0,0,
+ -1, -1, 1,
+ -1, -1, 0,
+ 1, 0, 2, false, false, true);
+ }
+};
+
+
+}} // namespace policies::relate
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_DE9IM_HPP

Added: sandbox/geometry/boost/geometry/strategies/buffer.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/strategies/buffer.hpp 2010-02-20 11:40:13 EST (Sat, 20 Feb 2010)
@@ -0,0 +1,307 @@
+// 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)
+
+#ifndef BOOST_GEOMETRY_STRATEGIES_BUFFER_HPP
+#define BOOST_GEOMETRY_STRATEGIES_BUFFER_HPP
+
+
+// Buffer strategies
+
+#include <boost/geometry/core/cs.hpp>
+#include <boost/geometry/strategies/tags.hpp>
+#include <boost/geometry/strategies/side.hpp>
+
+
+
+namespace boost { namespace geometry
+{
+
+
+namespace strategy { namespace buffer
+{
+
+
+
+
+/*
+
+ A Buffer-join strategy gets 4 input points.
+ On the two consecutive segments s1 and s2 (combined by vertex v):
+
+ There are two points perpendicular to the segments (p1,p2),
+ crossing each other in interesction point x.
+
+
+ (s2)
+ |
+ |
+ ^
+ |
+ (p2) |(v)
+ * +----<--- (s1)
+
+ x(i) *(p1)
+
+
+ So, in clockwise order:
+ v : vertex point
+ p1: perpendicular on left side of segment1<1> (perp1)
+ i : intersection point (ip)
+ p2: perpendicular on left side of segment2<0> (perp2)
+*/
+
+
+template
+<
+ typename PointIn,
+ typename PointOut
+#ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER
+ , typename Mapper
+#endif
+>
+struct join_miter
+{
+ typedef typename strategy_side<typename cs_tag<PointIn>::type>::type side;
+ typedef typename coordinate_type<PointIn>::type coordinate_type;
+
+#ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER
+ Mapper const& m_mapper;
+
+ join_miter(Mapper const& mapper)
+ : m_mapper(mapper)
+ {}
+#endif
+
+ template <typename Ring>
+ inline void apply(PointIn const& ip, PointIn const& vertex,
+ PointIn const& perp1, PointIn const& perp2,
+ double buffer_distance,
+ Ring& buffered) const
+ {
+ int signum = buffer_distance > 0 ? 1 : buffer_distance < 0 ? -1 : 0;
+
+ // If it is concave (corner to left), add helper-line
+ if (side::apply(perp1, ip, perp2) == signum)
+ {
+ buffered.push_back(perp1);
+ buffered.push_back(perp2);
+ // Note, because perp1 crosses perp2 at IP, it is not necessary to
+ // include also IP
+ }
+ else
+ {
+ PointIn p = ip;
+
+ // Normalize it and give it X*dist.
+ coordinate_type dx = get<0>(ip) - get<0>(vertex);
+ coordinate_type dy = get<1>(ip) - get<1>(vertex);
+
+ coordinate_type length = sqrt(dx * dx + dy * dy);
+ coordinate_type max = 10 * abs(buffer_distance);
+
+ if (length > max)
+ {
+ coordinate_type prop = 0.7 * buffer_distance;
+ prop /= length;
+ set<0>(p, get<0>(vertex) + dx * prop);
+ set<1>(p, get<1>(vertex) + dy * prop);
+
+ std::cout << length << std::endl;
+ }
+
+
+ buffered.push_back(p);
+ }
+
+
+ // Map it
+ {
+ Ring corner;
+ corner.push_back(vertex);
+ corner.push_back(perp1);
+ corner.push_back(ip);
+ corner.push_back(perp2);
+ corner.push_back(vertex);
+
+#ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER
+ const_cast<Mapper&>(m_mapper).map(corner,
+ "opacity:0.4;fill:rgb(255,0,0);stroke:rgb(0,0,0);stroke-width:1");
+#endif
+ }
+ }
+};
+
+
+template
+<
+ typename PointIn,
+ typename PointOut
+#ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER
+ , typename Mapper
+#endif
+>
+struct join_bevel
+{
+
+#ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER
+ Mapper const& m_mapper;
+
+ join_bevel(Mapper const& mapper)
+ : m_mapper(mapper)
+ {}
+#endif
+
+ template <typename Ring>
+ inline void apply(PointIn const& ip, PointIn const& vertex,
+ PointIn const& perp1, PointIn const& perp2,
+ double buffer_distance,
+ Ring& buffered) const
+ {
+ buffered.push_back(perp1);
+ buffered.push_back(perp2);
+
+ // Map it
+ {
+ Ring corner;
+ corner.push_back(vertex);
+ corner.push_back(perp1);
+ corner.push_back(perp2);
+ corner.push_back(vertex);
+
+#ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER
+ const_cast<Mapper&>(m_mapper).map(corner,
+ "opacity:0.4;fill:rgb(255,0,0);stroke:rgb(0,0,0);stroke-width:1");
+#endif
+ }
+ }
+};
+
+
+template
+<
+ typename PointIn,
+ typename PointOut
+#ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER
+ , typename Mapper
+#endif
+>
+struct join_round
+{
+ int m_max_level;
+
+#ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER
+ Mapper const& m_mapper;
+
+ join_round(Mapper const& mapper, int max_level = 4)
+ : m_mapper(mapper)
+ , m_max_level(max_level)
+ {}
+#endif
+
+ inline join_round(int max_level = 4)
+ : m_max_level(max_level)
+ {}
+
+
+ template <typename Ring>
+ inline void mid_points(PointIn const& vertex,
+ PointIn const& p1, PointIn const& p2,
+ double buffer_distance,
+ Ring& buffered,
+ int level = 1) const
+ {
+ // Generate 'vectors'
+ double vp1_x = get<0>(p1) - get<0>(vertex);
+ double vp1_y = get<1>(p1) - get<1>(vertex);
+
+ double vp2_x = (get<0>(p2) - get<0>(vertex));
+ double vp2_y = (get<1>(p2) - get<1>(vertex));
+
+ // Average them to generate vector in between
+ double two = 2;
+ double v_x = (vp1_x + vp2_x) / two;
+ double v_y = (vp1_y + vp2_y) / two;
+
+ double length2 = sqrt(v_x * v_x + v_y * v_y);
+
+ double prop = buffer_distance / length2;
+
+ PointIn mid_point;
+ set<0>(mid_point, get<0>(vertex) + v_x * prop);
+ set<1>(mid_point, get<1>(vertex) + v_y * prop);
+
+ if (level < m_max_level)
+ {
+ mid_points(vertex, p1, mid_point, buffer_distance, buffered, level + 1);
+ mid_points(vertex, mid_point, p2, buffer_distance, buffered, level + 1);
+ }
+
+ buffered.push_back(p2);
+ }
+
+
+ template <typename Ring>
+ inline void apply(PointIn const& ip, PointIn const& vertex,
+ PointIn const& perp1, PointIn const& perp2,
+ double buffer_distance,
+ Ring& buffered) const
+ {
+ // Generate 'vectors'
+ double vpx = get<0>(perp1) - get<0>(vertex);
+ double vpy = get<1>(perp1) - get<1>(vertex);
+
+ double vix = (get<0>(ip) - get<0>(vertex));
+ double viy = (get<1>(ip) - get<1>(vertex));
+
+ double length_i = sqrt(vix * vix + viy * viy);
+
+ double prop = buffer_distance / length_i;
+
+ PointIn bp;
+ set<0>(bp, get<0>(vertex) + vix * prop);
+ set<1>(bp, get<1>(vertex) + viy * prop);
+
+ if (m_max_level <= 1)
+ {
+ buffered.push_back(perp1);
+ if (m_max_level == 1)
+ {
+ buffered.push_back(bp);
+ }
+ buffered.push_back(perp2);
+ }
+ else
+ {
+ buffered.push_back(perp1);
+ mid_points(vertex, perp1, bp, buffer_distance, buffered);
+ mid_points(vertex, bp, perp2, buffer_distance, buffered);
+ }
+
+
+ // Map it
+ {
+ Ring corner;
+ corner.push_back(vertex);
+ corner.push_back(perp1);
+ corner.push_back(bp);
+ corner.push_back(perp2);
+ corner.push_back(vertex);
+
+#ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER
+ const_cast<Mapper&>(m_mapper).map(corner,
+ "opacity:0.4;fill:rgb(255,0,0);stroke:rgb(0,0,0);stroke-width:1");
+#endif
+ }
+ }
+};
+
+}} // namespace strategy::buffer
+
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_STRATEGIES_BUFFER_HPP

Added: sandbox/geometry/boost/geometry/util/get_cs_as_radian.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/util/get_cs_as_radian.hpp 2010-02-20 11:40:13 EST (Sat, 20 Feb 2010)
@@ -0,0 +1,49 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// 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_UTIL_GET_CS_AS_RADIAN_HPP
+#define BOOST_GEOMETRY_UTIL_GET_CS_AS_RADIAN_HPP
+
+// obsolete? It is not used anymore (get_as_radian is usually OK)
+
+#include <boost/geometry/core/cs.hpp>
+
+namespace boost { namespace geometry {
+
+#ifndef DOXYGEN_NO_DETAIL
+namespace detail {
+
+ /*!
+ \brief Small meta-function defining the specified coordinate system,
+ but then in radian units
+ */
+ template <typename CoordinateSystem>
+ struct get_cs_as_radian {};
+
+ template <typename Units>
+ struct get_cs_as_radian<cs::geographic<Units> >
+ {
+ typedef cs::geographic<radian> type;
+ };
+
+ template <typename Units>
+ struct get_cs_as_radian<cs::spherical<Units> >
+ {
+ typedef cs::spherical<radian> type;
+ };
+
+} // namespace detail
+#endif
+
+
+
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_UTIL_GET_CS_AS_RADIAN_HPP

Added: sandbox/geometry/boost/geometry/util/readme.txt
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/util/readme.txt 2010-02-20 11:40:13 EST (Sat, 20 Feb 2010)
@@ -0,0 +1,4 @@
+This folder contains several headerfiles not fitting in one of the other folders,
+or meta-functions which would fit into boost as a separate trait or utility,
+such as add_const_if_c
+


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