From 716e6e656a84224d729d1a836b6cd52d1be587e8 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 9 Apr 2015 23:38:31 +0200 Subject: [PATCH 1/3] [doc][geometries] Add examples (cpp and qbk files) for all models. --- doc/imports.qbk | 9 ++- doc/reference/geometries/linestring.qbk | 16 +++++ doc/reference/geometries/multi_linestring.qbk | 16 +++++ doc/reference/geometries/multi_point.qbk | 16 +++++ doc/reference/geometries/multi_polygon.qbk | 16 +++++ doc/reference/geometries/point_xy.qbk | 18 +++++ doc/reference/geometries/polygon.qbk | 16 +++++ doc/reference/geometries/ring.qbk | 16 +++++ doc/reference/geometries/segment.qbk | 16 +++++ doc/src/examples/geometries/Jamfile.v2 | 10 ++- doc/src/examples/geometries/box.cpp | 16 ++--- doc/src/examples/geometries/linestring.cpp | 51 +++++++++++++ .../examples/geometries/multi_linestring.cpp | 58 +++++++++++++++ doc/src/examples/geometries/multi_point.cpp | 51 +++++++++++++ doc/src/examples/geometries/multi_polygon.cpp | 71 +++++++++++++++++++ doc/src/examples/geometries/point_xy.cpp | 44 ++++++++++++ doc/src/examples/geometries/polygon.cpp | 61 ++++++++++++++++ doc/src/examples/geometries/ring.cpp | 53 ++++++++++++++ doc/src/examples/geometries/segment.cpp | 56 +++++++++++++++ 19 files changed, 600 insertions(+), 10 deletions(-) create mode 100644 doc/reference/geometries/linestring.qbk create mode 100644 doc/reference/geometries/multi_linestring.qbk create mode 100644 doc/reference/geometries/multi_point.qbk create mode 100644 doc/reference/geometries/multi_polygon.qbk create mode 100644 doc/reference/geometries/point_xy.qbk create mode 100644 doc/reference/geometries/polygon.qbk create mode 100644 doc/reference/geometries/ring.qbk create mode 100644 doc/reference/geometries/segment.qbk create mode 100644 doc/src/examples/geometries/linestring.cpp create mode 100644 doc/src/examples/geometries/multi_linestring.cpp create mode 100644 doc/src/examples/geometries/multi_point.cpp create mode 100644 doc/src/examples/geometries/multi_polygon.cpp create mode 100644 doc/src/examples/geometries/point_xy.cpp create mode 100644 doc/src/examples/geometries/polygon.cpp create mode 100644 doc/src/examples/geometries/ring.cpp create mode 100644 doc/src/examples/geometries/segment.cpp diff --git a/doc/imports.qbk b/doc/imports.qbk index dd240c2ba..e7b05e791 100644 --- a/doc/imports.qbk +++ b/doc/imports.qbk @@ -82,8 +82,15 @@ [import src/examples/core/tag.cpp] [import src/examples/core/tag_cast.cpp] -[import src/examples/geometries/point.cpp] [import src/examples/geometries/box.cpp] +[import src/examples/geometries/linestring.cpp] +[import src/examples/geometries/multi_linestring.cpp] +[import src/examples/geometries/multi_point.cpp] +[import src/examples/geometries/multi_polygon.cpp] +[import src/examples/geometries/point.cpp] +[import src/examples/geometries/polygon.cpp] +[import src/examples/geometries/ring.cpp] +[import src/examples/geometries/segment.cpp] [import src/examples/geometries/adapted/c_array.cpp] [import src/examples/geometries/adapted/boost_array.cpp] diff --git a/doc/reference/geometries/linestring.qbk b/doc/reference/geometries/linestring.qbk new file mode 100644 index 000000000..b22e8d2ea --- /dev/null +++ b/doc/reference/geometries/linestring.qbk @@ -0,0 +1,16 @@ +[/============================================================================ + Boost.Geometry (aka GGL, Generic Geometry Library) + + Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands. + Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + Copyright (c) 2009-2012 Bruno Lalande, Paris, France. + Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. + + 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 Examples] +[linestring] +[linestring_output] diff --git a/doc/reference/geometries/multi_linestring.qbk b/doc/reference/geometries/multi_linestring.qbk new file mode 100644 index 000000000..b2ee9b155 --- /dev/null +++ b/doc/reference/geometries/multi_linestring.qbk @@ -0,0 +1,16 @@ +[/============================================================================ + Boost.Geometry (aka GGL, Generic Geometry Library) + + Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands. + Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + Copyright (c) 2009-2012 Bruno Lalande, Paris, France. + Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. + + 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 Examples] +[multi_linestring] +[multi_linestring_output] diff --git a/doc/reference/geometries/multi_point.qbk b/doc/reference/geometries/multi_point.qbk new file mode 100644 index 000000000..342242f86 --- /dev/null +++ b/doc/reference/geometries/multi_point.qbk @@ -0,0 +1,16 @@ +[/============================================================================ + Boost.Geometry (aka GGL, Generic Geometry Library) + + Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands. + Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + Copyright (c) 2009-2012 Bruno Lalande, Paris, France. + Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. + + 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 Examples] +[multi_point] +[multi_point_output] diff --git a/doc/reference/geometries/multi_polygon.qbk b/doc/reference/geometries/multi_polygon.qbk new file mode 100644 index 000000000..1397dba17 --- /dev/null +++ b/doc/reference/geometries/multi_polygon.qbk @@ -0,0 +1,16 @@ +[/============================================================================ + Boost.Geometry (aka GGL, Generic Geometry Library) + + Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands. + Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + Copyright (c) 2009-2012 Bruno Lalande, Paris, France. + Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. + + 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 Examples] +[multi_polygon] +[multi_polygon_output] diff --git a/doc/reference/geometries/point_xy.qbk b/doc/reference/geometries/point_xy.qbk new file mode 100644 index 000000000..ead56d36f --- /dev/null +++ b/doc/reference/geometries/point_xy.qbk @@ -0,0 +1,18 @@ +[/============================================================================ + Boost.Geometry (aka GGL, Generic Geometry Library) + + Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands. + Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + Copyright (c) 2009-2012 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 Examples] +[point_xy] +[point_xy_output] + +[include reference/geometries/point_assign_warning.qbk] + diff --git a/doc/reference/geometries/polygon.qbk b/doc/reference/geometries/polygon.qbk new file mode 100644 index 000000000..7b6909088 --- /dev/null +++ b/doc/reference/geometries/polygon.qbk @@ -0,0 +1,16 @@ +[/============================================================================ + Boost.Geometry (aka GGL, Generic Geometry Library) + + Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands. + Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + Copyright (c) 2009-2012 Bruno Lalande, Paris, France. + Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. + + 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 Examples] +[polygon] +[polygon_output] diff --git a/doc/reference/geometries/ring.qbk b/doc/reference/geometries/ring.qbk new file mode 100644 index 000000000..746466a44 --- /dev/null +++ b/doc/reference/geometries/ring.qbk @@ -0,0 +1,16 @@ +[/============================================================================ + Boost.Geometry (aka GGL, Generic Geometry Library) + + Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands. + Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + Copyright (c) 2009-2012 Bruno Lalande, Paris, France. + Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. + + 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 Examples] +[ring] +[ring_output] diff --git a/doc/reference/geometries/segment.qbk b/doc/reference/geometries/segment.qbk new file mode 100644 index 000000000..1336dcaac --- /dev/null +++ b/doc/reference/geometries/segment.qbk @@ -0,0 +1,16 @@ +[/============================================================================ + Boost.Geometry (aka GGL, Generic Geometry Library) + + Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands. + Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + Copyright (c) 2009-2012 Bruno Lalande, Paris, France. + Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. + + 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 Examples] +[segment] +[segment_output] diff --git a/doc/src/examples/geometries/Jamfile.v2 b/doc/src/examples/geometries/Jamfile.v2 index 6f6af323c..cd0e71e6d 100644 --- a/doc/src/examples/geometries/Jamfile.v2 +++ b/doc/src/examples/geometries/Jamfile.v2 @@ -13,8 +13,16 @@ project boost-geometry-doc-src-example-geometries : # requirements ; -exe point : point.cpp ; exe box : box.cpp ; +exe linestring : linestring.cpp ; +exe point : point.cpp ; +exe point_xy : point_xy.cpp ; +exe polygon : polygon.cpp ; +exe multi_linestring : multi_linestring.cpp ; +exe multi_point : multi_point.cpp ; +exe multi_polygon : multi_polygon.cpp ; +exe ring : ring.cpp ; +exe segment : segment.cpp ; build-project adapted ; build-project register ; diff --git a/doc/src/examples/geometries/box.cpp b/doc/src/examples/geometries/box.cpp index 2ac6a7cbf..8ec272cf7 100644 --- a/doc/src/examples/geometries/box.cpp +++ b/doc/src/examples/geometries/box.cpp @@ -21,10 +21,10 @@ int main() typedef bg::model::point point_t; typedef bg::model::box box_t; - box_t box1; /*< Default-construct a box >*/ - box_t box2(point_t(0.0, 0.0), point_t(5.0, 5.0)); /*< Construct, assigning min and max corner point >*/ + box_t box1; /*< Default-construct a box. >*/ + box_t box2(point_t(0.0, 0.0), point_t(5.0, 5.0)); /*< Construct, assigning min and max corner point. >*/ #ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX - box_t box3{{0.0, 0.0}, {5.0, 5.0}}; /*< Construct, using C++11 unified initialization syntax >*/ + box_t box3{{0.0, 0.0}, {5.0, 5.0}}; /*< Construct, using C++11 unified initialization syntax. >*/ #endif bg::set(box1, 1.0); /*< Set a coordinate, generic. >*/ @@ -32,12 +32,12 @@ int main() box1.max_corner().set<0>(3.0); /*< Set a coordinate, class-specific ([*Note]: prefer `bg::set();`). >*/ box1.max_corner().set<1>(4.0); - double x0 = bg::get(box1); /*< Get a coordinate. >*/ - double y0 = bg::get(box1); - double x1 = box1.max_corner().get<0>(); /*< Get a coordinate, class-specific ([*Note]: prefer `bg::get();`). >*/ - double y1 = box1.max_corner().get<1>(); + double min_x = bg::get(box1); /*< Get a coordinate, generic. >*/ + double min_y = bg::get(box1); + double max_x = box1.max_corner().get<0>(); /*< Get a coordinate, class-specific ([*Note]: prefer `bg::get();`). >*/ + double max_y = box1.max_corner().get<1>(); - std::cout << x0 << ", " << y0 << ", " << x1 << ", " << y1 << std::endl; + std::cout << min_x << ", " << min_y << ", " << max_x << ", " << max_y << std::endl; return 0; } diff --git a/doc/src/examples/geometries/linestring.cpp b/doc/src/examples/geometries/linestring.cpp new file mode 100644 index 000000000..36f767c8f --- /dev/null +++ b/doc/src/examples/geometries/linestring.cpp @@ -0,0 +1,51 @@ +// Boost.Geometry +// QuickBook Example + +// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. + +// 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) + +//[linestring +//` Declaration and use of the Boost.Geometry model::linestring, modelling the Linestring Concept + +#include +#include +#include + +namespace bg = boost::geometry; + +int main() +{ + typedef bg::model::point point_t; + typedef bg::model::linestring linestring_t; + + linestring_t ls1; /*< Default-construct a linestring. >*/ +#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + linestring_t ls2{{0.0, 0.0}, {1.0, 0.0}, {1.0, 2.0}}; /*< Construct a linestring containing three points, using C++11 unified initialization syntax. >*/ +#endif + + bg::append(ls1, point_t(0.0, 0.0)); /*< Append point. >*/ + bg::append(ls1, point_t(1.0, 0.0)); + bg::append(ls1, point_t(1.0, 2.0)); + + double l = bg::length(ls1); + + std::cout << l << std::endl; + + return 0; +} + +//] + + +//[linestring_output +/*` +Output: +[pre +3 +] +*/ +//] diff --git a/doc/src/examples/geometries/multi_linestring.cpp b/doc/src/examples/geometries/multi_linestring.cpp new file mode 100644 index 000000000..af36df583 --- /dev/null +++ b/doc/src/examples/geometries/multi_linestring.cpp @@ -0,0 +1,58 @@ +// Boost.Geometry +// QuickBook Example + +// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. + +// 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) + +//[multi_linestring +//` Declaration and use of the Boost.Geometry model::multi_linestring, modelling the MultiLinestring Concept + +#include +#include +#include + +namespace bg = boost::geometry; + +int main() +{ + typedef bg::model::point point_t; + typedef bg::model::linestring linestring_t; + typedef bg::model::multi_linestring mlinestring_t; + + mlinestring_t mls1; /*< Default-construct a multi_linestring. >*/ +#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + mlinestring_t mls2{{{0.0, 0.0}, {0.0, 1.0}, {2.0, 1.0}}, + {{1.0, 0.0}, {2.0, 0.0}}}; /*< Construct a multi_linestring containing two linestrings, using C++11 unified initialization syntax. >*/ +#endif + + mls1.resize(2); /*< Resize a multi_linestring, store two linestrings. >*/ + + bg::append(mls1[0], point_t(0.0, 0.0)); /*< Append point to the first linestring. >*/ + bg::append(mls1[0], point_t(0.0, 1.0)); + bg::append(mls1[0], point_t(2.0, 1.0)); + + bg::append(mls1[1], point_t(1.0, 0.0)); /*< Append point to the second linestring. >*/ + bg::append(mls1[1], point_t(2.0, 0.0)); + + double l = bg::length(mls1); + + std::cout << l << std::endl; + + return 0; +} + +//] + + +//[multi_linestring_output +/*` +Output: +[pre +4 +] +*/ +//] diff --git a/doc/src/examples/geometries/multi_point.cpp b/doc/src/examples/geometries/multi_point.cpp new file mode 100644 index 000000000..209165874 --- /dev/null +++ b/doc/src/examples/geometries/multi_point.cpp @@ -0,0 +1,51 @@ +// Boost.Geometry +// QuickBook Example + +// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. + +// 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) + +//[multi_point +//` Declaration and use of the Boost.Geometry model::multi_point, modelling the MultiPoint Concept + +#include +#include +#include + +namespace bg = boost::geometry; + +int main() +{ + typedef bg::model::point point_t; + typedef bg::model::multi_point mpoint_t; + + mpoint_t mpt1; /*< Default-construct a multi_point. >*/ +#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + mpoint_t mpt2{{{0.0, 0.0}, {1.0, 1.0}, {2.0, 2.0}}}; /*< Construct a multi_point containing three points, using C++11 unified initialization syntax. >*/ +#endif + + bg::append(mpt1, point_t(0.0, 0.0)); /*< Append point to the multi_point. >*/ + bg::append(mpt1, point_t(1.0, 1.0)); + bg::append(mpt1, point_t(2.0, 2.0)); + + std::size_t count = bg::num_points(mpt1); + + std::cout << count << std::endl; + + return 0; +} + +//] + + +//[multi_point_output +/*` +Output: +[pre +3 +] +*/ +//] diff --git a/doc/src/examples/geometries/multi_polygon.cpp b/doc/src/examples/geometries/multi_polygon.cpp new file mode 100644 index 000000000..ac1c177f8 --- /dev/null +++ b/doc/src/examples/geometries/multi_polygon.cpp @@ -0,0 +1,71 @@ +// Boost.Geometry +// QuickBook Example + +// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. + +// 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) + +//[multi_polygon +//` Declaration and use of the Boost.Geometry model::multi_polygon, modelling the MultiPolygon Concept + +#include +#include +#include + +namespace bg = boost::geometry; + +int main() +{ + typedef bg::model::point point_t; + typedef bg::model::polygon polygon_t; /*< Default parameters, clockwise, closed polygon. >*/ + typedef bg::model::multi_polygon mpolygon_t; /*< Clockwise, closed multi_polygon. >*/ + + mpolygon_t mpoly1; /*< Default-construct a multi_polygon. >*/ +#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + mpolygon_t mpoly2{{{{0.0, 0.0}, {0.0, 5.0}, {5.0, 5.0}, {5.0, 0.0}, {0.0, 0.0}}, + {{1.0, 1.0}, {4.0, 1.0}, {4.0, 4.0}, {1.0, 4.0}, {1.0, 1.0}}}, + {{{5.0, 5.0}, {5.0, 6.0}, {6.0, 6.0}, {6.0, 5.0}, {5.0, 5.0}}}}; /*< Construct a multi_polygon containing two polygons, using C++11 unified initialization syntax. >*/ +#endif + + mpoly1.resize(2); /*< Resize a multi_polygon, store two polygons. >*/ + + bg::append(mpoly1[0].outer(), point_t(0.0, 0.0)); /*< Append point to the exterior ring of the first polygon. >*/ + bg::append(mpoly1[0].outer(), point_t(0.0, 5.0)); + bg::append(mpoly1[0].outer(), point_t(5.0, 5.0)); + bg::append(mpoly1[0].outer(), point_t(5.0, 0.0)); + bg::append(mpoly1[0].outer(), point_t(0.0, 0.0)); + + mpoly1[0].inners().resize(1); /*< Resize a container of interior rings of the first polygon. >*/ + bg::append(mpoly1[0].inners()[0], point_t(1.0, 1.0)); /*< Append point to the interior ring of the first polygon. >*/ + bg::append(mpoly1[0].inners()[0], point_t(4.0, 1.0)); + bg::append(mpoly1[0].inners()[0], point_t(4.0, 4.0)); + bg::append(mpoly1[0].inners()[0], point_t(1.0, 4.0)); + bg::append(mpoly1[0].inners()[0], point_t(1.0, 1.0)); + + bg::append(mpoly1[1].outer(), point_t(5.0, 5.0)); /*< Append point to the exterior ring of the second polygon. >*/ + bg::append(mpoly1[1].outer(), point_t(5.0, 6.0)); + bg::append(mpoly1[1].outer(), point_t(6.0, 6.0)); + bg::append(mpoly1[1].outer(), point_t(6.0, 5.0)); + bg::append(mpoly1[1].outer(), point_t(5.0, 5.0)); + + double a = bg::area(mpoly1); + + std::cout << a << std::endl; + + return 0; +} + +//] + + +//[multi_polygon_output +/*` +Output: +[pre +17 +] +*/ +//] diff --git a/doc/src/examples/geometries/point_xy.cpp b/doc/src/examples/geometries/point_xy.cpp new file mode 100644 index 000000000..a94965622 --- /dev/null +++ b/doc/src/examples/geometries/point_xy.cpp @@ -0,0 +1,44 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// QuickBook Example + +// Copyright (c) 2011-2012 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) + +//[point_xy +//` Declaration and use of the Boost.Geometry model::d2::point_xy, modelling the Point Concept + +#include +#include +#include + +namespace bg = boost::geometry; + +int main() +{ + bg::model::d2::point_xy point1; + bg::model::d2::point_xy point2(1.0, 2.0); /*< Construct, assigning coordinates. >*/ + + bg::set<0>(point1, 1.0); /*< Set a coordinate, generic. >*/ + point1.y(2.0); /*< Set a coordinate, class-specific ([*Note]: prefer `bg::set();`). >*/ + + double x = bg::get<0>(point1); /*< Get a coordinate, generic. >*/ + double y = point1.y(); /*< Get a coordinate, class-specific ([*Note]: prefer `bg::get();`). >*/ + + std::cout << x << ", " << y << std::endl; + return 0; +} + +//] + + +//[point_xy_output +/*` +Output: +[pre +1, 2 +] +*/ +//] diff --git a/doc/src/examples/geometries/polygon.cpp b/doc/src/examples/geometries/polygon.cpp new file mode 100644 index 000000000..563f842ff --- /dev/null +++ b/doc/src/examples/geometries/polygon.cpp @@ -0,0 +1,61 @@ +// Boost.Geometry +// QuickBook Example + +// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. + +// 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) + +//[polygon +//` Declaration and use of the Boost.Geometry model::polygon, modelling the Polygon Concept + +#include +#include +#include + +namespace bg = boost::geometry; + +int main() +{ + typedef bg::model::point point_t; + typedef bg::model::polygon polygon_t; /*< Default parameters, clockwise, closed polygon. >*/ + + polygon_t poly1; /*< Default-construct a polygon. >*/ +#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + polygon_t polygon2{{{0.0, 0.0}, {0.0, 5.0}, {5.0, 5.0}, {5.0, 0.0}, {0.0, 0.0}}, + {{1.0, 1.0}, {4.0, 1.0}, {4.0, 4.0}, {1.0, 4.0}, {1.0, 1.0}}}; /*< Construct a polygon containing an exterior and interior ring, using C++11 unified initialization syntax. >*/ +#endif + + bg::append(poly1.outer(), point_t(0.0, 0.0)); /*< Append point to the exterior ring. >*/ + bg::append(poly1.outer(), point_t(0.0, 5.0)); + bg::append(poly1.outer(), point_t(5.0, 5.0)); + bg::append(poly1.outer(), point_t(5.0, 0.0)); + bg::append(poly1.outer(), point_t(0.0, 0.0)); + + poly1.inners().resize(1); /*< Resize a container of interior rings. >*/ + bg::append(poly1.inners()[0], point_t(1.0, 1.0)); /*< Append point to the interior ring. >*/ + bg::append(poly1.inners()[0], point_t(4.0, 1.0)); + bg::append(poly1.inners()[0], point_t(4.0, 4.0)); + bg::append(poly1.inners()[0], point_t(1.0, 4.0)); + bg::append(poly1.inners()[0], point_t(1.0, 1.0)); + + double a = bg::area(poly1); + + std::cout << a << std::endl; + + return 0; +} + +//] + + +//[polygon_output +/*` +Output: +[pre +16 +] +*/ +//] diff --git a/doc/src/examples/geometries/ring.cpp b/doc/src/examples/geometries/ring.cpp new file mode 100644 index 000000000..acad825fd --- /dev/null +++ b/doc/src/examples/geometries/ring.cpp @@ -0,0 +1,53 @@ +// Boost.Geometry +// QuickBook Example + +// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. + +// 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) + +//[ring +//` Declaration and use of the Boost.Geometry model::ring, modelling the Ring Concept + +#include +#include +#include + +namespace bg = boost::geometry; + +int main() +{ + typedef bg::model::point point_t; + typedef bg::model::ring ring_t; /*< Default parameters, clockwise, closed ring. >*/ + + ring_t ring1; /*< Default-construct a ring. >*/ +#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + ring_t ring2{{0.0, 0.0}, {0.0, 5.0}, {5.0, 5.0}, {5.0, 0.0}, {0.0, 0.0}}; /*< Construct a ring containing four points plus one closing point, using C++11 unified initialization syntax. >*/ +#endif + + bg::append(ring1, point_t(0.0, 0.0)); /*< Append point. >*/ + bg::append(ring1, point_t(0.0, 5.0)); + bg::append(ring1, point_t(5.0, 5.0)); + bg::append(ring1, point_t(5.0, 0.0)); + bg::append(ring1, point_t(0.0, 0.0)); + + double a = bg::area(ring1); + + std::cout << a << std::endl; + + return 0; +} + +//] + + +//[ring_output +/*` +Output: +[pre +25 +] +*/ +//] diff --git a/doc/src/examples/geometries/segment.cpp b/doc/src/examples/geometries/segment.cpp new file mode 100644 index 000000000..66eea43b5 --- /dev/null +++ b/doc/src/examples/geometries/segment.cpp @@ -0,0 +1,56 @@ +// Boost.Geometry +// QuickBook Example + +// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. + +// 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) + +//[segment +//` Declaration and use of the Boost.Geometry model::segment, modelling the Segment Concept + +#include +#include +#include + +namespace bg = boost::geometry; + +int main() +{ + typedef bg::model::point point_t; + typedef bg::model::segment segment_t; + + segment_t seg1; /*< Default-construct a segment. >*/ + segment_t seg2(point_t(0.0, 0.0), point_t(5.0, 5.0)); /*< Construct, assigning the first and the second point. >*/ +#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + segment_t seg3{{0.0, 0.0}, {5.0, 5.0}}; /*< Construct, using C++11 unified initialization syntax. >*/ +#endif + + bg::set<0, 0>(seg1, 1.0); /*< Set a coordinate. >*/ + bg::set<0, 1>(seg1, 2.0); + bg::set<1, 0>(seg1, 3.0); + bg::set<1, 1>(seg1, 4.0); + + double x0 = bg::get<0, 0>(seg1); /*< Get a coordinate. >*/ + double y0 = bg::get<0, 1>(seg1); + double x1 = bg::get<1, 0>(seg1); + double y1 = bg::get<1, 1>(seg1); + + std::cout << x0 << ", " << y0 << ", " << x1 << ", " << y1 << std::endl; + + return 0; +} + +//] + + +//[segment_output +/*` +Output: +[pre +1, 2, 3, 4 +] +*/ +//] From 34dba9be8542a5f0b33f1ff1f068c6f1a766017c Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 9 Apr 2015 23:39:58 +0200 Subject: [PATCH 2/3] [geometries][doc] Add examples to descriptions of all geometries models. --- include/boost/geometry/geometries/linestring.hpp | 1 + include/boost/geometry/geometries/multi_linestring.hpp | 1 + include/boost/geometry/geometries/multi_point.hpp | 2 ++ include/boost/geometry/geometries/multi_polygon.hpp | 1 + include/boost/geometry/geometries/point_xy.hpp | 1 + include/boost/geometry/geometries/polygon.hpp | 1 + include/boost/geometry/geometries/ring.hpp | 1 + include/boost/geometry/geometries/segment.hpp | 6 ++++++ 8 files changed, 14 insertions(+) diff --git a/include/boost/geometry/geometries/linestring.hpp b/include/boost/geometry/geometries/linestring.hpp index 481fda2f9..22c9c99de 100644 --- a/include/boost/geometry/geometries/linestring.hpp +++ b/include/boost/geometry/geometries/linestring.hpp @@ -44,6 +44,7 @@ namespace model \tparam Container \tparam_container \tparam Allocator \tparam_allocator +\qbk{[include reference/geometries/linestring.qbk]} \qbk{before.synopsis, [heading Model of] [link geometry.reference.concepts.concept_linestring Linestring Concept] diff --git a/include/boost/geometry/geometries/multi_linestring.hpp b/include/boost/geometry/geometries/multi_linestring.hpp index 829da9a22..cd08fdbe1 100644 --- a/include/boost/geometry/geometries/multi_linestring.hpp +++ b/include/boost/geometry/geometries/multi_linestring.hpp @@ -41,6 +41,7 @@ namespace model e.g. a highway (with interruptions) \ingroup geometries +\qbk{[include reference/geometries/multi_linestring.qbk]} \qbk{before.synopsis, [heading Model of] [link geometry.reference.concepts.concept_multi_linestring MultiLineString Concept] diff --git a/include/boost/geometry/geometries/multi_point.hpp b/include/boost/geometry/geometries/multi_point.hpp index 98cb283a1..ab4cd8817 100644 --- a/include/boost/geometry/geometries/multi_point.hpp +++ b/include/boost/geometry/geometries/multi_point.hpp @@ -43,6 +43,8 @@ namespace model \tparam Allocator \tparam_allocator \details Multipoint can be used to group points belonging to each other, e.g. a constellation, or the result set of an intersection + +\qbk{[include reference/geometries/multi_point.qbk]} \qbk{before.synopsis, [heading Model of] [link geometry.reference.concepts.concept_multi_point MultiPoint Concept] diff --git a/include/boost/geometry/geometries/multi_polygon.hpp b/include/boost/geometry/geometries/multi_polygon.hpp index 10b1ac6a1..9db74b4ec 100644 --- a/include/boost/geometry/geometries/multi_polygon.hpp +++ b/include/boost/geometry/geometries/multi_polygon.hpp @@ -40,6 +40,7 @@ namespace model e.g. Hawaii \ingroup geometries +\qbk{[include reference/geometries/multi_polygon.qbk]} \qbk{before.synopsis, [heading Model of] [link geometry.reference.concepts.concept_multi_polygon MultiPolygon Concept] diff --git a/include/boost/geometry/geometries/point_xy.hpp b/include/boost/geometry/geometries/point_xy.hpp index dabb70b65..bbc35d5ce 100644 --- a/include/boost/geometry/geometries/point_xy.hpp +++ b/include/boost/geometry/geometries/point_xy.hpp @@ -33,6 +33,7 @@ namespace model { namespace d2 \tparam CoordinateType numeric type, for example, double, float, int \tparam CoordinateSystem coordinate system, defaults to cs::cartesian +\qbk{[include reference/geometries/point_xy.qbk]} \qbk{before.synopsis, [heading Model of] [link geometry.reference.concepts.concept_point Point Concept] diff --git a/include/boost/geometry/geometries/polygon.hpp b/include/boost/geometry/geometries/polygon.hpp index 25b21d98f..5e6064e89 100644 --- a/include/boost/geometry/geometries/polygon.hpp +++ b/include/boost/geometry/geometries/polygon.hpp @@ -55,6 +55,7 @@ namespace model \note The container collecting the points in the rings can be different from the container collecting the inner rings. They all default to vector. +\qbk{[include reference/geometries/polygon.qbk]} \qbk{before.synopsis, [heading Model of] [link geometry.reference.concepts.concept_polygon Polygon Concept] diff --git a/include/boost/geometry/geometries/ring.hpp b/include/boost/geometry/geometries/ring.hpp index a496480b9..01bcf58cf 100644 --- a/include/boost/geometry/geometries/ring.hpp +++ b/include/boost/geometry/geometries/ring.hpp @@ -48,6 +48,7 @@ namespace model \tparam Container container type, for example std::vector, std::deque \tparam Allocator container-allocator-type +\qbk{[include reference/geometries/ring.qbk]} \qbk{before.synopsis, [heading Model of] [link geometry.reference.concepts.concept_ring Ring Concept] diff --git a/include/boost/geometry/geometries/segment.hpp b/include/boost/geometry/geometries/segment.hpp index eb3ce936e..af406aa09 100644 --- a/include/boost/geometry/geometries/segment.hpp +++ b/include/boost/geometry/geometries/segment.hpp @@ -35,6 +35,12 @@ namespace model by two distinct end points, and contains every point on the line between its end points. \note There is also a point-referring-segment, class referring_segment, containing point references, where points are NOT copied + +\qbk{[include reference/geometries/segment.qbk]} +\qbk{before.synopsis, +[heading Model of] +[link geometry.reference.concepts.concept_segment Segment Concept] +} */ template class segment : public std::pair From ff67f4a6d08f098cfbf24a9cc69b10ca1c9807a1 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 10 Apr 2015 00:20:15 +0200 Subject: [PATCH 3/3] [doc][geometries] Small fixes in examples of models. Add mising #ifdef conditions enabling the example of std::initializer_list support. Remove unneeded semicolons from comments. Add missing QBK import (point_xy). --- doc/imports.qbk | 1 + doc/src/examples/geometries/box.cpp | 7 +++++-- doc/src/examples/geometries/linestring.cpp | 6 +++++- doc/src/examples/geometries/multi_linestring.cpp | 6 +++++- doc/src/examples/geometries/multi_point.cpp | 6 +++++- doc/src/examples/geometries/multi_polygon.cpp | 6 +++++- doc/src/examples/geometries/point.cpp | 4 ++-- doc/src/examples/geometries/point_xy.cpp | 4 ++-- doc/src/examples/geometries/polygon.cpp | 6 +++++- doc/src/examples/geometries/ring.cpp | 6 +++++- doc/src/examples/geometries/segment.cpp | 3 +++ 11 files changed, 43 insertions(+), 12 deletions(-) diff --git a/doc/imports.qbk b/doc/imports.qbk index e7b05e791..3625fc2e8 100644 --- a/doc/imports.qbk +++ b/doc/imports.qbk @@ -87,6 +87,7 @@ [import src/examples/geometries/multi_linestring.cpp] [import src/examples/geometries/multi_point.cpp] [import src/examples/geometries/multi_polygon.cpp] +[import src/examples/geometries/point_xy.cpp] [import src/examples/geometries/point.cpp] [import src/examples/geometries/polygon.cpp] [import src/examples/geometries/ring.cpp] diff --git a/doc/src/examples/geometries/box.cpp b/doc/src/examples/geometries/box.cpp index 8ec272cf7..0dfecc83d 100644 --- a/doc/src/examples/geometries/box.cpp +++ b/doc/src/examples/geometries/box.cpp @@ -23,18 +23,21 @@ int main() box_t box1; /*< Default-construct a box. >*/ box_t box2(point_t(0.0, 0.0), point_t(5.0, 5.0)); /*< Construct, assigning min and max corner point. >*/ + #ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + box_t box3{{0.0, 0.0}, {5.0, 5.0}}; /*< Construct, using C++11 unified initialization syntax. >*/ + #endif bg::set(box1, 1.0); /*< Set a coordinate, generic. >*/ bg::set(box1, 2.0); - box1.max_corner().set<0>(3.0); /*< Set a coordinate, class-specific ([*Note]: prefer `bg::set();`). >*/ + box1.max_corner().set<0>(3.0); /*< Set a coordinate, class-specific ([*Note]: prefer `bg::set()`). >*/ box1.max_corner().set<1>(4.0); double min_x = bg::get(box1); /*< Get a coordinate, generic. >*/ double min_y = bg::get(box1); - double max_x = box1.max_corner().get<0>(); /*< Get a coordinate, class-specific ([*Note]: prefer `bg::get();`). >*/ + double max_x = box1.max_corner().get<0>(); /*< Get a coordinate, class-specific ([*Note]: prefer `bg::get()`). >*/ double max_y = box1.max_corner().get<1>(); std::cout << min_x << ", " << min_y << ", " << max_x << ", " << max_y << std::endl; diff --git a/doc/src/examples/geometries/linestring.cpp b/doc/src/examples/geometries/linestring.cpp index 36f767c8f..b2ba1ae8b 100644 --- a/doc/src/examples/geometries/linestring.cpp +++ b/doc/src/examples/geometries/linestring.cpp @@ -23,8 +23,12 @@ int main() typedef bg::model::linestring linestring_t; linestring_t ls1; /*< Default-construct a linestring. >*/ -#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + +#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) \ + && !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + linestring_t ls2{{0.0, 0.0}, {1.0, 0.0}, {1.0, 2.0}}; /*< Construct a linestring containing three points, using C++11 unified initialization syntax. >*/ + #endif bg::append(ls1, point_t(0.0, 0.0)); /*< Append point. >*/ diff --git a/doc/src/examples/geometries/multi_linestring.cpp b/doc/src/examples/geometries/multi_linestring.cpp index af36df583..b7a039cf9 100644 --- a/doc/src/examples/geometries/multi_linestring.cpp +++ b/doc/src/examples/geometries/multi_linestring.cpp @@ -24,9 +24,13 @@ int main() typedef bg::model::multi_linestring mlinestring_t; mlinestring_t mls1; /*< Default-construct a multi_linestring. >*/ -#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + +#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) \ + && !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + mlinestring_t mls2{{{0.0, 0.0}, {0.0, 1.0}, {2.0, 1.0}}, {{1.0, 0.0}, {2.0, 0.0}}}; /*< Construct a multi_linestring containing two linestrings, using C++11 unified initialization syntax. >*/ + #endif mls1.resize(2); /*< Resize a multi_linestring, store two linestrings. >*/ diff --git a/doc/src/examples/geometries/multi_point.cpp b/doc/src/examples/geometries/multi_point.cpp index 209165874..89d63d737 100644 --- a/doc/src/examples/geometries/multi_point.cpp +++ b/doc/src/examples/geometries/multi_point.cpp @@ -23,8 +23,12 @@ int main() typedef bg::model::multi_point mpoint_t; mpoint_t mpt1; /*< Default-construct a multi_point. >*/ -#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + +#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) \ + && !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + mpoint_t mpt2{{{0.0, 0.0}, {1.0, 1.0}, {2.0, 2.0}}}; /*< Construct a multi_point containing three points, using C++11 unified initialization syntax. >*/ + #endif bg::append(mpt1, point_t(0.0, 0.0)); /*< Append point to the multi_point. >*/ diff --git a/doc/src/examples/geometries/multi_polygon.cpp b/doc/src/examples/geometries/multi_polygon.cpp index ac1c177f8..d5414868f 100644 --- a/doc/src/examples/geometries/multi_polygon.cpp +++ b/doc/src/examples/geometries/multi_polygon.cpp @@ -24,10 +24,14 @@ int main() typedef bg::model::multi_polygon mpolygon_t; /*< Clockwise, closed multi_polygon. >*/ mpolygon_t mpoly1; /*< Default-construct a multi_polygon. >*/ -#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + +#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) \ + && !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + mpolygon_t mpoly2{{{{0.0, 0.0}, {0.0, 5.0}, {5.0, 5.0}, {5.0, 0.0}, {0.0, 0.0}}, {{1.0, 1.0}, {4.0, 1.0}, {4.0, 4.0}, {1.0, 4.0}, {1.0, 1.0}}}, {{{5.0, 5.0}, {5.0, 6.0}, {6.0, 6.0}, {6.0, 5.0}, {5.0, 5.0}}}}; /*< Construct a multi_polygon containing two polygons, using C++11 unified initialization syntax. >*/ + #endif mpoly1.resize(2); /*< Resize a multi_polygon, store two polygons. >*/ diff --git a/doc/src/examples/geometries/point.cpp b/doc/src/examples/geometries/point.cpp index 0d6ebd67c..6373217c8 100644 --- a/doc/src/examples/geometries/point.cpp +++ b/doc/src/examples/geometries/point.cpp @@ -21,10 +21,10 @@ int main() bg::model::point point2(1.0, 2.0, 3.0); /*< Construct, assigning three coordinates >*/ bg::set<0>(point1, 1.0); /*< Set a coordinate, generic. >*/ - point1.set<1>(2.0); /*< Set a coordinate, class-specific ([*Note]: prefer `bg::set();`). >*/ + point1.set<1>(2.0); /*< Set a coordinate, class-specific ([*Note]: prefer `bg::set()`). >*/ double x = bg::get<0>(point1); /*< Get a coordinate, generic. >*/ - double y = point1.get<1>(); /*< Get a coordinate, class-specific ([*Note]: prefer `bg::get();`). >*/ + double y = point1.get<1>(); /*< Get a coordinate, class-specific ([*Note]: prefer `bg::get()`). >*/ std::cout << x << ", " << y << std::endl; return 0; diff --git a/doc/src/examples/geometries/point_xy.cpp b/doc/src/examples/geometries/point_xy.cpp index a94965622..96eedf82b 100644 --- a/doc/src/examples/geometries/point_xy.cpp +++ b/doc/src/examples/geometries/point_xy.cpp @@ -22,10 +22,10 @@ int main() bg::model::d2::point_xy point2(1.0, 2.0); /*< Construct, assigning coordinates. >*/ bg::set<0>(point1, 1.0); /*< Set a coordinate, generic. >*/ - point1.y(2.0); /*< Set a coordinate, class-specific ([*Note]: prefer `bg::set();`). >*/ + point1.y(2.0); /*< Set a coordinate, class-specific ([*Note]: prefer `bg::set()`). >*/ double x = bg::get<0>(point1); /*< Get a coordinate, generic. >*/ - double y = point1.y(); /*< Get a coordinate, class-specific ([*Note]: prefer `bg::get();`). >*/ + double y = point1.y(); /*< Get a coordinate, class-specific ([*Note]: prefer `bg::get()`). >*/ std::cout << x << ", " << y << std::endl; return 0; diff --git a/doc/src/examples/geometries/polygon.cpp b/doc/src/examples/geometries/polygon.cpp index 563f842ff..199a00824 100644 --- a/doc/src/examples/geometries/polygon.cpp +++ b/doc/src/examples/geometries/polygon.cpp @@ -23,9 +23,13 @@ int main() typedef bg::model::polygon polygon_t; /*< Default parameters, clockwise, closed polygon. >*/ polygon_t poly1; /*< Default-construct a polygon. >*/ -#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + +#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) \ + && !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + polygon_t polygon2{{{0.0, 0.0}, {0.0, 5.0}, {5.0, 5.0}, {5.0, 0.0}, {0.0, 0.0}}, {{1.0, 1.0}, {4.0, 1.0}, {4.0, 4.0}, {1.0, 4.0}, {1.0, 1.0}}}; /*< Construct a polygon containing an exterior and interior ring, using C++11 unified initialization syntax. >*/ + #endif bg::append(poly1.outer(), point_t(0.0, 0.0)); /*< Append point to the exterior ring. >*/ diff --git a/doc/src/examples/geometries/ring.cpp b/doc/src/examples/geometries/ring.cpp index acad825fd..1818ee127 100644 --- a/doc/src/examples/geometries/ring.cpp +++ b/doc/src/examples/geometries/ring.cpp @@ -23,8 +23,12 @@ int main() typedef bg::model::ring ring_t; /*< Default parameters, clockwise, closed ring. >*/ ring_t ring1; /*< Default-construct a ring. >*/ -#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + +#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) \ + && !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + ring_t ring2{{0.0, 0.0}, {0.0, 5.0}, {5.0, 5.0}, {5.0, 0.0}, {0.0, 0.0}}; /*< Construct a ring containing four points plus one closing point, using C++11 unified initialization syntax. >*/ + #endif bg::append(ring1, point_t(0.0, 0.0)); /*< Append point. >*/ diff --git a/doc/src/examples/geometries/segment.cpp b/doc/src/examples/geometries/segment.cpp index 66eea43b5..3cbb4453c 100644 --- a/doc/src/examples/geometries/segment.cpp +++ b/doc/src/examples/geometries/segment.cpp @@ -24,8 +24,11 @@ int main() segment_t seg1; /*< Default-construct a segment. >*/ segment_t seg2(point_t(0.0, 0.0), point_t(5.0, 5.0)); /*< Construct, assigning the first and the second point. >*/ + #ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + segment_t seg3{{0.0, 0.0}, {5.0, 5.0}}; /*< Construct, using C++11 unified initialization syntax. >*/ + #endif bg::set<0, 0>(seg1, 1.0); /*< Set a coordinate. >*/