Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71715 - in trunk/libs/geometry: doc doc/doxy doc/reference/geometries/adapted doc/src/examples/geometries/register doc/src/examples/ranges example
From: barend.gehrels_at_[hidden]
Date: 2011-05-04 12:14:30


Author: barendgehrels
Date: 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
New Revision: 71715
URL: http://svn.boost.org/trac/boost/changeset/71715

Log:
Doc update including adding tests for registration macro's
Added:
   trunk/libs/geometry/doc/src/examples/geometries/register/linestring.cpp (contents, props changed)
   trunk/libs/geometry/doc/src/examples/geometries/register/linestring_templated.cpp (contents, props changed)
   trunk/libs/geometry/doc/src/examples/geometries/register/multi_linestring.cpp (contents, props changed)
   trunk/libs/geometry/doc/src/examples/geometries/register/multi_point.cpp (contents, props changed)
   trunk/libs/geometry/doc/src/examples/geometries/register/multi_point_templated.cpp (contents, props changed)
   trunk/libs/geometry/doc/src/examples/geometries/register/multi_polygon.cpp (contents, props changed)
   trunk/libs/geometry/doc/src/examples/geometries/register/ring.cpp (contents, props changed)
   trunk/libs/geometry/doc/src/examples/geometries/register/ring_templated.cpp (contents, props changed)
   trunk/libs/geometry/doc/src/examples/ranges/
   trunk/libs/geometry/doc/src/examples/ranges/Jamfile.v2 (contents, props changed)
   trunk/libs/geometry/doc/src/examples/ranges/box_range.cpp (contents, props changed)
Text files modified:
   trunk/libs/geometry/doc/doxy/Doxyfile | 3 ++-
   trunk/libs/geometry/doc/imports.qbk | 8 ++++++++
   trunk/libs/geometry/doc/quickref.xml | 12 ++++++++++++
   trunk/libs/geometry/doc/reference/geometries/adapted/boost_array.qbk | 2 +-
   trunk/libs/geometry/doc/reference/geometries/adapted/boost_fusion.qbk | 2 +-
   trunk/libs/geometry/doc/reference/geometries/adapted/boost_tuple.qbk | 2 +-
   trunk/libs/geometry/doc/reference/geometries/adapted/c_array.qbk | 2 +-
   trunk/libs/geometry/doc/src/examples/geometries/register/Jamfile.v2 | 11 +++++++++++
   trunk/libs/geometry/example/c03_custom_linestring_example.cpp | 6 ++----
   trunk/libs/geometry/example/c04_a_custom_triangle_example.cpp | 5 ++---
   trunk/libs/geometry/example/c04_b_custom_triangle_example.cpp | 5 ++---
   trunk/libs/geometry/example/c06_custom_polygon_example.cpp | 8 ++------
   trunk/libs/geometry/example/c08_custom_non_std_example.cpp | 7 +++----
   13 files changed, 48 insertions(+), 25 deletions(-)

Modified: trunk/libs/geometry/doc/doxy/Doxyfile
==============================================================================
--- trunk/libs/geometry/doc/doxy/Doxyfile (original)
+++ trunk/libs/geometry/doc/doxy/Doxyfile 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -98,7 +98,7 @@
                         details_macro{2}="The macro \1 registers a \2 such that it is recognized by Boost.Geometry and that Boost.Geometry functionality can used with the specified type." \
                         details_macro_const="The const version registers only read access to the fields, the point type is therefore read-only" \
                         details_macro_getset="The get/set version registers get and set methods separately and can be used for classes with protected member variables and get/set methods to change coordinates" \
- details_macro_templated{1}="The type must have one template parameter, which should be a point type, and should not be specified. Boost.Geometry takes care of inserting the template parameter. Hence all types of this templated \1 are registered, regardless of their point type." \
+ details_macro_templated{2}="The type must have one template parameter, which should be a \2 type, and should not be specified. Boost.Geometry takes care of inserting the template parameter. Hence all types of this templated \1 are registered, regardless of their point type." \
                         details_default_strategy="It uses the default strategy, based on the coordinate system of the geometry." \
                         details_strategy_reasons="Reasons to specify a strategy include: use another coordinate system for calculations; construct the strategy beforehand (e.g. with the radius of the Earth); select a strategy when there are more than one available for a calculation." \
                         details_return{1}="This version with the return_ prefix returns the \1, and a template parameter must therefore be specified in the call." \
@@ -190,6 +190,7 @@
                         ../../../../boost/geometry/multi/algorithms/detail \
                         ../../../../boost/geometry/multi/core \
                         ../../../../boost/geometry/multi/geometries \
+ ../../../../boost/geometry/multi/geometries/register \
                         ../../../../boost/geometry/multi/geometries/concepts \
                         ../../../../boost/geometry/multi/iterators \
                         ../../../../boost/geometry/multi/strategies/cartesian \

Modified: trunk/libs/geometry/doc/imports.qbk
==============================================================================
--- trunk/libs/geometry/doc/imports.qbk (original)
+++ trunk/libs/geometry/doc/imports.qbk 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -93,5 +93,13 @@
 [import src/examples/geometries/register/box_templated.cpp]
 [import src/examples/geometries/register/box_2d_4values.cpp]
 [import src/examples/geometries/register/point.cpp]
+[import src/examples/geometries/register/linestring.cpp]
+[import src/examples/geometries/register/linestring_templated.cpp]
+[import src/examples/geometries/register/ring.cpp]
+[import src/examples/geometries/register/ring_templated.cpp]
 
+[import src/examples/geometries/register/multi_point.cpp]
+[import src/examples/geometries/register/multi_point_templated.cpp]
 
+[import src/examples/geometries/register/multi_linestring.cpp]
+[import src/examples/geometries/register/multi_polygon.cpp]

Modified: trunk/libs/geometry/doc/quickref.xml
==============================================================================
--- trunk/libs/geometry/doc/quickref.xml (original)
+++ trunk/libs/geometry/doc/quickref.xml 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -134,11 +134,19 @@
      <member><link linkend="geometry.reference.adapted.register.boost_geometry_register_point_3d">BOOST_GEOMETRY_REGISTER_POINT_3D</link></member>
      <member><link linkend="geometry.reference.adapted.register.boost_geometry_register_point_3d_const">BOOST_GEOMETRY_REGISTER_POINT_3D_CONST</link></member>
      <member><link linkend="geometry.reference.adapted.register.boost_geometry_register_point_3d_get_set">BOOST_GEOMETRY_REGISTER_POINT_3D_GET_SET</link></member>
+
+ <member><link linkend="geometry.reference.adapted.register.boost_geometry_register_multi_point">BOOST_GEOMETRY_REGISTER_MULTI_POINT</link></member>
+ <member><link linkend="geometry.reference.adapted.register.boost_geometry_register_multi_point_templated">BOOST_GEOMETRY_REGISTER_MULTI_POINT_TEMPLATED</link></member>
+
     </simplelist>
    </entry>
    <entry valign="top">
     <bridgehead renderas="sect3">1-dimensionial (macro's for adaption)</bridgehead>
     <simplelist type="vert" columns="1">
+ <member><link linkend="geometry.reference.adapted.register.boost_geometry_register_linestring">BOOST_GEOMETRY_REGISTER_LINESTRING</link></member>
+ <member><link linkend="geometry.reference.adapted.register.boost_geometry_register_linestring_templated">BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED</link></member>
+ <member><link linkend="geometry.reference.adapted.register.boost_geometry_register_multi_linestring">BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING</link></member>
+ <member><link linkend="geometry.reference.adapted.register.boost_geometry_register_multi_linestring_templated">BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING_TEMPLATED</link></member>
     </simplelist>
    </entry>
    <entry valign="top">
@@ -147,6 +155,10 @@
      <member><link linkend="geometry.reference.adapted.register.boost_geometry_register_box">BOOST_GEOMETRY_REGISTER_BOX</link></member>
      <member><link linkend="geometry.reference.adapted.register.boost_geometry_register_box_2d_4values">BOOST_GEOMETRY_REGISTER_BOX_2D_4VALUES</link></member>
      <member><link linkend="geometry.reference.adapted.register.boost_geometry_register_box_templated">BOOST_GEOMETRY_REGISTER_BOX_TEMPLATED</link></member>
+ <member><link linkend="geometry.reference.adapted.register.boost_geometry_register_ring">BOOST_GEOMETRY_REGISTER_RING</link></member>
+ <member><link linkend="geometry.reference.adapted.register.boost_geometry_register_ring_templated">BOOST_GEOMETRY_REGISTER_RING_TEMPLATED</link></member>
+ <member><link linkend="geometry.reference.adapted.register.boost_geometry_register_multi_polygon">BOOST_GEOMETRY_REGISTER_MULTI_POLYGON</link></member>
+ <member><link linkend="geometry.reference.adapted.register.boost_geometry_register_multi_polygon_templated">BOOST_GEOMETRY_REGISTER_MULTI_POLYGON_TEMPLATED</link></member>
     </simplelist>
    </entry>
   </row>

Modified: trunk/libs/geometry/doc/reference/geometries/adapted/boost_array.qbk
==============================================================================
--- trunk/libs/geometry/doc/reference/geometries/adapted/boost_array.qbk (original)
+++ trunk/libs/geometry/doc/reference/geometries/adapted/boost_array.qbk 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -28,7 +28,7 @@
 [heading Header]
 `#include <boost/geometry/geometries/adapted/boost_array.hpp>`
 
-The standard header `<boost/geometry.hpp>` does not include this header.
+__not_in_boost_geometry_hpp__
 
 [heading Example]
 [boost_array]

Modified: trunk/libs/geometry/doc/reference/geometries/adapted/boost_fusion.qbk
==============================================================================
--- trunk/libs/geometry/doc/reference/geometries/adapted/boost_fusion.qbk (original)
+++ trunk/libs/geometry/doc/reference/geometries/adapted/boost_fusion.qbk 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -25,7 +25,7 @@
 [heading Header]
 `#include <boost/geometry/geometries/adapted/boost_fusion.hpp>`
 
-The standard header `<boost/geometry.hpp>` does not include this header.
+__not_in_boost_geometry_hpp__
 
 [heading Example]
 [boost_fusion]

Modified: trunk/libs/geometry/doc/reference/geometries/adapted/boost_tuple.qbk
==============================================================================
--- trunk/libs/geometry/doc/reference/geometries/adapted/boost_tuple.qbk (original)
+++ trunk/libs/geometry/doc/reference/geometries/adapted/boost_tuple.qbk 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -37,7 +37,7 @@
 [heading Header]
 `#include <boost/geometry/geometries/adapted/boost_tuple.hpp>`
 
-The standard header `<boost/geometry.hpp>` does not include this header.
+__not_in_boost_geometry_hpp__
 
 [heading Example]
 [boost_tuple]

Modified: trunk/libs/geometry/doc/reference/geometries/adapted/c_array.qbk
==============================================================================
--- trunk/libs/geometry/doc/reference/geometries/adapted/c_array.qbk (original)
+++ trunk/libs/geometry/doc/reference/geometries/adapted/c_array.qbk 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -30,7 +30,7 @@
 [heading Header]
 `#include <boost/geometry/geometries/adapted/c_array.hpp>`
 
-The standard header `<boost/geometry.hpp>` does not include this header.
+__not_in_boost_geometry_hpp__
 
 [heading Example]
 [c_array]

Modified: trunk/libs/geometry/doc/src/examples/geometries/register/Jamfile.v2
==============================================================================
--- trunk/libs/geometry/doc/src/examples/geometries/register/Jamfile.v2 (original)
+++ trunk/libs/geometry/doc/src/examples/geometries/register/Jamfile.v2 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -17,3 +17,14 @@
 exe box_templated : box_templated.cpp ;
 exe box_2d_4values : box_2d_4values.cpp ;
 exe point : point.cpp ;
+
+exe linestring : linestring.cpp ;
+exe linestring_templated : linestring_templated.cpp ;
+exe ring : ring.cpp ;
+exe ring_templated : ring_templated.cpp ;
+
+exe multi_point : multi_point.cpp ;
+exe multi_point_templated : multi_point_templated.cpp ;
+
+exe multi_linestring : multi_linestring.cpp ;
+exe multi_polygon : multi_polygon.cpp ;

Added: trunk/libs/geometry/doc/src/examples/geometries/register/linestring.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/geometries/register/linestring.cpp 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -0,0 +1,52 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// QuickBook Example
+
+// Copyright (c) 2011 Barend Gehrels, 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)
+
+//[register_linestring
+//` Show the use of BOOST_GEOMETRY_REGISTER_LINESTRING
+
+#include <iostream>
+#include <boost/geometry.hpp>
+#include <boost/geometry/geometries/register/linestring.hpp>
+
+typedef boost::geometry::model::d2::point_xy<double> point_2d;
+
+BOOST_GEOMETRY_REGISTER_LINESTRING(std::vector<point_2d>)
+
+int main()
+{
+ // Normal usage of std::
+ std::vector<point_2d> line;
+ line.push_back(point_2d(1, 1));
+ line.push_back(point_2d(2, 2));
+ line.push_back(point_2d(3, 1));
+
+ // Usage of Boost.Geometry's length and wkt functions
+ std::cout << "Length: "
+ << boost::geometry::length(line)
+ << std::endl;
+
+ std::cout << "WKT: "
+ << boost::geometry::wkt(line)
+ << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[register_linestring_output
+/*`
+Output:
+[pre
+Length: 2.82843
+WKT: LINESTRING(1 1,2 2,3 1)
+]
+*/
+//]

Added: trunk/libs/geometry/doc/src/examples/geometries/register/linestring_templated.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/geometries/register/linestring_templated.cpp 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -0,0 +1,45 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// QuickBook Example
+
+// Copyright (c) 2011 Barend Gehrels, 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)
+
+//[register_linestring_templated
+//` Show the use of the macro BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED
+
+#include <iostream>
+#include <deque>
+#include <boost/geometry.hpp>
+#include <boost/geometry/geometries/register/linestring.hpp>
+
+// Adapt any deque to Boost.Geometry Linestring Concept
+BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque)
+
+int main()
+{
+ std::deque<boost::geometry::model::d2::point_xy<double> > line(2);
+ boost::geometry::assign_values(line[0], 1, 1);
+ boost::geometry::assign_values(line[1], 2, 2);
+
+ // Boost.Geometry algorithms work on any deque now
+ std::cout << "Length: " << boost::geometry::length(line) << std::endl;
+ std::cout << "Line: " << boost::geometry::dsv(line) << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[register_linestring_templated_output
+/*`
+Output:
+[pre
+Length: 1.41421
+Line: ((1, 1), (2, 2))
+]
+*/
+//]

Added: trunk/libs/geometry/doc/src/examples/geometries/register/multi_linestring.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/geometries/register/multi_linestring.cpp 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -0,0 +1,49 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// QuickBook Example
+
+// Copyright (c) 2011 Barend Gehrels, 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)
+
+//[register_multi_linestring
+//` Show the use of the macro BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING
+
+#include <iostream>
+#include <boost/geometry.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include <boost/geometry/multi/geometries/register/multi_linestring.hpp>
+
+typedef boost::geometry::model::linestring
+ <
+ boost::tuple<float, float>
+ > linestring_type;
+
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING(std::deque<linestring_type>)
+
+int main()
+{
+ // Normal usage of std::
+ std::deque<linestring_type> lines(2);
+ boost::geometry::read_wkt("LINESTRING(0 0,1 1)", lines[0]);
+ boost::geometry::read_wkt("LINESTRING(2 2,3 3)", lines[1]);
+
+ // Usage of Boost.Geometry
+ std::cout << "LENGTH: " << boost::geometry::length(lines) << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[register_multi_linestring_output
+/*`
+Output:
+[pre
+LENGTH: 2.82843
+]
+*/
+//]

Added: trunk/libs/geometry/doc/src/examples/geometries/register/multi_point.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/geometries/register/multi_point.cpp 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -0,0 +1,46 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// QuickBook Example
+
+// Copyright (c) 2011 Barend Gehrels, 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)
+
+//[register_multi_point
+//` Show the use of the macro BOOST_GEOMETRY_REGISTER_MULTI_POINT
+
+#include <iostream>
+#include <boost/geometry.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include <boost/geometry/multi/geometries/register/multi_point.hpp>
+
+typedef boost::tuple<float, float> point_type;
+
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_MULTI_POINT(std::deque<::point_type>)
+
+int main()
+{
+ // Normal usage of std::
+ std::deque<point_type> multi_point;
+ multi_point.push_back(point_type(1, 1));
+ multi_point.push_back(point_type(3, 2));
+
+ // Usage of Boost.Geometry
+ std::cout << "WKT: " << boost::geometry::wkt(multi_point) << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[register_multi_point_output
+/*`
+Output:
+[pre
+WKT: MULTIPOINT((1 1),(3 2))
+]
+*/
+//]

Added: trunk/libs/geometry/doc/src/examples/geometries/register/multi_point_templated.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/geometries/register/multi_point_templated.cpp 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -0,0 +1,46 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// QuickBook Example
+
+// Copyright (c) 2011 Barend Gehrels, 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)
+
+//[register_multi_point_templated
+//` Show the use of the macro BOOST_GEOMETRY_REGISTER_MULTI_POINT_TEMPLATED
+
+#include <iostream>
+#include <boost/geometry.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include <boost/geometry/multi/geometries/register/multi_point.hpp>
+
+
+BOOST_GEOMETRY_REGISTER_MULTI_POINT_TEMPLATED(std::deque)
+
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+
+int main()
+{
+ // Normal usage of std::
+ std::deque<boost::tuple<float, float> > multi_point;
+ multi_point.push_back(boost::tuple<float, float>(1, 1));
+ multi_point.push_back(boost::tuple<float, float>(3, 2));
+
+ // Usage of Boost.Geometry
+ std::cout << "WKT: " << boost::geometry::wkt(multi_point) << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[register_multi_point_templated_output
+/*`
+Output:
+[pre
+WKT: MULTIPOINT((1 1),(3 2))
+]
+*/
+//]

Added: trunk/libs/geometry/doc/src/examples/geometries/register/multi_polygon.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/geometries/register/multi_polygon.cpp 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -0,0 +1,49 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// QuickBook Example
+
+// Copyright (c) 2011 Barend Gehrels, 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)
+
+//[register_multi_polygon
+//` Show the use of the macro BOOST_GEOMETRY_REGISTER_MULTI_POLYGON
+
+#include <iostream>
+#include <boost/geometry.hpp>
+#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include <boost/geometry/multi/geometries/register/multi_polygon.hpp>
+
+typedef boost::geometry::model::polygon
+ <
+ boost::tuple<float, float>
+ > polygon_type;
+
+BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
+BOOST_GEOMETRY_REGISTER_MULTI_POLYGON(std::vector<polygon_type>)
+
+int main()
+{
+ // Normal usage of std::
+ std::vector<polygon_type> polygons(2);
+ boost::geometry::read_wkt("POLYGON((0 0,0 1,1 1,1 0,0 0))", polygons[0]);
+ boost::geometry::read_wkt("POLYGON((3 0,3 1,4 1,4 0,3 0))", polygons[1]);
+
+ // Usage of Boost.Geometry
+ std::cout << "AREA: " << boost::geometry::area(polygons) << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[register_multi_polygon_output
+/*`
+Output:
+[pre
+AREA: 2
+]
+*/
+//]

Added: trunk/libs/geometry/doc/src/examples/geometries/register/ring.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/geometries/register/ring.cpp 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -0,0 +1,49 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// QuickBook Example
+
+// Copyright (c) 2011 Barend Gehrels, 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)
+
+//[register_ring
+//` Show the use of the macro BOOST_GEOMETRY_REGISTER_RING
+
+#include <iostream>
+#include <boost/geometry.hpp>
+#include <boost/geometry/geometries/register/ring.hpp>
+
+typedef boost::geometry::model::d2::point_xy<double> point_2d;
+
+BOOST_GEOMETRY_REGISTER_RING(std::vector<point_2d>) /*< The magic: adapt vector to Boost.Geometry Ring Concept >*/
+
+int main()
+{
+ // Normal usage of std::
+ std::vector<point_2d> ring;
+ ring.push_back(point_2d(1, 1));
+ ring.push_back(point_2d(2, 2));
+ ring.push_back(point_2d(2, 1));
+
+
+ // Usage of Boost.Geometry
+ boost::geometry::correct(ring);
+ std::cout << "Area: " << boost::geometry::area(ring) << std::endl;
+ std::cout << "WKT: " << boost::geometry::wkt(ring) << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[register_ring_output
+/*`
+Output:
+[pre
+Area: 0.5
+WKT: POLYGON((1 1,2 2,2 1,1 1))
+]
+*/
+//]

Added: trunk/libs/geometry/doc/src/examples/geometries/register/ring_templated.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/geometries/register/ring_templated.cpp 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -0,0 +1,47 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// QuickBook Example
+
+// Copyright (c) 2011 Barend Gehrels, 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)
+
+//[register_ring_templated
+//` Show the use of the macro BOOST_GEOMETRY_REGISTER_RING_TEMPLATED
+
+#include <iostream>
+#include <deque>
+#include <boost/geometry.hpp>
+#include <boost/geometry/geometries/register/ring.hpp>
+
+// Adapt any deque to Boost.Geometry Ring Concept
+BOOST_GEOMETRY_REGISTER_RING_TEMPLATED(std::deque)
+
+int main()
+{
+ std::deque<boost::geometry::model::d2::point_xy<double> > ring(3);
+ boost::geometry::assign_values(ring[0], 0, 0);
+ boost::geometry::assign_values(ring[2], 4, 1);
+ boost::geometry::assign_values(ring[1], 1, 4);
+
+ // Boost.Geometry algorithms work on any deque now
+ boost::geometry::correct(ring);
+ std::cout << "Area: " << boost::geometry::area(ring) << std::endl;
+ std::cout << "Contents: " << boost::geometry::wkt(ring) << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[register_ring_templated_output
+/*`
+Output:
+[pre
+Area: 7.5
+Line: ((0, 0), (1, 4), (4, 1), (0, 0))
+]
+*/
+//]

Added: trunk/libs/geometry/doc/src/examples/ranges/Jamfile.v2
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/ranges/Jamfile.v2 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -0,0 +1,16 @@
+# Boost.Geometry (aka GGL, Generic Geometry Library)
+#
+# Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2011 Mateusz Loskot, London, UK.
+
+# 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)
+
+
+project boost-geometry-doc-example-ranges
+ : # requirements
+ ;
+
+exe box_range : box_range.cpp ;

Added: trunk/libs/geometry/doc/src/examples/ranges/box_range.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/ranges/box_range.cpp 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -0,0 +1,58 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// QuickBook Example
+
+// Copyright (c) 2011 Barend Gehrels, 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)
+
+//[box_range
+//` Shows usage of the Boost.Range compatible view on a box
+
+#include <iostream>
+
+#include <boost/geometry.hpp>
+
+
+int main()
+{
+ typedef boost::geometry::model::box
+ <
+ boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>
+ > box_type;
+
+ // Define the Boost.Range compatible type:
+ typedef boost::geometry::box_range<box_type> box_range;
+
+ box_type box;
+ boost::geometry::assign_values(box, 0, 0, 4, 4);
+
+ box_range range(box);
+
+ // Iterating in clockwise direction over the points of this box
+ for (boost::range_iterator<box_range const>::type it = boost::begin(range);
+ it != boost::end(range); ++it)
+ {
+ std::cout << " " << boost::geometry::dsv(*it);
+ }
+ std::cout << std::endl;
+
+ // Note that a box_range is tagged as a ring, so supports area etc.
+ std::cout << "Area: " << boost::geometry::area(range) << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[box_range_output
+/*`
+Output:
+[pre
+ (0, 0) (0, 4) (4, 4) (4, 0) (0, 0)
+Area: 16
+]
+*/
+//]

Modified: trunk/libs/geometry/example/c03_custom_linestring_example.cpp
==============================================================================
--- trunk/libs/geometry/example/c03_custom_linestring_example.cpp (original)
+++ trunk/libs/geometry/example/c03_custom_linestring_example.cpp 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -16,6 +16,7 @@
 
 #include <boost/geometry/geometry.hpp>
 #include <boost/geometry/geometries/register/point.hpp>
+#include <boost/geometry/geometries/register/linestring.hpp>
 
 // To register the 'geographic' distance function to calculate distance over the earth:
 #include <boost/geometry/extensions/gis/geographic/strategies/andoyer.hpp>
@@ -58,11 +59,8 @@
 // Register this point as being a recognizable point by Boost.Geometry
 BOOST_GEOMETRY_REGISTER_POINT_2D(gps_point, double, cs::geographic<degree>, longitude, latitude)
 
-
 // Register the track as well, as being a "linestring"
-namespace boost { namespace geometry { namespace traits {
-template <> struct tag<gps_track> { typedef ring_tag type; };
-}}}
+BOOST_GEOMETRY_REGISTER_LINESTRING(gps_track)
 
 
 int main()

Modified: trunk/libs/geometry/example/c04_a_custom_triangle_example.cpp
==============================================================================
--- trunk/libs/geometry/example/c04_a_custom_triangle_example.cpp (original)
+++ trunk/libs/geometry/example/c04_a_custom_triangle_example.cpp 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -16,6 +16,7 @@
 
 #include <boost/geometry/algorithms/area.hpp>
 #include <boost/geometry/algorithms/centroid.hpp>
+#include <boost/geometry/geometries/register/ring.hpp>
 #include <boost/geometry/strategies/strategies.hpp>
 #include <boost/geometry/util/write_dsv.hpp>
 
@@ -30,9 +31,7 @@
 
 
 // Register triangle as a ring
-namespace boost { namespace geometry { namespace traits {
-template <> struct tag<triangle> { typedef ring_tag type; };
-}}}
+BOOST_GEOMETRY_REGISTER_RING(triangle)
 
 
 // Specializations of algorithms, where useful. If not specialized the default ones

Modified: trunk/libs/geometry/example/c04_b_custom_triangle_example.cpp
==============================================================================
--- trunk/libs/geometry/example/c04_b_custom_triangle_example.cpp (original)
+++ trunk/libs/geometry/example/c04_b_custom_triangle_example.cpp 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -18,6 +18,7 @@
 #include <boost/geometry/algorithms/area.hpp>
 #include <boost/geometry/algorithms/centroid.hpp>
 #include <boost/geometry/geometries/adapted/boost_tuple.hpp>
+#include <boost/geometry/geometries/register/ring.hpp>
 #include <boost/geometry/strategies/strategies.hpp>
 #include <boost/geometry/util/write_dsv.hpp>
 
@@ -31,9 +32,7 @@
 
 
 // Register triangle<P> as a ring
-namespace boost { namespace geometry { namespace traits {
-template <typename P> struct tag<triangle<P> > { typedef ring_tag type; };
-}}}
+BOOST_GEOMETRY_REGISTER_RING_TEMPLATED(triangle)
 
 
 namespace boost { namespace geometry { namespace dispatch {

Modified: trunk/libs/geometry/example/c06_custom_polygon_example.cpp
==============================================================================
--- trunk/libs/geometry/example/c06_custom_polygon_example.cpp (original)
+++ trunk/libs/geometry/example/c06_custom_polygon_example.cpp 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -14,6 +14,7 @@
 #include <boost/geometry/geometry.hpp>
 
 #include <boost/geometry/geometries/register/point.hpp>
+#include <boost/geometry/geometries/register/ring.hpp>
 
 
 struct my_point
@@ -48,11 +49,7 @@
 
 // We can conveniently use macro's to register point and ring
 BOOST_GEOMETRY_REGISTER_POINT_2D(my_point, double, cs::cartesian, x, y)
-
-// Register my_ring as a ring
-namespace boost { namespace geometry { namespace traits {
-template <> struct tag<my_ring> { typedef ring_tag type; };
-}}}
+BOOST_GEOMETRY_REGISTER_RING(my_ring)
 
 
 
@@ -76,7 +73,6 @@
     typedef boost::array<my_ring, 2>& type;
 };
 
-
 template<> struct exterior_ring<my_polygon>
 {
     static my_ring& get(my_polygon& p)

Modified: trunk/libs/geometry/example/c08_custom_non_std_example.cpp
==============================================================================
--- trunk/libs/geometry/example/c08_custom_non_std_example.cpp (original)
+++ trunk/libs/geometry/example/c08_custom_non_std_example.cpp 2011-05-04 12:14:26 EDT (Wed, 04 May 2011)
@@ -20,6 +20,7 @@
 
 #include <boost/geometry/geometry.hpp>
 #include <boost/geometry/geometries/register/point.hpp>
+#include <boost/geometry/geometries/register/ring.hpp>
 #include <boost/geometry/util/add_const_if_c.hpp>
 
 // Sample point, having x/y
@@ -215,9 +216,7 @@
 // 4) register with Boost.Geometry
 BOOST_GEOMETRY_REGISTER_POINT_2D(my_point, double, cs::cartesian, x, y)
 
-namespace boost { namespace geometry { namespace traits {
-template <> struct tag<my_polygon> { typedef ring_tag type; };
-}}}
+BOOST_GEOMETRY_REGISTER_RING(my_polygon)
 
 
 // end adaption
@@ -238,7 +237,7 @@
 
 void walk_using_range(my_polygon const& polygon)
 {
- for (boost::range_iterator<const my_polygon>::type it
+ for (boost::range_iterator<my_polygon const>::type it
             = boost::begin(polygon);
         it != boost::end(polygon);
         ++it)


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