diff --git a/doc/concept/linestring.qbk b/doc/concept/linestring.qbk index dba503eb3..e6213f549 100644 --- a/doc/concept/linestring.qbk +++ b/doc/concept/linestring.qbk @@ -23,7 +23,7 @@ A linestring is ['a Curve with linear interpolation between Points]. The Linestring Concept is defined as following: * there must be a specialization of `traits::tag` defining `linestring_tag` as type -* it must behave like a Boost.Range +* it must behave like a Boost.Range Random Access Range * The type defined by the metafunction `range_value<...>::type` must fulfill the [link geometry.reference.concepts.concept_point Point Concept] diff --git a/doc/concept/multi_linestring.qbk b/doc/concept/multi_linestring.qbk index 3b7e0569b..516d009fb 100644 --- a/doc/concept/multi_linestring.qbk +++ b/doc/concept/multi_linestring.qbk @@ -20,7 +20,7 @@ The MultiLinestring Concept is defined as following: * There must be a specialization of the metafunction `traits::tag`, defining `multi_linestring_tag` as type -* It must behave like a Boost.Range +* It must behave like a Boost.Range Random Access Range * The type defined by the metafunction `range_value<...>::type` must fulfill the [link geometry.reference.concepts.concept_linestring Linestring Concept] diff --git a/doc/concept/multi_point.qbk b/doc/concept/multi_point.qbk index 4127c47aa..3880ade2c 100644 --- a/doc/concept/multi_point.qbk +++ b/doc/concept/multi_point.qbk @@ -21,7 +21,7 @@ The MultiPoint Concept is defined as following: * There must be a specialization of the metafunction `traits::tag`, defining `multi_point_tag` as type -* It must behave like a Boost.Range +* It must behave like a Boost.Range Random Access Range * The type defined by the metafunction `range_value<...>::type` must fulfill the [link geometry.reference.concepts.concept_point Point Concept] [heading Available Models] diff --git a/doc/concept/multi_polygon.qbk b/doc/concept/multi_polygon.qbk index 3dbae687b..0c4de61c1 100644 --- a/doc/concept/multi_polygon.qbk +++ b/doc/concept/multi_polygon.qbk @@ -20,7 +20,7 @@ The MultiPolygon Concept is defined as following: * There must be a specialization of the metafunction `traits::tag`, defining `multi_polygon_tag` as type -* It must behave like a Boost.Range +* It must behave like a Boost.Range Random Access Range * The type defined by the metafunction `range_value<...>::type` must fulfill the [link geometry.reference.concepts.concept_polygon Polygon Concept] diff --git a/doc/concept/point.qbk b/doc/concept/point.qbk index d44170444..f19dabd55 100644 --- a/doc/concept/point.qbk +++ b/doc/concept/point.qbk @@ -37,12 +37,12 @@ The Point Concept is defined as following: * [link geometry.reference.models.model_point model::point] * [link geometry.reference.models.model_d2_point_xy model::d2::point_xy] * a lat long point (currently in an extension) -* a C array (requires `#include boost/geometry/geometries/adapted/c_array.hpp>`) -* a Boost.Array (requires `#include `) -* a Boost.Polygon point (requires `#include boost/geometry/geometries/adapted/boost_polygon/point.hpp>`) -* a Boost.Fusion adapted structure (requires `#include boost/geometry/geometries/adapted/fusion.hpp>`) -* a Boost.Tuple (requires `#include boost/geometry/geometries/adapted/tuple.hpp>`) -* an adapted point using one of the [link geometry.reference.register registration macro's] +* [link geometry.reference.adapted.c_array C array] +* [link geometry.reference.adapted.boost_array Boost.Array] +* [link geometry.reference.adapted.boost_fusion Boost.Fusion] +* [link geometry.reference.adapted.boost_polygon Boost.Polygon] +* [link geometry.reference.adapted.boost_tuple Boost.Tuple] +* other point types, adapted e.g. using one of the [link geometry.reference.adapted registration macro's] [endsect] diff --git a/doc/concept/polygon.qbk b/doc/concept/polygon.qbk index cebdd1722..c577c33db 100644 --- a/doc/concept/polygon.qbk +++ b/doc/concept/polygon.qbk @@ -29,7 +29,8 @@ The Polygon Concept is defined as following: * there must be a specialization of `traits::tag` defining `polygon_tag` as type * there must be a specialization of `traits::ring_type` defining the type of its exterior ring and interior rings as type * this type defined by `ring_type` must fulfill the [link geometry.reference.concepts.concept_ring Ring Concept] -* there must be a specialization of `traits::interior_type` defining the type of the collection of its interior rings as type +* there must be a specialization of `traits::interior_type` defining the type of the collection of its interior rings as type; + this collection itself must fulfill a Boost.Range Random Access Range Concept * there must be a specialization of `traits::exterior_ring` with two functions named `get`, returning the exterior ring, one being const, the other being non const * there must be a specialization of `traits::interior_rings` with two functions named `get`, returning the interior rings, one being const, the other being non const diff --git a/doc/concept/ring.qbk b/doc/concept/ring.qbk index ea57f115e..6c693afe6 100644 --- a/doc/concept/ring.qbk +++ b/doc/concept/ring.qbk @@ -22,7 +22,7 @@ The Ring Concept is defined as following: * there must be a specialization of `traits::tag` defining `ring_tag` as type -* it must behave like a Boost.Range +* it must behave like a Boost.Range Random Access Range * The type defined by the metafunction `range_value<...>::type` must fulfill the [link geometry.reference.concepts.concept_point Point Concept] * there might be a specialization of `traits::point_order` defining the order or orientation of its points, `clockwise` or `counterclockwise` diff --git a/doc/doxy/Doxyfile b/doc/doxy/Doxyfile index 7c34fb5e0..f1183a74e 100644 --- a/doc/doxy/Doxyfile +++ b/doc/doxy/Doxyfile @@ -50,7 +50,7 @@ ALIASES = qbk{1}="\xmlonly \1 \endxmlonly" \ brief_macro{1}="Macro to register a \1" \ brief_macro_const=" (const version)" \ brief_macro_getset=" (having separate get/set methods)" \ - brief_meta{3}="Metafunction defining [*\1] as the specified \2 of the \3" \ + brief_meta{3}="Metafunction defining [*\1] as the \2 of the \3" \ tparam_allocator="container-allocator-type" \ tparam_box="Any type fulfilling a Box Concept" \ tparam_box_or_segment="Any type fulfilling a Box Concept or a Segment Concept" \ @@ -95,9 +95,10 @@ ALIASES = qbk{1}="\xmlonly \1 \endxmlonly" \ details_calc2{2}="The free function \1 calculates the \2 of two geometries" \ details_calc2{1}="The free function \1 calculates the \1 of two geometries" \ details_check12{2}="The free function \1 checks if the first geometry \2 the second geometry" \ - 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 point type" \ + 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_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." \ diff --git a/doc/doxy/doxygen_input/pages/doxygen_examples.hpp b/doc/doxy/doxygen_input/pages/doxygen_examples.hpp index 665a6423e..0757e0544 100644 --- a/doc/doxy/doxygen_input/pages/doxygen_examples.hpp +++ b/doc/doxy/doxygen_input/pages/doxygen_examples.hpp @@ -157,7 +157,7 @@ Besides custom points, custom boxes are possible as shown in this example. */ //--------------------------------------------------------------------------------------------------- -/*! +/* \example c03_custom_linestring_example.cpp GPS tracks are shown in this example: a custom linestring with GPS points */ @@ -219,14 +219,14 @@ Second example showing how to get polygons from a database using SOCI and put th //--------------------------------------------------------------------------------------------------- - /*! + /* \example x03_c_soci_example.cpp Example showing how to get polygons from PostGIS using SOCI and use them in GGL through WKB */ //--------------------------------------------------------------------------------------------------- - /*! + /* \example x03_d_soci_example.cpp Example showing how to get polygons from PostGIS using SOCI and use them in GGL through WKB diff --git a/doc/geometry.qbk b/doc/geometry.qbk index 3519723ef..4e2d304c0 100644 --- a/doc/geometry.qbk +++ b/doc/geometry.qbk @@ -49,6 +49,9 @@ [def __other__ Other geometries] [def __nyiversion__ Not yet supported in this version] +[def __not_in_boost_geometry_hpp__ The standard header `boost/geometry.hpp` does not include this header.] + + [/Parts] [def __ret_zero__ Returns zero] [def __ret_one__ Returns 1] @@ -62,8 +65,8 @@ All algorithms in Boost.Geometry will check any geometry arguments against the concept requirements.] -[def __boost_geometry__ Boost.Geometry] -[def __boost_gil__ [@http://www.boost.org/libs/gil/ Boost.GIL]] +[def __boost_geometry__ Boost.Geometry] +[def __boost_gil__ [@http://www.boost.org/libs/gil/ Boost.GIL]] [heading Contributions] diff --git a/doc/imports.qbk b/doc/imports.qbk index 208bb28d8..675dd4be2 100644 --- a/doc/imports.qbk +++ b/doc/imports.qbk @@ -69,9 +69,29 @@ [import src/examples/core/set_box.cpp] [import src/examples/core/degree_radian.cpp] +[import src/examples/core/interior_type.cpp] [import src/examples/core/point_type.cpp] +[import src/examples/core/ring_type.cpp] +[import src/examples/core/rings.cpp] [import src/examples/core/tag.cpp] [import src/examples/core/tag_cast.cpp] [import src/examples/geometries/point.cpp] +[import src/examples/geometries/adapted/c_array.cpp] +[import src/examples/geometries/adapted/boost_array.cpp] +[import src/examples/geometries/adapted/boost_fusion.cpp] +[import src/examples/geometries/adapted/boost_polygon.cpp] +[import src/examples/geometries/adapted/boost_tuple.cpp] + +[import src/examples/geometries/adapted/boost_range/filtered.cpp] +[import src/examples/geometries/adapted/boost_range/reversed.cpp] +[import src/examples/geometries/adapted/boost_range/sliced.cpp] +[import src/examples/geometries/adapted/boost_range/strided.cpp] +[import src/examples/geometries/adapted/boost_range/uniqued.cpp] + +[import src/examples/geometries/register/box.cpp] +[import src/examples/geometries/register/box_templated.cpp] +[import src/examples/geometries/register/box_2d_4values.cpp] [import src/examples/geometries/register/point.cpp] + + diff --git a/doc/quickref.xml b/doc/quickref.xml index 3241aba28..3c0a1cf00 100644 --- a/doc/quickref.xml +++ b/doc/quickref.xml @@ -100,16 +100,53 @@ - - Macros + + 0-dimensional (adapted) - BOOST_GEOMETRY_REGISTER_POINT_2D - BOOST_GEOMETRY_REGISTER_POINT_2D_CONST - BOOST_GEOMETRY_REGISTER_POINT_2D_GET_SET - BOOST_GEOMETRY_REGISTER_POINT_3D - BOOST_GEOMETRY_REGISTER_POINT_3D_CONST - BOOST_GEOMETRY_REGISTER_POINT_3D_GET_SET - + Boost.Array + Boost.Fusion + Boost.Polygon's point_data + Boost.Tuple + C arrays + + + + 1-dimensional (adapted) + + + + + 2-dimensional (adapted) + + Boost.Polygon's rectangle_data + Boost.Polygon's polygon_data + Boost.Polygon's polygon_with_holes_data + + + + + + 0-dimensional (macro's for adaption) + + BOOST_GEOMETRY_REGISTER_POINT_2D + BOOST_GEOMETRY_REGISTER_POINT_2D_CONST + BOOST_GEOMETRY_REGISTER_POINT_2D_GET_SET + BOOST_GEOMETRY_REGISTER_POINT_3D + BOOST_GEOMETRY_REGISTER_POINT_3D_CONST + BOOST_GEOMETRY_REGISTER_POINT_3D_GET_SET + + + + 1-dimensionial (macro's for adaption) + + + + + 2-dimensional (macro's for adaption) + + BOOST_GEOMETRY_REGISTER_BOX + BOOST_GEOMETRY_REGISTER_BOX_2D_4VALUES + BOOST_GEOMETRY_REGISTER_BOX_TEMPLATED diff --git a/doc/reference.qbk b/doc/reference.qbk index 54cb12783..335b78614 100644 --- a/doc/reference.qbk +++ b/doc/reference.qbk @@ -34,14 +34,30 @@ [include generated/interior_rings.qbk] [endsect] - [endsect] [/access functions] - - -[section:register Adaption and adapted models] +[section:adapted Adapted models] +[include reference/geometries/adapted/c_array.qbk] +[include reference/geometries/adapted/boost_array.qbk] +[include reference/geometries/adapted/boost_fusion.qbk] +[include reference/geometries/adapted/boost_tuple.qbk] +[section:boost_polygon Boost.Polygon] +[include reference/geometries/adapted/boost_polygon/point_data.qbk] +[include reference/geometries/adapted/boost_polygon/rectangle_data.qbk] +[include reference/geometries/adapted/boost_polygon/polygon_data.qbk] +[include reference/geometries/adapted/boost_polygon/polygon_with_holes_data.qbk] +[endsect] +[section:boost_range Boost.Range] +[include reference/geometries/adapted/boost_range/filtered.qbk] +[include reference/geometries/adapted/boost_range/reversed.qbk] +[include reference/geometries/adapted/boost_range/sliced.qbk] +[include reference/geometries/adapted/boost_range/strided.qbk] +[/ include reference/geometries/adapted/boost_range/uniqued.qbk] +[endsect] +[section:register Macro's for adaption] [include generated/register.qbk] [endsect] +[endsect] [section:algorithms Algorithms] @@ -52,10 +68,8 @@ [section:assign assign] [include generated/assign.qbk] [endsect] -[/section:append append] -[include generated/append.qbk] -[/endsect] +[include generated/append.qbk] [section:buffer buffer] [include generated/buffer.qbk] @@ -175,7 +189,6 @@ [include generated/cs_tag.qbk] [include generated/degree.qbk] [include generated/dimension.qbk] -[include generated/exception.qbk] [include generated/interior_type.qbk] [include generated/is_radian.qbk] [include generated/point_order.qbk] diff --git a/doc/reference/core/interior_type.qbk b/doc/reference/core/interior_type.qbk new file mode 100644 index 000000000..7eb883b82 --- /dev/null +++ b/doc/reference/core/interior_type.qbk @@ -0,0 +1,17 @@ +[/============================================================================ + Boost.Geometry (aka GGL, Generic Geometry Library) + + Copyright (c) 2009-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) +=============================================================================/] + + +[heading Complexity] +Compile time + +[heading Example] +[interior_type] +[interior_type_output] diff --git a/doc/reference/core/ring_type.qbk b/doc/reference/core/ring_type.qbk new file mode 100644 index 000000000..d0f399814 --- /dev/null +++ b/doc/reference/core/ring_type.qbk @@ -0,0 +1,17 @@ +[/============================================================================ + Boost.Geometry (aka GGL, Generic Geometry Library) + + Copyright (c) 2009-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) +=============================================================================/] + + +[heading Complexity] +Compile time + +[heading Example] +[ring_type] +[ring_type_output] diff --git a/doc/reference/core/tag.qbk b/doc/reference/core/tag.qbk index c7d7711ae..4ad2bba2d 100644 --- a/doc/reference/core/tag.qbk +++ b/doc/reference/core/tag.qbk @@ -8,9 +8,18 @@ http://www.boost.org/LICENSE_1_0.txt) =============================================================================/] -[note With Boost.Geometry, tags are the driving force of the tag dispatching - mechanism. The tag metafunction is therefore used in every free function. -] +[heading Metafunction result type] +The metafunction tag defines [*type] as one of the following tags: + +* point_tag +* linestring_tag +* polygon_tag +* multi_point_tag +* multi_linestring_tag +* multi_polygon_tag +* box_tag +* segment_tag +* ring_tag [heading Complexity] Compile time diff --git a/doc/reference/geometries/adapted/boost_array.qbk b/doc/reference/geometries/adapted/boost_array.qbk new file mode 100644 index 000000000..6c1e96078 --- /dev/null +++ b/doc/reference/geometries/adapted/boost_array.qbk @@ -0,0 +1,38 @@ +[/============================================================================ + 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) +=============================================================================/] + +[section:boost_array Boost.Array] + +Boost.Array arrays are adapted to the Boost.Geometry point concept + +[heading Description] + +A boost::array is (optionally) adapted to the Boost.Geometry +point concept. It can therefore be used in all Boost.Geometry algorithms. + +A boost::array can be the point type used by the models linestring, polygon, segment, +box, and ring + +[heading Model of] +[link geometry.reference.concepts.concept_point Point Concept] + +[heading Header] +`#include ` + +The standard header `` does not include this header. + +[heading Example] +[boost_array] +[boost_array_output] + +[endsect] + diff --git a/doc/reference/geometries/adapted/boost_fusion.qbk b/doc/reference/geometries/adapted/boost_fusion.qbk new file mode 100644 index 000000000..a55ae232b --- /dev/null +++ b/doc/reference/geometries/adapted/boost_fusion.qbk @@ -0,0 +1,35 @@ +[/============================================================================ + 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) +=============================================================================/] + +[section:boost_fusion Boost.Fusion] + +Boost.Fusion adapted structs or classes are adapted to the Boost.Geometry point concept + +[heading Description] + +Boost.Fusion adapted structs are (optionally) adapted to the Boost.Geometry +point concept. They can therefore be used in many Boost.Geometry algorithms. + +[heading Model of] +[link geometry.reference.concepts.concept_point Point Concept] + +[heading Header] +`#include ` + +The standard header `` does not include this header. + +[heading Example] +[boost_fusion] +[boost_fusion_output] + +[endsect] + diff --git a/doc/reference/geometries/adapted/boost_polygon/point_data.qbk b/doc/reference/geometries/adapted/boost_polygon/point_data.qbk new file mode 100644 index 000000000..7aea17d2a --- /dev/null +++ b/doc/reference/geometries/adapted/boost_polygon/point_data.qbk @@ -0,0 +1,36 @@ +[/============================================================================ + 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) +=============================================================================/] + +[section:point_data Boost.Polygon's point_data] + +The Boost.Polygon point type (boost::polygon::point_data) is adapted to the Boost.Geometry Point Concept. + +[heading Description] + +Boost.Polygon's points (as well as polygons) can be used by Boost.Geometry. The +two libraries can therefore be used together. Using a boost::polygon::point_data<...>, +algorithms from both Boost.Polygon and Boost.Geometry can be called. + +[heading Model of] +[link geometry.reference.concepts.concept_point Point Concept] + +[heading Header] +`#include ` + +__not_in_boost_geometry_hpp__ + +[heading Example] +[boost_polygon] +[boost_polygon_output] + +[endsect] + diff --git a/doc/reference/geometries/adapted/boost_polygon/polygon_data.qbk b/doc/reference/geometries/adapted/boost_polygon/polygon_data.qbk new file mode 100644 index 000000000..8254fdda8 --- /dev/null +++ b/doc/reference/geometries/adapted/boost_polygon/polygon_data.qbk @@ -0,0 +1,36 @@ +[/============================================================================ + 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) +=============================================================================/] + +[section:polygon_data Boost.Polygon's polygon_data] + +Boost.Polygon's polygon type (boost::polygon::polygon_data) is adapted to the Boost.Geometry Ring Concept. + +[heading Description] + +Boost.Polygon's points (as well as polygons) can be used by Boost.Geometry. The +two libraries can therefore be used together. Using a boost::polygon::point_data<...>, +algorithms from both Boost.Polygon and Boost.Geometry can be called. + +[heading Model of] +[link geometry.reference.concepts.concept_ring Ring Concept] + +[heading Header] +`#include ` + +__not_in_boost_geometry_hpp__ + +[heading Example] +[boost_polygon] +[boost_polygon_output] + +[endsect] + diff --git a/doc/reference/geometries/adapted/boost_polygon/polygon_with_holes_data.qbk b/doc/reference/geometries/adapted/boost_polygon/polygon_with_holes_data.qbk new file mode 100644 index 000000000..00979a3d9 --- /dev/null +++ b/doc/reference/geometries/adapted/boost_polygon/polygon_with_holes_data.qbk @@ -0,0 +1,37 @@ +[/============================================================================ + 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) +=============================================================================/] + +[section:polygon_with_holes_data Boost.Polygon's polygon_with_holes_data] + +Boost.Polygon's polygon type supporting holes (boost::polygon::polygon_with_holes_data) +is adapted to the Boost.Geometry Polygon Concept. + +[heading Description] + +Boost.Polygon's points (as well as polygons) can be used by Boost.Geometry. The +two libraries can therefore be used together. Using a boost::polygon::point_data<...>, +algorithms from both Boost.Polygon and Boost.Geometry can be called. + +[heading Model of] +[link geometry.reference.concepts.concept_polygon Polygon Concept] + +[heading Header] +`#include ` + +__not_in_boost_geometry_hpp__ + +[heading Example] +[boost_polygon] +[boost_polygon_output] + +[endsect] + diff --git a/doc/reference/geometries/adapted/boost_polygon/rectangle_data.qbk b/doc/reference/geometries/adapted/boost_polygon/rectangle_data.qbk new file mode 100644 index 000000000..a94db7808 --- /dev/null +++ b/doc/reference/geometries/adapted/boost_polygon/rectangle_data.qbk @@ -0,0 +1,36 @@ +[/============================================================================ + 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) +=============================================================================/] + +[section:rectangle_data Boost.Polygon's rectangle_data] + +Boost.Polygon's rectangle type (boost::polygon::rectangle_data) is adapted to the Boost.Geometry Point Concept. + +[heading Description] + +Boost.Polygon's points (as well as polygons) can be used by Boost.Geometry. The +two libraries can therefore be used together. Using a boost::polygon::point_data<...>, +algorithms from both Boost.Polygon and Boost.Geometry can be called. + +[heading Model of] +[link geometry.reference.concepts.concept_box Box Concept] + +[heading Header] +`#include ` + +__not_in_boost_geometry_hpp__ + +[heading Example] +[boost_polygon] +[boost_polygon_output] + +[endsect] + diff --git a/doc/reference/geometries/adapted/boost_range/adapts_model.qbk b/doc/reference/geometries/adapted/boost_range/adapts_model.qbk new file mode 100644 index 000000000..f46803562 --- /dev/null +++ b/doc/reference/geometries/adapted/boost_range/adapts_model.qbk @@ -0,0 +1,19 @@ +[/============================================================================ + 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) +=============================================================================/] + +The __adaptor__ takes over the model of the original geometry, which might be: + +* a linestring +* a ring +* a multi_point +* a multi_linestring +* a multi_polygon diff --git a/doc/reference/geometries/adapted/boost_range/filtered.qbk b/doc/reference/geometries/adapted/boost_range/filtered.qbk new file mode 100644 index 000000000..e0f88cedf --- /dev/null +++ b/doc/reference/geometries/adapted/boost_range/filtered.qbk @@ -0,0 +1,36 @@ +[/============================================================================ + 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) +=============================================================================/] + +[section:filtered Boost.Range filtered] + +[def __adaptor__ Boost.Range filtered range adaptor] + +__adaptor__ is adapted to Boost.Geometry + +[heading Description] + +__adaptor__ filters a range. + +[heading Model of] +[include adapts_model.qbk] + +[heading Header] +`#include ` + +__not_in_boost_geometry_hpp__ + +[heading Example] +[boost_range_filtered] +[boost_range_filtered_output] + +[endsect] + diff --git a/doc/reference/geometries/adapted/boost_range/reversed.qbk b/doc/reference/geometries/adapted/boost_range/reversed.qbk new file mode 100644 index 000000000..b8b291466 --- /dev/null +++ b/doc/reference/geometries/adapted/boost_range/reversed.qbk @@ -0,0 +1,36 @@ +[/============================================================================ + 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) +=============================================================================/] + +[section:reversed Boost.Range reversed] + +[def __adaptor__ Boost.Range reversed range adaptor] + +__adaptor__ is adapted to Boost.Geometry + +[heading Description] + +__adaptor__ reverses a range. + +[heading Model of] +[include adapts_model.qbk] + +[heading Header] +`#include ` + +__not_in_boost_geometry_hpp__ + +[heading Example] +[boost_range_reversed] +[boost_range_reversed_output] + +[endsect] + diff --git a/doc/reference/geometries/adapted/boost_range/sliced.qbk b/doc/reference/geometries/adapted/boost_range/sliced.qbk new file mode 100644 index 000000000..bf89f9cd4 --- /dev/null +++ b/doc/reference/geometries/adapted/boost_range/sliced.qbk @@ -0,0 +1,36 @@ +[/============================================================================ + 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) +=============================================================================/] + +[section:sliced Boost.Range sliced] + +[def __adaptor__ Boost.Range sliced range adaptor] + +__adaptor__ is adapted to Boost.Geometry + +[heading Description] + +__adaptor__ creates a slice of a range (usually a linestring) + +[heading Model of] +[include adapts_model.qbk] + +[heading Header] +`#include ` + +__not_in_boost_geometry_hpp__ + +[heading Example] +[boost_range_sliced] +[boost_range_sliced_output] + +[endsect] + diff --git a/doc/reference/geometries/adapted/boost_range/strided.qbk b/doc/reference/geometries/adapted/boost_range/strided.qbk new file mode 100644 index 000000000..f67e0989d --- /dev/null +++ b/doc/reference/geometries/adapted/boost_range/strided.qbk @@ -0,0 +1,37 @@ +[/============================================================================ + 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) +=============================================================================/] + +[section:strided Boost.Range strided] + +[def __adaptor__ Boost.Range strided range adaptor] + +__adaptor__ is adapted to Boost.Geometry + +[heading Description] + +__adaptor__ makes a strided range (usually begin a linestring or ring) such that +traversal is performed in steps of n. + +[heading Model of] +[include adapts_model.qbk] + +[heading Header] +`#include ` + +__not_in_boost_geometry_hpp__ + +[heading Example] +[boost_range_strided] +[boost_range_strided_output] + +[endsect] + diff --git a/doc/reference/geometries/adapted/boost_range/uniqued.qbk b/doc/reference/geometries/adapted/boost_range/uniqued.qbk new file mode 100644 index 000000000..ed809f7d4 --- /dev/null +++ b/doc/reference/geometries/adapted/boost_range/uniqued.qbk @@ -0,0 +1,36 @@ +[/============================================================================ + 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) +=============================================================================/] + +[section:uniqued Boost.Range uniqued] + +[def __adaptor__ Boost.Range uniqued range adaptor] + +__adaptor__ is adapted to Boost.Geometry + +[heading Description] + +__adaptor__ makes a range unique + +[heading Model of] +[include adapts_model.qbk] + +[heading Header] +`#include ` + +__not_in_boost_geometry_hpp__ + +[heading Example] +[boost_range_uniqued] +[boost_range_uniqued_output] + +[endsect] + diff --git a/doc/reference/geometries/adapted/boost_tuple.qbk b/doc/reference/geometries/adapted/boost_tuple.qbk new file mode 100644 index 000000000..32b0ddbeb --- /dev/null +++ b/doc/reference/geometries/adapted/boost_tuple.qbk @@ -0,0 +1,47 @@ +[/============================================================================ + 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) +=============================================================================/] + +[section:boost_tuple Boost.Tuple] + +Boost.Tuple tuples with arithmetic elements can be used as +points within Boost.Geometry + +[heading Description] + +Boost.Tuple fixed sized collections, such as boost::tuple, are +(optionally) adapted to the Boost.Geometry point concept. + +Boost.Tuple pairs or triples might have mutually different types, such as a +boost::tuple. Boost.Geometry reports the first type as its +[link geometry.reference.core.coordinate_type coordinate_type]. + +Boost.Geometry supports Boost.Tuple pairs, triples, quadruples, etc up to +tuples with 10 elements (though most algorithms do not support so many +dimensions). + +A tuple can be the point type used by the models linestring, polygon, segment, +box, and ring + +[heading Model of] +[link geometry.reference.concepts.concept_point Point Concept] + +[heading Header] +`#include ` + +The standard header `` does not include this header. + +[heading Example] +[boost_tuple] +[boost_tuple_output] + +[endsect] + diff --git a/doc/reference/geometries/adapted/c_array.qbk b/doc/reference/geometries/adapted/c_array.qbk new file mode 100644 index 000000000..be560a870 --- /dev/null +++ b/doc/reference/geometries/adapted/c_array.qbk @@ -0,0 +1,40 @@ +[/============================================================================ + 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) +=============================================================================/] + +[section:c_array C array] + +C arrays are adapted to the Boost.Geometry point concept + +[heading Description] + +C arrays, such as double[2] or int[3], are (optionally) adapted to the Boost.Geometry +point concept. They can therefore be used in many Boost.Geometry algorithms. + +Note that a C array cannot be the point type of a linestring or a polygon. The reason +for that is that a std::vector does not allow containing C arrays +(this is not related to Boost.Geometry). The C array is therefore limited to +the point type. + +[heading Model of] +[link geometry.reference.concepts.concept_point Point Concept] + +[heading Header] +`#include ` + +The standard header `` does not include this header. + +[heading Example] +[c_array] +[c_array_output] + +[endsect] + diff --git a/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_elements.hpp b/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_elements.hpp index cafb9b934..e2fe9bdd5 100644 --- a/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_elements.hpp +++ b/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_elements.hpp @@ -140,6 +140,7 @@ struct base_class struct class_or_struct : public element { + bool is_class; // true if class, false if struct std::string name, fullname; std::vector functions; diff --git a/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp b/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp index a3a999927..2667fe985 100644 --- a/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp +++ b/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp @@ -430,9 +430,16 @@ static void parse(rapidxml::xml_node<>* node, configuration const& config, docum { recurse = true; } - if (kind == "struct" || kind == "class") + else if (kind == "struct") { recurse = true; + doc.cos.is_class = false; + parse_element(node->first_node(), config, "", doc.cos); + } + else if (kind == "class") + { + recurse = true; + doc.cos.is_class = true; parse_element(node->first_node(), config, "", doc.cos); } } diff --git a/doc/src/docutils/tools/doxygen_xml2qbk/for_debugger.ini b/doc/src/docutils/tools/doxygen_xml2qbk/for_debugger.ini index e225e2e5c..2916bbe51 100644 --- a/doc/src/docutils/tools/doxygen_xml2qbk/for_debugger.ini +++ b/doc/src/docutils/tools/doxygen_xml2qbk/for_debugger.ini @@ -4,7 +4,7 @@ # xml=../../../../doxy/doxygen_output/xml/classboost_1_1geometry_1_1strategy_1_1distance_1_1pythagoras.xml # xml=../../../../doxy/doxygen_output/xml/group__get.xml -xml=../../../../doxy/doxygen_output/xml/group__num__points.xml +xml=../../../../doxy/doxygen_output/xml/structboost_1_1geometry_1_1tag.xml start_include=boost/geometry/ convenience_header_path=../../../../../../../boost/geometry/ diff --git a/doc/src/docutils/tools/doxygen_xml2qbk/quickbook_output.hpp b/doc/src/docutils/tools/doxygen_xml2qbk/quickbook_output.hpp index f1fb92869..e8d3f2570 100644 --- a/doc/src/docutils/tools/doxygen_xml2qbk/quickbook_output.hpp +++ b/doc/src/docutils/tools/doxygen_xml2qbk/quickbook_output.hpp @@ -474,7 +474,8 @@ void quickbook_output(class_or_struct const& cos, configuration const& config, s out << "[heading Synopsis]" << std::endl << "``"; quickbook_template_parameter_list(cos.template_parameters, out); - out << "class " << short_name << std::endl; + out << (cos.is_class ? "class" : "struct") + << " " << short_name << std::endl; if (! cos.base_classes.empty()) { diff --git a/doc/src/examples/algorithms/append.cpp b/doc/src/examples/algorithms/append.cpp index 692951433..f4392d645 100644 --- a/doc/src/examples/algorithms/append.cpp +++ b/doc/src/examples/algorithms/append.cpp @@ -12,12 +12,14 @@ #include -#include -#include -#include - #include +#include +#include +#include + +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + int main() { using boost::assign::tuple_list_of; diff --git a/doc/src/examples/algorithms/area.cpp b/doc/src/examples/algorithms/area.cpp index d89d0012c..597bec3b4 100644 --- a/doc/src/examples/algorithms/area.cpp +++ b/doc/src/examples/algorithms/area.cpp @@ -11,7 +11,7 @@ //` Calculate the area of a polygon #include -#include +#include #include namespace bg = boost::geometry; /*< Convenient namespace alias >*/ diff --git a/doc/src/examples/algorithms/area_with_strategy.cpp b/doc/src/examples/algorithms/area_with_strategy.cpp index 808f102ff..cefbf39a2 100644 --- a/doc/src/examples/algorithms/area_with_strategy.cpp +++ b/doc/src/examples/algorithms/area_with_strategy.cpp @@ -11,7 +11,7 @@ //` Calculate the area of a polygon #include -#include +#include #include namespace bg = boost::geometry; /*< Convenient namespace alias >*/ diff --git a/doc/src/examples/algorithms/assign.cpp b/doc/src/examples/algorithms/assign.cpp index bc5b4cdc5..94482adb4 100644 --- a/doc/src/examples/algorithms/assign.cpp +++ b/doc/src/examples/algorithms/assign.cpp @@ -12,8 +12,10 @@ #include -#include -#include +#include +#include + +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) int main() { diff --git a/doc/src/examples/algorithms/assign_2d_point.cpp b/doc/src/examples/algorithms/assign_2d_point.cpp index e32f5b5c7..f21f47e0e 100644 --- a/doc/src/examples/algorithms/assign_2d_point.cpp +++ b/doc/src/examples/algorithms/assign_2d_point.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include #if defined(HAVE_TTMATH) diff --git a/doc/src/examples/algorithms/assign_3d_point.cpp b/doc/src/examples/algorithms/assign_3d_point.cpp index aa3ddb683..094b8869b 100644 --- a/doc/src/examples/algorithms/assign_3d_point.cpp +++ b/doc/src/examples/algorithms/assign_3d_point.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include int main() diff --git a/doc/src/examples/algorithms/assign_box_corners.cpp b/doc/src/examples/algorithms/assign_box_corners.cpp index f6588194f..e74545bed 100644 --- a/doc/src/examples/algorithms/assign_box_corners.cpp +++ b/doc/src/examples/algorithms/assign_box_corners.cpp @@ -12,7 +12,7 @@ #include -#include +#include #include using namespace boost::geometry; diff --git a/doc/src/examples/algorithms/assign_inverse.cpp b/doc/src/examples/algorithms/assign_inverse.cpp index 8685f1397..27d1fdf11 100644 --- a/doc/src/examples/algorithms/assign_inverse.cpp +++ b/doc/src/examples/algorithms/assign_inverse.cpp @@ -12,7 +12,7 @@ #include -#include +#include #include using namespace boost::geometry; diff --git a/doc/src/examples/algorithms/assign_point_from_index.cpp b/doc/src/examples/algorithms/assign_point_from_index.cpp index 2f5284693..06a684afe 100644 --- a/doc/src/examples/algorithms/assign_point_from_index.cpp +++ b/doc/src/examples/algorithms/assign_point_from_index.cpp @@ -12,7 +12,7 @@ #include -#include +#include #include using namespace boost::geometry; diff --git a/doc/src/examples/algorithms/assign_point_to_index.cpp b/doc/src/examples/algorithms/assign_point_to_index.cpp index 8cec40be8..db73730ef 100644 --- a/doc/src/examples/algorithms/assign_point_to_index.cpp +++ b/doc/src/examples/algorithms/assign_point_to_index.cpp @@ -12,7 +12,7 @@ #include -#include +#include #include using namespace boost::geometry; diff --git a/doc/src/examples/algorithms/assign_points.cpp b/doc/src/examples/algorithms/assign_points.cpp index c74775963..d43321da2 100644 --- a/doc/src/examples/algorithms/assign_points.cpp +++ b/doc/src/examples/algorithms/assign_points.cpp @@ -12,13 +12,15 @@ #include -#include +#include #include -#include +#include #include #include +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template struct x_between { diff --git a/doc/src/examples/algorithms/centroid.cpp b/doc/src/examples/algorithms/centroid.cpp index e4004183a..49bb80cde 100644 --- a/doc/src/examples/algorithms/centroid.cpp +++ b/doc/src/examples/algorithms/centroid.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include diff --git a/doc/src/examples/algorithms/clear.cpp b/doc/src/examples/algorithms/clear.cpp index f9932ed26..20f9deba1 100644 --- a/doc/src/examples/algorithms/clear.cpp +++ b/doc/src/examples/algorithms/clear.cpp @@ -12,9 +12,11 @@ #include -#include +#include #include -#include +#include + +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) #include diff --git a/doc/src/examples/algorithms/comparable_distance.cpp b/doc/src/examples/algorithms/comparable_distance.cpp index 0ed9a0490..64df6d56d 100644 --- a/doc/src/examples/algorithms/comparable_distance.cpp +++ b/doc/src/examples/algorithms/comparable_distance.cpp @@ -12,7 +12,7 @@ #include -#include +#include #include #include diff --git a/doc/src/examples/algorithms/convert.cpp b/doc/src/examples/algorithms/convert.cpp index 5b6e377e1..6baf27c5a 100644 --- a/doc/src/examples/algorithms/convert.cpp +++ b/doc/src/examples/algorithms/convert.cpp @@ -13,7 +13,9 @@ #include #include -#include +#include + +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) int main() { diff --git a/doc/src/examples/algorithms/convex_hull.cpp b/doc/src/examples/algorithms/convex_hull.cpp index f6963f092..2f826e148 100644 --- a/doc/src/examples/algorithms/convex_hull.cpp +++ b/doc/src/examples/algorithms/convex_hull.cpp @@ -12,8 +12,10 @@ #include -#include -#include +#include +#include + +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) /*<-*/ #include "create_svg_two.hpp" /*->*/ int main() diff --git a/doc/src/examples/algorithms/correct.cpp b/doc/src/examples/algorithms/correct.cpp index add730428..ec8753dd7 100644 --- a/doc/src/examples/algorithms/correct.cpp +++ b/doc/src/examples/algorithms/correct.cpp @@ -12,8 +12,10 @@ #include -#include -#include +#include +#include + +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) #include diff --git a/doc/src/examples/algorithms/difference.cpp b/doc/src/examples/algorithms/difference.cpp index 44bcf82b5..03f5cf954 100644 --- a/doc/src/examples/algorithms/difference.cpp +++ b/doc/src/examples/algorithms/difference.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include diff --git a/doc/src/examples/algorithms/difference_inserter.cpp b/doc/src/examples/algorithms/difference_inserter.cpp index 3c54ccd5b..60d8883ac 100644 --- a/doc/src/examples/algorithms/difference_inserter.cpp +++ b/doc/src/examples/algorithms/difference_inserter.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include diff --git a/doc/src/examples/algorithms/distance.cpp b/doc/src/examples/algorithms/distance.cpp index 3d4e71d5a..bc77e9f0e 100644 --- a/doc/src/examples/algorithms/distance.cpp +++ b/doc/src/examples/algorithms/distance.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include diff --git a/doc/src/examples/algorithms/envelope.cpp b/doc/src/examples/algorithms/envelope.cpp index ec50f572c..fd310dae2 100644 --- a/doc/src/examples/algorithms/envelope.cpp +++ b/doc/src/examples/algorithms/envelope.cpp @@ -12,7 +12,7 @@ #include -#include +#include #include #include diff --git a/doc/src/examples/algorithms/equals.cpp b/doc/src/examples/algorithms/equals.cpp index 27b087125..4b8df5f34 100644 --- a/doc/src/examples/algorithms/equals.cpp +++ b/doc/src/examples/algorithms/equals.cpp @@ -12,9 +12,11 @@ #include -#include +#include #include -#include +#include + +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) #include diff --git a/doc/src/examples/algorithms/expand.cpp b/doc/src/examples/algorithms/expand.cpp index 449b48fd9..d2cb3fc4d 100644 --- a/doc/src/examples/algorithms/expand.cpp +++ b/doc/src/examples/algorithms/expand.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include int main() { diff --git a/doc/src/examples/algorithms/for_each_point.cpp b/doc/src/examples/algorithms/for_each_point.cpp index 23c3b5a37..f5a42ba55 100644 --- a/doc/src/examples/algorithms/for_each_point.cpp +++ b/doc/src/examples/algorithms/for_each_point.cpp @@ -12,7 +12,7 @@ #include -#include +#include #include #include diff --git a/doc/src/examples/algorithms/for_each_point_const.cpp b/doc/src/examples/algorithms/for_each_point_const.cpp index 51d5f7a5e..8b29ef1e9 100644 --- a/doc/src/examples/algorithms/for_each_point_const.cpp +++ b/doc/src/examples/algorithms/for_each_point_const.cpp @@ -12,7 +12,7 @@ #include -#include +#include #include #include diff --git a/doc/src/examples/algorithms/for_each_segment_const.cpp b/doc/src/examples/algorithms/for_each_segment_const.cpp index 3d0a6d914..c1ae26236 100644 --- a/doc/src/examples/algorithms/for_each_segment_const.cpp +++ b/doc/src/examples/algorithms/for_each_segment_const.cpp @@ -12,7 +12,7 @@ #include -#include +#include #include #include diff --git a/doc/src/examples/algorithms/intersection_ls_ls_point.cpp b/doc/src/examples/algorithms/intersection_ls_ls_point.cpp index 827f2b403..a4ef55ef6 100644 --- a/doc/src/examples/algorithms/intersection_ls_ls_point.cpp +++ b/doc/src/examples/algorithms/intersection_ls_ls_point.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include /*< Adapts std::vector to linestring concept >*/ diff --git a/doc/src/examples/algorithms/intersection_poly_poly.cpp b/doc/src/examples/algorithms/intersection_poly_poly.cpp index d863ca6b8..0966e1446 100644 --- a/doc/src/examples/algorithms/intersection_poly_poly.cpp +++ b/doc/src/examples/algorithms/intersection_poly_poly.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include diff --git a/doc/src/examples/algorithms/intersection_segment.cpp b/doc/src/examples/algorithms/intersection_segment.cpp index bbbc1d497..d9a902436 100644 --- a/doc/src/examples/algorithms/intersection_segment.cpp +++ b/doc/src/examples/algorithms/intersection_segment.cpp @@ -12,7 +12,7 @@ #include -#include +#include #include #include /*< Adapts std::vector to linestring concept >*/ diff --git a/doc/src/examples/algorithms/intersects_linestring.cpp b/doc/src/examples/algorithms/intersects_linestring.cpp index 3d98e0a6b..536c649e7 100644 --- a/doc/src/examples/algorithms/intersects_linestring.cpp +++ b/doc/src/examples/algorithms/intersects_linestring.cpp @@ -12,7 +12,7 @@ #include -#include +#include #include int main() diff --git a/doc/src/examples/algorithms/intersects_segment.cpp b/doc/src/examples/algorithms/intersects_segment.cpp index fc96a3e88..9c98a3085 100644 --- a/doc/src/examples/algorithms/intersects_segment.cpp +++ b/doc/src/examples/algorithms/intersects_segment.cpp @@ -12,7 +12,7 @@ #include -#include +#include #include int main() diff --git a/doc/src/examples/algorithms/length.cpp b/doc/src/examples/algorithms/length.cpp index 1eab5e117..506a3e6b5 100644 --- a/doc/src/examples/algorithms/length.cpp +++ b/doc/src/examples/algorithms/length.cpp @@ -11,7 +11,7 @@ //` The following simple example shows the calculation of the length of a linestring containing three points #include -#include +#include #include diff --git a/doc/src/examples/algorithms/length_with_strategy.cpp b/doc/src/examples/algorithms/length_with_strategy.cpp index 4f35ae41b..32eb6d39b 100644 --- a/doc/src/examples/algorithms/length_with_strategy.cpp +++ b/doc/src/examples/algorithms/length_with_strategy.cpp @@ -11,7 +11,7 @@ //`The following example shows the length measured over a sphere, expressed in kilometers. To do that the radius of the sphere must be specified in the constructor of the strategy. #include -#include +#include int main() { diff --git a/doc/src/examples/algorithms/make_2d_point.cpp b/doc/src/examples/algorithms/make_2d_point.cpp index be55eb553..8c6189b3b 100644 --- a/doc/src/examples/algorithms/make_2d_point.cpp +++ b/doc/src/examples/algorithms/make_2d_point.cpp @@ -12,12 +12,14 @@ #include -#include +#include #include #include -#include +#include #include +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + struct mypoint { float _x, _y; }; BOOST_GEOMETRY_REGISTER_POINT_2D(mypoint, float, cs::cartesian, _x, _y) diff --git a/doc/src/examples/algorithms/make_3d_point.cpp b/doc/src/examples/algorithms/make_3d_point.cpp index 254f0b281..4605bb81a 100644 --- a/doc/src/examples/algorithms/make_3d_point.cpp +++ b/doc/src/examples/algorithms/make_3d_point.cpp @@ -12,7 +12,7 @@ #include -#include +#include #include int main() diff --git a/doc/src/examples/algorithms/make_inverse.cpp b/doc/src/examples/algorithms/make_inverse.cpp index cfcd718ee..20dd5fc37 100644 --- a/doc/src/examples/algorithms/make_inverse.cpp +++ b/doc/src/examples/algorithms/make_inverse.cpp @@ -12,7 +12,7 @@ #include -#include +#include #include using namespace boost::geometry; diff --git a/doc/src/examples/algorithms/make_with_range.cpp b/doc/src/examples/algorithms/make_with_range.cpp index 3b996ac4a..faf97f707 100644 --- a/doc/src/examples/algorithms/make_with_range.cpp +++ b/doc/src/examples/algorithms/make_with_range.cpp @@ -12,24 +12,25 @@ #include -#include -#include -#include /*< Necessary to register a C array like {1,2} as a point >*/ +#include +#include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) /*< Necessary to register a C array like {1,2} as a point >*/ int main() { using boost::geometry::make; + using boost::geometry::detail::make::make_points; typedef boost::geometry::model::d2::point_xy point; typedef boost::geometry::model::linestring linestring; double coordinates[][2] = {{1,2}, {3,4}, {5, 6}}; /*< Initialize with C array points >*/ - linestring ls = make(coordinates); + linestring ls = make_points(coordinates); std::cout << boost::geometry::dsv(ls) << std::endl; point points[3] = { make(9,8), make(7,6), make(5,4) }; /*< Construct array with points, using make which should work for any point type >*/ - std::cout << boost::geometry::dsv(make(points)) << std::endl; /*< Construct linestring with point-array and output it as Delimiter Separated Values >*/ + std::cout << boost::geometry::dsv(make_points(points)) << std::endl; /*< Construct linestring with point-array and output it as Delimiter Separated Values >*/ return 0; } diff --git a/doc/src/examples/algorithms/num_geometries.cpp b/doc/src/examples/algorithms/num_geometries.cpp index 87805761b..d66735de7 100644 --- a/doc/src/examples/algorithms/num_geometries.cpp +++ b/doc/src/examples/algorithms/num_geometries.cpp @@ -12,7 +12,7 @@ #include -#include +#include #include #include #include diff --git a/doc/src/examples/algorithms/num_interior_rings.cpp b/doc/src/examples/algorithms/num_interior_rings.cpp index b4aa82940..b6edc4a67 100644 --- a/doc/src/examples/algorithms/num_interior_rings.cpp +++ b/doc/src/examples/algorithms/num_interior_rings.cpp @@ -12,7 +12,7 @@ #include -#include +#include #include #include #include diff --git a/doc/src/examples/algorithms/num_points.cpp b/doc/src/examples/algorithms/num_points.cpp index b44c44c2a..be0c1492a 100644 --- a/doc/src/examples/algorithms/num_points.cpp +++ b/doc/src/examples/algorithms/num_points.cpp @@ -12,7 +12,7 @@ #include -#include +#include #include #include #include diff --git a/doc/src/examples/algorithms/return_envelope.cpp b/doc/src/examples/algorithms/return_envelope.cpp index 5775d9f53..cb8914e5d 100644 --- a/doc/src/examples/algorithms/return_envelope.cpp +++ b/doc/src/examples/algorithms/return_envelope.cpp @@ -13,7 +13,7 @@ #include -#include +#include #include #include diff --git a/doc/src/examples/algorithms/reverse.cpp b/doc/src/examples/algorithms/reverse.cpp index 33fc690fc..f12c72281 100644 --- a/doc/src/examples/algorithms/reverse.cpp +++ b/doc/src/examples/algorithms/reverse.cpp @@ -12,9 +12,11 @@ #include -#include +#include #include -#include +#include + +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) #include diff --git a/doc/src/examples/algorithms/simplify.cpp b/doc/src/examples/algorithms/simplify.cpp index f67a256b3..db4a97bfb 100644 --- a/doc/src/examples/algorithms/simplify.cpp +++ b/doc/src/examples/algorithms/simplify.cpp @@ -11,7 +11,7 @@ //` Example showing how to simplify a linestring #include -#include +#include /*< For this example we use Boost.Assign to add points >*/ #include diff --git a/doc/src/examples/algorithms/simplify_insert.cpp b/doc/src/examples/algorithms/simplify_insert.cpp index e3a2e7c05..d93034dfd 100644 --- a/doc/src/examples/algorithms/simplify_insert.cpp +++ b/doc/src/examples/algorithms/simplify_insert.cpp @@ -11,7 +11,7 @@ //` Simplify a linestring using a back inserter #include -#include +#include int main() { diff --git a/doc/src/examples/algorithms/simplify_insert_with_strategy.cpp b/doc/src/examples/algorithms/simplify_insert_with_strategy.cpp index a73cd0c68..3236fee0b 100644 --- a/doc/src/examples/algorithms/simplify_insert_with_strategy.cpp +++ b/doc/src/examples/algorithms/simplify_insert_with_strategy.cpp @@ -11,7 +11,7 @@ //` Simplify a linestring using an output iterator #include -#include +#include #include #include diff --git a/doc/src/examples/algorithms/sym_difference.cpp b/doc/src/examples/algorithms/sym_difference.cpp index 80d487819..7f0bf779f 100644 --- a/doc/src/examples/algorithms/sym_difference.cpp +++ b/doc/src/examples/algorithms/sym_difference.cpp @@ -12,7 +12,7 @@ #include -#include +#include #include #include #include diff --git a/doc/src/examples/algorithms/transform.cpp b/doc/src/examples/algorithms/transform.cpp index 8eea3be30..feee4ab13 100644 --- a/doc/src/examples/algorithms/transform.cpp +++ b/doc/src/examples/algorithms/transform.cpp @@ -11,7 +11,7 @@ //` Shows how points can be transformed using the default strategy #include -#include +#include int main() diff --git a/doc/src/examples/algorithms/transform_with_strategy.cpp b/doc/src/examples/algorithms/transform_with_strategy.cpp index 2fcfc57f4..20e842635 100644 --- a/doc/src/examples/algorithms/transform_with_strategy.cpp +++ b/doc/src/examples/algorithms/transform_with_strategy.cpp @@ -11,7 +11,7 @@ //` Shows how points can be scaled, translated or rotated #include -#include +#include int main() diff --git a/doc/src/examples/algorithms/union.cpp b/doc/src/examples/algorithms/union.cpp index 865da72c2..79c35298a 100644 --- a/doc/src/examples/algorithms/union.cpp +++ b/doc/src/examples/algorithms/union.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include diff --git a/doc/src/examples/algorithms/unique.cpp b/doc/src/examples/algorithms/unique.cpp index 294e1cd98..1c3511272 100644 --- a/doc/src/examples/algorithms/unique.cpp +++ b/doc/src/examples/algorithms/unique.cpp @@ -12,8 +12,10 @@ #include -#include -#include +#include +#include + +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) int main() { diff --git a/doc/src/examples/algorithms/within.cpp b/doc/src/examples/algorithms/within.cpp index cb8e110fc..24d33bdcc 100644 --- a/doc/src/examples/algorithms/within.cpp +++ b/doc/src/examples/algorithms/within.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include diff --git a/doc/src/examples/core/Jamfile.v2 b/doc/src/examples/core/Jamfile.v2 index 53d08c43a..26bab2bf5 100644 --- a/doc/src/examples/core/Jamfile.v2 +++ b/doc/src/examples/core/Jamfile.v2 @@ -25,6 +25,9 @@ exe coordinate_dimension : coordinate_dimension.cpp ; exe point_order : point_order.cpp ; exe closure : closure.cpp ; +exe interior_type : interior_type.cpp ; exe point_type : point_type.cpp ; +exe ring_type : ring_type.cpp ; +exe rings : rings.cpp ; exe tag : tag.cpp ; exe tag_cast : tag_cast.cpp ; diff --git a/doc/src/examples/core/closure.cpp b/doc/src/examples/core/closure.cpp index 47c40adcc..db4c5e406 100644 --- a/doc/src/examples/core/closure.cpp +++ b/doc/src/examples/core/closure.cpp @@ -11,7 +11,7 @@ //` Examine if a polygon is defined as "should be closed" #include -#include +#include int main() { diff --git a/doc/src/examples/core/coordinate_dimension.cpp b/doc/src/examples/core/coordinate_dimension.cpp index 5061c46ce..47fda0163 100644 --- a/doc/src/examples/core/coordinate_dimension.cpp +++ b/doc/src/examples/core/coordinate_dimension.cpp @@ -11,15 +11,16 @@ //` Examine the number of coordinates making up the points in a linestring type #include -#include -#include -#include +#include +#include + +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian); int main() { int dim = boost::geometry::dimension < - std::vector + boost::geometry::model::linestring < boost::tuple > diff --git a/doc/src/examples/core/coordinate_system.cpp b/doc/src/examples/core/coordinate_system.cpp index 0152aabf4..6969a27a2 100644 --- a/doc/src/examples/core/coordinate_system.cpp +++ b/doc/src/examples/core/coordinate_system.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include int main() { diff --git a/doc/src/examples/core/coordinate_type.cpp b/doc/src/examples/core/coordinate_type.cpp index ebeea7e3c..3fffafa5f 100644 --- a/doc/src/examples/core/coordinate_type.cpp +++ b/doc/src/examples/core/coordinate_type.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include int main() { diff --git a/doc/src/examples/core/degree_radian.cpp b/doc/src/examples/core/degree_radian.cpp index 3b8411068..3cd2d3dba 100644 --- a/doc/src/examples/core/degree_radian.cpp +++ b/doc/src/examples/core/degree_radian.cpp @@ -11,7 +11,7 @@ //` Specify two coordinate systems, one in degrees, one in radians. #include -#include +#include using namespace boost::geometry; diff --git a/doc/src/examples/core/get_box.cpp b/doc/src/examples/core/get_box.cpp index 379f8c99d..181721267 100644 --- a/doc/src/examples/core/get_box.cpp +++ b/doc/src/examples/core/get_box.cpp @@ -11,7 +11,7 @@ //` Get the coordinate of a box #include -#include +#include namespace bg = boost::geometry; @@ -19,7 +19,7 @@ int main() { bg::model::box > box; - bg::assign(box, 1, 3, 5, 6); + bg::assign_values(box, 1, 3, 5, 6); std::cout << "Box:" << " " << bg::get(box) diff --git a/doc/src/examples/core/get_point.cpp b/doc/src/examples/core/get_point.cpp index 126b25aac..cd0243e52 100644 --- a/doc/src/examples/core/get_point.cpp +++ b/doc/src/examples/core/get_point.cpp @@ -11,7 +11,7 @@ //` Get the coordinate of a point #include -#include +#include namespace bg = boost::geometry; diff --git a/doc/src/examples/core/interior_type.cpp b/doc/src/examples/core/interior_type.cpp new file mode 100644 index 000000000..79b22a914 --- /dev/null +++ b/doc/src/examples/core/interior_type.cpp @@ -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) + +//[interior_type +//`Shows how to use the interior_type metafunction + +#include +#include +#include +#include + +BOOST_GEOMETRY_REGISTER_BOOST_ARRAY_CS(cs::cartesian) + +int main() +{ + // Define a polygon storing points in a deque and storing interior rings + // in a list (note that std::list is not supported by most algorithms + // because not supporting a random access iterator) + typedef boost::geometry::model::polygon + < + boost::array, + true, true, + std::deque, std::list + > polygon; + + std::cout << typeid(boost::geometry::interior_type::type).name() << std::endl; + + return 0; +} + +//] + +//[interior_type_output +/*` +Output (using MSVC) is a long story (part manually replaced with ellipsis): +[pre +class std::list,1,1,class std::deque,class std::allocator>,class std::allocator<...> > > +] +*/ +//] diff --git a/doc/src/examples/core/point_order.cpp b/doc/src/examples/core/point_order.cpp index 34e371209..dede853cd 100644 --- a/doc/src/examples/core/point_order.cpp +++ b/doc/src/examples/core/point_order.cpp @@ -11,7 +11,7 @@ //` Examine the expected point order of a polygon type #include -#include +#include int main() { diff --git a/doc/src/examples/core/point_type.cpp b/doc/src/examples/core/point_type.cpp index 2f1b499b7..51508511c 100644 --- a/doc/src/examples/core/point_type.cpp +++ b/doc/src/examples/core/point_type.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include int main() { diff --git a/doc/src/examples/core/ring_type.cpp b/doc/src/examples/core/ring_type.cpp new file mode 100644 index 000000000..cae4dfd2b --- /dev/null +++ b/doc/src/examples/core/ring_type.cpp @@ -0,0 +1,53 @@ +// 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) + +//[ring_type +//`Shows how to use the ring_type metafunction, as well as interior_type + +#include +#include +#include + +int main() +{ + typedef boost::geometry::model::d2::point_xy point; + typedef boost::geometry::model::polygon polygon; + + typedef boost::geometry::ring_type::type ring_type; + typedef boost::geometry::interior_type::type int_type; + + std::cout << typeid(ring_type).name() << std::endl; + std::cout << typeid(int_type).name() << std::endl; + + // So int_type defines a collection of rings, + // which is a Boost.Range compatible range + // The type of an element of the collection is the very same ring type again. + // We show that. + typedef boost::range_value::type int_ring_type; + + std::cout + << std::boolalpha + << boost::is_same::value + << std::endl; + + return 0; +} + +//] + +//[ring_type_output +/*` +Output (using gcc): +[pre + N5boost8geometry5model4ringINS1_2d28point_xyIdNS0_2cs9cartesianEEELb1ELb1ESt6vectorSaEE +St6vectorIN5boost8geometry5model4ringINS2_2d28point_xyIdNS1_2cs9cartesianEEELb1ELb1ES_SaEESaIS9_EE +true +] +*/ +//] diff --git a/doc/src/examples/core/rings.cpp b/doc/src/examples/core/rings.cpp new file mode 100644 index 000000000..30a32b86f --- /dev/null +++ b/doc/src/examples/core/rings.cpp @@ -0,0 +1,74 @@ +// 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) + +//[rings +/*` +Shows how to access the exterior ring (one) +and interior rings (zero or more) of a polygon. +Also shows the related ring_type and interior_type. +*/ + +#include +#include + + +int main() +{ + typedef boost::geometry::model::d2::point_xy point; + typedef boost::geometry::model::polygon polygon_type; + + polygon_type poly; + + typedef boost::geometry::ring_type::type ring_type; + ring_type& ring = boost::geometry::exterior_ring(poly); + + // For a ring of model::polygon, you can call "push_back". + // (internally, it is done using a traits::push_back class) + ring.push_back(point(0, 0)); + ring.push_back(point(0, 5)); + ring.push_back(point(5, 4)); + ring.push_back(point(0, 0)); + + ring_type inner; + inner.push_back(point(1, 1)); + inner.push_back(point(2, 1)); + inner.push_back(point(2, 2)); + inner.push_back(point(1, 1)); + + typedef boost::geometry::interior_type::type int_type; + int_type& interiors = boost::geometry::interior_rings(poly); + interiors.push_back(inner); + + std::cout << boost::geometry::dsv(poly) << std::endl; + + // So int_type defines a collection of rings, + // which is a Boost.Range compatible range + // The type of an element of the collection is the very same ring type again. + // We show that. + typedef boost::range_value::type int_ring_type; + + std::cout + << std::boolalpha + << boost::is_same::value + << std::endl; + + return 0; +} + +//] + +//[rings_output +/*` +Output: +[pre +(((0, 0), (0, 5), (5, 4), (0, 0)), ((1, 1), (2, 1), (2, 2), (1, 1))) +true +] +*/ +//] diff --git a/doc/src/examples/core/set_box.cpp b/doc/src/examples/core/set_box.cpp index e4b871330..1c56572b1 100644 --- a/doc/src/examples/core/set_box.cpp +++ b/doc/src/examples/core/set_box.cpp @@ -11,7 +11,7 @@ //` Set the coordinate of a box #include -#include +#include namespace bg = boost::geometry; diff --git a/doc/src/examples/core/set_point.cpp b/doc/src/examples/core/set_point.cpp index 14a3c5138..39520c921 100644 --- a/doc/src/examples/core/set_point.cpp +++ b/doc/src/examples/core/set_point.cpp @@ -11,7 +11,7 @@ //` Set the coordinate of a point #include -#include +#include namespace bg = boost::geometry; diff --git a/doc/src/examples/core/tag.cpp b/doc/src/examples/core/tag.cpp index 895c528bb..215e77f23 100644 --- a/doc/src/examples/core/tag.cpp +++ b/doc/src/examples/core/tag.cpp @@ -8,41 +8,101 @@ // http://www.boost.org/LICENSE_1_0.txt) //[tag -//` Examine the tag of some geometry types +//` Shows how tag dispatching essentially works in Boost.Geometry #include -#include -#include + +#include + +#include +#include + +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + +template struct dispatch {}; + +// Specialization for points +template <> struct dispatch +{ + template + static inline void apply(Point const& p) + { + // Use the Boost.Geometry free function "get" + // working on all supported point types + std::cout << "Hello POINT, you are located at: " + << boost::geometry::get<0>(p) << ", " + << boost::geometry::get<1>(p) + << std::endl; + } +}; + +// Specialization for polygons +template <> struct dispatch +{ + template + static inline void apply(Polygon const& p) + { + // Use the Boost.Geometry manipulator "dsv" + // working on all supported geometries + std::cout << "Hello POLYGON, you look like: " + << boost::geometry::dsv(p) + << std::endl; + } +}; + +// Specialization for multipolygons +template <> struct dispatch +{ + template + static inline void apply(MultiPolygon const& m) + { + // Use the Boost.Range free function "size" because all + // multigeometries comply to Boost.Range + std::cout << "Hello MULTIPOLYGON, you contain: " + << boost::size(m) << " polygon(s)" + << std::endl; + } +}; + +template +inline void hello(Geometry const& geometry) +{ + // Call the metafunction "tag" to dispatch, and call method (here "apply") + dispatch + < + typename boost::geometry::tag::type + >::apply(geometry); +} int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::polygon polygon_type; - typedef boost::geometry::model::multi_polygon mp_type; + // Define polygon type (here: based on a Boost.Tuple) + typedef boost::geometry::model::polygon > polygon_type; - typedef boost::geometry::tag::type tag1; - typedef boost::geometry::tag::type tag2; - typedef boost::geometry::tag::type tag3; - - std::cout - << "tag 1: " << typeid(tag1).name() << std::endl - << "tag 2: " << typeid(tag2).name() << std::endl - << "tag 3: " << typeid(tag3).name() << std::endl - ; + // Declare and fill a polygon and a multipolygon + polygon_type poly; + boost::geometry::exterior_ring(poly) = boost::assign::tuple_list_of(0, 0)(0, 10)(10, 5)(0, 0); + + boost::geometry::model::multi_polygon multi; + multi.push_back(poly); + + // Call "hello" for point, polygon, multipolygon + hello(boost::make_tuple(2, 3)); + hello(poly); + hello(multi); return 0; } //] - //[tag_output /*` -Output (in MSVC): +Output: [pre -tag 1: struct boost::geometry::point_tag -tag 2: struct boost::geometry::polygon_tag -tag 3: struct boost::geometry::multi_polygon_tag +Hello POINT, you are located at: 2, 3 +Hello POLYGON, you look like: (((0, 0), (0, 10), (10, 5), (0, 0))) +Hello MULTIPOLYGON, you contain: 1 polygon(s) ] */ //] diff --git a/doc/src/examples/core/tag_cast.cpp b/doc/src/examples/core/tag_cast.cpp index 7f4ab3e0e..f33345706 100644 --- a/doc/src/examples/core/tag_cast.cpp +++ b/doc/src/examples/core/tag_cast.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include namespace geo = boost::geometry; int main() diff --git a/doc/src/examples/geometries/Jamfile.v2 b/doc/src/examples/geometries/Jamfile.v2 index 49465b344..a7b953f86 100644 --- a/doc/src/examples/geometries/Jamfile.v2 +++ b/doc/src/examples/geometries/Jamfile.v2 @@ -15,4 +15,5 @@ project boost-geometry-doc-src-example-geometries exe point : point.cpp ; +build-project adapted ; build-project register ; diff --git a/doc/src/examples/geometries/adapted/Jamfile.v2 b/doc/src/examples/geometries/adapted/Jamfile.v2 new file mode 100644 index 000000000..8a0013f1c --- /dev/null +++ b/doc/src/examples/geometries/adapted/Jamfile.v2 @@ -0,0 +1,22 @@ +# 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-src-example-geometries-adapted + : # requirements + ; + +exe c_array : c_array.cpp ; +exe boost_array : boost_array.cpp ; +exe boost_fusion : boost_fusion.cpp ; +exe boost_polygon : boost_polygon.cpp ; +exe boost_tuple : boost_tuple.cpp ; + +build-project boost_range ; diff --git a/doc/src/examples/geometries/adapted/boost_array.cpp b/doc/src/examples/geometries/adapted/boost_array.cpp new file mode 100644 index 000000000..99aa8a3d7 --- /dev/null +++ b/doc/src/examples/geometries/adapted/boost_array.cpp @@ -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) + +//[boost_array +//` Shows how to use a Boost.Array using Boost.Geometry's distance, set and assign_values algorithms + +#include +#include +#include + +BOOST_GEOMETRY_REGISTER_BOOST_ARRAY_CS(cs::cartesian) + +int main() +{ + boost::array a = { {1, 2} }; + boost::array b = { {2, 3} }; + std::cout << boost::geometry::distance(a, b) << std::endl; + + boost::geometry::set<0>(a, 1.1); + boost::geometry::set<1>(a, 2.2); + std::cout << boost::geometry::distance(a, b) << std::endl; + + boost::geometry::assign_values(b, 2.2, 3.3); + std::cout << boost::geometry::distance(a, b) << std::endl; + + boost::geometry::model::linestring > line; + line.push_back(b); + + return 0; +} + +//] + +//[boost_array_output +/*` +Output: +[pre +1.41421 +1.20416 +1.55563 +] +*/ +//] diff --git a/doc/src/examples/geometries/adapted/boost_fusion.cpp b/doc/src/examples/geometries/adapted/boost_fusion.cpp new file mode 100644 index 000000000..f13c6bad6 --- /dev/null +++ b/doc/src/examples/geometries/adapted/boost_fusion.cpp @@ -0,0 +1,62 @@ +// 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) + +//[boost_fusion +//` Shows how to combine Boost.Fusion with Boost.Geometry + +#include + +#include + +#include +#include + + +struct sample_point +{ + double x, y, z; +}; + +BOOST_FUSION_ADAPT_STRUCT(sample_point, (double, x) (double, y) (double, z)) +BOOST_GEOMETRY_REGISTER_BOOST_FUSION_CS(sample_point) + +int main() +{ + sample_point a, b, c; + + // Set coordinates the Boost.Geometry way (one of the ways) + boost::geometry::assign_values(a, 3, 2, 1); + + // Set coordinates the Boost.Fusion way + boost::fusion::at_c<0>(b) = 6; + boost::fusion::at_c<1>(b) = 5; + boost::fusion::at_c<2>(b) = 4; + + // Set coordinates the native way + c.x = 9; + c.y = 8; + c.z = 7; + + std::cout << "Distance a-b: " << boost::geometry::distance(a, b) << std::endl; + std::cout << "Distance a-c: " << boost::geometry::distance(a, c) << std::endl; + + return 0; +} + +//] + +//[boost_fusion_output +/*` +Output: +[pre +Distance a-b: 5.19615 +Distance a-c: 10.3923 +] +*/ +//] diff --git a/doc/src/examples/geometries/adapted/boost_polygon.cpp b/doc/src/examples/geometries/adapted/boost_polygon.cpp new file mode 100644 index 000000000..2cfd5a9d2 --- /dev/null +++ b/doc/src/examples/geometries/adapted/boost_polygon.cpp @@ -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) + +//[boost_polygon +//`Shows how to use Boost.Polygon points within Boost.Geometry + +#include +#include +#include + +int main() +{ + boost::polygon::point_data a(1, 2), b(3, 4); + std::cout << "Distance (using Boost.Geometry): " + << boost::geometry::distance(a, b) << std::endl; + std::cout << "Distance (using Boost.Polygon): " + << boost::polygon::euclidean_distance(a, b) << std::endl; + + return 0; +} + +//] + +//[boost_polygon_output +/*` +Output: +[pre +Distance (using Boost.Geometry): 2.82843 +Distance (using Boost.Polygon): 2.82843 +] +*/ +//] diff --git a/doc/src/examples/geometries/adapted/boost_range/Jamfile.v2 b/doc/src/examples/geometries/adapted/boost_range/Jamfile.v2 new file mode 100644 index 000000000..5dfaf8662 --- /dev/null +++ b/doc/src/examples/geometries/adapted/boost_range/Jamfile.v2 @@ -0,0 +1,22 @@ +# 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-src-example-geometries-adapted-boost_range + : # requirements + ; + +exe filtered : filtered.cpp ; +exe reversed : reversed.cpp ; +exe sliced : sliced.cpp ; +exe strided : strided.cpp ; +# exe uniqued : uniqued.cpp ; + + diff --git a/doc/src/examples/geometries/adapted/boost_range/filtered.cpp b/doc/src/examples/geometries/adapted/boost_range/filtered.cpp new file mode 100644 index 000000000..e215594d0 --- /dev/null +++ b/doc/src/examples/geometries/adapted/boost_range/filtered.cpp @@ -0,0 +1,61 @@ +// 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) + +//[boost_range_filtered +//` Shows how to use a Boost.Geometry linestring, filtered by Boost.Range adaptor + +#include +#include +#include + +struct not_two +{ + template + bool operator()(P const& p) const + { + return boost::geometry::get<1>(p) != 2; + } +}; + + +int main() +{ + typedef boost::geometry::model::d2::point_xy xy; + boost::geometry::model::linestring line; + line.push_back(xy(0, 0)); + line.push_back(xy(1, 1)); + line.push_back(xy(2, 2)); + line.push_back(xy(3, 1)); + line.push_back(xy(4, 0)); + line.push_back(xy(5, 1)); + line.push_back(xy(6, 2)); + line.push_back(xy(7, 1)); + line.push_back(xy(8, 0)); + + using boost::adaptors::filtered; + std::cout + << boost::geometry::length(line) << std::endl + << boost::geometry::length(line | filtered(not_two())) << std::endl + << boost::geometry::dsv(line | filtered(not_two())) << std::endl; + + return 0; +} + +//] + +//[boost_range_filtered_output +/*` +Output: +[pre +11.3137 +9.65685 +((0, 0), (1, 1), (3, 1), (4, 0), (5, 1), (7, 1), (8, 0)) +] +*/ +//] diff --git a/doc/src/examples/geometries/adapted/boost_range/reversed.cpp b/doc/src/examples/geometries/adapted/boost_range/reversed.cpp new file mode 100644 index 000000000..5bdf5e2ce --- /dev/null +++ b/doc/src/examples/geometries/adapted/boost_range/reversed.cpp @@ -0,0 +1,40 @@ +// 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) + +//[boost_range_reversed +//` Shows how to use a Boost.Geometry linestring, reversed by Boost.Range adaptor + +#include +#include +#include + +int main() +{ + typedef boost::geometry::model::d2::point_xy xy; + boost::geometry::model::linestring line; + line.push_back(xy(0, 0)); + line.push_back(xy(1, 1)); + + std::cout + << boost::geometry::dsv(line | boost::adaptors::reversed) + << std::endl; + + return 0; +} + +//] + +//[boost_range_reversed_output +/*` +Output: +[pre +((1, 1), (0, 0)) +] +*/ +//] diff --git a/doc/src/examples/geometries/adapted/boost_range/sliced.cpp b/doc/src/examples/geometries/adapted/boost_range/sliced.cpp new file mode 100644 index 000000000..eb65621f2 --- /dev/null +++ b/doc/src/examples/geometries/adapted/boost_range/sliced.cpp @@ -0,0 +1,48 @@ +// 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) + +//[boost_range_sliced +//` Shows how to use a Boost.Geometry linestring, sliced by Boost.Range adaptor + +#include + +#include + +#include +#include + + +int main() +{ + using namespace boost::assign; + + typedef boost::geometry::model::d2::point_xy xy; + boost::geometry::model::linestring line; + line += xy(0, 0); + line += xy(1, 1); + line += xy(2, 2); + line += xy(3, 3); + line += xy(4, 4); + + std::cout + << boost::geometry::dsv(line | boost::adaptors::sliced(1, 3)) << std::endl; + + return 0; +} + +//] + +//[boost_range_sliced_output +/*` +Output: +[pre +((1, 1), (2, 2)) +] +*/ +//] diff --git a/doc/src/examples/geometries/adapted/boost_range/strided.cpp b/doc/src/examples/geometries/adapted/boost_range/strided.cpp new file mode 100644 index 000000000..08ae880f6 --- /dev/null +++ b/doc/src/examples/geometries/adapted/boost_range/strided.cpp @@ -0,0 +1,54 @@ +// 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) + +//[boost_range_strided +//` Shows how to use a Boost.Geometry ring, strided by Boost.Range adaptor + +#include + +#include + +#include +#include + + +int main() +{ + using namespace boost::assign; + using boost::adaptors::strided; + + typedef boost::geometry::model::d2::point_xy xy; + boost::geometry::model::ring ring; + ring += xy(0, 0); + ring += xy(0, 1); + ring += xy(0, 2); + ring += xy(1, 2); + ring += xy(2, 2); + ring += xy(2, 0); + + boost::geometry::correct(ring); + + std::cout + << "Normal : " << boost::geometry::dsv(ring) << std::endl + << "Strided: " << boost::geometry::dsv(ring | strided(2)) << std::endl; + + return 0; +} + +//] + +//[boost_range_strided_output +/*` +Output: +[pre +Normal : ((0, 0), (0, 1), (0, 2), (1, 2), (2, 2), (2, 0), (0, 0)) +Strided: ((0, 0), (0, 2), (2, 2), (0, 0)) +] +*/ +//] diff --git a/doc/src/examples/geometries/adapted/boost_range/uniqued.cpp b/doc/src/examples/geometries/adapted/boost_range/uniqued.cpp new file mode 100644 index 000000000..1d75c6980 --- /dev/null +++ b/doc/src/examples/geometries/adapted/boost_range/uniqued.cpp @@ -0,0 +1,62 @@ +// 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) + +//[boost_range_uniqued +//` Shows how to use a Boost.Geometry ring, made unique by Boost.Range adaptor + +#include + +#include + +#include +#include + +typedef boost::geometry::model::d2::point_xy xy; + +inline bool operator==(xy const& left, xy const& right) +{ + boost::geometry::equal_to eq; + return eq(left, right); +} + + +int main() +{ + using namespace boost::assign; + using boost::adaptors::uniqued; + + boost::geometry::model::ring ring; + ring += xy(0, 0); + ring += xy(0, 1); + ring += xy(0, 2); + ring += xy(1, 2); + ring += xy(2, 2); + ring += xy(2, 2); + ring += xy(2, 2); + ring += xy(2, 0); + ring += xy(0, 0); + + std::cout + << "Normal: " << boost::geometry::dsv(ring) << std::endl + << "Unique: " << boost::geometry::dsv(ring | uniqued) << std::endl; + + return 0; +} + +//] + +//[boost_range_uniqued_output +/*` +Output: +[pre +Normal : ((0, 0), (0, 1), (0, 2), (1, 2), (2, 2), (2, 0), (0, 0)) +uniqued: ((0, 0), (0, 2), (2, 2), (0, 0)) +] +*/ +//] diff --git a/doc/src/examples/geometries/adapted/boost_tuple.cpp b/doc/src/examples/geometries/adapted/boost_tuple.cpp new file mode 100644 index 000000000..67a51836d --- /dev/null +++ b/doc/src/examples/geometries/adapted/boost_tuple.cpp @@ -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) + +//[boost_tuple +/*` +Shows how to use Boost.Tuple points in Boost.Geometry + +Working with Boost.Tuples in Boost.Geometry is straightforward and shown in +various other examples as well. + +*/ + +#include +#include +#include + +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + +int main() +{ + boost::geometry::model::polygon > poly; + poly.outer().push_back(boost::make_tuple(1.0, 2.0)); + poly.outer().push_back(boost::make_tuple(6.0, 4.0)); + poly.outer().push_back(boost::make_tuple(5.0, 1.0)); + poly.outer().push_back(boost::make_tuple(1.0, 2.0)); + + std::cout << "Area: " << boost::geometry::area(poly) << std::endl; + std::cout << "Contains (1.5, 2.5): " + << std::boolalpha + << boost::geometry::within(boost::make_tuple(1.5, 2.5), poly) + << std::endl; + + return 0; +} + +//] + +//[boost_tuple_output +/*` +Output: +[pre +Area: 6.5 +Contains (1.5, 2.5): false +] +*/ +//] diff --git a/doc/src/examples/geometries/adapted/c_array.cpp b/doc/src/examples/geometries/adapted/c_array.cpp new file mode 100644 index 000000000..ef0956b0a --- /dev/null +++ b/doc/src/examples/geometries/adapted/c_array.cpp @@ -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) + +//[c_array +//` Small example showing the combination of an array with a Boost.Geometry algorithm + +#include +#include +#include + +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) + +int main() +{ + int a[3] = {1, 2, 3}; + int b[3] = {2, 3, 4}; + + std::cout << boost::geometry::distance(a, b) << std::endl; + + return 0; +} + +//] + +//[c_array_output +/*` +Output: +[pre +1.73205 +] +*/ +//] diff --git a/doc/src/examples/geometries/point.cpp b/doc/src/examples/geometries/point.cpp index 680ca4a5e..103642f4b 100644 --- a/doc/src/examples/geometries/point.cpp +++ b/doc/src/examples/geometries/point.cpp @@ -11,7 +11,7 @@ //` Declaration and use of the Boost.Geometry model::point, modelling the Point Concept #include -#include +#include namespace bg = boost::geometry; diff --git a/doc/src/examples/geometries/register/Jamfile.v2 b/doc/src/examples/geometries/register/Jamfile.v2 index b22d5f7a0..cb87e3a0e 100644 --- a/doc/src/examples/geometries/register/Jamfile.v2 +++ b/doc/src/examples/geometries/register/Jamfile.v2 @@ -13,5 +13,7 @@ project boost-geometry-doc-src-example-geometries-register : # requirements ; +exe box : box.cpp ; +exe box_templated : box_templated.cpp ; +exe box_2d_4values : box_2d_4values.cpp ; exe point : point.cpp ; - diff --git a/doc/src/examples/geometries/register/box.cpp b/doc/src/examples/geometries/register/box.cpp new file mode 100644 index 000000000..55dc00551 --- /dev/null +++ b/doc/src/examples/geometries/register/box.cpp @@ -0,0 +1,51 @@ +// 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_box +//` Show the use of the macro BOOST_GEOMETRY_REGISTER_BOX + +#include +#include +#include +#include + +struct my_point +{ + double x, y; +}; + +struct my_box +{ + my_point ll, ur; +}; + +// Register the point type +BOOST_GEOMETRY_REGISTER_POINT_2D(my_point, double, cs::cartesian, x, y) + +// Register the box type, also notifying that it is based on "my_point" +BOOST_GEOMETRY_REGISTER_BOX(my_box, my_point, ll, ur) + +int main() +{ + my_box b = boost::geometry::make(0, 0, 2, 2); + std::cout << "Area: " << boost::geometry::area(b) << std::endl; + return 0; +} + +//] + + +//[register_box_output +/*` +Output: +[pre +Area: 4 +] +*/ +//] diff --git a/doc/src/examples/geometries/register/box_2d_4values.cpp b/doc/src/examples/geometries/register/box_2d_4values.cpp new file mode 100644 index 000000000..4cec35101 --- /dev/null +++ b/doc/src/examples/geometries/register/box_2d_4values.cpp @@ -0,0 +1,51 @@ +// 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_box_2d_4values +//` Show the use of the macro BOOST_GEOMETRY_REGISTER_BOX_2D_4VALUES + +#include +#include +#include +#include + +struct my_point +{ + int x, y; +}; + +struct my_box +{ + int left, top, right, bottom; +}; + +BOOST_GEOMETRY_REGISTER_POINT_2D(my_point, int, cs::cartesian, x, y) + +// Register the box type, also notifying that it is based on "my_point" +// (even if it does not contain it) +BOOST_GEOMETRY_REGISTER_BOX_2D_4VALUES(my_box, my_point, left, top, right, bottom) + +int main() +{ + my_box b = boost::geometry::make(0, 0, 2, 2); + std::cout << "Area: " << boost::geometry::area(b) << std::endl; + return 0; +} + +//] + + +//[register_box_2d_4values_output +/*` +Output: +[pre +Area: 4 +] +*/ +//] diff --git a/doc/src/examples/geometries/register/box_templated.cpp b/doc/src/examples/geometries/register/box_templated.cpp new file mode 100644 index 000000000..72e0a589f --- /dev/null +++ b/doc/src/examples/geometries/register/box_templated.cpp @@ -0,0 +1,44 @@ +// 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_box_templated +//` Show the use of the macro BOOST_GEOMETRY_REGISTER_BOX_TEMPLATED + +#include +#include +#include + +template +struct my_box +{ + P ll, ur; +}; + +// Register the box type +BOOST_GEOMETRY_REGISTER_BOX_TEMPLATED(my_box, ll, ur) + +int main() +{ + typedef my_box > box; + box b = boost::geometry::make(0, 0, 2, 2); + std::cout << "Area: " << boost::geometry::area(b) << std::endl; + return 0; +} + +//] + + +//[register_box_templated_output +/*` +Output: +[pre +Area: 4 +] +*/ +//] diff --git a/doc/src/examples/geometries/register/point.cpp b/doc/src/examples/geometries/register/point.cpp index bfac67d88..085e03839 100644 --- a/doc/src/examples/geometries/register/point.cpp +++ b/doc/src/examples/geometries/register/point.cpp @@ -11,7 +11,7 @@ //` Show the use of the macro BOOST_GEOMETRY_REGISTER_POINT_2D #include -#include +#include #include /*< Somewhere, any legacy point struct is defined >*/ @@ -28,7 +28,7 @@ int main() namespace bg = boost::geometry; - /*< Any Boost.Geometry function can be used for legacy point now. Here: assign and distance >*/ + /*< Any Boost.Geometry function can be used for legacy point now. Here: assign_values and distance >*/ bg::assign_values(p1, 1, 1); bg::assign_values(p2, 2, 2); diff --git a/doc/src/examples/quick_start.cpp b/doc/src/examples/quick_start.cpp index 36567b3fa..8b2beb4d2 100644 --- a/doc/src/examples/quick_start.cpp +++ b/doc/src/examples/quick_start.cpp @@ -20,13 +20,15 @@ //#pragma warning( disable : 4244 ) #endif // defined(_MSC_VER) -#include +#include #include #include #include -#include -#include -#include +#include + + +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) // Small QRect simulations following http://doc.trolltech.com/4.4/qrect.html @@ -129,7 +131,7 @@ void example_for_main_page() QRect r2(110, 210, 20, 20); if (overlaps(r1, r2)) { - assign(r2, 200, 300, 220, 320); + assign_values(r2, 200, 300, 220, 320); } //] } @@ -144,7 +146,7 @@ void example_for_transform() XYZ p; SPH sph1, sph2; - assign(sph1, 12.5, 41.90, 1.0); + assign_values(sph1, 12.5, 41.90, 1.0); // Go from spherical to Cartesian-3D: transform(sph1, p); // Go back from Cartesian 3D to spherical: diff --git a/example/01_point_example.cpp b/example/01_point_example.cpp index 574831e46..6d5e782b4 100644 --- a/example/01_point_example.cpp +++ b/example/01_point_example.cpp @@ -13,11 +13,15 @@ #include #include -#include -#include -#include +#include +#include +#include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + int main() { diff --git a/example/02_linestring_example.cpp b/example/02_linestring_example.cpp index 329993529..8315d1761 100644 --- a/example/02_linestring_example.cpp +++ b/example/02_linestring_example.cpp @@ -18,9 +18,9 @@ #include // Optional includes to handle c-arrays as points, std::vectors as linestrings -#include +#include #include - +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) template diff --git a/example/03_polygon_example.cpp b/example/03_polygon_example.cpp index 780221a93..e817fa261 100644 --- a/example/03_polygon_example.cpp +++ b/example/03_polygon_example.cpp @@ -15,10 +15,13 @@ #include #include -#include +#include #include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) + + std::string boolstr(bool v) { return v ? "true" : "false"; diff --git a/example/04_boost_example.cpp b/example/04_boost_example.cpp index 288ea6690..f6d56cdfe 100644 --- a/example/04_boost_example.cpp +++ b/example/04_boost_example.cpp @@ -13,10 +13,11 @@ #include #include -#include +#include -#include +#include +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian); int main(void) diff --git a/example/05_a_overlay_polygon_example.cpp b/example/05_a_overlay_polygon_example.cpp index 625b0f497..6a81221b1 100644 --- a/example/05_a_overlay_polygon_example.cpp +++ b/example/05_a_overlay_polygon_example.cpp @@ -19,12 +19,14 @@ #include -#include +#include #if defined(HAVE_SVG) # include #endif +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) + int main(void) { diff --git a/example/05_b_overlay_linestring_polygon_example.cpp b/example/05_b_overlay_linestring_polygon_example.cpp index 8e0dc7483..118026603 100644 --- a/example/05_b_overlay_linestring_polygon_example.cpp +++ b/example/05_b_overlay_linestring_polygon_example.cpp @@ -19,12 +19,14 @@ #include -#include +#include #if defined(HAVE_SVG) # include #endif +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian); + int main(void) { diff --git a/example/06_a_transformation_example.cpp b/example/06_a_transformation_example.cpp index ef7d279d3..3c5f6f9b0 100644 --- a/example/06_a_transformation_example.cpp +++ b/example/06_a_transformation_example.cpp @@ -13,9 +13,12 @@ #include #include -#include +#include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) + + int main() { using namespace boost::geometry; @@ -34,7 +37,7 @@ int main() model::polygon poly, poly2; const double coor[][2] = { {0, 0}, {0, 7}, {2, 2}, {2, 0}, {0, 0} }; // note that for this syntax you have to include the two - // include files above (c_array_cartesian.hpp, std_as_linestring.hpp) + // include files above (c_array.hpp, std_as_linestring.hpp) assign_points(poly, coor); //read_wkt("POLYGON((0 0,0 7,4 2,2 0,0 0))", poly); transform(poly, poly2, translate); diff --git a/example/c02_custom_box_example.cpp b/example/c02_custom_box_example.cpp index 5d6d74e6b..a335781d4 100644 --- a/example/c02_custom_box_example.cpp +++ b/example/c02_custom_box_example.cpp @@ -53,7 +53,7 @@ struct my_box_t BOOST_GEOMETRY_REGISTER_POINT_2D(my_point, double, cs::cartesian, x, y) BOOST_GEOMETRY_REGISTER_POINT_2D(my_int_point, int, cs::cartesian, x, y) BOOST_GEOMETRY_REGISTER_BOX(my_box, my_point, ll, ur) -BOOST_GEOMETRY_REGISTER_BOX_TEMPLATIZED(my_box_t, ll, ur) +BOOST_GEOMETRY_REGISTER_BOX_TEMPLATED(my_box_t, ll, ur) BOOST_GEOMETRY_REGISTER_BOX_2D_4VALUES(my_box_ltrb, my_int_point, left, top, right, bottom) BOOST_GEOMETRY_REGISTER_BOX_2D_4VALUES(my_box_4, my_point, coors[0], coors[1], coors[2], coors[3]) diff --git a/example/c04_a_custom_triangle_example.cpp b/example/c04_a_custom_triangle_example.cpp index a8084a98c..8c4b7d6d8 100644 --- a/example/c04_a_custom_triangle_example.cpp +++ b/example/c04_a_custom_triangle_example.cpp @@ -16,7 +16,6 @@ #include #include -#include #include #include @@ -30,7 +29,10 @@ struct triangle : public boost::array struct tag { typedef ring_tag type; }; +}}} // Specializations of algorithms, where useful. If not specialized the default ones diff --git a/example/c04_b_custom_triangle_example.cpp b/example/c04_b_custom_triangle_example.cpp index 99acaa34e..1e41c5f9b 100644 --- a/example/c04_b_custom_triangle_example.cpp +++ b/example/c04_b_custom_triangle_example.cpp @@ -17,12 +17,11 @@ #include #include -#include -#include -#include +#include #include #include +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) template @@ -30,8 +29,11 @@ struct triangle : public boost::array { }; -// Register triangle

-BOOST_GEOMETRY_REGISTER_RING_TEMPLATIZED(triangle) + +// Register triangle

as a ring +namespace boost { namespace geometry { namespace traits { +template struct tag > { typedef ring_tag type; }; +}}} namespace boost { namespace geometry { namespace dispatch { diff --git a/example/c06_custom_polygon_example.cpp b/example/c06_custom_polygon_example.cpp index 6067a7358..da4a978de 100644 --- a/example/c06_custom_polygon_example.cpp +++ b/example/c06_custom_polygon_example.cpp @@ -14,7 +14,6 @@ #include #include -#include struct my_point @@ -49,7 +48,11 @@ struct my_polygon // We can conveniently use macro's to register point and ring BOOST_GEOMETRY_REGISTER_POINT_2D(my_point, double, cs::cartesian, x, y) -BOOST_GEOMETRY_REGISTER_RING(my_ring) + +// Register my_ring as a ring +namespace boost { namespace geometry { namespace traits { +template <> struct tag { typedef ring_tag type; }; +}}} diff --git a/example/c08_custom_non_std_example.cpp b/example/c08_custom_non_std_example.cpp index 2a8460ecf..874917d8e 100644 --- a/example/c08_custom_non_std_example.cpp +++ b/example/c08_custom_non_std_example.cpp @@ -20,7 +20,6 @@ #include #include -#include #include // Sample point, having x/y @@ -215,7 +214,10 @@ template<> struct resize // 4) register with Boost.Geometry BOOST_GEOMETRY_REGISTER_POINT_2D(my_point, double, cs::cartesian, x, y) -BOOST_GEOMETRY_REGISTER_RING(my_polygon) + +namespace boost { namespace geometry { namespace traits { +template <> struct tag { typedef ring_tag type; }; +}}} // end adaption diff --git a/example/c09_custom_fusion_example.cpp b/example/c09_custom_fusion_example.cpp index 6bc3779b7..ef8828c59 100644 --- a/example/c09_custom_fusion_example.cpp +++ b/example/c09_custom_fusion_example.cpp @@ -15,12 +15,13 @@ #include -#include -#include +#include #include #include +BOOST_GEOMETRY_REGISTER_BOOST_FUSION_CS(cs::cartesian); + // Sample point, having x/y struct my_2d diff --git a/example/with_external_libs/x03_a_soci_example.cpp b/example/with_external_libs/x03_a_soci_example.cpp index 9177d15c4..de75b1831 100644 --- a/example/with_external_libs/x03_a_soci_example.cpp +++ b/example/with_external_libs/x03_a_soci_example.cpp @@ -35,9 +35,10 @@ #include #include -#include +#include #include +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian); int main() diff --git a/include/boost/geometry/algorithms/detail/has_self_intersections.hpp b/include/boost/geometry/algorithms/detail/has_self_intersections.hpp new file mode 100644 index 000000000..c6144f4d1 --- /dev/null +++ b/include/boost/geometry/algorithms/detail/has_self_intersections.hpp @@ -0,0 +1,121 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// 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) + +#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_HAS_SELF_INTERSECTIONS_HPP +#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_HAS_SELF_INTERSECTIONS_HPP + +#include + +#include +#include +#include +#include +#include + +#include + +#ifdef BOOST_GEOMETRY_DEBUG_HAS_SELF_INTERSECTIONS +# include +# include +#endif + + +namespace boost { namespace geometry +{ + + +#if ! defined(BOOST_GEOMETRY_OVERLAY_NO_THROW) + +/*! +\brief Overlay Invalid Input Exception +\ingroup overlay +\details The overlay_invalid_input_exception is thrown at invalid input + */ +class overlay_invalid_input_exception : public geometry::exception +{ +public: + + inline overlay_invalid_input_exception() {} + + virtual char const* what() const throw() + { + return "Boost.Geometry Overlay invald input exception"; + } +}; + +#endif + + +#ifndef DOXYGEN_NO_DETAIL +namespace detail { namespace overlay +{ + + +template +inline bool has_self_intersections(Geometry const& geometry) +{ + using namespace boost::geometry; + typedef typename point_type::type point_type; + typedef detail::overlay::turn_info turn_info; + std::deque turns; + detail::get_turns::no_interrupt_policy policy; + geometry::self_turns(geometry, turns, policy); + +#ifdef BOOST_GEOMETRY_DEBUG_HAS_SELF_INTERSECTIONS + bool first = true; +#endif + for(typename std::deque::const_iterator it = boost::begin(turns); + it != boost::end(turns); ++it) + { + turn_info const& info = *it; + bool const both_union_turn = + info.operations[0].operation == detail::overlay::operation_union + && info.operations[1].operation == detail::overlay::operation_union; + bool const both_intersection_turn = + info.operations[0].operation == detail::overlay::operation_intersection + && info.operations[1].operation == detail::overlay::operation_intersection; + + bool const valid = (both_union_turn || both_intersection_turn) + && (info.method == detail::overlay::method_touch + || info.method == detail::overlay::method_touch_interior); + + if (! valid) + { +#ifdef BOOST_GEOMETRY_DEBUG_HAS_SELF_INTERSECTIONS + if (first) + { + std::cout << "turn points: " << std::endl; + first = false; + } + std::cout << method_char(info.method); + for (int i = 0; i < 2; i++) + { + std::cout << " " << operation_char(info.operations[i].operation); + } + std::cout << " " << geometry::dsv(info.point) << std::endl; +#endif + +#if ! defined(BOOST_GEOMETRY_OVERLAY_NO_THROW) + throw overlay_invalid_input_exception(); +#endif + } + + } + return false; +} + + +}} // namespace detail::overlay +#endif // DOXYGEN_NO_DETAIL + + +}} // namespace boost::geometry + + +#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_HAS_SELF_INTERSECTIONS_HPP + diff --git a/include/boost/geometry/algorithms/detail/overlay/overlay.hpp b/include/boost/geometry/algorithms/detail/overlay/overlay.hpp index a469dd93a..459ccb1bd 100644 --- a/include/boost/geometry/algorithms/detail/overlay/overlay.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/overlay.hpp @@ -25,6 +25,8 @@ #include #include +#include + #include #include @@ -168,6 +170,9 @@ struct overlay GeometryOut, Direction, ReverseOut >(geometry1, geometry2, out); } + + has_self_intersections(geometry1); + has_self_intersections(geometry2); container_type turn_points; diff --git a/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp b/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp index 3efe5c7d7..f996b60ea 100644 --- a/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp @@ -136,6 +136,31 @@ struct self_get_turn_points {}; +template +< + typename Box, + typename Turns, + typename TurnPolicy, + typename InterruptPolicy +> +struct self_get_turn_points + < + box_tag, Box, + Turns, + TurnPolicy, + InterruptPolicy + > +{ + static inline bool apply( + Box const& , + Turns& , + InterruptPolicy& ) + { + return true; + } +}; + + template < typename Polygon, @@ -182,7 +207,7 @@ template typename Turns, typename InterruptPolicy > -inline void get_turns(Geometry const& geometry, +inline void self_turns(Geometry const& geometry, Turns& turns, InterruptPolicy& interrupt_policy) { concept::check(); diff --git a/include/boost/geometry/core/closure.hpp b/include/boost/geometry/core/closure.hpp index bb806b3aa..c1d3a902c 100644 --- a/include/boost/geometry/core/closure.hpp +++ b/include/boost/geometry/core/closure.hpp @@ -32,11 +32,11 @@ namespace boost { namespace geometry \brief Enumerates options for defining if polygons are open or closed \ingroup enum \details The enumeration closure_selector describes options for if a polygon is - open or closed. In a closed polygon the very first point (per ring) should be - equal to the very last point. - The specific closing property of a polygon type is defined by the closure metafunction. - The closure metafunction defines a value, which is one of the values enumerated - in the closure_selector + open or closed. In a closed polygon the very first point (per ring) should + be equal to the very last point. + The specific closing property of a polygon type is defined by the closure + metafunction. The closure metafunction defines a value, which is one of the + values enumerated in the closure_selector \qbk{ [heading See also] @@ -45,8 +45,13 @@ namespace boost { namespace geometry */ enum closure_selector { + /// Rings are open: first point and last point are different, algorithms + /// close them explicitly on the fly open = 0, + /// Rings are closed: first point and last point must be the same closed = 1, + /// (Not yet implemented): algorithms first figure out if ring must be + /// closed on the fly closure_undertermined = -1 }; @@ -123,13 +128,15 @@ template struct closure : public core_detail::closure::closed {}; template -struct closure : public core_detail::closure::closed {}; +struct closure + : public core_detail::closure::closed {}; template struct closure { - static const closure_selector value = geometry::traits::closure::value; + static const closure_selector value + = geometry::traits::closure::value; }; // Specialization for polygon: the closure is the closure of its rings @@ -149,7 +156,8 @@ struct closure /*! -\brief \brief_meta{value, closure (clockwise\, counterclockwise), \meta_geometry_type} +\brief \brief_meta{value, closure (clockwise\, counterclockwise), + \meta_geometry_type} \tparam Geometry \tparam_geometry \ingroup core diff --git a/include/boost/geometry/core/interior_type.hpp b/include/boost/geometry/core/interior_type.hpp index 0b3aa5057..805ca4b7b 100644 --- a/include/boost/geometry/core/interior_type.hpp +++ b/include/boost/geometry/core/interior_type.hpp @@ -114,7 +114,7 @@ struct interior_type typedef typename boost::remove_reference < typename interior_return_type::type - > type; + >::type type; }; @@ -123,13 +123,16 @@ struct interior_type /*! - \brief Meta-function defining container type - of inner rings of (multi)polygon geometriy - \details the interior rings should be organized as a container - (std::vector, std::deque, boost::array) with - boost range support. This meta function defines the type - of that container. - \ingroup core +\brief \brief_meta{type, interior_type (container type + of inner rings), \meta_geometry_type} +\details Interior rings should be organized as a container + (std::vector, std::deque, boost::array) with + Boost.Range support. This metafunction defines the type + of the container. +\tparam Geometry A type fullfilling the Polygon or MultiPolygon concept. +\ingroup core + +\qbk{[include reference/core/interior_type.qbk]} */ template struct interior_type diff --git a/include/boost/geometry/core/point_order.hpp b/include/boost/geometry/core/point_order.hpp index 675fee802..fa956e259 100644 --- a/include/boost/geometry/core/point_order.hpp +++ b/include/boost/geometry/core/point_order.hpp @@ -29,11 +29,11 @@ namespace boost { namespace geometry /*! \brief Enumerates options for the order of points within polygons \ingroup enum -\details The enumeration order_selector describes options for the order of points - within a polygon. Polygons can be ordered either clockwise or counterclockwise. - The specific order of a polygon type is defined by the point_order metafunction. - The point_order metafunction defines a value, which is one of the values enumerated - in the order_selector +\details The enumeration order_selector describes options for the order of + points within a polygon. Polygons can be ordered either clockwise or + counterclockwise. The specific order of a polygon type is defined by the + point_order metafunction. The point_order metafunction defines a value, + which is one of the values enumerated in the order_selector \qbk{ [heading See also] @@ -46,7 +46,8 @@ enum order_selector clockwise = 1, /// Points are ordered counter clockwise counterclockwise = 2, - /// Points might be stored in any order, the algorithm will find out (not yet supported) + /// Points might be stored in any order, algorithms will determine it on the + /// fly (not yet supported) order_undetermined = 0 }; @@ -119,7 +120,8 @@ struct point_order template struct point_order { - static const order_selector value = geometry::traits::point_order::value; + static const order_selector value + = geometry::traits::point_order::value; }; // Specialization for polygon: the order is the order of its rings @@ -138,7 +140,8 @@ struct point_order /*! -\brief \brief_meta{value, point order (clockwise\, counterclockwise), \meta_geometry_type} +\brief \brief_meta{value, point order (clockwise\, counterclockwise), + \meta_geometry_type} \tparam Geometry \tparam_geometry \ingroup core diff --git a/include/boost/geometry/core/ring_type.hpp b/include/boost/geometry/core/ring_type.hpp index cf79fc65e..a53b95c96 100644 --- a/include/boost/geometry/core/ring_type.hpp +++ b/include/boost/geometry/core/ring_type.hpp @@ -132,12 +132,15 @@ struct ring_type /*! -\brief Meta-function which defines ring type of (multi)polygon geometry -\details a polygon contains one exterior ring +\brief \brief_meta{type, ring_type, \meta_geometry_type} +\details A polygon contains one exterior ring and zero or more interior rings (holes). - This meta function retrieves the type of the rings -\note Exterior ring and interior rings must have the same ring-type. + This metafunction retrieves the type of the rings. + Exterior ring and each of the interior rings all have the same ring_type. +\tparam Geometry A type fullfilling the Ring, Polygon or MultiPolygon concept. \ingroup core + +\qbk{[include reference/core/ring_type.qbk]} */ template struct ring_type diff --git a/include/boost/geometry/core/tag.hpp b/include/boost/geometry/core/tag.hpp index f8f622e74..b5e44958e 100644 --- a/include/boost/geometry/core/tag.hpp +++ b/include/boost/geometry/core/tag.hpp @@ -49,6 +49,8 @@ struct tag /*! \brief \brief_meta{type, tag, \meta_geometry_type} +\details With Boost.Geometry, tags are the driving force of the tag dispatching + mechanism. The tag metafunction is therefore used in every free function. \tparam Geometry \tparam_geometry \ingroup core diff --git a/include/boost/geometry/geometries/adapted/boost_array.hpp b/include/boost/geometry/geometries/adapted/boost_array.hpp index db5efb244..bd2b88df2 100644 --- a/include/boost/geometry/geometries/adapted/boost_array.hpp +++ b/include/boost/geometry/geometries/adapted/boost_array.hpp @@ -98,9 +98,6 @@ struct access, Dimension> } }; -// The library user has -// 1) either to specify the coordinate system -// 2) or include where @=cartesian,geographic,... } // namespace traits #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS @@ -108,5 +105,16 @@ struct access, Dimension> }} // namespace boost::geometry + +#define BOOST_GEOMETRY_REGISTER_BOOST_ARRAY_CS(CoordinateSystem) \ + namespace boost { namespace geometry { namespace traits { \ + template \ + struct coordinate_system > \ + { \ + typedef CoordinateSystem type; \ + }; \ + }}} + + #endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ARRAY_HPP diff --git a/include/boost/geometry/geometries/adapted/boost_array_cartesian.hpp b/include/boost/geometry/geometries/adapted/boost_array_cartesian.hpp deleted file mode 100644 index a11c9e2bb..000000000 --- a/include/boost/geometry/geometries/adapted/boost_array_cartesian.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2010 Alfredo Correa -// Copyright (c) 2010-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) - -#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ARRAY_CARTESIAN_HPP -#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ARRAY_CARTESIAN_HPP - -#ifdef BOOST_GEOMETRY_ADAPTED_BOOST_ARRAY_COORDINATE_SYSTEM_DEFINED -#error Include only one headerfile to register coordinate coordinate_system for adapted boost array -#endif - -#define BOOST_GEOMETRY_ADAPTED_BOOST_ARRAY_COORDINATE_SYSTEM_DEFINED - - -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS -namespace traits -{ - template - struct coordinate_system > - { typedef cs::cartesian type; }; - -} -#endif - - -}} // namespace boost::geometry - - -#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ARRAY_CARTESIAN_HPP - diff --git a/include/boost/geometry/geometries/adapted/boost_array_geographic.hpp b/include/boost/geometry/geometries/adapted/boost_array_geographic.hpp deleted file mode 100644 index ca103520e..000000000 --- a/include/boost/geometry/geometries/adapted/boost_array_geographic.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2010 Alfredo Correa -// Copyright (c) 2010-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) - -#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ARRAY_GEOGRAPHIC_HPP -#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ARRAY_GEOGRAPHIC_HPP - -#ifdef BOOST_GEOMETRY_ADAPTED_BOOST_ARRAY_COORDINATE_SYSTEM_DEFINED -#error Include only one headerfile to register coordinate coordinate_system for adapted boost array -#endif - -#define BOOST_GEOMETRY_ADAPTED_BOOST_ARRAY_COORDINATE_SYSTEM_DEFINED - - -#include - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS -namespace traits -{ - template - struct coordinate_system > - { typedef cs::geographic type; }; - -} -#endif - - -}} // namespace boost::geometry - - -#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ARRAY_GEOGRAPHIC_HPP diff --git a/include/boost/geometry/geometries/adapted/fusion.hpp b/include/boost/geometry/geometries/adapted/boost_fusion.hpp similarity index 87% rename from include/boost/geometry/geometries/adapted/fusion.hpp rename to include/boost/geometry/geometries/adapted/boost_fusion.hpp index 81d89230a..3c81672f8 100644 --- a/include/boost/geometry/geometries/adapted/fusion.hpp +++ b/include/boost/geometry/geometries/adapted/boost_fusion.hpp @@ -130,10 +130,6 @@ struct access } }; -// The library user has -// 1) either to specify the coordinate system using a traits class -// 2) or include -// where @=cartesian,geographic,... template struct tag @@ -148,6 +144,7 @@ struct tag typedef point_tag type; }; + } // namespace traits #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS @@ -155,5 +152,21 @@ struct tag }} // namespace boost::geometry -#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_HPP +// Convenience registration macro to bind a Fusion sequence to a CS +#define BOOST_GEOMETRY_REGISTER_BOOST_FUSION_CS(CoordinateSystem) \ + namespace boost { namespace geometry { namespace traits { \ + template \ + struct coordinate_system \ + < \ + Sequence, \ + typename boost::enable_if \ + < \ + fusion_adapt_detail::is_fusion_sequence \ + >::type \ + > \ + { typedef cs::cartesian type; }; \ + }}} + + +#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_HPP diff --git a/include/boost/geometry/geometries/adapted/boost_polygon.hpp b/include/boost/geometry/geometries/adapted/boost_polygon.hpp new file mode 100644 index 000000000..9fe982b04 --- /dev/null +++ b/include/boost/geometry/geometries/adapted/boost_polygon.hpp @@ -0,0 +1,18 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2010-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) + +#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_HPP +#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_HPP + +#include +#include +#include +#include + +#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_HPP + diff --git a/include/boost/geometry/geometries/adapted/boost_tuple.hpp b/include/boost/geometry/geometries/adapted/boost_tuple.hpp new file mode 100644 index 000000000..b2e18771f --- /dev/null +++ b/include/boost/geometry/geometries/adapted/boost_tuple.hpp @@ -0,0 +1,109 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2008-2011 Bruno Lalande, Paris, France. +// Copyright (c) 2008-2011 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2009-2011 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_TUPLE_HPP +#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_TUPLE_HPP + + +#include + +#include + +#include +#include +#include +#include + + +namespace boost { namespace geometry +{ + + +#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS +namespace traits +{ + + +template +struct tag > +{ + typedef point_tag type; +}; + + +template +struct coordinate_type > +{ + typedef T1 type; +}; + + +template +struct dimension > + : boost::mpl::int_ + < + boost::tuples::length + < + boost::tuple + >::value + > +{}; + + +template +struct access + < + boost::tuple, + Dimension + > +{ + static inline T1 get( + boost::tuple const& point) + { + return point.template get(); + } + + static inline void set( + boost::tuple& point, + T1 const& value) + { + point.template get() = value; + } +}; + + +} // namespace traits +#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS + + +}} // namespace boost::geometry + + +// Convenience registration macro to bind boost::tuple to a CS +#define BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(CoordinateSystem) \ + namespace boost { namespace geometry { namespace traits { \ + template \ + struct coordinate_system > \ + { \ + typedef CoordinateSystem type; \ + }; \ + }}} + + +#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_TUPLE_HPP diff --git a/include/boost/geometry/geometries/adapted/c_array.hpp b/include/boost/geometry/geometries/adapted/c_array.hpp index 0e2209b43..ebbfbd469 100644 --- a/include/boost/geometry/geometries/adapted/c_array.hpp +++ b/include/boost/geometry/geometries/adapted/c_array.hpp @@ -90,9 +90,6 @@ struct access } }; -// The library user has -// 1) either to specify the coordinate system -// 2) or include where @=cartesian,geographic,... } // namespace traits #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS @@ -100,4 +97,15 @@ struct access }} // namespace boost::geometry + +#define BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(CoordinateSystem) \ + namespace boost { namespace geometry { namespace traits { \ + template \ + struct coordinate_system \ + { \ + typedef CoordinateSystem type; \ + }; \ + }}} + + #endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_C_ARRAY_HPP diff --git a/include/boost/geometry/geometries/adapted/c_array_cartesian.hpp b/include/boost/geometry/geometries/adapted/c_array_cartesian.hpp deleted file mode 100644 index dc1efcaca..000000000 --- a/include/boost/geometry/geometries/adapted/c_array_cartesian.hpp +++ /dev/null @@ -1,45 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2008-2011 Bruno Lalande, Paris, France. -// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2009-2011 Mateusz Loskot, London, UK. - -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_C_ARRAY_CARTESIAN_HPP -#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_C_ARRAY_CARTESIAN_HPP - -#ifdef BOOST_GEOMETRY_ADAPTED_C_ARRAY_COORDINATE_SYSTEM_DEFINED -#error Include only one headerfile to register coordinate coordinate_system for adapted c array -#endif - -#define BOOST_GEOMETRY_ADAPTED_C_ARRAY_COORDINATE_SYSTEM_DEFINED - - -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS -namespace traits -{ - template - struct coordinate_system - { typedef cs::cartesian type; }; - -} -#endif - - -}} // namespace boost::geometry - - -#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_C_ARRAY_CARTESIAN_HPP diff --git a/include/boost/geometry/geometries/adapted/c_array_geographic.hpp b/include/boost/geometry/geometries/adapted/c_array_geographic.hpp deleted file mode 100644 index f9003acf3..000000000 --- a/include/boost/geometry/geometries/adapted/c_array_geographic.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2008-2011 Bruno Lalande, Paris, France. -// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2009-2011 Mateusz Loskot, London, UK. - -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_C_ARRAY_GEOGRAPHIC_HPP -#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_C_ARRAY_GEOGRAPHIC_HPP - -#ifdef BOOST_GEOMETRY_ADAPTED_C_ARRAY_COORDINATE_SYSTEM_DEFINED -#error Include only one headerfile to register coordinate coordinate_system for adapted c array -#endif - -#define BOOST_GEOMETRY_ADAPTED_C_ARRAY_COORDINATE_SYSTEM_DEFINED - -#include - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS -namespace traits -{ - template - struct coordinate_system - { typedef cs::geographic type; }; - -} -#endif - - -}} // namespace boost::geometry - - -#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_C_ARRAY_GEOGRAPHIC_HPP diff --git a/include/boost/geometry/geometries/adapted/fusion_cartesian.hpp b/include/boost/geometry/geometries/adapted/fusion_cartesian.hpp deleted file mode 100644 index 2aa17a712..000000000 --- a/include/boost/geometry/geometries/adapted/fusion_cartesian.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2011 Akira Takahashi -// 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) - -#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_CARTESIAN_HPP -#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_CARTESIAN_HPP - -#ifdef BOOST_GEOMETRY_ADAPTED_FUSION_COORDINATE_SYSTEM_DEFINED -#error Include only one headerfile to register coordinate coordinate_system for adapted fusion -#endif - -#define BOOST_GEOMETRY_ADAPTED_FUSION_COORDINATE_SYSTEM_DEFINED - - -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS -namespace traits -{ - template - struct coordinate_system< - Sequence, - typename boost::enable_if< - fusion_adapt_detail::is_fusion_sequence >::type> - { typedef cs::cartesian type; }; - -} // namespace traits -#endif - - -}} // namespace boost::geometry - - -#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_CARTESIAN_HPP diff --git a/include/boost/geometry/geometries/adapted/fusion_geographic.hpp b/include/boost/geometry/geometries/adapted/fusion_geographic.hpp deleted file mode 100644 index 4e693af4e..000000000 --- a/include/boost/geometry/geometries/adapted/fusion_geographic.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2011 Akira Takahashi -// 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) - -#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_GEOGRAPHIC_HPP -#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_GEOGRAPHIC_HPP - -#ifdef BOOST_GEOMETRY_ADAPTED_FUSION_COORDINATE_SYSTEM_DEFINED -#error Include only one headerfile to register coordinate coordinate_system for adapted fusion -#endif - -#define BOOST_GEOMETRY_ADAPTED_FUSION_COORDINATE_SYSTEM_DEFINED - - -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS -namespace traits -{ - template - struct coordinate_system< - Sequence, - typename boost::enable_if< - fusion_adapt_detail::is_fusion_sequence >::type> - { typedef cs::geographic type; }; - -} // namespace traits -#endif - - -}} // namespace boost::geometry - - -#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_FUSION_GEOGRAPHIC_HPP diff --git a/include/boost/geometry/geometries/adapted/tuple.hpp b/include/boost/geometry/geometries/adapted/tuple.hpp deleted file mode 100644 index f26b8e08b..000000000 --- a/include/boost/geometry/geometries/adapted/tuple.hpp +++ /dev/null @@ -1,136 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2008-2011 Bruno Lalande, Paris, France. -// Copyright (c) 2008-2011 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2009-2011 Mateusz Loskot, London, UK. - -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_TUPLE_HPP -#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_TUPLE_HPP - - -#include - -#include - -#include -#include -#include -#include - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS -namespace traits -{ - -// boost::tuple, 2D -template -struct coordinate_type > -{ - typedef CoordinateType type; -}; - - -template -struct dimension > - : boost::mpl::int_<2> -{}; - - -template -struct access - < - boost::tuple, - Dimension - > -{ - static inline CoordinateType get( - boost::tuple const& point) - { - return point.template get(); - } - - static inline void set(boost::tuple& point, - CoordinateType const& value) - { - point.template get() = value; - } -}; - - -template -struct tag > -{ - typedef point_tag type; -}; - - -// boost::tuple, 3D -template -struct coordinate_type - < - boost::tuple - > -{ - typedef CoordinateType type; -}; - -template -struct dimension > - : boost::mpl::int_<3> -{}; - - -template -struct access - < - boost::tuple, - Dimension - > -{ - static inline CoordinateType get( - boost::tuple - < - CoordinateType, CoordinateType, CoordinateType - > const& point) - { - return point.template get(); - } - - static inline void set( - boost::tuple& point, - CoordinateType const& value) - { - point.template get() = value; - } -}; - - -template -struct tag > -{ - typedef point_tag type; -}; - -// The library user has -// 1) either to specify the coordinate system using a traits class -// 2) or include -// where @=cartesian,geographic,... - -} // namespace traits -#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS - - -}} // namespace boost::geometry - -#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_TUPLE_HPP - diff --git a/include/boost/geometry/geometries/adapted/tuple_cartesian.hpp b/include/boost/geometry/geometries/adapted/tuple_cartesian.hpp deleted file mode 100644 index b6e9cd682..000000000 --- a/include/boost/geometry/geometries/adapted/tuple_cartesian.hpp +++ /dev/null @@ -1,49 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2008-2011 Bruno Lalande, Paris, France. -// Copyright (c) 2008-2011 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2009-2011 Mateusz Loskot, London, UK. - -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_TUPLE_CARTESIAN_HPP -#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_TUPLE_CARTESIAN_HPP - -#ifdef BOOST_GEOMETRY_ADAPTED_TUPLE_COORDINATE_SYSTEM_DEFINED -#error Include only one headerfile to register coordinate coordinate_system for adapted tuple -#endif - -#define BOOST_GEOMETRY_ADAPTED_TUPLE_COORDINATE_SYSTEM_DEFINED - - -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS -namespace traits -{ - template - struct coordinate_system > - { typedef cs::cartesian type; }; - - template - struct coordinate_system > - { typedef cs::cartesian type; }; - -} -#endif - - -}} // namespace boost::geometry - - -#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_TUPLE_CARTESIAN_HPP diff --git a/include/boost/geometry/geometries/adapted/tuple_geographic.hpp b/include/boost/geometry/geometries/adapted/tuple_geographic.hpp deleted file mode 100644 index da0c702ee..000000000 --- a/include/boost/geometry/geometries/adapted/tuple_geographic.hpp +++ /dev/null @@ -1,49 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2008-2011 Bruno Lalande, Paris, France. -// Copyright (c) 2008-2011 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2009-2011 Mateusz Loskot, London, UK. - -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_TUPLE_GEOGRAPHIC_HPP -#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_TUPLE_GEOGRAPHIC_HPP - -#ifdef BOOST_GEOMETRY_ADAPTED_TUPLE_COORDINATE_SYSTEM_DEFINED -#error Include only one headerfile to register coordinate coordinate_system for adapted tuple -#endif - -#define BOOST_GEOMETRY_ADAPTED_TUPLE_COORDINATE_SYSTEM_DEFINED - - -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS -namespace traits -{ - template - struct coordinate_system > - { typedef cs::geographic type; }; - - template - struct coordinate_system > - { typedef cs::geographic type; }; - -} -#endif - - -}} // namespace boost::geometry - - -#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_TUPLE_GEOGRAPHIC_HPP diff --git a/include/boost/geometry/geometries/geometries.hpp b/include/boost/geometry/geometries/geometries.hpp index cef9f6bf1..fd766ff26 100644 --- a/include/boost/geometry/geometries/geometries.hpp +++ b/include/boost/geometry/geometries/geometries.hpp @@ -15,7 +15,7 @@ #define BOOST_GEOMETRY_GEOMETRIES_HPP #include -#include +#include #include #include diff --git a/include/boost/geometry/geometries/register/box.hpp b/include/boost/geometry/geometries/register/box.hpp index 4761384a9..cac2af7a7 100644 --- a/include/boost/geometry/geometries/register/box.hpp +++ b/include/boost/geometry/geometries/register/box.hpp @@ -40,7 +40,7 @@ struct indexed_access \ }; -#define BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS_TEMPLATIZED(Box, MinCorner, MaxCorner) \ +#define BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS_TEMPLATED(Box, MinCorner, MaxCorner) \ template \ struct indexed_access, min_corner, D> \ { \ @@ -94,7 +94,7 @@ template <> struct indexed_access \ template<> struct tag { typedef box_tag type; }; \ template<> struct point_type { typedef PointType type; }; -#define BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS_TEMPLATIZED(Box) \ +#define BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS_TEMPLATED(Box) \ template struct tag > { typedef box_tag type; }; \ template struct point_type > { typedef P type; }; @@ -102,23 +102,73 @@ template <> struct indexed_access \ -#define BOOST_GEOMETRY_REGISTER_BOX(Box, PointType, MinCorner, MaxCorner) \ +/*! +\brief \brief_macro{box} +\ingroup register +\details \details_macro{BOOST_GEOMETRY_REGISTER_BOX, box} The + box may contain template parameters, which must be specified then. +\param Box \param_macro_type{Box} +\param Point Point type on which box is based. Might be two or three-dimensional +\param MinCorner minimum corner (should be public member or method) +\param MaxCorner maximum corner (should be public member or method) + +\qbk{ +[heading Example] +[register_box] +[register_box_output] +} +*/ +#define BOOST_GEOMETRY_REGISTER_BOX(Box, Point, MinCorner, MaxCorner) \ namespace boost { namespace geometry { namespace traits { \ - BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS(Box, PointType) \ - BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS(Box, PointType, MinCorner, MaxCorner) \ + BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS(Box, Point) \ + BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS(Box, Point, MinCorner, MaxCorner) \ }}} -#define BOOST_GEOMETRY_REGISTER_BOX_TEMPLATIZED(Box, MinCorner, MaxCorner) \ +/*! +\brief \brief_macro{box} +\ingroup register +\details \details_macro{BOOST_GEOMETRY_REGISTER_BOX_TEMPLATED, box} + \details_macro_templated{box} +\param Box \param_macro_type{Box} +\param MinCorner minimum corner (should be public member or method) +\param MaxCorner maximum corner (should be public member or method) + +\qbk{ +[heading Example] +[register_box_templated] +[register_box_templated_output] +} +*/ +#define BOOST_GEOMETRY_REGISTER_BOX_TEMPLATED(Box, MinCorner, MaxCorner) \ namespace boost { namespace geometry { namespace traits { \ - BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS_TEMPLATIZED(Box) \ - BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS_TEMPLATIZED(Box, MinCorner, MaxCorner) \ + BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS_TEMPLATED(Box) \ + BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS_TEMPLATED(Box, MinCorner, MaxCorner) \ }}} -#define BOOST_GEOMETRY_REGISTER_BOX_2D_4VALUES(Box, PointType, Left, Bottom, Right, Top) \ +/*! +\brief \brief_macro{box} +\ingroup register +\details \details_macro{BOOST_GEOMETRY_REGISTER_BOX_2D_4VALUES, box} +\param Box \param_macro_type{Box} +\param Point Point type reported as point_type by box. Must be two dimensional. + Note that these box tyeps do not contain points, but they must have a + related point_type +\param Left Left side (must be public member or method) +\param Bottom Bottom side (must be public member or method) +\param Right Right side (must be public member or method) +\param Top Top side (must be public member or method) + +\qbk{ +[heading Example] +[register_box_2d_4values] +[register_box_2d_4values_output] +} +*/ +#define BOOST_GEOMETRY_REGISTER_BOX_2D_4VALUES(Box, Point, Left, Bottom, Right, Top) \ namespace boost { namespace geometry { namespace traits { \ - BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS(Box, PointType) \ - BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS_4VALUES(Box, PointType, Left, Bottom, Right, Top) \ + BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS(Box, Point) \ + BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS_4VALUES(Box, Point, Left, Bottom, Right, Top) \ }}} diff --git a/include/boost/geometry/iterators/box_iterator.hpp b/include/boost/geometry/iterators/box_iterator.hpp index 735e90db3..ce1241dcf 100644 --- a/include/boost/geometry/iterators/box_iterator.hpp +++ b/include/boost/geometry/iterators/box_iterator.hpp @@ -41,6 +41,13 @@ struct box_iterator boost::random_access_traversal_tag > { + // Default constructor is required to check concept of Range + inline box_iterator() + : m_index(-1) + , m_box_address(NULL) + { + } + explicit inline box_iterator(Box const& box) : m_index(0) , m_box_address(&box) @@ -56,6 +63,14 @@ struct box_iterator init(box); } + // Operator= is required to check concept of Range + inline box_iterator& operator=(box_iterator const& source) + { + m_index = source.m_index; + m_box_address = source.m_box_address; + return *this; + } + typedef std::ptrdiff_t difference_type; private: @@ -101,7 +116,7 @@ private: // Copy points here - box might define them otherwise point_type m_points[4]; int m_index; - Box const* const m_box_address; + Box const* m_box_address; }; diff --git a/include/boost/geometry/iterators/segment_range_iterator.hpp b/include/boost/geometry/iterators/segment_range_iterator.hpp index 55c1f5046..cedb9310d 100644 --- a/include/boost/geometry/iterators/segment_range_iterator.hpp +++ b/include/boost/geometry/iterators/segment_range_iterator.hpp @@ -51,15 +51,6 @@ struct segment_range_iterator { } - // Operator= is required to check concept of Range - inline segment_range_iterator& operator=(segment_range_iterator const& source) - { - m_index = source.m_index; - m_segment_address = source.m_segment_address; - return *this; - } - - explicit inline segment_range_iterator(Segment const& segment) : m_index(0) , m_segment_address(&segment) @@ -74,7 +65,15 @@ struct segment_range_iterator { init(segment); } - + + // Operator= is required to check concept of Range + inline segment_range_iterator& operator=(segment_range_iterator const& source) + { + m_index = source.m_index; + m_segment_address = source.m_segment_address; + return *this; + } + typedef std::ptrdiff_t difference_type; private: diff --git a/test/algorithms/assign.cpp b/test/algorithms/assign.cpp index ab4ee31b0..ad3bef97b 100644 --- a/test/algorithms/assign.cpp +++ b/test/algorithms/assign.cpp @@ -19,10 +19,13 @@ #include #include -#include -#include +#include +#include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template void check_linestring_2d(Linestring const& line) diff --git a/test/algorithms/centroid.cpp b/test/algorithms/centroid.cpp index e2b5d5205..fab082b06 100644 --- a/test/algorithms/centroid.cpp +++ b/test/algorithms/centroid.cpp @@ -15,11 +15,15 @@ #include #include -#include -#include +#include +#include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + + template void test_polygon() { @@ -78,12 +82,21 @@ void test_2d() template void test_3d() { - test_centroid >("LINESTRING(1 2 3,4 5 -6,7 -8 9,-10 11 12,13 -14 -15, 16 17 18)", 5.6748865168734692, 0.31974938587214002, 1.9915270387763671); + test_centroid >("LINESTRING(1 2 3,4 5 -6,7 -8 9,-10 11 12,13 -14 -15, 16 17 18)", + 5.6748865168734692, 0.31974938587214002, 1.9915270387763671); test_centroid >("POLYGON((1 2 3,5 6 7))", 3, 4, 5); test_centroid

("POINT(1 2 3)", 1, 2, 3); } +template +void test_5d() +{ + test_centroid >("LINESTRING(1 2 3 4 95,4 5 -6 24 40,7 -8 9 -5 -7,-10 11 12 -5 5,13 -14 -15 4 3, 16 17 18 5 12)", + 4.9202312983547678, 0.69590937869808345, 1.2632138719797417, 6.0468332057401986, 23.082402715244868); +} + + int test_main(int, char* []) { test_2d >(); @@ -92,6 +105,8 @@ int test_main(int, char* []) test_3d >(); + test_5d >(); + #if defined(HAVE_TTMATH) test_2d >(); test_3d >(); diff --git a/test/algorithms/convert.cpp b/test/algorithms/convert.cpp index 185aceb11..039922b3b 100644 --- a/test/algorithms/convert.cpp +++ b/test/algorithms/convert.cpp @@ -21,10 +21,13 @@ #include #include -#include -#include +#include +#include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template void test_all() diff --git a/test/algorithms/distance.cpp b/test/algorithms/distance.cpp index aed42dbf2..bce602e41 100644 --- a/test/algorithms/distance.cpp +++ b/test/algorithms/distance.cpp @@ -22,13 +22,16 @@ #include #include -#include -#include +#include +#include #include #include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template void test_distance_point() diff --git a/test/algorithms/envelope.cpp b/test/algorithms/envelope.cpp index c790c0579..3896b34b3 100644 --- a/test/algorithms/envelope.cpp +++ b/test/algorithms/envelope.cpp @@ -16,11 +16,14 @@ #include #include -#include -#include +#include +#include #include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template void test_2d() diff --git a/test/algorithms/expand.cpp b/test/algorithms/expand.cpp index 040f2c3c5..5e1147ff2 100644 --- a/test/algorithms/expand.cpp +++ b/test/algorithms/expand.cpp @@ -18,11 +18,14 @@ #include #include -#include -#include +#include +#include #include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template void test_point_3d() diff --git a/test/algorithms/intersection.cpp b/test/algorithms/intersection.cpp index 5a7b2c647..1e8814d4d 100644 --- a/test/algorithms/intersection.cpp +++ b/test/algorithms/intersection.cpp @@ -350,10 +350,31 @@ void test_pointer_version() } +template +void test_exception() +{ + typedef bg::model::polygon

polygon; + try + { + // Define polygon with a spike (= invalid) + std::string spike = "POLYGON((0 0,0 4,2 4,2 6,2 4,4 4,4 0,0 0))"; + + test_one("with_spike", + simplex_normal[0], spike, + 0, 0, 0); + } + catch(bg::overlay_invalid_input_exception const& ) + { + return; + } + BOOST_CHECK_MESSAGE(false, "No exception thrown"); +} int test_main(int, char* []) { + test_exception >(); + test_all >(); #if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) diff --git a/test/algorithms/make.cpp b/test/algorithms/make.cpp index 65b63fe9e..6acee35b1 100644 --- a/test/algorithms/make.cpp +++ b/test/algorithms/make.cpp @@ -20,10 +20,13 @@ #include #include -#include -#include +#include +#include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template void test_point_2d() diff --git a/test/algorithms/overlay/get_turn_info.cpp b/test/algorithms/overlay/get_turn_info.cpp index 62f68c748..757bbcc0b 100644 --- a/test/algorithms/overlay/get_turn_info.cpp +++ b/test/algorithms/overlay/get_turn_info.cpp @@ -818,7 +818,8 @@ void test_all() /*** #include #include -#include +#include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) template void test2(G const& geometry) diff --git a/test/algorithms/overlay/overlay_common.hpp b/test/algorithms/overlay/overlay_common.hpp index de991806b..d821df85c 100644 --- a/test/algorithms/overlay/overlay_common.hpp +++ b/test/algorithms/overlay/overlay_common.hpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include @@ -33,6 +33,8 @@ # include #endif +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian); + template diff --git a/test/algorithms/overlay/self_intersection_points.cpp b/test/algorithms/overlay/self_intersection_points.cpp index 763243a89..7425ec4ac 100644 --- a/test/algorithms/overlay/self_intersection_points.cpp +++ b/test/algorithms/overlay/self_intersection_points.cpp @@ -53,7 +53,7 @@ struct test_self_intersection_points ///bg::get_intersection_points(geometry, turns); bg::detail::get_turns::no_interrupt_policy policy; - bg::get_turns + bg::self_turns < bg::detail::overlay::assign_null_policy >(geometry, turns, policy); diff --git a/test/algorithms/test_centroid.hpp b/test/algorithms/test_centroid.hpp index c9467251e..918932ef0 100644 --- a/test/algorithms/test_centroid.hpp +++ b/test/algorithms/test_centroid.hpp @@ -16,41 +16,31 @@ #include #include #include +#include #include -template +template struct check_result { -}; - -template <> -struct check_result<2> -{ - template - static void apply(Point const& p, T const& x, T const& y, T const&) + template + static void apply(Point1 const& actual, Point2 const& expected) { - BOOST_CHECK_CLOSE(bg::get<0>(p), x, 0.001); - BOOST_CHECK_CLOSE(bg::get<1>(p), y, 0.001); + check_result::apply(actual, expected); + BOOST_CHECK_CLOSE(bg::get(actual), bg::get(expected), 0.001); } }; - template <> -struct check_result<3> +struct check_result<0> { - template - static void apply(Point const& p, T const& x, T const& y, T const& z) - { - BOOST_CHECK_CLOSE(bg::get<0>(p), x, 0.001); - BOOST_CHECK_CLOSE(bg::get<1>(p), y, 0.001); - BOOST_CHECK_CLOSE(bg::get<2>(p), z, 0.001); - } + template + static void apply(Point1 const&, Point2 const&) + {} }; - template void test_with_other_calculation_type(Geometry const& geometry, Point& c1) { @@ -67,14 +57,14 @@ void test_with_other_calculation_type(Geometry const& geometry, Point& c1) } template -void test_centroid(std::string const& wkt, T const& x, T const& y, T const& z = T()) +void test_centroid(std::string const& wkt, T const& d1, T const& d2, T const& d3 = T(), T const& d4 = T(), T const& d5 = T()) { Geometry geometry; bg::read_wkt(wkt, geometry); typedef typename bg::point_type::type point_type; point_type c1; bg::centroid(geometry, c1); - check_result::type::value>::apply(c1, x, y, z); + check_result::type::value>::apply(c1, boost::make_tuple(d1, d2, d3, d4, d5)); #ifdef REPORT_RESULTS std::cout << "normal: " << std::setprecision(20) << bg::get<0>(c1) << " " << bg::get<1>(c1) << std::endl; diff --git a/test/arithmetic/arithmetic.cpp b/test/arithmetic/arithmetic.cpp index 1ae1915f4..e513804e9 100644 --- a/test/arithmetic/arithmetic.cpp +++ b/test/arithmetic/arithmetic.cpp @@ -21,10 +21,13 @@ #include #include -#include -#include +#include +#include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template void test_addition() diff --git a/test/arithmetic/dot_product.cpp b/test/arithmetic/dot_product.cpp index 777124ca2..d2bff94bc 100644 --- a/test/arithmetic/dot_product.cpp +++ b/test/arithmetic/dot_product.cpp @@ -21,10 +21,13 @@ #include #include -#include -#include +#include +#include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template void test_all() diff --git a/test/core/access.cpp b/test/core/access.cpp index f5e2cb033..bac9d7fba 100644 --- a/test/core/access.cpp +++ b/test/core/access.cpp @@ -22,8 +22,8 @@ #include #include -#include -#include +#include +#include #include @@ -31,6 +31,8 @@ #include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) template diff --git a/test/core/coordinate_dimension.cpp b/test/core/coordinate_dimension.cpp index 7013b3155..70e819ccf 100644 --- a/test/core/coordinate_dimension.cpp +++ b/test/core/coordinate_dimension.cpp @@ -16,8 +16,8 @@ #include -#include -#include +#include +#include #include #include @@ -25,6 +25,9 @@ #include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template void test_geometry() diff --git a/test/core/coordinate_system.cpp b/test/core/coordinate_system.cpp index d3aa6cdd6..fd2afd490 100644 --- a/test/core/coordinate_system.cpp +++ b/test/core/coordinate_system.cpp @@ -16,8 +16,8 @@ #include -#include -#include +#include +#include #include #include @@ -25,6 +25,9 @@ #include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template void test_geometry() diff --git a/test/core/coordinate_type.cpp b/test/core/coordinate_type.cpp index 71dbc4ae6..aa9fb752a 100644 --- a/test/core/coordinate_type.cpp +++ b/test/core/coordinate_type.cpp @@ -16,8 +16,8 @@ #include -#include -#include +#include +#include #include #include @@ -25,6 +25,9 @@ #include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template void test_geometry() diff --git a/test/core/geometry_id.cpp b/test/core/geometry_id.cpp index d80b4f8fb..bfb65d967 100644 --- a/test/core/geometry_id.cpp +++ b/test/core/geometry_id.cpp @@ -15,8 +15,8 @@ #include -#include -#include +#include +#include #include #include @@ -24,6 +24,9 @@ #include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template void test_geometry() diff --git a/test/core/point_type.cpp b/test/core/point_type.cpp index 957b8ebc6..1a4dd9855 100644 --- a/test/core/point_type.cpp +++ b/test/core/point_type.cpp @@ -15,8 +15,8 @@ #include -#include -#include +#include +#include #include #include @@ -24,6 +24,9 @@ #include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template void test_geometry() diff --git a/test/core/tag.cpp b/test/core/tag.cpp index 21361d42c..1a6759238 100644 --- a/test/core/tag.cpp +++ b/test/core/tag.cpp @@ -14,8 +14,8 @@ #include -#include -#include +#include +#include #include #include @@ -23,6 +23,9 @@ #include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template void test_geometry() diff --git a/test/core/topological_dimension.cpp b/test/core/topological_dimension.cpp index c2edfa47a..53b0ac4e8 100644 --- a/test/core/topological_dimension.cpp +++ b/test/core/topological_dimension.cpp @@ -14,8 +14,8 @@ #include -#include -#include +#include +#include #include #include @@ -23,6 +23,9 @@ #include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template void test_geometry() diff --git a/test/geometries/Jamfile.v2 b/test/geometries/Jamfile.v2 index 35c197764..de76d1bef 100644 --- a/test/geometries/Jamfile.v2 +++ b/test/geometries/Jamfile.v2 @@ -10,10 +10,12 @@ test-suite boost-geometry-geometries : + [ run adapted.cpp ] [ run boost_array_as_point.cpp ] [ run boost_fusion.cpp ] [ run boost_polygon.cpp ] [ run boost_range.cpp ] + [ run boost_tuple.cpp ] [ run box.cpp ] #[ compile-fail custom_linestring.cpp # : # requirements diff --git a/test/geometries/adapted.cpp b/test/geometries/adapted.cpp index 309324fc1..4bf8158e6 100644 --- a/test/geometries/adapted.cpp +++ b/test/geometries/adapted.cpp @@ -45,11 +45,14 @@ #endif -#include -#include +#include +#include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + // ---------------------------------------------------------------------------- diff --git a/test/geometries/boost_array_as_point.cpp b/test/geometries/boost_array_as_point.cpp index a74e4815c..7b451b34d 100644 --- a/test/geometries/boost_array_as_point.cpp +++ b/test/geometries/boost_array_as_point.cpp @@ -12,11 +12,15 @@ #include -#include -#include -#include +#include +#include +#include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + int test_main(int, char* []) { diff --git a/test/geometries/boost_fusion.cpp b/test/geometries/boost_fusion.cpp index 6ed8fd056..47c64778a 100644 --- a/test/geometries/boost_fusion.cpp +++ b/test/geometries/boost_fusion.cpp @@ -13,12 +13,16 @@ #include #include -#include -#include -#include -#include +#include +#include +#include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_FUSION_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + + struct for_fusion_2d { float x,y; diff --git a/test/geometries/boost_tuple.cpp b/test/geometries/boost_tuple.cpp new file mode 100644 index 000000000..281d73b56 --- /dev/null +++ b/test/geometries/boost_tuple.cpp @@ -0,0 +1,39 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2008-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) + + +#include +#include +#include +#include +#include + +#include + + +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + + +template +void test_all() +{ + P p1, p2; + bg::distance(p1, p2); +} + +int test_main(int, char* []) +{ + test_all >(); + test_all >(); + test_all >(); + test_all >(); + test_all >(); + + return 0; +} diff --git a/test/geometries/box.cpp b/test/geometries/box.cpp index 44a9a012f..a7c06eecc 100644 --- a/test/geometries/box.cpp +++ b/test/geometries/box.cpp @@ -20,10 +20,13 @@ #include #include -#include -#include +#include +#include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template bg::model::box

create_box() diff --git a/test/geometries/custom_linestring.cpp b/test/geometries/custom_linestring.cpp index 7596a7d9f..fbd4ab072 100644 --- a/test/geometries/custom_linestring.cpp +++ b/test/geometries/custom_linestring.cpp @@ -27,10 +27,13 @@ #include #include #include -#include -#include +#include +#include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + //#define TEST_FAIL_CLEAR //#define TEST_FAIL_APPEND diff --git a/test/geometries/segment.cpp b/test/geometries/segment.cpp index 9845021d4..f9035fa7f 100644 --- a/test/geometries/segment.cpp +++ b/test/geometries/segment.cpp @@ -22,8 +22,8 @@ #include -#include -#include +#include +#include #include @@ -31,6 +31,9 @@ #include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template void test_all() diff --git a/test/multi/algorithms/multi_distance.cpp b/test/multi/algorithms/multi_distance.cpp index 2eedc5690..702f0347f 100644 --- a/test/multi/algorithms/multi_distance.cpp +++ b/test/multi/algorithms/multi_distance.cpp @@ -23,10 +23,13 @@ #include #include -#include -#include +#include +#include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template void test_distance(std::string const& wkt1, std::string const& wkt2, double expected) diff --git a/test/multi/algorithms/multi_envelope.cpp b/test/multi/algorithms/multi_envelope.cpp index 0d033b7d6..c84ea9e82 100644 --- a/test/multi/algorithms/multi_envelope.cpp +++ b/test/multi/algorithms/multi_envelope.cpp @@ -24,11 +24,12 @@ #include #include -#include -#include +#include +#include #include - +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) template diff --git a/test/multi/algorithms/overlay/multi_overlay_cases.hpp b/test/multi/algorithms/overlay/multi_overlay_cases.hpp index 20da40441..544e79126 100644 --- a/test/multi/algorithms/overlay/multi_overlay_cases.hpp +++ b/test/multi/algorithms/overlay/multi_overlay_cases.hpp @@ -138,7 +138,7 @@ static std::string case_77_multi[2] = // -> went wrong in the assemble phase for intersection (traversal is OK) // -> fixed "MULTIPOLYGON(((3 3,3 4,4 4,4 3,3 3)),((5 3,5 4,4 4,4 5,3 5,3 6,5 6,5 5,7 5,7 6,8 6,8 5,9 5,9 2,8 2,8 1,7 1,7 2,5 2,5 3),(6 3,8 3,8 4,6 4,6 3)))", - "MULTIPOLYGON(((6 3,6 4,7 4,7 3,6 3)),((2 3,1 3,1 4,3 4,3 5,4 5,4 6,5 6,5 7,9 7,9 4,7 4,7 5,8 5,8 6,7 6,7 5,6 5,6 4,4 4,4 3,3 3,3 2,4 2,2 2,2 3)),((5 2,4 2,4 3,6 3,6 2,5 2)),((7 2,7 3,8 3,8 2,8 1,7 1,7 2)))" + "MULTIPOLYGON(((6 3,6 4,7 4,7 3,6 3)),((2 3,1 3,1 4,3 4,3 5,4 5,4 6,5 6,5 7,9 7,9 4,7 4,7 5,8 5,8 6,7 6,7 5,6 5,6 4,4 4,4 3,3 3,3 2,2 2,2 3)),((5 2,4 2,4 3,6 3,6 2,5 2)),((7 2,7 3,8 3,8 2,8 1,7 1,7 2)))" }; static std::string case_78_multi[2] = diff --git a/test/point_concept/array_point.cpp b/test/point_concept/array_point.cpp index 61ae34a9c..ea8b1ebbf 100644 --- a/test/point_concept/array_point.cpp +++ b/test/point_concept/array_point.cpp @@ -14,9 +14,12 @@ #include -#include +#include #include "function_requiring_a_point.hpp" +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) + + int main() { float p1[3] = { 0, 0, 0 }; diff --git a/test/policies/compare.cpp b/test/policies/compare.cpp index a1e406173..331ec8209 100644 --- a/test/policies/compare.cpp +++ b/test/policies/compare.cpp @@ -19,11 +19,14 @@ #include #include -#include -#include +#include +#include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + template inline std::string coordinates(Container const& points) diff --git a/test/ranges/box_range.cpp b/test/ranges/box_range.cpp index 0deb4f266..6acfccda8 100644 --- a/test/ranges/box_range.cpp +++ b/test/ranges/box_range.cpp @@ -54,6 +54,9 @@ void test_geometry(std::string const& wkt, std::string const& expected) int const n = boost::size(range); BOOST_CHECK_EQUAL(n, 5); } + + // Check Boost.Range concept + BOOST_CONCEPT_ASSERT( (boost::ForwardRangeConcept) ); } diff --git a/test/ranges/segment_range.cpp b/test/ranges/segment_range.cpp index 1c9520190..1d48199c6 100644 --- a/test/ranges/segment_range.cpp +++ b/test/ranges/segment_range.cpp @@ -58,6 +58,10 @@ void test_geometry(std::string const& wkt, std::string const& expected) int const n = boost::size(range); BOOST_CHECK_EQUAL(n, 2); } + + // Check Boost.Range concept + BOOST_CONCEPT_ASSERT( (boost::ForwardRangeConcept) ); + } diff --git a/test/strategies/projected_point.cpp b/test/strategies/projected_point.cpp index 7ad1e91fb..187f3d77b 100644 --- a/test/strategies/projected_point.cpp +++ b/test/strategies/projected_point.cpp @@ -22,14 +22,16 @@ #include -#include -#include +#include +#include #include #ifdef HAVE_TTMATH # include #endif +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) template diff --git a/test/strategies/pythagoras.cpp b/test/strategies/pythagoras.cpp index 204386422..015370e1b 100644 --- a/test/strategies/pythagoras.cpp +++ b/test/strategies/pythagoras.cpp @@ -30,8 +30,8 @@ #include -#include -#include +#include +#include #include @@ -39,6 +39,8 @@ # include #endif +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) template diff --git a/test/strategies/segment_intersection.cpp b/test/strategies/segment_intersection.cpp index cbf40f278..d68b6ee5c 100644 --- a/test/strategies/segment_intersection.cpp +++ b/test/strategies/segment_intersection.cpp @@ -38,8 +38,9 @@ #include #include -#include +#include +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian); template diff --git a/test/strategies/transformer.cpp b/test/strategies/transformer.cpp index 3826ce823..e3116f87a 100644 --- a/test/strategies/transformer.cpp +++ b/test/strategies/transformer.cpp @@ -24,10 +24,11 @@ #include #include -#include -#include - +#include +#include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) template diff --git a/test/util/for_each_coordinate.cpp b/test/util/for_each_coordinate.cpp index 993c6a4d1..0b183a209 100644 --- a/test/util/for_each_coordinate.cpp +++ b/test/util/for_each_coordinate.cpp @@ -23,10 +23,13 @@ #include -#include -#include +#include +#include #include +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + struct test_operation { diff --git a/test/views/closeable_view.cpp b/test/views/closeable_view.cpp index 29b626349..991836eac 100644 --- a/test/views/closeable_view.cpp +++ b/test/views/closeable_view.cpp @@ -19,8 +19,9 @@ #include #include #include -#include +#include +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian); diff --git a/test/views/reversible_closeable.cpp b/test/views/reversible_closeable.cpp index 4dedb4cd5..87e0dc38d 100644 --- a/test/views/reversible_closeable.cpp +++ b/test/views/reversible_closeable.cpp @@ -21,7 +21,9 @@ #include #include #include -#include +#include + +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian); template diff --git a/test/views/reversible_view.cpp b/test/views/reversible_view.cpp index 865c3063f..42ae5c339 100644 --- a/test/views/reversible_view.cpp +++ b/test/views/reversible_view.cpp @@ -19,7 +19,10 @@ #include #include #include -#include +#include + +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian); + template void test_forward_or_reverse(Range const& range, std::string const& expected)