diff --git a/doc/geometry.qbk b/doc/geometry.qbk index b09ce0dff..9afc867b2 100644 --- a/doc/geometry.qbk +++ b/doc/geometry.qbk @@ -30,7 +30,7 @@ [def __1dim__ linear (e.g. linestring)] [def __2dim__ areal (e.g. polygon)] [def __single__ single (e.g. point, polygon)] -[def __multi__ single (e.g. multi_point, multi_polygon)] +[def __multi__ multiple (e.g. multi_point, multi_polygon)] [def __cart__ Cartesian] [def __sph__ Spherical] [def __geo__ Geographic] @@ -76,6 +76,9 @@ Simplify algorithm [link geometry.reference.algorithms.simplify.simplify_3 here] [import src/examples/algorithms/intersection_ls_ls_point.cpp] [import src/examples/algorithms/intersection_segment.cpp] [import src/examples/algorithms/intersects_linestring.cpp] +[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/simplify.cpp] [import src/examples/algorithms/simplify_inserter.cpp] [import src/examples/core/get_point.cpp] diff --git a/doc/quickref.xml b/doc/quickref.xml index 13865797e..87680bf63 100644 --- a/doc/quickref.xml +++ b/doc/quickref.xml @@ -157,12 +157,12 @@ Access Functions - exterior_ring + get - interior_rings - num_interior_rings - num_points set + exterior_ring + interior_rings Classes @@ -362,6 +362,15 @@ length + + Num_ (counting) + + num_interior_rings + num_geometries + num_points + + + Perimeter perimeter diff --git a/doc/ref/algorithms/num_geometries.qbk b/doc/ref/algorithms/num_geometries.qbk index 83787b0da..ce4de4c5a 100644 --- a/doc/ref/algorithms/num_geometries.qbk +++ b/doc/ref/algorithms/num_geometries.qbk @@ -20,3 +20,8 @@ [heading Complexity] Constant + +[heading Examples] +[num_geometries] +[num_geometries_output] + diff --git a/doc/ref/algorithms/num_interior_rings.qbk b/doc/ref/algorithms/num_interior_rings.qbk index c22a916e7..ee27b6186 100644 --- a/doc/ref/algorithms/num_interior_rings.qbk +++ b/doc/ref/algorithms/num_interior_rings.qbk @@ -13,11 +13,16 @@ [heading Behavior] [table [[Case] [Behavior] ] -[[__polygon__][[qbk_ret number of its interior rings]]] -[[__multi_polygon__][[qbk_ret number of the interior rings of all polygons]]] +[[__polygon__][[qbk_ret the number of its interior rings]]] +[[__multi_polygon__][[qbk_ret the number of the interior rings of all polygons]]] [[__other__][[qbk_ret 0]]] ] [heading Complexity] Constant + +[heading Examples] +[num_interior_rings] +[num_interior_rings_output] + diff --git a/doc/ref/algorithms/num_points.qbk b/doc/ref/algorithms/num_points.qbk index 7764fa5d4..70db18b43 100644 --- a/doc/ref/algorithms/num_points.qbk +++ b/doc/ref/algorithms/num_points.qbk @@ -18,8 +18,15 @@ [[__box__][[qbk_ret 4]]] [[__range__][[qbk_ret boost::size(geometry)]]] [[__other__][[qbk_ret the sum of the number of points of its elements]]] +[[Open geometries][[qbk_ret the sum of the number of points of its elements, it adds one for open if specified]]] +[[Closed geometries][[qbk_ret the sum of the number of points of its elements]]] ] [heading Complexity] Constant or Linear + +[heading Examples] +[num_points] +[num_points_output] + diff --git a/doc/ref/core/get_box.qbk b/doc/ref/core/get_box.qbk index 1e78c1e51..5971ef28e 100644 --- a/doc/ref/core/get_box.qbk +++ b/doc/ref/core/get_box.qbk @@ -11,8 +11,8 @@ [heading Behavior] [table [[Case] [Behavior] ] -[[__box__][Returns the coordinate of a box (use min_corner, max_corner to specify which of the points to set) ]] -[[__segment__][Returns the coordinate of a segment (use 0, 1 to specify which of the two points to set) ]] +[[__box__][Returns the coordinate of a box (use min_corner, max_corner to specify which of the points to get) ]] +[[__segment__][Returns the coordinate of a segment (use 0, 1 to specify which of the two points to get) ]] ] [heading Complexity] diff --git a/doc/reference.qbk b/doc/reference.qbk index 5d1ca9469..f32cccd5e 100644 --- a/doc/reference.qbk +++ b/doc/reference.qbk @@ -12,32 +12,36 @@ [section:reference Reference] -[section:core Core Metafunctions] -[include reference/closure.qbk] -[include reference/coordinate_system.qbk] -[include reference/coordinate_type.qbk] -[include reference/cs_tag.qbk] -[include reference/dimension.qbk] -[include reference/exception.qbk] -[include reference/geometry_id.qbk] -[include reference/interior_type.qbk] -[include reference/is_areal.qbk] -[include reference/is_linear.qbk] -[include reference/is_multi.qbk] -[include reference/is_radian.qbk] -[include reference/point_order.qbk] -[include reference/point_type.qbk] -[include reference/ring_type.qbk] -[include reference/tag.qbk] -[include reference/topological_dimension.qbk] -[endsect] [/core metafunctions] -[section:cs Coordinate Systems] -[include reference/cartesian.qbk] -[include reference/spherical.qbk] -[include reference/geographic.qbk] -[endsect] [/coordinate systems] +[section:access Access Functions] +[/ This section is not ordered alfabetically + to have get/set first and then the rings] + +[section:get get] +[include reference/get.qbk] +[endsect] + +[section:set set] +[include reference/set.qbk] +[endsect] + +[section:exterior_ring exterior_ring] +[include reference/exterior_ring.qbk] +[endsect] + +[section:interior_rings interior_rings] +[include reference/interior_rings.qbk] +[endsect] + + +[endsect] [/access functions] + + + +[section:register Adaption and adapted models] +[include reference/register.qbk] +[endsect] [section:algorithms Algorithms] @@ -125,8 +129,11 @@ [include reference/make.qbk] [endsect] +[include reference/num_geometries.qbk] +[include reference/num_interior_rings.qbk] [include reference/num_points.qbk] + [section:overlaps overlaps] [include reference/overlaps.qbk] [endsect] @@ -162,28 +169,11 @@ [endsect] [/algorithms] -[section:access Access Functions] -[section:exterior_ring exterior_ring] -[include reference/exterior_ring.qbk] -[endsect] +[section:arithmetic Arithmetic] +[include reference/arithmetic.qbk] +[endsect] -[section:get get] -[include reference/get.qbk] -[endsect] - -[section:interior_rings interior_rings] -[include reference/interior_rings.qbk] -[endsect] - -[include reference/num_points.qbk] -[include reference/num_interior_rings.qbk] - -[section:set set] -[include reference/set.qbk] -[endsect] - -[endsect] [/access functions] [section:concepts Concepts] @@ -196,7 +186,54 @@ [include concept/box.qbk] [include concept/ring.qbk] [include concept/segment.qbk] -[endsect] +[endsect] [/concepts] + +[section:cs Coordinate Systems] +[include reference/cartesian.qbk] +[include reference/spherical.qbk] +[include reference/geographic.qbk] +[endsect] [/coordinate systems] + + + +[section:core Core Metafunctions] +[include reference/closure.qbk] +[include reference/coordinate_system.qbk] +[include reference/coordinate_type.qbk] +[include reference/cs_tag.qbk] +[include reference/dimension.qbk] +[include reference/exception.qbk] +[include reference/geometry_id.qbk] +[include reference/interior_type.qbk] +[include reference/is_areal.qbk] +[include reference/is_linear.qbk] +[include reference/is_multi.qbk] +[include reference/is_radian.qbk] +[include reference/point_order.qbk] +[include reference/point_type.qbk] +[include reference/ring_type.qbk] +[include reference/tag.qbk] +[include reference/topological_dimension.qbk] +[endsect] [/core metafunctions] + + +[section:enumerations Enumerations] +[include reference/enum.qbk] +[endsect] + +[section:exceptions Exceptions] +[include reference/exception.qbk] +[include reference/centroid_exception.qbk] +[endsect] + + +[section:iterators Iterators] +[include reference/closing_iterator.qbk] +[include reference/box_iterator.qbk] +[include reference/circular_iterator.qbk] +[include reference/ever_circling_iterator.qbk] +[include reference/segment_range_iterator.qbk] +[endsect] [section:models Models] @@ -214,9 +251,6 @@ [include reference/referring_segment.qbk] [endsect] -[section:register Adaption and adapted models] -[include reference/register.qbk] -[endsect] [section:strategies Strategies] [include reference/distance_pythagoras.qbk] @@ -243,16 +277,6 @@ [endsect] - - -[section:iterators Iterators] -[include reference/closing_iterator.qbk] -[include reference/box_iterator.qbk] -[include reference/circular_iterator.qbk] -[include reference/ever_circling_iterator.qbk] -[include reference/segment_range_iterator.qbk] -[endsect] - [section:ranges Ranges] [include reference/box_range.qbk] [include reference/segment_range.qbk] @@ -261,18 +285,5 @@ [include reference/identity_view.qbk] [endsect] -[section:arithmetic Arithmetic] -[include reference/arithmetic.qbk] -[endsect] - -[section:exceptions Exceptions] -[include reference/exception.qbk] -[include reference/centroid_exception.qbk] -[endsect] - -[section:enumerations Enumerations] -[include reference/enum.qbk] -[endsect] - [endsect] [/reference] diff --git a/doc/reference/num_geometries.qbk b/doc/reference/num_geometries.qbk index 46f41a5c3..2341af91c 100644 --- a/doc/reference/num_geometries.qbk +++ b/doc/reference/num_geometries.qbk @@ -42,7 +42,7 @@ Either Or -`#include ` +`#include ` [include ref/algorithms/num_geometries.qbk] diff --git a/doc/reference/num_interior_rings.qbk b/doc/reference/num_interior_rings.qbk index fd27d2e3e..a9c7e4a8c 100644 --- a/doc/reference/num_interior_rings.qbk +++ b/doc/reference/num_interior_rings.qbk @@ -42,7 +42,7 @@ Either Or -`#include ` +`#include ` [include ref/algorithms/num_interior_rings.qbk] diff --git a/doc/reference/tag.qbk b/doc/reference/tag.qbk index c6f50f367..169242d98 100644 --- a/doc/reference/tag.qbk +++ b/doc/reference/tag.qbk @@ -18,7 +18,7 @@ Meta-function to get the tag of any geometry type. [heading Description] -All geometries tell their geometry type (point, linestring, polygon, etc) by implementing a tag traits class. This meta-function uses that traits class to retrieve the tag. If the input type is not a geometry at all, a geometry_not_recognized_tag will be returned. +All geometries tell their geometry type (point, linestring, polygon, etc) by implementing a tag traits class. This meta-function uses that traits class to retrieve the tag. [heading Synopsis] ``template diff --git a/doc/src/examples/algorithms/Jamfile.v2 b/doc/src/examples/algorithms/Jamfile.v2 index 54ecd5c77..cd2cd8b54 100644 --- a/doc/src/examples/algorithms/Jamfile.v2 +++ b/doc/src/examples/algorithms/Jamfile.v2 @@ -19,6 +19,11 @@ exe intersection_segment : intersection_segment.cpp ; exe intersects_linestring : intersects_linestring.cpp ; +exe num_geometries : num_geometries.cpp ; +exe num_interior_rings : num_interior_rings.cpp ; +exe num_points : num_points.cpp ; + + exe length : length.cpp ; exe length_with_strategy : length_with_strategy.cpp ; diff --git a/doc/src/examples/algorithms/num_geometries.cpp b/doc/src/examples/algorithms/num_geometries.cpp new file mode 100644 index 000000000..4ce57a3cf --- /dev/null +++ b/doc/src/examples/algorithms/num_geometries.cpp @@ -0,0 +1,47 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Copyright Barend Gehrels 2011, 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) +// +// Quickbook Example + +//[num_geometries +//` Get the number of geometries making up a multi-geometry + +#include + +#include +#include +#include +#include +#include + + +int main() +{ + boost::geometry::model::multi_polygon + < + boost::geometry::model::polygon + < + boost::geometry::model::d2::point_xy + > + > mp; + boost::geometry::read_wkt("MULTIPOLYGON(((0 0,0 10,10 0,0 0),(1 1,1 9,9 1,1 1)),((10 10,10 7,7 10,10 10)))", mp); + std::cout << "Number of geometries: " << boost::geometry::num_geometries(mp) << std::endl; + + return 0; +} + +//] + + +//[num_geometries_output +/*` +Output: +[pre + Number of geometries: 2 +] +*/ +//] diff --git a/doc/src/examples/algorithms/num_interior_rings.cpp b/doc/src/examples/algorithms/num_interior_rings.cpp new file mode 100644 index 000000000..ce129729c --- /dev/null +++ b/doc/src/examples/algorithms/num_interior_rings.cpp @@ -0,0 +1,47 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Copyright Barend Gehrels 2011, 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) +// +// Quickbook Example + +//[num_interior_rings +//` Get the number of interior rings in a polygon or multi-polygon + +#include + +#include +#include +#include +#include +#include + + +int main() +{ + boost::geometry::model::multi_polygon + < + boost::geometry::model::polygon + < + boost::geometry::model::d2::point_xy + > + > mp; + boost::geometry::read_wkt("MULTIPOLYGON(((0 0,0 10,10 0,0 0),(1 1,1 9,9 1,1 1)),((10 10,10 7,7 10,10 10)))", mp); + std::cout << "Number of interior rings: " << boost::geometry::num_interior_rings(mp) << std::endl; + + return 0; +} + +//] + + +//[num_interior_rings_output +/*` +Output: +[pre + Number of interior rings: 1 +] +*/ +//] diff --git a/doc/src/examples/algorithms/num_points.cpp b/doc/src/examples/algorithms/num_points.cpp new file mode 100644 index 000000000..719f5bc8f --- /dev/null +++ b/doc/src/examples/algorithms/num_points.cpp @@ -0,0 +1,47 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Copyright Barend Gehrels 2011, 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) +// +// Quickbook Example + +//[num_points +//` Get the number of points in a geometry + +#include + +#include +#include +#include +#include +#include + + +int main() +{ + boost::geometry::model::multi_polygon + < + boost::geometry::model::polygon + < + boost::geometry::model::d2::point_xy + > + > mp; + boost::geometry::read_wkt("MULTIPOLYGON(((0 0,0 10,10 0,0 0),(1 1,1 9,9 1,1 1)),((10 10,10 7,7 10,10 10)))", mp); + std::cout << "Number of points: " << boost::geometry::num_points(mp) << std::endl; + + return 0; +} + +//] + + +//[num_points_output +/*` +Output: +[pre + Number of points: 12 +] +*/ +//] diff --git a/doc/src/examples/core/get_box.cpp b/doc/src/examples/core/get_box.cpp index 619cb3d28..79f45f1c3 100644 --- a/doc/src/examples/core/get_box.cpp +++ b/doc/src/examples/core/get_box.cpp @@ -8,7 +8,7 @@ // Quickbook Example //[get_box -//` Set the coordinate of a box +//` Get the coordinate of a box #include #include