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,75 @@
// 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.
// 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_STRATEGIES_CONCEPTS_AREA_CONCEPT_HPP
#define BOOST_GEOMETRY_STRATEGIES_CONCEPTS_AREA_CONCEPT_HPP
#include <boost/concept_check.hpp>
namespace boost { namespace geometry { namespace concept
{
/*!
\brief Checks strategy for area
\ingroup area
*/
template <typename Strategy>
class AreaStrategy
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
// 1) must define state_type,
typedef typename Strategy::state_type state_type;
// 2) must define return_type,
typedef typename Strategy::return_type return_type;
// 3) must define point_type, of polygon (segments)
typedef typename Strategy::segment_point_type spoint_type;
struct check_methods
{
static void apply()
{
Strategy const* str;
state_type *st;
// 4) must implement a method apply with the following signature
spoint_type const* sp;
str->apply(*sp, *sp, *st);
// 5) must implement a static method result with the following signature
return_type r = str->result(*st);
boost::ignore_unused_variable_warning(r);
boost::ignore_unused_variable_warning(str);
}
};
public :
BOOST_CONCEPT_USAGE(AreaStrategy)
{
check_methods::apply();
}
#endif
};
}}} // namespace boost::geometry::concept
#endif // BOOST_GEOMETRY_STRATEGIES_CONCEPTS_AREA_CONCEPT_HPP

View File

@@ -0,0 +1,78 @@
// 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.
// 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_STRATEGIES_CONCEPTS_CENTROID_CONCEPT_HPP
#define BOOST_GEOMETRY_STRATEGIES_CONCEPTS_CENTROID_CONCEPT_HPP
#include <boost/concept_check.hpp>
namespace boost { namespace geometry { namespace concept
{
/*!
\brief Checks strategy for centroid
\ingroup centroid
*/
template <typename Strategy>
class CentroidStrategy
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
// 1) must define state_type,
typedef typename Strategy::state_type state_type;
// 2) must define point_type,
typedef typename Strategy::point_type point_type;
// 3) must define point_type, of polygon (segments)
typedef typename Strategy::segment_point_type spoint_type;
struct check_methods
{
static void apply()
{
Strategy *str;
state_type *st;
// 4) must implement a static method apply,
// getting two segment-points
spoint_type const* sp;
str->apply(*sp, *sp, *st);
// 5) must implement a static method result
// getting the centroid
point_type *c;
bool r = str->result(*st, *c);
boost::ignore_unused_variable_warning(str);
boost::ignore_unused_variable_warning(r);
}
};
public :
BOOST_CONCEPT_USAGE(CentroidStrategy)
{
check_methods::apply();
}
#endif
};
}}} // namespace boost::geometry::concept
#endif // BOOST_GEOMETRY_STRATEGIES_CONCEPTS_CENTROID_CONCEPT_HPP

View File

@@ -0,0 +1,75 @@
// 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.
// 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_STRATEGIES_CONCEPTS_CONVEX_HULL_CONCEPT_HPP
#define BOOST_GEOMETRY_STRATEGIES_CONCEPTS_CONVEX_HULL_CONCEPT_HPP
#include <vector>
#include <boost/concept_check.hpp>
namespace boost { namespace geometry { namespace concept
{
/*!
\brief Checks strategy for convex_hull
\ingroup convex_hull
*/
template <typename Strategy>
class ConvexHullStrategy
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
// 1) must define state_type
typedef typename Strategy::state_type state_type;
// 2) must define point_type
typedef typename Strategy::point_type point_type;
// 3) must define geometry_type
typedef typename Strategy::geometry_type geometry_type;
struct check_methods
{
static void apply()
{
Strategy const* str;
state_type* st;
geometry_type* sp;
std::vector<point_type> *v;
// 4) must implement a method apply, iterating over a range
str->apply(*sp, *st);
// 5) must implement a method result, with an output iterator
str->result(*st, std::back_inserter(*v), true);
}
};
public :
BOOST_CONCEPT_USAGE(ConvexHullStrategy)
{
check_methods::apply();
}
#endif
};
}}} // namespace boost::geometry::concept
#endif // BOOST_GEOMETRY_STRATEGIES_CONCEPTS_CONVEX_HULL_CONCEPT_HPP

View File

@@ -0,0 +1,206 @@
// 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.
// 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_STRATEGIES_CONCEPTS_DISTANCE_CONCEPT_HPP
#define BOOST_GEOMETRY_STRATEGIES_CONCEPTS_DISTANCE_CONCEPT_HPP
#include <vector>
#include <iterator>
#include <boost/concept_check.hpp>
#include <boost/geometry/util/parameter_type_of.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/geometry/geometries/segment.hpp>
namespace boost { namespace geometry { namespace concept
{
/*!
\brief Checks strategy for point-segment-distance
\ingroup distance
*/
template <typename Strategy>
struct PointDistanceStrategy
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
private :
struct checker
{
template <typename ApplyMethod>
static void apply(ApplyMethod const&)
{
// 1: inspect and define both arguments of apply
typedef typename parameter_type_of
<
ApplyMethod, 0
>::type ptype1;
typedef typename parameter_type_of
<
ApplyMethod, 1
>::type ptype2;
// 2) check if apply-arguments fulfill point concept
BOOST_CONCEPT_ASSERT
(
(concept::ConstPoint<ptype1>)
);
BOOST_CONCEPT_ASSERT
(
(concept::ConstPoint<ptype2>)
);
// 3) must define meta-function return_type
typedef typename strategy::distance::services::return_type<Strategy>::type rtype;
// 4) must define meta-function "similar_type"
typedef typename strategy::distance::services::similar_type
<
Strategy, ptype2, ptype1
>::type stype;
// 5) must define meta-function "comparable_type"
typedef typename strategy::distance::services::comparable_type
<
Strategy
>::type ctype;
// 6) must define meta-function "tag"
typedef typename strategy::distance::services::tag
<
Strategy
>::type tag;
// 7) must implement apply with arguments
Strategy* str;
ptype1 *p1;
ptype2 *p2;
rtype r = str->apply(*p1, *p2);
// 8) must define (meta)struct "get_similar" with apply
stype s = strategy::distance::services::get_similar
<
Strategy,
ptype2, ptype1
>::apply(*str);
// 9) must define (meta)struct "get_comparable" with apply
ctype c = strategy::distance::services::get_comparable
<
Strategy
>::apply(*str);
// 10) must define (meta)struct "result_from_distance" with apply
r = strategy::distance::services::result_from_distance
<
Strategy
>::apply(*str, 1.0);
boost::ignore_unused_variable_warning(str);
boost::ignore_unused_variable_warning(s);
boost::ignore_unused_variable_warning(c);
boost::ignore_unused_variable_warning(r);
}
};
public :
BOOST_CONCEPT_USAGE(PointDistanceStrategy)
{
checker::apply(&Strategy::apply);
}
#endif
};
/*!
\brief Checks strategy for point-segment-distance
\ingroup strategy_concepts
*/
template <typename Strategy>
struct PointSegmentDistanceStrategy
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
private :
struct checker
{
template <typename ApplyMethod>
static void apply(ApplyMethod const&)
{
typedef typename parameter_type_of
<
ApplyMethod, 0
>::type ptype;
typedef typename parameter_type_of
<
ApplyMethod, 1
>::type sptype;
// 2) check if apply-arguments fulfill point concept
BOOST_CONCEPT_ASSERT
(
(concept::ConstPoint<ptype>)
);
BOOST_CONCEPT_ASSERT
(
(concept::ConstPoint<sptype>)
);
// 3) must define meta-function return_type
typedef typename strategy::distance::services::return_type<Strategy>::type rtype;
// 4) must define underlying point-distance-strategy
typedef typename strategy::distance::services::strategy_point_point<Strategy>::type stype;
BOOST_CONCEPT_ASSERT
(
(concept::PointDistanceStrategy<stype>)
);
Strategy *str;
ptype *p;
sptype *sp1;
sptype *sp2;
rtype r = str->apply(*p, *sp1, *sp2);
boost::ignore_unused_variable_warning(str);
boost::ignore_unused_variable_warning(r);
}
};
public :
BOOST_CONCEPT_USAGE(PointSegmentDistanceStrategy)
{
checker::apply(&Strategy::apply);
}
#endif
};
}}} // namespace boost::geometry::concept
#endif // BOOST_GEOMETRY_STRATEGIES_CONCEPTS_DISTANCE_CONCEPT_HPP

View File

@@ -0,0 +1,78 @@
// 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.
// 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_STRATEGIES_CONCEPTS_SEGMENT_INTERSECT_CONCEPT_HPP
#define BOOST_GEOMETRY_STRATEGIES_CONCEPTS_SEGMENT_INTERSECT_CONCEPT_HPP
//NOT FINISHED!
#include <boost/concept_check.hpp>
namespace boost { namespace geometry { namespace concept
{
/*!
\brief Checks strategy for segment intersection
\ingroup segment_intersection
*/
template <typename Strategy>
class SegmentIntersectStrategy
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
// 1) must define return_type
typedef typename Strategy::return_type return_type;
// 2) must define point_type (of segment points)
//typedef typename Strategy::point_type point_type;
// 3) must define segment_type 1 and 2 (of segment points)
typedef typename Strategy::segment_type1 segment_type1;
typedef typename Strategy::segment_type2 segment_type2;
struct check_methods
{
static void apply()
{
Strategy const* str;
return_type* rt;
//point_type const* p;
segment_type1 const* s1;
segment_type2 const* s2;
// 4) must implement a method apply
// having two segments
*rt = str->apply(*s1, *s2);
}
};
public :
BOOST_CONCEPT_USAGE(SegmentIntersectStrategy)
{
check_methods::apply();
}
#endif
};
}}} // namespace boost::geometry::concept
#endif // BOOST_GEOMETRY_STRATEGIES_CONCEPTS_SEGMENT_INTERSECT_CONCEPT_HPP

View File

@@ -0,0 +1,109 @@
// 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.
// 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_STRATEGIES_CONCEPTS_SIMPLIFY_CONCEPT_HPP
#define BOOST_GEOMETRY_STRATEGIES_CONCEPTS_SIMPLIFY_CONCEPT_HPP
#include <vector>
#include <iterator>
#include <boost/concept_check.hpp>
#include <boost/geometry/strategies/concepts/distance_concept.hpp>
namespace boost { namespace geometry { namespace concept
{
/*!
\brief Checks strategy for simplify
\ingroup simplify
*/
template <typename Strategy>
struct SimplifyStrategy
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
private :
// 1) must define distance_strategy_type,
// defining point-segment distance strategy (to be checked)
typedef typename Strategy::distance_strategy_type ds_type;
struct checker
{
template <typename ApplyMethod>
static void apply(ApplyMethod const&)
{
namespace ft = boost::function_types;
typedef typename ft::parameter_types
<
ApplyMethod
>::type parameter_types;
typedef typename boost::mpl::if_
<
ft::is_member_function_pointer<ApplyMethod>,
boost::mpl::int_<1>,
boost::mpl::int_<0>
>::type base_index;
// 1: inspect and define both arguments of apply
typedef typename boost::remove_const
<
typename boost::remove_reference
<
typename boost::mpl::at
<
parameter_types,
base_index
>::type
>::type
>::type point_type;
BOOST_CONCEPT_ASSERT
(
(concept::PointSegmentDistanceStrategy<ds_type>)
);
Strategy *str;
std::vector<point_type> const* v1;
std::vector<point_type> * v2;
// 2) must implement method apply with arguments
// - Range
// - OutputIterator
// - floating point value
str->apply(*v1, std::back_inserter(*v2), 1.0);
boost::ignore_unused_variable_warning(str);
}
};
public :
BOOST_CONCEPT_USAGE(SimplifyStrategy)
{
checker::apply(&ds_type::apply);
}
#endif
};
}}} // namespace boost::geometry::concept
#endif // BOOST_GEOMETRY_STRATEGIES_CONCEPTS_SIMPLIFY_CONCEPT_HPP

View File

@@ -0,0 +1,291 @@
// 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.
// 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_STRATEGIES_CONCEPTS_WITHIN_CONCEPT_HPP
#define BOOST_GEOMETRY_STRATEGIES_CONCEPTS_WITHIN_CONCEPT_HPP
#include <boost/concept_check.hpp>
#include <boost/function_types/result_type.hpp>
#include <boost/geometry/util/parameter_type_of.hpp>
namespace boost { namespace geometry { namespace concept
{
/*!
\brief Checks strategy for within (point-in-polygon)
\ingroup within
*/
template <typename Strategy>
class WithinStrategyPolygonal
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
// 1) must define state_type
typedef typename Strategy::state_type state_type;
struct checker
{
template <typename ApplyMethod, typename ResultMethod>
static void apply(ApplyMethod const&, ResultMethod const& )
{
typedef typename parameter_type_of
<
ApplyMethod, 0
>::type point_type;
typedef typename parameter_type_of
<
ApplyMethod, 1
>::type segment_point_type;
// CHECK: apply-arguments should both fulfill point concept
BOOST_CONCEPT_ASSERT
(
(concept::ConstPoint<point_type>)
);
BOOST_CONCEPT_ASSERT
(
(concept::ConstPoint<segment_point_type>)
);
// CHECK: return types (result: int, apply: bool)
BOOST_MPL_ASSERT_MSG
(
(boost::is_same
<
bool, typename boost::function_types::result_type<ApplyMethod>::type
>::type::value),
WRONG_RETURN_TYPE_OF_APPLY
, (bool)
);
BOOST_MPL_ASSERT_MSG
(
(boost::is_same
<
int, typename boost::function_types::result_type<ResultMethod>::type
>::type::value),
WRONG_RETURN_TYPE_OF_RESULT
, (int)
);
// CHECK: calling method apply and result
Strategy const* str;
state_type* st;
point_type const* p;
segment_point_type const* sp;
bool b = str->apply(*p, *sp, *sp, *st);
int r = str->result(*st);
boost::ignore_unused_variable_warning(r);
boost::ignore_unused_variable_warning(b);
boost::ignore_unused_variable_warning(str);
}
};
public :
BOOST_CONCEPT_USAGE(WithinStrategyPolygonal)
{
checker::apply(&Strategy::apply, &Strategy::result);
}
#endif
};
template <typename Strategy>
class WithinStrategyPointBox
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
struct checker
{
template <typename ApplyMethod>
static void apply(ApplyMethod const&)
{
typedef typename parameter_type_of
<
ApplyMethod, 0
>::type point_type;
typedef typename parameter_type_of
<
ApplyMethod, 1
>::type box_type;
// CHECK: apply-arguments should fulfill point/box concept
BOOST_CONCEPT_ASSERT
(
(concept::ConstPoint<point_type>)
);
BOOST_CONCEPT_ASSERT
(
(concept::ConstBox<box_type>)
);
// CHECK: return types (apply: bool)
BOOST_MPL_ASSERT_MSG
(
(boost::is_same
<
bool,
typename boost::function_types::result_type<ApplyMethod>::type
>::type::value),
WRONG_RETURN_TYPE
, (bool)
);
// CHECK: calling method apply
Strategy const* str;
point_type const* p;
box_type const* bx;
bool b = str->apply(*p, *bx);
boost::ignore_unused_variable_warning(b);
boost::ignore_unused_variable_warning(str);
}
};
public :
BOOST_CONCEPT_USAGE(WithinStrategyPointBox)
{
checker::apply(&Strategy::apply);
}
#endif
};
template <typename Strategy>
class WithinStrategyBoxBox
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
struct checker
{
template <typename ApplyMethod>
static void apply(ApplyMethod const&)
{
typedef typename parameter_type_of
<
ApplyMethod, 0
>::type box_type1;
typedef typename parameter_type_of
<
ApplyMethod, 1
>::type box_type2;
// CHECK: apply-arguments should both fulfill box concept
BOOST_CONCEPT_ASSERT
(
(concept::ConstBox<box_type1>)
);
BOOST_CONCEPT_ASSERT
(
(concept::ConstBox<box_type2>)
);
// CHECK: return types (apply: bool)
BOOST_MPL_ASSERT_MSG
(
(boost::is_same
<
bool,
typename boost::function_types::result_type<ApplyMethod>::type
>::type::value),
WRONG_RETURN_TYPE
, (bool)
);
// CHECK: calling method apply
Strategy const* str;
box_type1 const* b1;
box_type2 const* b2;
bool b = str->apply(*b1, *b2);
boost::ignore_unused_variable_warning(b);
boost::ignore_unused_variable_warning(str);
}
};
public :
BOOST_CONCEPT_USAGE(WithinStrategyBoxBox)
{
checker::apply(&Strategy::apply);
}
#endif
};
// So now: boost::geometry::concept::within
namespace within
{
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <typename FirstTag, typename SecondTag, typename CastedTag, typename Strategy>
struct check_within
{};
template <typename AnyTag, typename Strategy>
struct check_within<point_tag, AnyTag, areal_tag, Strategy>
{
BOOST_CONCEPT_ASSERT( (WithinStrategyPolygonal<Strategy>) );
};
template <typename Strategy>
struct check_within<point_tag, box_tag, areal_tag, Strategy>
{
BOOST_CONCEPT_ASSERT( (WithinStrategyPointBox<Strategy>) );
};
template <typename Strategy>
struct check_within<box_tag, box_tag, areal_tag, Strategy>
{
BOOST_CONCEPT_ASSERT( (WithinStrategyBoxBox<Strategy>) );
};
} // namespace dispatch
#endif
/*!
\brief Checks, in compile-time, the concept of any within-strategy
\ingroup concepts
*/
template <typename FirstTag, typename SecondTag, typename CastedTag, typename Strategy>
inline void check()
{
dispatch::check_within<FirstTag, SecondTag, CastedTag, Strategy> c;
boost::ignore_unused_variable_warning(c);
}
}}}} // namespace boost::geometry::concept::within
#endif // BOOST_GEOMETRY_STRATEGIES_CONCEPTS_WITHIN_CONCEPT_HPP