Doc update (metafunctions tag, tag_cast, point_type)

[SVN r71330]
This commit is contained in:
Barend Gehrels 2011-04-16 20:43:54 +00:00
parent 8cca47c971
commit 373f4dc5f4
13 changed files with 209 additions and 9 deletions

View File

@ -69,5 +69,9 @@
[import src/examples/core/set_box.cpp]
[import src/examples/core/degree_radian.cpp]
[import src/examples/core/point_type.cpp]
[import src/examples/core/tag.cpp]
[import src/examples/core/tag_cast.cpp]
[import src/examples/geometries/point.cpp]
[import src/examples/geometries/register/point.cpp]

View File

@ -81,10 +81,10 @@ access_functions = ["get", "set", "exterior_ring", "interior_rings"
coordinate_systems = ["cartesian", "geographic", "polar", "spherical"]
core = ["closure", "coordinate_system", "coordinate_type", "cs_tag"
, "dimension", "exception", "geometry_id", "interior_type"
, "dimension", "exception", "interior_type"
, "degree", "radian"
, "is_radian", "point_order"
, "point_type", "ring_type", "tag", "topological_dimension" ]
, "point_type", "ring_type", "tag", "tag_cast" ]
exceptions = ["exception", "centroid_exception"];

View File

@ -133,20 +133,17 @@
<bridgehead renderas="sect3">Metafunctions</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="geometry.reference.core.cs_tag">cs_tag</link></member>
<member><link linkend="geometry.reference.core.closure">closure</link></member>
<member><link linkend="geometry.reference.core.coordinate_type">coordinate_type</link></member>
<member><link linkend="geometry.reference.core.coordinate_system">coordinate_system</link></member>
<member><link linkend="geometry.reference.core.dimension">dimension</link></member>
<member><link linkend="geometry.reference.core.geometry_id">geometry_id</link></member>
<member><link linkend="geometry.reference.core.interior_type">interior_type</link></member>
<member><link linkend="geometry.reference.core.is_radian">is_radian</link></member>
<member><link linkend="geometry.reference.core.point_order">point_order</link></member>
<member><link linkend="geometry.reference.core.point_type">point_type</link></member>
<member><link linkend="geometry.reference.core.ring_type">ring_type</link></member>
<!-- for internal use only (detail?)
<member><link linkend="geometry.reference.core.reverse_dispatch">reverse_dispatch</link></member>
-->
<member><link linkend="geometry.reference.core.tag">tag</link></member>
<member><link linkend="geometry.reference.core.topological_dimension">topological_dimension</link></member>
<member><link linkend="geometry.reference.core.tag_cast">tag_cast</link></member>
</simplelist>
</entry>
<entry valign="top">

View File

@ -176,7 +176,6 @@
[include generated/degree.qbk]
[include generated/dimension.qbk]
[include generated/exception.qbk]
[include generated/geometry_id.qbk]
[include generated/interior_type.qbk]
[include generated/is_radian.qbk]
[include generated/point_order.qbk]
@ -184,7 +183,7 @@
[include generated/radian.qbk]
[include generated/ring_type.qbk]
[include generated/tag.qbk]
[include generated/topological_dimension.qbk]
[include generated/tag_cast.qbk]
[endsect] [/core metafunctions]
[section:enumerations Enumerations]

View File

@ -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]
[point_type]
[point_type_output]

View File

@ -0,0 +1,20 @@
[/============================================================================
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)
=============================================================================/]
[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 Complexity]
Compile time
[heading Example]
[tag]
[tag_output]

View File

@ -0,0 +1,26 @@
[/============================================================================
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)
=============================================================================/]
[note The specified tag list is handled in the specified order: as soon as a tag
inheriting the specified tag is found, it is defined as the metafunction
typedef [*type].
]
[note If none of the specified possible base tags is a base class of the
specified tag, the tag itself is defined as the [*type] result of the
metafunction.
]
[heading Complexity]
Compile time
[heading Example]
[tag_cast]
[tag_cast_output]

View File

@ -24,3 +24,7 @@ exe coordinate_system : coordinate_system.cpp ;
exe coordinate_dimension : coordinate_dimension.cpp ;
exe point_order : point_order.cpp ;
exe closure : closure.cpp ;
exe point_type : point_type.cpp ;
exe tag : tag.cpp ;
exe tag_cast : tag_cast.cpp ;

View File

@ -11,6 +11,7 @@
//` Examine the coordinate system of a point
#include <iostream>
#include <typeinfo>
#include <boost/geometry/geometry.hpp>
int main()

View File

@ -11,6 +11,7 @@
//` Examine the coordinate type of a point
#include <iostream>
#include <typeinfo>
#include <boost/geometry/geometry.hpp>
int main()

View File

@ -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)
//[point_type
//` Examine the point type of a multi_polygon
#include <iostream>
#include <typeinfo>
#include <boost/geometry/geometry.hpp>
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
typedef boost::geometry::model::multi_polygon<polygon_type> mp_type;
typedef boost::geometry::point_type<mp_type>::type ptype;
std::cout << "point type: " << typeid(ptype).name() << std::endl;
return 0;
}
//]
//[point_type_output
/*`
Output (in MSVC):
[pre
point type: class boost::geometry::model::d2::point_xy<double,struct boost::geometry::cs::cartesian>
]
*/
//]

View File

@ -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)
//[tag
//` Examine the tag of some geometry types
#include <iostream>
#include <typeinfo>
#include <boost/geometry/geometry.hpp>
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
typedef boost::geometry::model::multi_polygon<polygon_type> mp_type;
typedef boost::geometry::tag<point_type>::type tag1;
typedef boost::geometry::tag<polygon_type>::type tag2;
typedef boost::geometry::tag<mp_type>::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
;
return 0;
}
//]
//[tag_output
/*`
Output (in MSVC):
[pre
tag 1: struct boost::geometry::point_tag
tag 2: struct boost::geometry::polygon_tag
tag 3: struct boost::geometry::multi_polygon_tag
]
*/
//]

View File

@ -0,0 +1,43 @@
// 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)
//[tag_cast
//` Check if the polygon_tag can be casted to the areal_tag
#include <iostream>
#include <typeinfo>
#include <boost/geometry/geometry.hpp>
namespace geo = boost::geometry;
int main()
{
typedef geo::model::d2::point_xy<double> point_type;
typedef geo::model::polygon<point_type> polygon_type;
typedef geo::tag<polygon_type>::type tag;
typedef geo::tag_cast<tag, geo::linear_tag, geo::areal_tag>::type base_tag;
std::cout << "tag: " << typeid(tag).name() << std::endl
<< "base tag: " << typeid(base_tag).name() << std::endl;
return 0;
}
//]
//[tag_cast_output
/*`
Output (in MSVC):
[pre
tag: struct boost::geometry::polygon_tag
base tag: struct boost::geometry::areal_tag
]
*/
//]