Added boost header

This commit is contained in:
Christophe Riccio
2012-01-08 01:26:07 +00:00
parent 9c3faaca40
commit c7d752cdf8
8946 changed files with 1732316 additions and 0 deletions

View File

@@ -0,0 +1,136 @@
// 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_CONCEPTS_BOX_CONCEPT_HPP
#define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_BOX_CONCEPT_HPP
#include <cstddef>
#include <boost/concept_check.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/point_type.hpp>
namespace boost { namespace geometry { namespace concept
{
/*!
\brief Box concept
\ingroup concepts
\par Formal definition:
The box concept is defined as following:
- there must be a specialization of traits::tag defining box_tag as type
- there must be a specialization of traits::point_type to define the
underlying point type (even if it does not consist of points, it should define
this type, to indicate the points it can work with)
- there must be a specialization of traits::indexed_access, per index
(min_corner, max_corner) and per dimension, with two functions:
- get to get a coordinate value
- set to set a coordinate value (this one is not checked for ConstBox)
*/
template <typename Geometry>
class Box
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename point_type<Geometry>::type point_type;
template
<
std::size_t Index,
std::size_t Dimension,
std::size_t DimensionCount
>
struct dimension_checker
{
static void apply()
{
Geometry* b = 0;
geometry::set<Index, Dimension>(*b, geometry::get<Index, Dimension>(*b));
dimension_checker<Index, Dimension + 1, DimensionCount>::apply();
}
};
template <std::size_t Index, std::size_t DimensionCount>
struct dimension_checker<Index, DimensionCount, DimensionCount>
{
static void apply() {}
};
public :
BOOST_CONCEPT_USAGE(Box)
{
static const std::size_t n = dimension<Geometry>::type::value;
dimension_checker<min_corner, 0, n>::apply();
dimension_checker<max_corner, 0, n>::apply();
}
#endif
};
/*!
\brief Box concept (const version)
\ingroup const_concepts
\details The ConstBox concept apply the same as the Box concept,
but does not apply write access.
*/
template <typename Geometry>
class ConstBox
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename point_type<Geometry>::type point_type;
typedef typename coordinate_type<Geometry>::type coordinate_type;
template
<
std::size_t Index,
std::size_t Dimension,
std::size_t DimensionCount
>
struct dimension_checker
{
static void apply()
{
const Geometry* b = 0;
coordinate_type coord(geometry::get<Index, Dimension>(*b));
boost::ignore_unused_variable_warning(coord);
dimension_checker<Index, Dimension + 1, DimensionCount>::apply();
}
};
template <std::size_t Index, std::size_t DimensionCount>
struct dimension_checker<Index, DimensionCount, DimensionCount>
{
static void apply() {}
};
public :
BOOST_CONCEPT_USAGE(ConstBox)
{
static const std::size_t n = dimension<Geometry>::type::value;
dimension_checker<min_corner, 0, n>::apply();
dimension_checker<max_corner, 0, n>::apply();
}
#endif
};
}}} // namespace boost::geometry::concept
#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_BOX_CONCEPT_HPP

View File

@@ -0,0 +1,171 @@
// 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_CONCEPTS_CHECK_HPP
#define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CHECK_HPP
#include <boost/concept_check.hpp>
#include <boost/concept/requires.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/geometries/concepts/box_concept.hpp>
#include <boost/geometry/geometries/concepts/linestring_concept.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/geometry/geometries/concepts/polygon_concept.hpp>
#include <boost/geometry/geometries/concepts/ring_concept.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace concept_check
{
template <typename Concept>
class check
{
BOOST_CONCEPT_ASSERT((Concept ));
};
}} // namespace detail::concept_check
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <typename GeometryTag, typename Geometry, bool IsConst>
struct check
{};
template <typename Geometry>
struct check<point_tag, Geometry, true>
: detail::concept_check::check<concept::ConstPoint<Geometry> >
{};
template <typename Geometry>
struct check<point_tag, Geometry, false>
: detail::concept_check::check<concept::Point<Geometry> >
{};
template <typename Geometry>
struct check<linestring_tag, Geometry, true>
: detail::concept_check::check<concept::ConstLinestring<Geometry> >
{};
template <typename Geometry>
struct check<linestring_tag, Geometry, false>
: detail::concept_check::check<concept::Linestring<Geometry> >
{};
template <typename Geometry>
struct check<polygon_tag, Geometry, true>
: detail::concept_check::check<concept::ConstPolygon<Geometry> >
{};
template <typename Geometry>
struct check<polygon_tag, Geometry, false>
: detail::concept_check::check<concept::Polygon<Geometry> >
{};
template <typename Geometry>
struct check<box_tag, Geometry, true>
: detail::concept_check::check<concept::ConstBox<Geometry> >
{};
template <typename Geometry>
struct check<box_tag, Geometry, false>
: detail::concept_check::check<concept::Box<Geometry> >
{};
} // namespace dispatch
#endif
namespace concept
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
template <typename Geometry, bool IsConst>
struct checker : dispatch::check
<
typename tag<Geometry>::type,
Geometry,
IsConst
>
{};
}
#endif // DOXYGEN_NO_DETAIL
/*!
\brief Checks, in compile-time, the concept of any geometry
\ingroup concepts
*/
template <typename Geometry>
inline void check()
{
detail::checker<Geometry, boost::is_const<Geometry>::type::value> c;
boost::ignore_unused_variable_warning(c);
}
/*!
\brief Checks, in compile-time, the concept of two geometries, and if they
have equal dimensions
\ingroup concepts
*/
template <typename Geometry1, typename Geometry2>
inline void check_concepts_and_equal_dimensions()
{
check<Geometry1>();
check<Geometry2>();
assert_dimension_equal<Geometry1, Geometry2>();
}
} // namespace concept
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CHECK_HPP

View File

@@ -0,0 +1,125 @@
// 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_CONCEPTS_LINESTRING_CONCEPT_HPP
#define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_LINESTRING_CONCEPT_HPP
#include <boost/concept_check.hpp>
#include <boost/range/concepts.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/mutable_range.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
namespace boost { namespace geometry { namespace concept
{
/*!
\brief Linestring concept
\ingroup concepts
\par Formal definition:
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 implement a std::back_insert_iterator
- either by implementing push_back
- or by specializing std::back_insert_iterator
\note to fulfill the concepts, no traits class has to be specialized to
define the point type.
\par Example:
A custom linestring, defining the necessary specializations to fulfill to the concept.
Suppose that the following linestring is defined:
\dontinclude doxygen_5.cpp
\skip custom_linestring1
\until };
It can then be adapted to the concept as following:
\dontinclude doxygen_5.cpp
\skip adapt custom_linestring1
\until }}
\note
- There is also the registration macro BOOST_GEOMETRY_REGISTER_LINESTRING
- For registration of std::vector<P> (and deque, and list) it is enough to
include the header-file geometries/adapted/std_as_linestring.hpp. That registers
a vector as a linestring (so it cannot be registered as a linear ring then,
in the same source code).
*/
template <typename Geometry>
class Linestring
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename point_type<Geometry>::type point_type;
BOOST_CONCEPT_ASSERT( (concept::Point<point_type>) );
BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
public :
BOOST_CONCEPT_USAGE(Linestring)
{
Geometry* ls = 0;
traits::clear<Geometry>::apply(*ls);
traits::resize<Geometry>::apply(*ls, 0);
point_type* point = 0;
traits::push_back<Geometry>::apply(*ls, *point);
}
#endif
};
/*!
\brief Linestring concept (const version)
\ingroup const_concepts
\details The ConstLinestring concept check the same as the Linestring concept,
but does not check write access.
*/
template <typename Geometry>
class ConstLinestring
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename point_type<Geometry>::type point_type;
BOOST_CONCEPT_ASSERT( (concept::ConstPoint<point_type>) );
//BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
// Relaxed the concept.
BOOST_CONCEPT_ASSERT( (boost::ForwardRangeConcept<Geometry>) );
public :
BOOST_CONCEPT_USAGE(ConstLinestring)
{
}
#endif
};
}}} // namespace boost::geometry::concept
#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_LINESTRING_CONCEPT_HPP

View File

@@ -0,0 +1,176 @@
// 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_CONCEPTS_POINT_CONCEPT_HPP
#define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POINT_CONCEPT_HPP
#include <cstddef>
#include <boost/concept_check.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/coordinate_system.hpp>
namespace boost { namespace geometry { namespace concept
{
/*!
\brief Point concept.
\ingroup concepts
\par Formal definition:
The point concept is defined as following:
- there must be a specialization of traits::tag defining point_tag as type
- there must be a specialization of traits::coordinate_type defining the type
of its coordinates
- there must be a specialization of traits::coordinate_system defining its
coordinate system (cartesian, spherical, etc)
- there must be a specialization of traits::dimension defining its number
of dimensions (2, 3, ...) (derive it conveniently
from boost::mpl::int_&lt;X&gt; for X-D)
- there must be a specialization of traits::access, per dimension,
with two functions:
- \b get to get a coordinate value
- \b set to set a coordinate value (this one is not checked for ConstPoint)
\par Example:
A legacy point, defining the necessary specializations to fulfil to the concept.
Suppose that the following point is defined:
\dontinclude doxygen_5.cpp
\skip legacy_point1
\until };
It can then be adapted to the concept as following:
\dontinclude doxygen_5.cpp
\skip adapt legacy_point1
\until }}
Note that it is done like above to show the system. Users will normally use the registration macro.
\par Example:
A read-only legacy point, using a macro to fulfil to the ConstPoint concept.
It cannot be modified by the library but can be used in all algorithms where
points are not modified.
The point looks like the following:
\dontinclude doxygen_5.cpp
\skip legacy_point2
\until };
It uses the macro as following:
\dontinclude doxygen_5.cpp
\skip adapt legacy_point2
\until end adaptation
*/
template <typename Geometry>
class Point
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename coordinate_type<Geometry>::type ctype;
typedef typename coordinate_system<Geometry>::type csystem;
enum { ccount = dimension<Geometry>::value };
template <typename P, std::size_t Dimension, std::size_t DimensionCount>
struct dimension_checker
{
static void apply()
{
P* p = 0;
geometry::set<Dimension>(*p, geometry::get<Dimension>(*p));
dimension_checker<P, Dimension+1, DimensionCount>::apply();
}
};
template <typename P, std::size_t DimensionCount>
struct dimension_checker<P, DimensionCount, DimensionCount>
{
static void apply() {}
};
public:
/// BCCL macro to apply the Point concept
BOOST_CONCEPT_USAGE(Point)
{
dimension_checker<Geometry, 0, ccount>::apply();
}
#endif
};
/*!
\brief point concept (const version).
\ingroup const_concepts
\details The ConstPoint concept apply the same as the Point concept,
but does not apply write access.
*/
template <typename Geometry>
class ConstPoint
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename coordinate_type<Geometry>::type ctype;
typedef typename coordinate_system<Geometry>::type csystem;
enum { ccount = dimension<Geometry>::value };
template <typename P, std::size_t Dimension, std::size_t DimensionCount>
struct dimension_checker
{
static void apply()
{
const P* p = 0;
ctype coord(geometry::get<Dimension>(*p));
boost::ignore_unused_variable_warning(coord);
dimension_checker<P, Dimension+1, DimensionCount>::apply();
}
};
template <typename P, std::size_t DimensionCount>
struct dimension_checker<P, DimensionCount, DimensionCount>
{
static void apply() {}
};
public:
/// BCCL macro to apply the ConstPoint concept
BOOST_CONCEPT_USAGE(ConstPoint)
{
dimension_checker<Geometry, 0, ccount>::apply();
}
#endif
};
}}} // namespace boost::geometry::concept
#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POINT_CONCEPT_HPP

View File

@@ -0,0 +1,135 @@
// 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_CONCEPTS_POLYGON_CONCEPT_HPP
#define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POLYGON_CONCEPT_HPP
#include <boost/concept_check.hpp>
#include <boost/range/concepts.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/geometry/geometries/concepts/ring_concept.hpp>
namespace boost { namespace geometry { namespace concept
{
/*!
\brief Checks polygon concept
\ingroup concepts
*/
template <typename PolygonType>
class Polygon
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename boost::remove_const<PolygonType>::type polygon_type;
typedef typename traits::ring_const_type<polygon_type>::type ring_const_type;
typedef typename traits::ring_mutable_type<polygon_type>::type ring_mutable_type;
typedef typename traits::interior_const_type<polygon_type>::type interior_const_type;
typedef typename traits::interior_mutable_type<polygon_type>::type interior_mutable_type;
typedef typename point_type<PolygonType>::type point_type;
typedef typename ring_type<PolygonType>::type ring_type;
BOOST_CONCEPT_ASSERT( (concept::Point<point_type>) );
BOOST_CONCEPT_ASSERT( (concept::Ring<ring_type>) );
//BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<interior_type>) );
struct checker
{
static inline void apply()
{
polygon_type* poly = 0;
polygon_type const* cpoly = poly;
ring_mutable_type e = traits::exterior_ring<PolygonType>::get(*poly);
interior_mutable_type i = traits::interior_rings<PolygonType>::get(*poly);
ring_const_type ce = traits::exterior_ring<PolygonType>::get(*cpoly);
interior_const_type ci = traits::interior_rings<PolygonType>::get(*cpoly);
boost::ignore_unused_variable_warning(e);
boost::ignore_unused_variable_warning(i);
boost::ignore_unused_variable_warning(ce);
boost::ignore_unused_variable_warning(ci);
boost::ignore_unused_variable_warning(poly);
boost::ignore_unused_variable_warning(cpoly);
}
};
public:
BOOST_CONCEPT_USAGE(Polygon)
{
checker::apply();
}
#endif
};
/*!
\brief Checks polygon concept (const version)
\ingroup const_concepts
*/
template <typename PolygonType>
class ConstPolygon
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename boost::remove_const<PolygonType>::type const_polygon_type;
typedef typename traits::ring_const_type<const_polygon_type>::type ring_const_type;
typedef typename traits::interior_const_type<const_polygon_type>::type interior_const_type;
typedef typename point_type<const_polygon_type>::type point_type;
typedef typename ring_type<const_polygon_type>::type ring_type;
BOOST_CONCEPT_ASSERT( (concept::ConstPoint<point_type>) );
BOOST_CONCEPT_ASSERT( (concept::ConstRing<ring_type>) );
////BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<interior_type>) );
struct checker
{
static inline void apply()
{
const_polygon_type const* cpoly = 0;
ring_const_type ce = traits::exterior_ring<const_polygon_type>::get(*cpoly);
interior_const_type ci = traits::interior_rings<const_polygon_type>::get(*cpoly);
boost::ignore_unused_variable_warning(ce);
boost::ignore_unused_variable_warning(ci);
boost::ignore_unused_variable_warning(cpoly);
}
};
public:
BOOST_CONCEPT_USAGE(ConstPolygon)
{
checker::apply();
}
#endif
};
}}} // namespace boost::geometry::concept
#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POLYGON_CONCEPT_HPP

View File

@@ -0,0 +1,99 @@
// 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_CONCEPTS_RING_CONCEPT_HPP
#define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_RING_CONCEPT_HPP
#include <boost/concept_check.hpp>
#include <boost/range/concepts.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/mutable_range.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
namespace boost { namespace geometry { namespace concept
{
/*!
\brief ring concept
\ingroup concepts
\par Formal definition:
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
- there can optionally be a specialization of traits::point_order defining the
order or orientation of its points, clockwise or counterclockwise.
- it must implement a std::back_insert_iterator
(This is the same as the for the concept Linestring, and described there)
\note to fulfill the concepts, no traits class has to be specialized to
define the point type.
*/
template <typename Geometry>
class Ring
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename point_type<Geometry>::type point_type;
BOOST_CONCEPT_ASSERT( (concept::Point<point_type>) );
BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
public :
BOOST_CONCEPT_USAGE(Ring)
{
Geometry* ring = 0;
traits::clear<Geometry>::apply(*ring);
traits::resize<Geometry>::apply(*ring, 0);
point_type* point = 0;
traits::push_back<Geometry>::apply(*ring, *point);
}
#endif
};
/*!
\brief (linear) ring concept (const version)
\ingroup const_concepts
\details The ConstLinearRing concept check the same as the Geometry concept,
but does not check write access.
*/
template <typename Geometry>
class ConstRing
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename point_type<Geometry>::type point_type;
BOOST_CONCEPT_ASSERT( (concept::ConstPoint<point_type>) );
BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
public :
BOOST_CONCEPT_USAGE(ConstRing)
{
}
#endif
};
}}} // namespace boost::geometry::concept
#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_RING_CONCEPT_HPP

View File

@@ -0,0 +1,135 @@
// 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_CONCEPTS_SEGMENT_CONCEPT_HPP
#define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_SEGMENT_CONCEPT_HPP
#include <boost/concept_check.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/point_type.hpp>
namespace boost { namespace geometry { namespace concept
{
/*!
\brief Segment concept.
\ingroup concepts
\details Formal definition:
The segment concept is defined as following:
- there must be a specialization of traits::tag defining segment_tag as type
- there must be a specialization of traits::point_type to define the
underlying point type (even if it does not consist of points, it should define
this type, to indicate the points it can work with)
- there must be a specialization of traits::indexed_access, per index
and per dimension, with two functions:
- get to get a coordinate value
- set to set a coordinate value (this one is not checked for ConstSegment)
\note The segment concept is similar to the box concept, defining another tag.
However, the box concept assumes the index as min_corner, max_corner, while
for the segment concept there is no assumption.
*/
template <typename Geometry>
class Segment
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename point_type<Geometry>::type point_type;
BOOST_CONCEPT_ASSERT( (concept::Point<point_type>) );
template <size_t Index, size_t Dimension, size_t DimensionCount>
struct dimension_checker
{
static void apply()
{
Geometry* s = 0;
geometry::set<Index, Dimension>(*s, geometry::get<Index, Dimension>(*s));
dimension_checker<Index, Dimension + 1, DimensionCount>::apply();
}
};
template <size_t Index, size_t DimensionCount>
struct dimension_checker<Index, DimensionCount, DimensionCount>
{
static void apply() {}
};
public :
BOOST_CONCEPT_USAGE(Segment)
{
static const size_t n = dimension<point_type>::type::value;
dimension_checker<0, 0, n>::apply();
dimension_checker<1, 0, n>::apply();
}
#endif
};
/*!
\brief Segment concept (const version).
\ingroup const_concepts
\details The ConstSegment concept verifies the same as the Segment concept,
but does not verify write access.
*/
template <typename Geometry>
class ConstSegment
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename point_type<Geometry>::type point_type;
typedef typename coordinate_type<Geometry>::type coordinate_type;
BOOST_CONCEPT_ASSERT( (concept::ConstPoint<point_type>) );
template <size_t Index, size_t Dimension, size_t DimensionCount>
struct dimension_checker
{
static void apply()
{
const Geometry* s = 0;
coordinate_type coord(geometry::get<Index, Dimension>(*s));
boost::ignore_unused_variable_warning(coord);
dimension_checker<Index, Dimension + 1, DimensionCount>::apply();
}
};
template <size_t Index, size_t DimensionCount>
struct dimension_checker<Index, DimensionCount, DimensionCount>
{
static void apply() {}
};
public :
BOOST_CONCEPT_USAGE(ConstSegment)
{
static const size_t n = dimension<point_type>::type::value;
dimension_checker<0, 0, n>::apply();
dimension_checker<1, 0, n>::apply();
}
#endif
};
}}} // namespace boost::geometry::concept
#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_SEGMENT_CONCEPT_HPP