Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71123 - in trunk/libs/geometry/doc: . other reference/algorithms src/examples/algorithms
From: barend.gehrels_at_[hidden]
Date: 2011-04-08 16:17:50


Author: barendgehrels
Date: 2011-04-08 16:17:49 EDT (Fri, 08 Apr 2011)
New Revision: 71123
URL: http://svn.boost.org/trac/boost/changeset/71123

Log:
Doc update, added samples of clear, expand, reverse, unique
Removed convert from doc
Added:
   trunk/libs/geometry/doc/reference/algorithms/clear.qbk (contents, props changed)
   trunk/libs/geometry/doc/reference/algorithms/expand.qbk (contents, props changed)
   trunk/libs/geometry/doc/reference/algorithms/reverse.qbk (contents, props changed)
   trunk/libs/geometry/doc/reference/algorithms/unique.qbk (contents, props changed)
   trunk/libs/geometry/doc/src/examples/algorithms/expand.cpp (contents, props changed)
   trunk/libs/geometry/doc/src/examples/algorithms/reverse.cpp (contents, props changed)
   trunk/libs/geometry/doc/src/examples/algorithms/unique.cpp (contents, props changed)
Binary files modified:
   trunk/libs/geometry/doc/other/status.xls
Text files modified:
   trunk/libs/geometry/doc/geometry.qbk | 4 +++-
   trunk/libs/geometry/doc/imports.qbk | 4 ++++
   trunk/libs/geometry/doc/quickref.xml | 4 ----
   trunk/libs/geometry/doc/reference.qbk | 4 ----
   trunk/libs/geometry/doc/src/examples/algorithms/clear.cpp | 4 ++--
   trunk/libs/geometry/doc/src/examples/algorithms/num_interior_rings.cpp | 2 +-
   6 files changed, 10 insertions(+), 12 deletions(-)

Modified: trunk/libs/geometry/doc/geometry.qbk
==============================================================================
--- trunk/libs/geometry/doc/geometry.qbk (original)
+++ trunk/libs/geometry/doc/geometry.qbk 2011-04-08 16:17:49 EDT (Fri, 08 Apr 2011)
@@ -42,7 +42,8 @@
 [def __linestring__ Linestring]
 [def __polygon__ Polygon]
 [def __ring__ Ring]
-[def __multi_point__ Multi point]
+[def __multi_point__ Multi Point]
+[def __multi_linestring__ Multi Linestring]
 [def __multi_polygon__ Multi Polygon]
 [def __range__ Rangelike (linestring, ring)]
 [def __other__ Other geometries]
@@ -51,6 +52,7 @@
 [/Parts]
 [def __ret_zero__ Returns zero]
 [def __ret_one__ Returns 1]
+[def __does_nothing__ Nothing happens, geometry is unchanged]
 [def __cs_units__ in the same units as the input coordinates]
 [def __sph1__ on a unit sphere (or another sphere, if specified as such in the constructor of the strategy)]
 [template qbk_ret[what] Returns [what]]

Modified: trunk/libs/geometry/doc/imports.qbk
==============================================================================
--- trunk/libs/geometry/doc/imports.qbk (original)
+++ trunk/libs/geometry/doc/imports.qbk 2011-04-08 16:17:49 EDT (Fri, 08 Apr 2011)
@@ -21,10 +21,12 @@
 [import src/examples/algorithms/assign_with_range.cpp]
 [import src/examples/algorithms/assign_point_to_index.cpp]
 [import src/examples/algorithms/assign_point_from_index.cpp]
+[import src/examples/algorithms/clear.cpp]
 [import src/examples/algorithms/centroid.cpp]
 [import src/examples/algorithms/distance.cpp]
 [import src/examples/algorithms/difference.cpp]
 [import src/examples/algorithms/envelope.cpp]
+[import src/examples/algorithms/expand.cpp]
 [import src/examples/algorithms/for_each_point.cpp]
 [import src/examples/algorithms/for_each_point_const.cpp]
 [import src/examples/algorithms/for_each_segment_const.cpp]
@@ -41,10 +43,12 @@
 [import src/examples/algorithms/num_geometries.cpp]
 [import src/examples/algorithms/num_interior_rings.cpp]
 [import src/examples/algorithms/num_points.cpp]
+[import src/examples/algorithms/reverse.cpp]
 [import src/examples/algorithms/return_envelope.cpp]
 [import src/examples/algorithms/simplify.cpp]
 [import src/examples/algorithms/sym_difference.cpp]
 [import src/examples/algorithms/union.cpp]
+[import src/examples/algorithms/unique.cpp]
 [import src/examples/algorithms/within.cpp]
 [import src/examples/core/get_point.cpp]
 [import src/examples/core/get_box.cpp]

Modified: trunk/libs/geometry/doc/other/status.xls
==============================================================================
Binary files. No diff available.

Modified: trunk/libs/geometry/doc/quickref.xml
==============================================================================
--- trunk/libs/geometry/doc/quickref.xml (original)
+++ trunk/libs/geometry/doc/quickref.xml 2011-04-08 16:17:49 EDT (Fri, 08 Apr 2011)
@@ -315,10 +315,6 @@
     <simplelist type="vert" columns="1">
      <member><link linkend="geometry.reference.algorithms.clear">clear</link></member>
     </simplelist>
- <bridgehead renderas="sect3">Convert</bridgehead>
- <simplelist type="vert" columns="1">
- <member><link linkend="geometry.reference.algorithms.convert">convert</link></member>
- </simplelist>
     <bridgehead renderas="sect3">Convex Hull</bridgehead>
     <simplelist type="vert" columns="1">
      <member><link linkend="geometry.reference.algorithms.convex_hull">convex_hull</link></member>

Modified: trunk/libs/geometry/doc/reference.qbk
==============================================================================
--- trunk/libs/geometry/doc/reference.qbk (original)
+++ trunk/libs/geometry/doc/reference.qbk 2011-04-08 16:17:49 EDT (Fri, 08 Apr 2011)
@@ -69,10 +69,6 @@
 [include generated/clear.qbk]
 [endsect]
 
-[section:convert convert]
-[include generated/convert.qbk]
-[endsect]
-
 [section:convex_hull convex_hull]
 [include generated/convex_hull.qbk]
 [endsect]

Added: trunk/libs/geometry/doc/reference/algorithms/clear.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/reference/algorithms/clear.qbk 2011-04-08 16:17:49 EDT (Fri, 08 Apr 2011)
@@ -0,0 +1,35 @@
+[/============================================================================
+ Boost.Geometry (aka GGL, Generic Geometry Library)
+
+ Copyright (c) 2009-2011 Barend Gehrels, Amsterdam, the Netherlands.
+ Copyright (c) 2009-2011 Mateusz Loskot, London, UK.
+ Copyright (c) 2009-2011 Bruno Lalande, Paris, France.
+
+ 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)
+=============================================================================/]
+
+[def __is_cleared__ is cleared]
+
+[heading Behavior]
+[table
+[[Case] [Behavior] ]
+[[__point__][__does_nothing__]]
+[[__segment__][__does_nothing__]]
+[[__box__][__does_nothing__]]
+[[__linestring__][__linestring__ __is_cleared__]]
+[[__ring__][__ring__ is cleared]]
+[[__polygon__][The exterior ring __is_cleared__ and all interior rings are removed]]
+[[__multi_point__][__multi_point__ __is_cleared__]]
+[[__multi_linestring__][__multi_linestring__ __is_cleared__]]
+[[__multi_polygon__][__multi_polygon__ __is_cleared__]]
+]
+
+[heading Complexity]
+Constant
+
+[heading Examples]
+[clear]
+[clear_output]
+

Added: trunk/libs/geometry/doc/reference/algorithms/expand.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/reference/algorithms/expand.qbk 2011-04-08 16:17:49 EDT (Fri, 08 Apr 2011)
@@ -0,0 +1,32 @@
+[/============================================================================
+ Boost.Geometry (aka GGL, Generic Geometry Library)
+
+ Copyright (c) 2009-2011 Barend Gehrels, Amsterdam, the Netherlands.
+ Copyright (c) 2009-2011 Mateusz Loskot, London, UK.
+ Copyright (c) 2009-2011 Bruno Lalande, Paris, France.
+
+ 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)
+=============================================================================/]
+
+[def __apply_expand__ Box is expanded to include the specified]
+
+[heading Behavior]
+[table
+[[Case] [Behavior] ]
+[[__box__ / __point__][__apply_expand__ __point__]]
+[[__box__ / __box__][__apply_expand__ __box__]]
+[[__box__ / __other__][__nyiversion__]]
+]
+
+[tip Expand is not defined within OGC or ISO]
+[note To use expand with another geometry type then specified, use expand(make_envelope<box_type>(geometry)]
+
+[heading Complexity]
+Linear
+
+[heading Examples]
+[expand]
+[expand_output]
+

Added: trunk/libs/geometry/doc/reference/algorithms/reverse.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/reference/algorithms/reverse.qbk 2011-04-08 16:17:49 EDT (Fri, 08 Apr 2011)
@@ -0,0 +1,38 @@
+[/============================================================================
+ Boost.Geometry (aka GGL, Generic Geometry Library)
+
+ Copyright (c) 2009-2011 Barend Gehrels, Amsterdam, the Netherlands.
+ Copyright (c) 2009-2011 Mateusz Loskot, London, UK.
+ Copyright (c) 2009-2011 Bruno Lalande, Paris, France.
+
+ 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)
+=============================================================================/]
+
+
+[heading Behavior]
+[table
+[[Case] [Behavior] ]
+[[__point__][__does_nothing__]]
+[[__segment__][__nyiversion__]]
+[[__box__][__does_nothing__]]
+[[__linestring__][Reverses the __linestring__]]
+[[__ring__][Reverses the __ring__]]
+[[__polygon__][Reverses the exterior ring and all interior rings in the polygon]]
+[[__multi_point__][__does_nothing__]]
+[[__multi_linestring__][Reverses all contained linestrings individually]]
+[[__multi_polygon__][Reverses all contained polygons individually]]
+]
+
+[note The reverse of a (multi)polygon or ring might make a valid geometry invalid because the (counter)clockwise orientation reverses.]
+
+[tip Conforms to std::reverse functionality. It is not defined within OGC or ISO]
+
+[heading Complexity]
+Linear
+
+[heading Examples]
+[reverse]
+[reverse_output]
+

Added: trunk/libs/geometry/doc/reference/algorithms/unique.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/reference/algorithms/unique.qbk 2011-04-08 16:17:49 EDT (Fri, 08 Apr 2011)
@@ -0,0 +1,37 @@
+[/============================================================================
+ Boost.Geometry (aka GGL, Generic Geometry Library)
+
+ Copyright (c) 2009-2011 Barend Gehrels, Amsterdam, the Netherlands.
+ Copyright (c) 2009-2011 Mateusz Loskot, London, UK.
+ Copyright (c) 2009-2011 Bruno Lalande, Paris, France.
+
+ 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)
+=============================================================================/]
+
+[def __applies_unique__ Removes all consecutive duplicate points]
+
+[heading Behavior]
+[table
+[[Case] [Behavior] ]
+[[__point__][__does_nothing__]]
+[[__segment__][__does_nothing__]]
+[[__box__][__does_nothing__]]
+[[__linestring__][__applies_unique__]]
+[[__ring__][__applies_unique__]]
+[[__polygon__][__applies_unique__ in all rings]]
+[[__multi_point__][__does_nothing__. Even if two equal points happen to be stored consecutively, they are kept]]
+[[__multi_linestring__][__applies_unique__ in all contained linestrings]]
+[[__multi_polygon__][__applies_unique__ in all contained polygons (all rings)]]
+]
+
+[tip Conforms to std::unique functionality. It is not defined within OGC or ISO]
+
+[heading Complexity]
+Linear
+
+[heading Examples]
+[unique]
+[unique_output]
+

Modified: trunk/libs/geometry/doc/src/examples/algorithms/clear.cpp
==============================================================================
--- trunk/libs/geometry/doc/src/examples/algorithms/clear.cpp (original)
+++ trunk/libs/geometry/doc/src/examples/algorithms/clear.cpp 2011-04-08 16:17:49 EDT (Fri, 08 Apr 2011)
@@ -29,8 +29,8 @@
     polygon poly;
 
     // Fill the polygon (using its own methods + Boost.Assign)
- poly.outer() = tuple_list_of(0, 0)(0, 10)(11, 11)(0, 0);
- poly.inners().push_back(tuple_list_of(0, 0)(0, 10)(11, 11)(0, 0));
+ poly.outer() = tuple_list_of(0, 0)(0, 9)(10, 10)(0, 0);
+ poly.inners().push_back(tuple_list_of(1, 2)(4, 6)(2, 8)(1, 2));
 
     std::cout << boost::geometry::dsv(poly) << std::endl;
     boost::geometry::clear(poly);

Added: trunk/libs/geometry/doc/src/examples/algorithms/expand.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/algorithms/expand.cpp 2011-04-08 16:17:49 EDT (Fri, 08 Apr 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)
+
+//[expand
+//` Shows the usage of expand
+
+#include <iostream>
+#include <list>
+
+#include <boost/geometry/geometry.hpp>
+
+int main()
+{
+ typedef boost::geometry::model::d2::point_xy<short int> point_type;
+ typedef boost::geometry::model::box<point_type> box_type;
+
+ using boost::geometry::expand;
+
+ box_type box = boost::geometry::make_inverse<box_type>(); /*< expand is usually preceded by a call to assign_inverse or make_inverse >*/
+
+ expand(box, point_type(0, 0));
+ expand(box, point_type(1, 2));
+ expand(box, point_type(5, 4));
+ expand(box, boost::geometry::make<box_type>(3, 3, 5, 5));
+
+ std::cout << boost::geometry::dsv(box) << std::endl;
+
+ return 0;
+}
+
+//]
+
+//[expand_output
+/*`
+Output:
+[pre
+((0, 0), (5, 5))
+]
+*/
+//]

Modified: trunk/libs/geometry/doc/src/examples/algorithms/num_interior_rings.cpp
==============================================================================
--- trunk/libs/geometry/doc/src/examples/algorithms/num_interior_rings.cpp (original)
+++ trunk/libs/geometry/doc/src/examples/algorithms/num_interior_rings.cpp 2011-04-08 16:17:49 EDT (Fri, 08 Apr 2011)
@@ -8,7 +8,7 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 
 //[num_interior_rings
-//` Get the number of interior rings in a polygon or multi-polygon
+//` Get the number of interior rings in a multi-polygon
 
 #include <iostream>
 

Added: trunk/libs/geometry/doc/src/examples/algorithms/reverse.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/algorithms/reverse.cpp 2011-04-08 16:17:49 EDT (Fri, 08 Apr 2011)
@@ -0,0 +1,64 @@
+// 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)
+
+//[reverse
+//` Shows how to reverse a ring or polygon
+
+#include <iostream>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
+
+#include <boost/assign.hpp>
+
+int main()
+{
+ using boost::assign::tuple_list_of;
+
+ typedef boost::tuple<int, int> point;
+ typedef boost::geometry::model::polygon<point> polygon;
+ typedef boost::geometry::model::ring<point> ring;
+
+
+ polygon poly;
+ boost::geometry::exterior_ring(poly) = tuple_list_of(0, 0)(0, 9)(10, 10)(0, 0);
+ boost::geometry::interior_rings(poly).push_back(tuple_list_of(1, 2)(4, 6)(2, 8)(1, 2));
+
+ double area_before = boost::geometry::area(poly);
+ boost::geometry::reverse(poly);
+ double area_after = boost::geometry::area(poly);
+ std::cout << boost::geometry::dsv(poly) << std::endl;
+ std::cout << area_before << " -> " << area_after << std::endl;
+
+ ring r = tuple_list_of(0, 0)(0, 9)(8, 8)(0, 0);
+
+ area_before = boost::geometry::area(r);
+ boost::geometry::reverse(r);
+ area_after = boost::geometry::area(r);
+ std::cout << boost::geometry::dsv(r) << std::endl;
+ std::cout << area_before << " -> " << area_after << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[reverse_output
+/*`
+Output:
+[pre
+(((0, 0), (10, 10), (0, 9), (0, 0)), ((1, 2), (2, 8), (4, 6), (1, 2)))
+38 -> -38
+((0, 0), (8, 8), (0, 9), (0, 0))
+36 -> -36
+]
+*/
+//]

Added: trunk/libs/geometry/doc/src/examples/algorithms/unique.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/algorithms/unique.cpp 2011-04-08 16:17:49 EDT (Fri, 08 Apr 2011)
@@ -0,0 +1,38 @@
+// 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)
+
+//[unique
+//` Shows how to make a so-called minimal set of a polygon by removing duplicate points
+
+#include <iostream>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
+
+int main()
+{
+ boost::geometry::model::polygon<boost::tuple<double, double> > poly;
+ boost::geometry::read_wkt("POLYGON((0 0,0 0,0 5,5 5,5 5,5 5,5 0,5 0,0 0,0 0,0 0,0 0))", poly);
+ boost::geometry::unique(poly);
+ std::cout << boost::geometry::wkt(poly) << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[unique_output
+/*`
+Output:
+[pre
+POLYGON((0 0,0 5,5 5,5 0,0 0))
+]
+*/
+//]


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