Added missing files [#CLICKHOUSE-3276].

This commit is contained in:
Alexey Milovidov 2017-09-04 22:31:23 +03:00
parent b4d7d8f1de
commit 8971967651
25 changed files with 3811 additions and 0 deletions

View File

@ -0,0 +1,399 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2009-2012 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_CORE_ACCESS_HPP
#define BOOST_GEOMETRY_CORE_ACCESS_HPP
#include <cstddef>
#include <boost/core/ignore_unused.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_pointer.hpp>
#include <boost/type_traits/remove_pointer.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/util/bare_type.hpp>
namespace boost { namespace geometry
{
/// Index of minimum corner of the box.
int const min_corner = 0;
/// Index of maximum corner of the box.
int const max_corner = 1;
namespace traits
{
/*!
\brief Traits class which gives access (get,set) to points.
\ingroup traits
\par Geometries:
/// @li point
\par Specializations should provide, per Dimension
/// @li static inline T get(G const&)
/// @li static inline void set(G&, T const&)
\tparam Geometry geometry-type
\tparam Dimension dimension to access
*/
template <typename Geometry, std::size_t Dimension, typename Enable = void>
struct access
{
BOOST_MPL_ASSERT_MSG
(
false, NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE, (types<Geometry>)
);
};
/*!
\brief Traits class defining "get" and "set" to get
and set point coordinate values
\tparam Geometry geometry (box, segment)
\tparam Index index (min_corner/max_corner for box, 0/1 for segment)
\tparam Dimension dimension
\par Geometries:
- box
- segment
\par Specializations should provide:
- static inline T get(G const&)
- static inline void set(G&, T const&)
\ingroup traits
*/
template <typename Geometry, std::size_t Index, std::size_t Dimension>
struct indexed_access {};
} // namespace traits
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
template
<
typename Geometry,
typename CoordinateType,
std::size_t Index,
std::size_t Dimension
>
struct indexed_access_non_pointer
{
static inline CoordinateType get(Geometry const& geometry)
{
return traits::indexed_access<Geometry, Index, Dimension>::get(geometry);
}
static inline void set(Geometry& b, CoordinateType const& value)
{
traits::indexed_access<Geometry, Index, Dimension>::set(b, value);
}
};
template
<
typename Geometry,
typename CoordinateType,
std::size_t Index,
std::size_t Dimension
>
struct indexed_access_pointer
{
static inline CoordinateType get(Geometry const* geometry)
{
return traits::indexed_access<typename boost::remove_pointer<Geometry>::type, Index, Dimension>::get(*geometry);
}
static inline void set(Geometry* geometry, CoordinateType const& value)
{
traits::indexed_access<typename boost::remove_pointer<Geometry>::type, Index, Dimension>::set(*geometry, value);
}
};
} // namespace detail
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace core_dispatch
{
template
<
typename Tag,
typename Geometry,
typename
CoordinateType,
std::size_t Dimension,
typename IsPointer
>
struct access
{
//static inline T get(G const&) {}
//static inline void set(G& g, T const& value) {}
};
template
<
typename Tag,
typename Geometry,
typename CoordinateType,
std::size_t Index,
std::size_t Dimension,
typename IsPointer
>
struct indexed_access
{
//static inline T get(G const&) {}
//static inline void set(G& g, T const& value) {}
};
template <typename Point, typename CoordinateType, std::size_t Dimension>
struct access<point_tag, Point, CoordinateType, Dimension, boost::false_type>
{
static inline CoordinateType get(Point const& point)
{
return traits::access<Point, Dimension>::get(point);
}
static inline void set(Point& p, CoordinateType const& value)
{
traits::access<Point, Dimension>::set(p, value);
}
};
template <typename Point, typename CoordinateType, std::size_t Dimension>
struct access<point_tag, Point, CoordinateType, Dimension, boost::true_type>
{
static inline CoordinateType get(Point const* point)
{
return traits::access<typename boost::remove_pointer<Point>::type, Dimension>::get(*point);
}
static inline void set(Point* p, CoordinateType const& value)
{
traits::access<typename boost::remove_pointer<Point>::type, Dimension>::set(*p, value);
}
};
template
<
typename Box,
typename CoordinateType,
std::size_t Index,
std::size_t Dimension
>
struct indexed_access<box_tag, Box, CoordinateType, Index, Dimension, boost::false_type>
: detail::indexed_access_non_pointer<Box, CoordinateType, Index, Dimension>
{};
template
<
typename Box,
typename CoordinateType,
std::size_t Index,
std::size_t Dimension
>
struct indexed_access<box_tag, Box, CoordinateType, Index, Dimension, boost::true_type>
: detail::indexed_access_pointer<Box, CoordinateType, Index, Dimension>
{};
template
<
typename Segment,
typename CoordinateType,
std::size_t Index,
std::size_t Dimension
>
struct indexed_access<segment_tag, Segment, CoordinateType, Index, Dimension, boost::false_type>
: detail::indexed_access_non_pointer<Segment, CoordinateType, Index, Dimension>
{};
template
<
typename Segment,
typename CoordinateType,
std::size_t Index,
std::size_t Dimension
>
struct indexed_access<segment_tag, Segment, CoordinateType, Index, Dimension, boost::true_type>
: detail::indexed_access_pointer<Segment, CoordinateType, Index, Dimension>
{};
} // namespace core_dispatch
#endif // DOXYGEN_NO_DISPATCH
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
// Two dummy tags to distinguish get/set variants below.
// They don't have to be specified by the user. The functions are distinguished
// by template signature also, but for e.g. GCC this is not enough. So give them
// a different signature.
struct signature_getset_dimension {};
struct signature_getset_index_dimension {};
} // namespace detail
#endif // DOXYGEN_NO_DETAIL
/*!
\brief Get coordinate value of a geometry (usually a point)
\details \details_get_set
\ingroup get
\tparam Dimension \tparam_dimension_required
\tparam Geometry \tparam_geometry (usually a Point Concept)
\param geometry \param_geometry (usually a point)
\return The coordinate value of specified dimension of specified geometry
\qbk{[include reference/core/get_point.qbk]}
*/
template <std::size_t Dimension, typename Geometry>
inline typename coordinate_type<Geometry>::type get(Geometry const& geometry
#ifndef DOXYGEN_SHOULD_SKIP_THIS
, detail::signature_getset_dimension* dummy = 0
#endif
)
{
boost::ignore_unused(dummy);
typedef core_dispatch::access
<
typename tag<Geometry>::type,
typename geometry::util::bare_type<Geometry>::type,
typename coordinate_type<Geometry>::type,
Dimension,
typename boost::is_pointer<Geometry>::type
> coord_access_type;
return coord_access_type::get(geometry);
}
/*!
\brief Set coordinate value of a geometry (usually a point)
\details \details_get_set
\tparam Dimension \tparam_dimension_required
\tparam Geometry \tparam_geometry (usually a Point Concept)
\param geometry geometry to assign coordinate to
\param geometry \param_geometry (usually a point)
\param value The coordinate value to set
\ingroup set
\qbk{[include reference/core/set_point.qbk]}
*/
template <std::size_t Dimension, typename Geometry>
inline void set(Geometry& geometry
, typename coordinate_type<Geometry>::type const& value
#ifndef DOXYGEN_SHOULD_SKIP_THIS
, detail::signature_getset_dimension* dummy = 0
#endif
)
{
boost::ignore_unused(dummy);
typedef core_dispatch::access
<
typename tag<Geometry>::type,
typename geometry::util::bare_type<Geometry>::type,
typename coordinate_type<Geometry>::type,
Dimension,
typename boost::is_pointer<Geometry>::type
> coord_access_type;
coord_access_type::set(geometry, value);
}
/*!
\brief get coordinate value of a Box or Segment
\details \details_get_set
\tparam Index \tparam_index_required
\tparam Dimension \tparam_dimension_required
\tparam Geometry \tparam_box_or_segment
\param geometry \param_geometry
\return coordinate value
\ingroup get
\qbk{distinguish,with index}
\qbk{[include reference/core/get_box.qbk]}
*/
template <std::size_t Index, std::size_t Dimension, typename Geometry>
inline typename coordinate_type<Geometry>::type get(Geometry const& geometry
#ifndef DOXYGEN_SHOULD_SKIP_THIS
, detail::signature_getset_index_dimension* dummy = 0
#endif
)
{
boost::ignore_unused(dummy);
typedef core_dispatch::indexed_access
<
typename tag<Geometry>::type,
typename geometry::util::bare_type<Geometry>::type,
typename coordinate_type<Geometry>::type,
Index,
Dimension,
typename boost::is_pointer<Geometry>::type
> coord_access_type;
return coord_access_type::get(geometry);
}
/*!
\brief set coordinate value of a Box / Segment
\details \details_get_set
\tparam Index \tparam_index_required
\tparam Dimension \tparam_dimension_required
\tparam Geometry \tparam_box_or_segment
\param geometry geometry to assign coordinate to
\param geometry \param_geometry
\param value The coordinate value to set
\ingroup set
\qbk{distinguish,with index}
\qbk{[include reference/core/set_box.qbk]}
*/
template <std::size_t Index, std::size_t Dimension, typename Geometry>
inline void set(Geometry& geometry
, typename coordinate_type<Geometry>::type const& value
#ifndef DOXYGEN_SHOULD_SKIP_THIS
, detail::signature_getset_index_dimension* dummy = 0
#endif
)
{
boost::ignore_unused(dummy);
typedef core_dispatch::indexed_access
<
typename tag<Geometry>::type,
typename geometry::util::bare_type<Geometry>::type,
typename coordinate_type<Geometry>::type,
Index,
Dimension,
typename boost::is_pointer<Geometry>::type
> coord_access_type;
coord_access_type::set(geometry, value);
}
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_ACCESS_HPP

View File

@ -0,0 +1,43 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
// Copyright (c) 2007, 2014 Peter Dimov
// Copyright (c) Beman Dawes 2011
// Copyright (c) 2015 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// 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_CORE_ASSERT_HPP
#define BOOST_GEOMETRY_CORE_ASSERT_HPP
#include <boost/assert.hpp>
#undef BOOST_GEOMETRY_ASSERT
#undef BOOST_GEOMETRY_ASSERT_MSG
#if defined(BOOST_GEOMETRY_ENABLE_ASSERT_HANDLER) || ( defined(BOOST_GEOMETRY_ENABLE_ASSERT_DEBUG_HANDLER) && !defined(NDEBUG) )
#include <boost/config.hpp> // for BOOST_LIKELY
#include <boost/current_function.hpp>
namespace boost { namespace geometry
{
void assertion_failed(char const * expr, char const * function, char const * file, long line); // user defined
void assertion_failed_msg(char const * expr, char const * msg, char const * function, char const * file, long line); // user defined
}} // namespace boost::geometry
#define BOOST_GEOMETRY_ASSERT(expr) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::geometry::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
#define BOOST_GEOMETRY_ASSERT_MSG(expr, msg) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::geometry::assertion_failed_msg(#expr, msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
#else
#define BOOST_GEOMETRY_ASSERT(expr) BOOST_ASSERT(expr)
#define BOOST_GEOMETRY_ASSERT_MSG(expr, msg) BOOST_ASSERT_MSG(expr, msg)
#endif
#endif // BOOST_GEOMETRY_CORE_EXCEPTION_HPP

View File

@ -0,0 +1,202 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2014.
// Modifications copyright (c) 2014 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// 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_CORE_CLOSURE_HPP
#define BOOST_GEOMETRY_CORE_CLOSURE_HPP
#include <boost/mpl/assert.hpp>
#include <boost/mpl/size_t.hpp>
#include <boost/range/value_type.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/util/bare_type.hpp>
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
\qbk{
[heading See also]
[link geometry.reference.core.closure The closure metafunction]
}
*/
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
};
namespace traits
{
/*!
\brief Traits class indicating if points within a
ring or (multi)polygon are closed (last point == first point),
open or not known.
\ingroup traits
\par Geometries:
- ring
\tparam G geometry
*/
template <typename G>
struct closure
{
static const closure_selector value = closed;
};
} // namespace traits
#ifndef DOXYGEN_NO_DETAIL
namespace core_detail { namespace closure
{
struct closed
{
static const closure_selector value = geometry::closed;
};
/// Metafunction to define the minimum size of a ring:
/// 3 for open rings, 4 for closed rings
template <closure_selector Closure>
struct minimum_ring_size {};
template <>
struct minimum_ring_size<geometry::closed> : boost::mpl::size_t<4> {};
template <>
struct minimum_ring_size<geometry::open> : boost::mpl::size_t<3> {};
}} // namespace detail::point_order
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace core_dispatch
{
template <typename Tag, typename Geometry>
struct closure
{
BOOST_MPL_ASSERT_MSG
(
false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
, (types<Geometry>)
);
};
template <typename Box>
struct closure<point_tag, Box> : public core_detail::closure::closed {};
template <typename Box>
struct closure<box_tag, Box> : public core_detail::closure::closed {};
template <typename Box>
struct closure<segment_tag, Box> : public core_detail::closure::closed {};
template <typename LineString>
struct closure<linestring_tag, LineString>
: public core_detail::closure::closed {};
template <typename Ring>
struct closure<ring_tag, Ring>
{
static const closure_selector value
= geometry::traits::closure<Ring>::value;
};
// Specialization for Polygon: the closure is the closure of its rings
template <typename Polygon>
struct closure<polygon_tag, Polygon>
{
static const closure_selector value = core_dispatch::closure
<
ring_tag,
typename ring_type<polygon_tag, Polygon>::type
>::value ;
};
template <typename MultiPoint>
struct closure<multi_point_tag, MultiPoint>
: public core_detail::closure::closed {};
template <typename MultiLinestring>
struct closure<multi_linestring_tag, MultiLinestring>
: public core_detail::closure::closed {};
// Specialization for MultiPolygon: the closure is the closure of Polygon's rings
template <typename MultiPolygon>
struct closure<multi_polygon_tag, MultiPolygon>
{
static const closure_selector value = core_dispatch::closure
<
polygon_tag,
typename boost::range_value<MultiPolygon>::type
>::value ;
};
} // namespace core_dispatch
#endif // DOXYGEN_NO_DISPATCH
/*!
\brief \brief_meta{value, closure (clockwise\, counterclockwise),
\meta_geometry_type}
\tparam Geometry \tparam_geometry
\ingroup core
\qbk{[include reference/core/closure.qbk]}
*/
template <typename Geometry>
struct closure
{
static const closure_selector value = core_dispatch::closure
<
typename tag<Geometry>::type,
typename util::bare_type<Geometry>::type
>::value;
};
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_CLOSURE_HPP

View File

@ -0,0 +1,127 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2009-2012 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_CORE_COORDINATE_DIMENSION_HPP
#define BOOST_GEOMETRY_CORE_COORDINATE_DIMENSION_HPP
#include <cstddef>
#include <boost/mpl/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/util/bare_type.hpp>
namespace boost { namespace geometry
{
namespace traits
{
/*!
\brief Traits class indicating the number of dimensions of a point
\par Geometries:
- point
\par Specializations should provide:
- value (should be derived from boost::mpl::int_<D>
\ingroup traits
*/
template <typename Point, typename Enable = void>
struct dimension
{
BOOST_MPL_ASSERT_MSG
(
false, NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE, (types<Point>)
);
};
} // namespace traits
#ifndef DOXYGEN_NO_DISPATCH
namespace core_dispatch
{
// Base class derive from its own specialization of point-tag
template <typename T, typename G>
struct dimension : dimension<point_tag, typename point_type<T, G>::type> {};
template <typename P>
struct dimension<point_tag, P>
: traits::dimension<typename geometry::util::bare_type<P>::type>
{
BOOST_MPL_ASSERT_MSG(
(traits::dimension<typename geometry::util::bare_type<P>::type>::value > 0),
INVALID_DIMENSION_VALUE,
(traits::dimension<typename geometry::util::bare_type<P>::type>)
);
};
} // namespace core_dispatch
#endif
/*!
\brief \brief_meta{value, number of coordinates (the number of axes of any geometry), \meta_point_type}
\tparam Geometry \tparam_geometry
\ingroup core
\qbk{[include reference/core/coordinate_dimension.qbk]}
*/
template <typename Geometry>
struct dimension
: core_dispatch::dimension
<
typename tag<Geometry>::type,
typename geometry::util::bare_type<Geometry>::type
>
{};
/*!
\brief assert_dimension, enables compile-time checking if coordinate dimensions are as expected
\ingroup utility
*/
template <typename Geometry, int Dimensions>
inline void assert_dimension()
{
BOOST_STATIC_ASSERT(( static_cast<int>(dimension<Geometry>::value) == Dimensions ));
}
/*!
\brief assert_dimension, enables compile-time checking if coordinate dimensions are as expected
\ingroup utility
*/
template <typename Geometry, int Dimensions>
inline void assert_dimension_less_equal()
{
BOOST_STATIC_ASSERT(( static_cast<int>(dimension<Geometry>::type::value) <= Dimensions ));
}
template <typename Geometry, int Dimensions>
inline void assert_dimension_greater_equal()
{
BOOST_STATIC_ASSERT(( static_cast<int>(dimension<Geometry>::type::value) >= Dimensions ));
}
/*!
\brief assert_dimension_equal, enables compile-time checking if coordinate dimensions of two geometries are equal
\ingroup utility
*/
template <typename G1, typename G2>
inline void assert_dimension_equal()
{
BOOST_STATIC_ASSERT(( static_cast<size_t>(dimension<G1>::type::value) == static_cast<size_t>(dimension<G2>::type::value) ));
}
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_COORDINATE_DIMENSION_HPP

View File

@ -0,0 +1,100 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2009-2012 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_CORE_COORDINATE_SYSTEM_HPP
#define BOOST_GEOMETRY_CORE_COORDINATE_SYSTEM_HPP
#include <boost/mpl/assert.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/util/bare_type.hpp>
namespace boost { namespace geometry
{
namespace traits
{
/*!
\brief Traits class defining the coordinate system of a point, important for strategy selection
\ingroup traits
\par Geometries:
- point
\par Specializations should provide:
- typedef CS type; (cs::cartesian, cs::spherical, etc)
*/
template <typename Point, typename Enable = void>
struct coordinate_system
{
BOOST_MPL_ASSERT_MSG
(
false, NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE, (types<Point>)
);
};
} // namespace traits
#ifndef DOXYGEN_NO_DISPATCH
namespace core_dispatch
{
template <typename GeometryTag, typename G>
struct coordinate_system
{
typedef typename point_type<GeometryTag, G>::type P;
// Call its own specialization on point-tag
typedef typename coordinate_system<point_tag, P>::type type;
};
template <typename Point>
struct coordinate_system<point_tag, Point>
{
typedef typename traits::coordinate_system
<
typename geometry::util::bare_type<Point>::type
>::type type;
};
} // namespace core_dispatch
#endif
/*!
\brief \brief_meta{type, coordinate system (cartesian\, spherical\, etc), \meta_point_type}
\tparam Geometry \tparam_geometry
\ingroup core
\qbk{[include reference/core/coordinate_system.qbk]}
*/
template <typename Geometry>
struct coordinate_system
{
typedef typename core_dispatch::coordinate_system
<
typename tag<Geometry>::type,
typename geometry::util::bare_type<Geometry>::type
>::type type;
};
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_COORDINATE_SYSTEM_HPP

View File

@ -0,0 +1,108 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2009-2012 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_CORE_COORDINATE_TYPE_HPP
#define BOOST_GEOMETRY_CORE_COORDINATE_TYPE_HPP
#include <boost/mpl/assert.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/util/bare_type.hpp>
#include <boost/geometry/util/promote_floating_point.hpp>
namespace boost { namespace geometry
{
namespace traits
{
/*!
\brief Traits class which indicate the coordinate type (double,float,...) of a point
\ingroup traits
\par Geometries:
- point
\par Specializations should provide:
- typedef T type; (double,float,int,etc)
*/
template <typename Point, typename Enable = void>
struct coordinate_type
{
BOOST_MPL_ASSERT_MSG
(
false, NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE, (types<Point>)
);
};
} // namespace traits
#ifndef DOXYGEN_NO_DISPATCH
namespace core_dispatch
{
template <typename GeometryTag, typename Geometry>
struct coordinate_type
{
typedef typename point_type<GeometryTag, Geometry>::type point_type;
// Call its own specialization on point-tag
typedef typename coordinate_type<point_tag, point_type>::type type;
};
template <typename Point>
struct coordinate_type<point_tag, Point>
{
typedef typename traits::coordinate_type
<
typename geometry::util::bare_type<Point>::type
>::type type;
};
} // namespace core_dispatch
#endif // DOXYGEN_NO_DISPATCH
/*!
\brief \brief_meta{type, coordinate type (int\, float\, double\, etc), \meta_point_type}
\tparam Geometry \tparam_geometry
\ingroup core
\qbk{[include reference/core/coordinate_type.qbk]}
*/
template <typename Geometry>
struct coordinate_type
{
typedef typename core_dispatch::coordinate_type
<
typename tag<Geometry>::type,
typename geometry::util::bare_type<Geometry>::type
>::type type;
};
template <typename Geometry>
struct fp_coordinate_type
{
typedef typename promote_floating_point
<
typename coordinate_type<Geometry>::type
>::type type;
};
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_COORDINATE_TYPE_HPP

View File

@ -0,0 +1,269 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2014.
// Modifications copyright (c) 2014, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// 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_CORE_CS_HPP
#define BOOST_GEOMETRY_CORE_CS_HPP
#include <cstddef>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/geometry/core/coordinate_system.hpp>
#include <boost/geometry/core/tags.hpp>
namespace boost { namespace geometry
{
/*!
\brief Unit of plane angle: Degrees
\details Tag defining the unit of plane angle for spherical coordinate systems.
This tag specifies that coordinates are defined in degrees (-180 .. 180).
It has to be specified for some coordinate systems.
\qbk{[include reference/core/degree_radian.qbk]}
*/
struct degree {};
/*!
\brief Unit of plane angle: Radians
\details Tag defining the unit of plane angle for spherical coordinate systems.
This tag specifies that coordinates are defined in radians (-PI .. PI).
It has to be specified for some coordinate systems.
\qbk{[include reference/core/degree_radian.qbk]}
*/
struct radian {};
#ifndef DOXYGEN_NO_DETAIL
namespace core_detail
{
template <typename DegreeOrRadian>
struct coordinate_system_units
{
BOOST_MPL_ASSERT_MSG
((false),
COORDINATE_SYSTEM_UNITS_MUST_BE_DEGREES_OR_RADIANS,
(types<DegreeOrRadian>));
};
template <>
struct coordinate_system_units<geometry::degree>
{
typedef geometry::degree units;
};
template <>
struct coordinate_system_units<geometry::radian>
{
typedef geometry::radian units;
};
} // namespace core_detail
#endif // DOXYGEN_NO_DETAIL
namespace cs
{
/*!
\brief Cartesian coordinate system
\details Defines the Cartesian or rectangular coordinate system
where points are defined in 2 or 3 (or more)
dimensions and usually (but not always) known as x,y,z
\see http://en.wikipedia.org/wiki/Cartesian_coordinate_system
\ingroup cs
*/
struct cartesian {};
/*!
\brief Geographic coordinate system, in degree or in radian
\details Defines the geographic coordinate system where points
are defined in two angles and usually
known as lat,long or lo,la or phi,lambda
\see http://en.wikipedia.org/wiki/Geographic_coordinate_system
\ingroup cs
\note might be moved to extensions/gis/geographic
*/
template<typename DegreeOrRadian>
struct geographic
{
typedef typename core_detail::coordinate_system_units
<
DegreeOrRadian
>::units units;
};
/*!
\brief Spherical (polar) coordinate system, in degree or in radian
\details Defines the spherical coordinate system where points are
defined in two angles
and an optional radius usually known as r, theta, phi
\par Coordinates:
- coordinate 0:
0 <= phi < 2pi is the angle between the positive x-axis and the
line from the origin to the P projected onto the xy-plane.
- coordinate 1:
0 <= theta <= pi is the angle between the positive z-axis and the
line formed between the origin and P.
- coordinate 2 (if specified):
r >= 0 is the distance from the origin to a given point P.
\see http://en.wikipedia.org/wiki/Spherical_coordinates
\ingroup cs
*/
template<typename DegreeOrRadian>
struct spherical
{
typedef typename core_detail::coordinate_system_units
<
DegreeOrRadian
>::units units;
};
/*!
\brief Spherical equatorial coordinate system, in degree or in radian
\details This one resembles the geographic coordinate system, and has latitude
up from zero at the equator, to 90 at the pole
(opposite to the spherical(polar) coordinate system).
Used in astronomy and in GIS (but there is also the geographic)
\see http://en.wikipedia.org/wiki/Spherical_coordinates
\ingroup cs
*/
template<typename DegreeOrRadian>
struct spherical_equatorial
{
typedef typename core_detail::coordinate_system_units
<
DegreeOrRadian
>::units units;
};
/*!
\brief Polar coordinate system
\details Defines the polar coordinate system "in which each point
on a plane is determined by an angle and a distance"
\see http://en.wikipedia.org/wiki/Polar_coordinates
\ingroup cs
*/
template<typename DegreeOrRadian>
struct polar
{
typedef typename core_detail::coordinate_system_units
<
DegreeOrRadian
>::units units;
};
} // namespace cs
namespace traits
{
/*!
\brief Traits class defining coordinate system tag, bound to coordinate system
\ingroup traits
\tparam CoordinateSystem coordinate system
*/
template <typename CoordinateSystem>
struct cs_tag
{
};
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
template<typename DegreeOrRadian>
struct cs_tag<cs::geographic<DegreeOrRadian> >
{
typedef geographic_tag type;
};
template<typename DegreeOrRadian>
struct cs_tag<cs::spherical<DegreeOrRadian> >
{
typedef spherical_polar_tag type;
};
template<typename DegreeOrRadian>
struct cs_tag<cs::spherical_equatorial<DegreeOrRadian> >
{
typedef spherical_equatorial_tag type;
};
template<>
struct cs_tag<cs::cartesian>
{
typedef cartesian_tag type;
};
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
} // namespace traits
/*!
\brief Meta-function returning coordinate system tag (cs family) of any geometry
\tparam Geometry \tparam_geometry
\ingroup core
*/
template <typename Geometry>
struct cs_tag
{
typedef typename traits::cs_tag
<
typename geometry::coordinate_system<Geometry>::type
>::type type;
};
/*!
\brief Meta-function to verify if a coordinate system is radian
\tparam CoordinateSystem Any coordinate system.
\ingroup core
*/
template <typename CoordinateSystem>
struct is_radian : boost::true_type {};
#ifndef DOXYGEN_NO_SPECIALIZATIONS
// Specialization for any degree coordinate systems
template <template<typename> class CoordinateSystem>
struct is_radian< CoordinateSystem<degree> > : boost::false_type
{
};
#endif // DOXYGEN_NO_SPECIALIZATIONS
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_CS_HPP

View File

@ -0,0 +1,89 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2015.
// Modifications copyright (c) 2015 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// 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_CORE_EXCEPTION_HPP
#define BOOST_GEOMETRY_CORE_EXCEPTION_HPP
#include <exception>
namespace boost { namespace geometry
{
/*!
\brief Base exception class for Boost.Geometry algorithms
\ingroup core
\details This class is never thrown. All exceptions thrown in Boost.Geometry
are derived from exception, so it might be convenient to catch it.
*/
class exception : public std::exception
{
public:
virtual char const* what() const throw()
{
return "Boost.Geometry exception";
}
};
/*!
\brief Invalid Input Exception
\ingroup core
\details The invalid_input_exception is thrown if an invalid attribute
is passed into a function, e.g. a DE-9IM mask string code containing
invalid characters passed into a de9im::mask constructor.
*/
class invalid_input_exception : public geometry::exception
{
public:
inline invalid_input_exception() {}
virtual char const* what() const throw()
{
return "Boost.Geometry Invalid-Input exception";
}
};
/*!
\brief Empty Input Exception
\ingroup core
\details The empty_input_exception is thrown if free functions, e.g. distance,
are called with empty geometries, e.g. a linestring
without points, a polygon without points, an empty multi-geometry.
\qbk{
[heading See also]
\* [link geometry.reference.algorithms.area the area function]
\* [link geometry.reference.algorithms.distance the distance function]
\* [link geometry.reference.algorithms.length the length function]
}
*/
class empty_input_exception : public geometry::invalid_input_exception
{
public:
inline empty_input_exception() {}
virtual char const* what() const throw()
{
return "Boost.Geometry Empty-Input exception";
}
};
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_EXCEPTION_HPP

View File

@ -0,0 +1,145 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 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_CORE_EXTERIOR_RING_HPP
#define BOOST_GEOMETRY_CORE_EXTERIOR_RING_HPP
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/util/add_const_if_c.hpp>
namespace boost { namespace geometry
{
namespace traits
{
/*!
\brief Traits class defining access to exterior_ring of a polygon
\details Should define const and non const access
\ingroup traits
\tparam Polygon the polygon type
\par Geometries:
- polygon
\par Specializations should provide:
- static inline RING& get(POLY& )
- static inline RING const& get(POLY const& )
*/
template <typename Polygon>
struct exterior_ring
{
BOOST_MPL_ASSERT_MSG
(
false, NOT_IMPLEMENTED_FOR_THIS_POLYGON_TYPE
, (types<Polygon>)
);
};
} // namespace traits
#ifndef DOXYGEN_NO_DISPATCH
namespace core_dispatch
{
template <typename Tag, typename Geometry>
struct exterior_ring
{
BOOST_MPL_ASSERT_MSG
(
false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
, (types<Geometry>)
);
};
template <typename Polygon>
struct exterior_ring<polygon_tag, Polygon>
{
static
typename geometry::ring_return_type<Polygon>::type
apply(typename add_const_if_c
<
boost::is_const<Polygon>::type::value,
Polygon
>::type& polygon)
{
return traits::exterior_ring
<
typename boost::remove_const<Polygon>::type
>::get(polygon);
}
};
} // namespace core_dispatch
#endif // DOXYGEN_NO_DISPATCH
/*!
\brief Function to get the exterior_ring ring of a polygon
\ingroup exterior_ring
\note OGC compliance: instead of ExteriorRing
\tparam Polygon polygon type
\param polygon the polygon to get the exterior ring from
\return a reference to the exterior ring
*/
template <typename Polygon>
inline typename ring_return_type<Polygon>::type exterior_ring(Polygon& polygon)
{
return core_dispatch::exterior_ring
<
typename tag<Polygon>::type,
Polygon
>::apply(polygon);
}
/*!
\brief Function to get the exterior ring of a polygon (const version)
\ingroup exterior_ring
\note OGC compliance: instead of ExteriorRing
\tparam Polygon polygon type
\param polygon the polygon to get the exterior ring from
\return a const reference to the exterior ring
\qbk{distinguish,const version}
*/
template <typename Polygon>
inline typename ring_return_type<Polygon const>::type exterior_ring(
Polygon const& polygon)
{
return core_dispatch::exterior_ring
<
typename tag<Polygon>::type,
Polygon const
>::apply(polygon);
}
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_EXTERIOR_RING_HPP

View File

@ -0,0 +1,103 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 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_CORE_GEOMETRY_ID_HPP
#define BOOST_GEOMETRY_CORE_GEOMETRY_ID_HPP
#include <boost/mpl/assert.hpp>
#include <boost/mpl/int.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DISPATCH
namespace core_dispatch
{
template <typename GeometryTag>
struct geometry_id
{
BOOST_MPL_ASSERT_MSG
(
false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
, (types<GeometryTag>)
);
};
template <>
struct geometry_id<point_tag> : boost::mpl::int_<1> {};
template <>
struct geometry_id<linestring_tag> : boost::mpl::int_<2> {};
template <>
struct geometry_id<polygon_tag> : boost::mpl::int_<3> {};
template <>
struct geometry_id<multi_point_tag> : boost::mpl::int_<4> {};
template <>
struct geometry_id<multi_linestring_tag> : boost::mpl::int_<5> {};
template <>
struct geometry_id<multi_polygon_tag> : boost::mpl::int_<6> {};
template <>
struct geometry_id<segment_tag> : boost::mpl::int_<92> {};
template <>
struct geometry_id<ring_tag> : boost::mpl::int_<93> {};
template <>
struct geometry_id<box_tag> : boost::mpl::int_<94> {};
} // namespace core_dispatch
#endif
/*!
\brief Meta-function returning the id of a geometry type
\details The meta-function geometry_id defines a numerical ID (based on
boost::mpl::int_<...> ) for each geometry concept. A numerical ID is
sometimes useful, and within Boost.Geometry it is used for the
reverse_dispatch metafuntion.
\note Used for e.g. reverse meta-function
\ingroup core
*/
template <typename Geometry>
struct geometry_id : core_dispatch::geometry_id<typename tag<Geometry>::type>
{};
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_GEOMETRY_ID_HPP

View File

@ -0,0 +1,150 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 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_CORE_INTERIOR_RINGS_HPP
#define BOOST_GEOMETRY_CORE_INTERIOR_RINGS_HPP
#include <cstddef>
#include <boost/mpl/assert.hpp>
#include <boost/range/value_type.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/core/interior_type.hpp>
namespace boost { namespace geometry
{
namespace traits
{
/*!
\brief Traits class defining access to interior_rings of a polygon
\details defines access (const and non const) to interior ring
\ingroup traits
\par Geometries:
- polygon
\par Specializations should provide:
- static inline INTERIOR& get(POLY&)
- static inline const INTERIOR& get(POLY const&)
\tparam Geometry geometry
*/
template <typename Geometry>
struct interior_rings
{
BOOST_MPL_ASSERT_MSG
(
false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
, (types<Geometry>)
);
};
} // namespace traits
#ifndef DOXYGEN_NO_DISPATCH
namespace core_dispatch
{
template
<
typename GeometryTag,
typename Geometry
>
struct interior_rings {};
template <typename Polygon>
struct interior_rings<polygon_tag, Polygon>
{
static inline
typename geometry::interior_return_type<Polygon>::type
apply(Polygon& polygon)
{
return traits::interior_rings
<
typename boost::remove_const<Polygon>::type
>::get(polygon);
}
};
template <typename MultiPolygon>
struct interior_type<multi_polygon_tag, MultiPolygon>
{
typedef typename core_dispatch::interior_type
<
polygon_tag,
typename boost::range_value<MultiPolygon>::type
>::type type;
};
} // namespace core_dispatch
#endif
/*!
\brief Function to get the interior rings of a polygon (non const version)
\ingroup interior_rings
\note OGC compliance: instead of InteriorRingN
\tparam Polygon polygon type
\param polygon the polygon to get the interior rings from
\return the interior rings (possibly a reference)
*/
template <typename Polygon>
inline typename interior_return_type<Polygon>::type interior_rings(Polygon& polygon)
{
return core_dispatch::interior_rings
<
typename tag<Polygon>::type,
Polygon
>::apply(polygon);
}
/*!
\brief Function to get the interior rings of a polygon (const version)
\ingroup interior_rings
\note OGC compliance: instead of InteriorRingN
\tparam Polygon polygon type
\param polygon the polygon to get the interior rings from
\return the interior rings (possibly a const reference)
\qbk{distinguish,const version}
*/
template <typename Polygon>
inline typename interior_return_type<Polygon const>::type interior_rings(
Polygon const& polygon)
{
return core_dispatch::interior_rings
<
typename tag<Polygon>::type,
Polygon const
>::apply(polygon);
}
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_INTERIOR_RINGS_HPP

View File

@ -0,0 +1,164 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 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_CORE_INTERIOR_TYPE_HPP
#define BOOST_GEOMETRY_CORE_INTERIOR_TYPE_HPP
#include <boost/mpl/assert.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
namespace boost { namespace geometry
{
namespace traits
{
/*!
\brief Traits class indicating interior container type of a polygon
\details defines inner container type, so the container containing
the interior rings
\ingroup traits
\par Geometries:
- polygon
\par Specializations should provide:
- typedef X type ( e.g. std::vector&lt;myring&lt;P&gt;&gt; )
\tparam Geometry geometry
*/
template <typename Geometry>
struct interior_const_type
{
BOOST_MPL_ASSERT_MSG
(
false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
, (types<Geometry>)
);
};
template <typename Geometry>
struct interior_mutable_type
{
BOOST_MPL_ASSERT_MSG
(
false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
, (types<Geometry>)
);
};
} // namespace traits
#ifndef DOXYGEN_NO_DISPATCH
namespace core_dispatch
{
template <typename GeometryTag, typename Geometry>
struct interior_return_type
{
BOOST_MPL_ASSERT_MSG
(
false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
, (types<Geometry>)
);
};
template <typename Polygon>
struct interior_return_type<polygon_tag, Polygon>
{
typedef typename boost::remove_const<Polygon>::type nc_polygon_type;
typedef typename boost::mpl::if_
<
boost::is_const<Polygon>,
typename traits::interior_const_type<nc_polygon_type>::type,
typename traits::interior_mutable_type<nc_polygon_type>::type
>::type type;
};
template <typename GeometryTag, typename Geometry>
struct interior_type
{
BOOST_MPL_ASSERT_MSG
(
false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
, (types<Geometry>)
);
};
template <typename Polygon>
struct interior_type<polygon_tag, Polygon>
{
typedef typename boost::remove_reference
<
typename interior_return_type<polygon_tag, Polygon>::type
>::type type;
};
} // namespace core_dispatch
#endif
/*!
\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 <typename Geometry>
struct interior_type
{
typedef typename core_dispatch::interior_type
<
typename tag<Geometry>::type,
Geometry
>::type type;
};
template <typename Geometry>
struct interior_return_type
{
typedef typename core_dispatch::interior_return_type
<
typename tag<Geometry>::type,
Geometry
>::type type;
};
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_INTERIOR_TYPE_HPP

View File

@ -0,0 +1,59 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 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_CORE_IS_AREAL_HPP
#define BOOST_GEOMETRY_CORE_IS_AREAL_HPP
#include <boost/type_traits/integral_constant.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DISPATCH
namespace core_dispatch
{
template <typename GeometryTag> struct is_areal : boost::false_type {};
template <> struct is_areal<ring_tag> : boost::true_type {};
template <> struct is_areal<box_tag> : boost::true_type {};
template <> struct is_areal<polygon_tag> : boost::true_type {};
template <> struct is_areal<multi_polygon_tag> : boost::true_type {};
} // namespace core_dispatch
#endif
/*!
\brief Meta-function defining "true" for areal types (box, (multi)polygon, ring),
\note Used for tag dispatching and meta-function finetuning
\note Also a "ring" has areal properties within Boost.Geometry
\ingroup core
*/
template <typename Geometry>
struct is_areal : core_dispatch::is_areal<typename tag<Geometry>::type>
{};
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_IS_AREAL_HPP

View File

@ -0,0 +1,98 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 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_CORE_MUTABLE_RANGE_HPP
#define BOOST_GEOMETRY_CORE_MUTABLE_RANGE_HPP
#include <cstddef>
#include <boost/range/value_type.hpp>
#include <boost/type_traits/remove_reference.hpp>
namespace boost { namespace geometry
{
namespace traits
{
/*!
\brief Metafunction to define the argument passed to the three
traits classes clear, push_back and resize
\ingroup mutable_range
*/
template <typename Range>
struct rvalue_type
{
typedef typename boost::remove_reference<Range>::type& type;
};
/*!
\brief Traits class to clear a geometry
\ingroup mutable_range
*/
template <typename Range>
struct clear
{
static inline void apply(typename rvalue_type<Range>::type range)
{
range.clear();
}
};
/*!
\brief Traits class to append a point to a range (ring, linestring, multi*)
\ingroup mutable_range
*/
template <typename Range>
struct push_back
{
typedef typename boost::range_value
<
typename boost::remove_reference<Range>::type
>::type item_type;
static inline void apply(typename rvalue_type<Range>::type range,
item_type const& item)
{
range.push_back(item);
}
};
/*!
\brief Traits class to append a point to a range (ring, linestring, multi*)
\ingroup mutable_range
*/
template <typename Range>
struct resize
{
static inline void apply(typename rvalue_type<Range>::type range,
std::size_t new_size)
{
range.resize(new_size);
}
};
} // namespace traits
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_MUTABLE_RANGE_HPP

View File

@ -0,0 +1,187 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2014.
// Modifications copyright (c) 2014 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// 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_CORE_POINT_ORDER_HPP
#define BOOST_GEOMETRY_CORE_POINT_ORDER_HPP
#include <boost/mpl/assert.hpp>
#include <boost/range/value_type.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/util/bare_type.hpp>
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
\qbk{
[heading See also]
[link geometry.reference.core.point_order The point_order metafunction]
}
*/
enum order_selector
{
/// Points are ordered clockwise
clockwise = 1,
/// Points are ordered counter clockwise
counterclockwise = 2,
/// Points might be stored in any order, algorithms will determine it on the
/// fly (not yet supported)
order_undetermined = 0
};
namespace traits
{
/*!
\brief Traits class indicating the order of contained points within a
ring or (multi)polygon, clockwise, counter clockwise or not known.
\ingroup traits
\tparam Ring ring
*/
template <typename Ring>
struct point_order
{
static const order_selector value = clockwise;
};
} // namespace traits
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace point_order
{
struct clockwise
{
static const order_selector value = geometry::clockwise;
};
}} // namespace detail::point_order
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace core_dispatch
{
template <typename Tag, typename Geometry>
struct point_order
{
BOOST_MPL_ASSERT_MSG
(
false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
, (types<Geometry>)
);
};
template <typename Point>
struct point_order<point_tag, Point>
: public detail::point_order::clockwise {};
template <typename Segment>
struct point_order<segment_tag, Segment>
: public detail::point_order::clockwise {};
template <typename Box>
struct point_order<box_tag, Box>
: public detail::point_order::clockwise {};
template <typename LineString>
struct point_order<linestring_tag, LineString>
: public detail::point_order::clockwise {};
template <typename Ring>
struct point_order<ring_tag, Ring>
{
static const order_selector value
= geometry::traits::point_order<Ring>::value;
};
// Specialization for polygon: the order is the order of its rings
template <typename Polygon>
struct point_order<polygon_tag, Polygon>
{
static const order_selector value = core_dispatch::point_order
<
ring_tag,
typename ring_type<polygon_tag, Polygon>::type
>::value ;
};
template <typename MultiPoint>
struct point_order<multi_point_tag, MultiPoint>
: public detail::point_order::clockwise {};
template <typename MultiLinestring>
struct point_order<multi_linestring_tag, MultiLinestring>
: public detail::point_order::clockwise {};
// Specialization for multi_polygon: the order is the order of its polygons
template <typename MultiPolygon>
struct point_order<multi_polygon_tag, MultiPolygon>
{
static const order_selector value = core_dispatch::point_order
<
polygon_tag,
typename boost::range_value<MultiPolygon>::type
>::value ;
};
} // namespace core_dispatch
#endif // DOXYGEN_NO_DISPATCH
/*!
\brief \brief_meta{value, point order (clockwise\, counterclockwise),
\meta_geometry_type}
\tparam Geometry \tparam_geometry
\ingroup core
\qbk{[include reference/core/point_order.qbk]}
*/
template <typename Geometry>
struct point_order
{
static const order_selector value = core_dispatch::point_order
<
typename tag<Geometry>::type,
typename util::bare_type<Geometry>::type
>::value;
};
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_POINT_ORDER_HPP

View File

@ -0,0 +1,162 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 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_CORE_POINT_TYPE_HPP
#define BOOST_GEOMETRY_CORE_POINT_TYPE_HPP
#include <boost/mpl/assert.hpp>
#include <boost/range/value_type.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/util/bare_type.hpp>
namespace boost { namespace geometry
{
namespace traits
{
/*!
\brief Traits class indicating the type of contained points
\ingroup traits
\par Geometries:
- all geometries except point
\par Specializations should provide:
- typedef P type (where P should fulfil the Point concept)
\tparam Geometry geometry
*/
template <typename Geometry>
struct point_type
{
BOOST_MPL_ASSERT_MSG
(
false, NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE, (types<Geometry>)
);
};
} // namespace traits
#ifndef DOXYGEN_NO_DISPATCH
namespace core_dispatch
{
template <typename Tag, typename Geometry>
struct point_type
{
// Default: call traits to get point type
typedef typename boost::remove_const
<
typename traits::point_type<Geometry>::type
>::type type;
};
// Specialization for point: the point itself
template <typename Point>
struct point_type<point_tag, Point>
{
typedef Point type;
};
// Specializations for linestring/ring, via boost::range
template <typename Linestring>
struct point_type<linestring_tag, Linestring>
{
typedef typename boost::range_value<Linestring>::type type;
};
template <typename Ring>
struct point_type<ring_tag, Ring>
{
typedef typename boost::range_value<Ring>::type type;
};
// Specialization for polygon: the point-type is the point-type of its rings
template <typename Polygon>
struct point_type<polygon_tag, Polygon>
{
typedef typename point_type
<
ring_tag,
typename ring_type<polygon_tag, Polygon>::type
>::type type;
};
template <typename MultiPoint>
struct point_type<multi_point_tag, MultiPoint>
{
typedef typename boost::range_value
<
MultiPoint
>::type type;
};
template <typename MultiLinestring>
struct point_type<multi_linestring_tag, MultiLinestring>
{
typedef typename point_type
<
linestring_tag,
typename boost::range_value<MultiLinestring>::type
>::type type;
};
template <typename MultiPolygon>
struct point_type<multi_polygon_tag, MultiPolygon>
{
typedef typename point_type
<
polygon_tag,
typename boost::range_value<MultiPolygon>::type
>::type type;
};
} // namespace core_dispatch
#endif // DOXYGEN_NO_DISPATCH
/*!
\brief \brief_meta{type, point_type, \meta_geometry_type}
\tparam Geometry \tparam_geometry
\ingroup core
\qbk{[include reference/core/point_type.qbk]}
*/
template <typename Geometry>
struct point_type
{
typedef typename core_dispatch::point_type
<
typename tag<Geometry>::type,
typename boost::geometry::util::bare_type<Geometry>::type
>::type type;
};
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_POINT_TYPE_HPP

View File

@ -0,0 +1,263 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2015.
// Modifications copyright (c) 2015, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// 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_CORE_RADIAN_ACCESS_HPP
#define BOOST_GEOMETRY_CORE_RADIAN_ACCESS_HPP
#include <cstddef>
#include <boost/numeric/conversion/cast.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/cs.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/util/math.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
template<std::size_t Dimension, typename Geometry>
struct degree_radian_converter
{
typedef typename fp_coordinate_type<Geometry>::type coordinate_type;
static inline coordinate_type get(Geometry const& geometry)
{
return boost::numeric_cast
<
coordinate_type
>(geometry::get<Dimension>(geometry)
* math::d2r<coordinate_type>());
}
static inline void set(Geometry& geometry, coordinate_type const& radians)
{
geometry::set<Dimension>(geometry, boost::numeric_cast
<
coordinate_type
>(radians * math::r2d<coordinate_type>()));
}
};
// Default, radian (or any other coordinate system) just works like "get"
template <std::size_t Dimension, typename Geometry, typename DegreeOrRadian>
struct radian_access
{
typedef typename fp_coordinate_type<Geometry>::type coordinate_type;
static inline coordinate_type get(Geometry const& geometry)
{
return geometry::get<Dimension>(geometry);
}
static inline void set(Geometry& geometry, coordinate_type const& radians)
{
geometry::set<Dimension>(geometry, radians);
}
};
// Specialize, any "degree" coordinate system will be converted to radian
// but only for dimension 0,1 (so: dimension 2 and heigher are untouched)
template
<
typename Geometry,
template<typename> class CoordinateSystem
>
struct radian_access<0, Geometry, CoordinateSystem<degree> >
: degree_radian_converter<0, Geometry>
{};
template
<
typename Geometry,
template<typename> class CoordinateSystem
>
struct radian_access<1, Geometry, CoordinateSystem<degree> >
: degree_radian_converter<1, Geometry>
{};
template<std::size_t Index, std::size_t Dimension, typename Geometry>
struct degree_radian_converter_box_segment
{
typedef typename fp_coordinate_type<Geometry>::type coordinate_type;
static inline coordinate_type get(Geometry const& geometry)
{
return boost::numeric_cast
<
coordinate_type
>(geometry::get<Index, Dimension>(geometry)
* math::d2r<coordinate_type>());
}
static inline void set(Geometry& geometry, coordinate_type const& radians)
{
geometry::set<Index, Dimension>(geometry, boost::numeric_cast
<
coordinate_type
>(radians * math::r2d<coordinate_type>()));
}
};
// Default, radian (or any other coordinate system) just works like "get"
template <std::size_t Index, std::size_t Dimension, typename Geometry, typename DegreeOrRadian>
struct radian_access_box_segment
{
typedef typename fp_coordinate_type<Geometry>::type coordinate_type;
static inline coordinate_type get(Geometry const& geometry)
{
return geometry::get<Index, Dimension>(geometry);
}
static inline void set(Geometry& geometry, coordinate_type const& radians)
{
geometry::set<Index, Dimension>(geometry, radians);
}
};
// Specialize, any "degree" coordinate system will be converted to radian
// but only for dimension 0,1 (so: dimension 2 and heigher are untouched)
template
<
typename Geometry,
template<typename> class CoordinateSystem,
std::size_t Index
>
struct radian_access_box_segment<Index, 0, Geometry, CoordinateSystem<degree> >
: degree_radian_converter_box_segment<Index, 0, Geometry>
{};
template
<
typename Geometry,
template<typename> class CoordinateSystem,
std::size_t Index
>
struct radian_access_box_segment<Index, 1, Geometry, CoordinateSystem<degree> >
: degree_radian_converter_box_segment<Index, 1, Geometry>
{};
} // namespace detail
#endif // DOXYGEN_NO_DETAIL
/*!
\brief get coordinate value of a point, result is in Radian
\details Result is in Radian, even if source coordinate system
is in Degrees
\return coordinate value
\ingroup get
\tparam Dimension dimension
\tparam Geometry geometry
\param geometry geometry to get coordinate value from
\note Only applicable to coordinate systems templatized by units,
e.g. spherical or geographic coordinate systems
*/
template <std::size_t Dimension, typename Geometry>
inline typename fp_coordinate_type<Geometry>::type get_as_radian(Geometry const& geometry)
{
return detail::radian_access<Dimension, Geometry,
typename coordinate_system<Geometry>::type>::get(geometry);
}
/*!
\brief set coordinate value (in radian) to a point
\details Coordinate value will be set correctly, if coordinate system of
point is in Degree, Radian value will be converted to Degree
\ingroup set
\tparam Dimension dimension
\tparam Geometry geometry
\param geometry geometry to assign coordinate to
\param radians coordinate value to assign
\note Only applicable to coordinate systems templatized by units,
e.g. spherical or geographic coordinate systems
*/
template <std::size_t Dimension, typename Geometry>
inline void set_from_radian(Geometry& geometry,
typename fp_coordinate_type<Geometry>::type const& radians)
{
detail::radian_access<Dimension, Geometry,
typename coordinate_system<Geometry>::type>::set(geometry, radians);
}
/*!
\brief get coordinate value of a segment or box, result is in Radian
\details Result is in Radian, even if source coordinate system
is in Degrees
\return coordinate value
\ingroup get
\tparam Index index
\tparam Dimension dimension
\tparam Geometry geometry
\param geometry geometry to get coordinate value from
\note Only applicable to coordinate systems templatized by units,
e.g. spherical or geographic coordinate systems
*/
template <std::size_t Index, std::size_t Dimension, typename Geometry>
inline typename fp_coordinate_type<Geometry>::type get_as_radian(Geometry const& geometry)
{
return detail::radian_access_box_segment<Index, Dimension, Geometry,
typename coordinate_system<Geometry>::type>::get(geometry);
}
/*!
\brief set coordinate value (in radian) to a segment or box
\details Coordinate value will be set correctly, if coordinate system of
point is in Degree, Radian value will be converted to Degree
\ingroup set
\tparam Index index
\tparam Dimension dimension
\tparam Geometry geometry
\param geometry geometry to assign coordinate to
\param radians coordinate value to assign
\note Only applicable to coordinate systems templatized by units,
e.g. spherical or geographic coordinate systems
*/
template <std::size_t Index, std::size_t Dimension, typename Geometry>
inline void set_from_radian(Geometry& geometry,
typename fp_coordinate_type<Geometry>::type const& radians)
{
detail::radian_access_box_segment<Index, Dimension, Geometry,
typename coordinate_system<Geometry>::type>::set(geometry, radians);
}
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_RADIAN_ACCESS_HPP

View File

@ -0,0 +1,251 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2014.
// Modifications copyright (c) 2014 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// 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_CORE_RADIUS_HPP
#define BOOST_GEOMETRY_CORE_RADIUS_HPP
#include <cstddef>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_pointer.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/util/bare_type.hpp>
namespace boost { namespace geometry
{
namespace traits
{
/*!
\brief Traits class to get/set radius of a circle/sphere/(ellipse)
\details the radius access meta-functions give read/write access to the radius of a circle or a sphere,
or to the major/minor axis or an ellipse, or to one of the 3 equatorial radii of an ellipsoid.
It should be specialized per geometry, in namespace core_dispatch. Those specializations should
forward the call via traits to the geometry class, which could be specified by the user.
There is a corresponding generic radius_get and radius_set function
\par Geometries:
- n-sphere (circle,sphere)
- upcoming ellipse
\par Specializations should provide:
- inline static T get(Geometry const& geometry)
- inline static void set(Geometry& geometry, T const& radius)
\ingroup traits
*/
template <typename Geometry, std::size_t Dimension>
struct radius_access {};
/*!
\brief Traits class indicating the type (double,float,...) of the radius of a circle or a sphere
\par Geometries:
- n-sphere (circle,sphere)
- upcoming ellipse
\par Specializations should provide:
- typedef T type (double,float,int,etc)
\ingroup traits
*/
template <typename Geometry>
struct radius_type {};
} // namespace traits
#ifndef DOXYGEN_NO_DISPATCH
namespace core_dispatch
{
template <typename Tag, typename Geometry>
struct radius_type
{
//typedef core_dispatch_specialization_required type;
};
/*!
\brief radius access meta-functions, used by concept n-sphere and upcoming ellipse.
*/
template <typename Tag,
typename Geometry,
std::size_t Dimension,
typename IsPointer>
struct radius_access
{
//static inline CoordinateType get(Geometry const& ) {}
//static inline void set(Geometry& g, CoordinateType const& value) {}
};
} // namespace core_dispatch
#endif // DOXYGEN_NO_DISPATCH
/*!
\brief Metafunction to get the type of radius of a circle / sphere / ellipse / etc.
\ingroup access
\tparam Geometry the type of geometry
*/
template <typename Geometry>
struct radius_type
{
typedef typename core_dispatch::radius_type
<
typename tag<Geometry>::type,
typename util::bare_type<Geometry>::type
>::type type;
};
/*!
\brief Function to get radius of a circle / sphere / ellipse / etc.
\return radius The radius for a given axis
\ingroup access
\param geometry the geometry to get the radius from
\tparam I index of the axis
*/
template <std::size_t I, typename Geometry>
inline typename radius_type<Geometry>::type get_radius(Geometry const& geometry)
{
return core_dispatch::radius_access
<
typename tag<Geometry>::type,
typename util::bare_type<Geometry>::type,
I,
typename boost::is_pointer<Geometry>::type
>::get(geometry);
}
/*!
\brief Function to set the radius of a circle / sphere / ellipse / etc.
\ingroup access
\tparam I index of the axis
\param geometry the geometry to change
\param radius the radius to set
*/
template <std::size_t I, typename Geometry>
inline void set_radius(Geometry& geometry,
typename radius_type<Geometry>::type const& radius)
{
core_dispatch::radius_access
<
typename tag<Geometry>::type,
typename util::bare_type<Geometry>::type,
I,
typename boost::is_pointer<Geometry>::type
>::set(geometry, radius);
}
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
template <typename Tag, typename Geometry, std::size_t Dimension>
struct radius_access
{
static inline typename radius_type<Geometry>::type get(Geometry const& geometry)
{
return traits::radius_access<Geometry, Dimension>::get(geometry);
}
static inline void set(Geometry& geometry,
typename radius_type<Geometry>::type const& value)
{
traits::radius_access<Geometry, Dimension>::set(geometry, value);
}
};
} // namespace detail
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace core_dispatch
{
template <typename Tag,
typename Geometry,
std::size_t Dimension>
struct radius_access<Tag, Geometry, Dimension, boost::true_type>
{
typedef typename geometry::radius_type<Geometry>::type radius_type;
static inline radius_type get(const Geometry * geometry)
{
return radius_access
<
Tag,
Geometry,
Dimension,
typename boost::is_pointer<Geometry>::type
>::get(*geometry);
}
static inline void set(Geometry * geometry, radius_type const& value)
{
return radius_access
<
Tag,
Geometry,
Dimension,
typename boost::is_pointer<Geometry>::type
>::set(*geometry, value);
}
};
template <typename Geometry>
struct radius_type<srs_sphere_tag, Geometry>
{
typedef typename traits::radius_type<Geometry>::type type;
};
template <typename Geometry, std::size_t Dimension>
struct radius_access<srs_sphere_tag, Geometry, Dimension, boost::false_type>
: detail::radius_access<srs_sphere_tag, Geometry, Dimension>
{
BOOST_STATIC_ASSERT(Dimension == 0);
//BOOST_STATIC_ASSERT(Dimension < 3);
};
template <typename Geometry>
struct radius_type<srs_spheroid_tag, Geometry>
{
typedef typename traits::radius_type<Geometry>::type type;
};
template <typename Geometry, std::size_t Dimension>
struct radius_access<srs_spheroid_tag, Geometry, Dimension, boost::false_type>
: detail::radius_access<srs_spheroid_tag, Geometry, Dimension>
{
BOOST_STATIC_ASSERT(Dimension == 0 || Dimension == 2);
//BOOST_STATIC_ASSERT(Dimension < 3);
};
} // namespace core_dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_RADIUS_HPP

View File

@ -0,0 +1,66 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 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_CORE_REVERSE_DISPATCH_HPP
#define BOOST_GEOMETRY_CORE_REVERSE_DISPATCH_HPP
#include <cstddef>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/geometry/core/geometry_id.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
// Different geometries: reverse_dispatch if second ID < first ID
template <std::size_t GeometryId1, std::size_t GeometryId2>
struct reverse_dispatch : boost::mpl::if_c
<
(GeometryId1 > GeometryId2),
boost::true_type,
boost::false_type
>
{};
// Same geometry: never reverse_dispatch
template <std::size_t GeometryId>
struct reverse_dispatch<GeometryId, GeometryId> : boost::false_type {};
} // namespace detail
#endif // DOXYGEN_NO_DETAIL
template <typename Geometry1, typename Geometry2>
struct reverse_dispatch : detail::reverse_dispatch
<
geometry_id<Geometry1>::type::value,
geometry_id<Geometry2>::type::value
>
{};
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_REVERSE_DISPATCH_HPP

View File

@ -0,0 +1,226 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2015.
// Modifications copyright (c) 2015, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// 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_CORE_RING_TYPE_HPP
#define BOOST_GEOMETRY_CORE_RING_TYPE_HPP
#include <boost/mpl/assert.hpp>
#include <boost/mpl/if.hpp>
#include <boost/range/value_type.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
namespace boost { namespace geometry
{
namespace traits
{
/*!
\brief Traits class to indicate ring-type of a polygon's exterior ring/interior rings
\ingroup traits
\par Geometries:
- polygon
\par Specializations should provide:
- typedef XXX type ( e.g. ring<P> )
\tparam Geometry geometry
*/
template <typename Geometry>
struct ring_const_type
{
BOOST_MPL_ASSERT_MSG
(
false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
, (types<Geometry>)
);
};
template <typename Geometry>
struct ring_mutable_type
{
BOOST_MPL_ASSERT_MSG
(
false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
, (types<Geometry>)
);
};
} // namespace traits
#ifndef DOXYGEN_NO_DISPATCH
namespace core_dispatch
{
template <typename GeometryTag, typename Geometry>
struct ring_return_type
{};
template <typename LineString>
struct ring_return_type<linestring_tag, LineString>
{
typedef LineString& type;
};
template <typename Ring>
struct ring_return_type<ring_tag, Ring>
{
typedef Ring& type;
};
template <typename Polygon>
struct ring_return_type<polygon_tag, Polygon>
{
typedef typename boost::remove_const<Polygon>::type nc_polygon_type;
typedef typename boost::mpl::if_
<
boost::is_const<Polygon>,
typename traits::ring_const_type<nc_polygon_type>::type,
typename traits::ring_mutable_type<nc_polygon_type>::type
>::type type;
};
template <typename MultiLinestring>
struct ring_return_type<multi_linestring_tag, MultiLinestring>
{
typedef typename ring_return_type
<
linestring_tag,
typename boost::mpl::if_
<
boost::is_const<MultiLinestring>,
typename boost::range_value<MultiLinestring>::type const,
typename boost::range_value<MultiLinestring>::type
>::type
>::type type;
};
template <typename MultiPolygon>
struct ring_return_type<multi_polygon_tag, MultiPolygon>
{
typedef typename ring_return_type
<
polygon_tag,
typename boost::mpl::if_
<
boost::is_const<MultiPolygon>,
typename boost::range_value<MultiPolygon>::type const,
typename boost::range_value<MultiPolygon>::type
>::type
>::type type;
};
template <typename GeometryTag, typename Geometry>
struct ring_type
{};
template <typename Ring>
struct ring_type<ring_tag, Ring>
{
typedef Ring type;
};
template <typename Polygon>
struct ring_type<polygon_tag, Polygon>
{
typedef typename boost::remove_reference
<
typename ring_return_type<polygon_tag, Polygon>::type
>::type type;
};
template <typename MultiLinestring>
struct ring_type<multi_linestring_tag, MultiLinestring>
{
typedef typename boost::remove_reference
<
typename ring_return_type<multi_linestring_tag, MultiLinestring>::type
>::type type;
};
template <typename MultiPolygon>
struct ring_type<multi_polygon_tag, MultiPolygon>
{
typedef typename boost::remove_reference
<
typename ring_return_type<multi_polygon_tag, MultiPolygon>::type
>::type type;
};
} // namespace core_dispatch
#endif
/*!
\brief \brief_meta{type, ring_type, \meta_geometry_type}
\details A polygon contains one exterior ring
and zero or more interior rings (holes).
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 <typename Geometry>
struct ring_type
{
typedef typename core_dispatch::ring_type
<
typename tag<Geometry>::type,
Geometry
>::type type;
};
template <typename Geometry>
struct ring_return_type
{
typedef typename core_dispatch::ring_return_type
<
typename tag<Geometry>::type,
Geometry
>::type type;
};
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_RING_TYPE_HPP

View File

@ -0,0 +1,196 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2014, 2016, 2017.
// Modifications copyright (c) 2014-2017 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// 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_CORE_SRS_HPP
#define BOOST_GEOMETRY_CORE_SRS_HPP
#include <cstddef>
#include <boost/static_assert.hpp>
#include <boost/geometry/core/radius.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
namespace boost { namespace geometry
{
namespace srs
{
/*!
\brief Defines spheroid radius values for use in geographical CS calculations
\note See http://en.wikipedia.org/wiki/Figure_of_the_Earth
and http://en.wikipedia.org/wiki/World_Geodetic_System#A_new_World_Geodetic_System:_WGS84
*/
template <typename RadiusType>
class spheroid
{
public:
spheroid(RadiusType const& a, RadiusType const& b)
: m_a(a)
, m_b(b)
{}
spheroid()
: m_a(RadiusType(6378137.0))
, m_b(RadiusType(6356752.3142451793))
{}
template <std::size_t I>
RadiusType get_radius() const
{
BOOST_STATIC_ASSERT(I < 3);
return I < 2 ? m_a : m_b;
}
template <std::size_t I>
void set_radius(RadiusType const& radius)
{
BOOST_STATIC_ASSERT(I < 3);
(I < 2 ? m_a : m_b) = radius;
}
private:
RadiusType m_a, m_b; // equatorial radius, polar radius
};
} // namespace srs
// Traits specializations for spheroid
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
namespace traits
{
template <typename RadiusType>
struct tag< srs::spheroid<RadiusType> >
{
typedef srs_spheroid_tag type;
};
template <typename RadiusType>
struct radius_type< srs::spheroid<RadiusType> >
{
typedef RadiusType type;
};
template <typename RadiusType, std::size_t Dimension>
struct radius_access<srs::spheroid<RadiusType>, Dimension>
{
typedef srs::spheroid<RadiusType> spheroid_type;
static inline RadiusType get(spheroid_type const& s)
{
return s.template get_radius<Dimension>();
}
static inline void set(spheroid_type& s, RadiusType const& value)
{
s.template set_radius<Dimension>(value);
}
};
} // namespace traits
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
namespace srs
{
/*!
\brief Defines sphere radius value for use in spherical CS calculations
*/
template <typename RadiusType>
class sphere
{
public:
explicit sphere(RadiusType const& r)
: m_r(r)
{}
sphere()
: m_r(RadiusType((2.0 * 6378137.0 + 6356752.3142451793) / 3.0))
{}
template <std::size_t I>
RadiusType get_radius() const
{
BOOST_STATIC_ASSERT(I < 3);
return m_r;
}
template <std::size_t I>
void set_radius(RadiusType const& radius)
{
BOOST_STATIC_ASSERT(I < 3);
m_r = radius;
}
private:
RadiusType m_r; // radius
};
} // namespace srs
// Traits specializations for sphere
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
namespace traits
{
template <typename RadiusType>
struct tag< srs::sphere<RadiusType> >
{
typedef srs_sphere_tag type;
};
template <typename RadiusType>
struct radius_type< srs::sphere<RadiusType> >
{
typedef RadiusType type;
};
template <typename RadiusType, std::size_t Dimension>
struct radius_access<srs::sphere<RadiusType>, Dimension>
{
typedef srs::sphere<RadiusType> sphere_type;
static inline RadiusType get(sphere_type const& s)
{
return s.template get_radius<Dimension>();
}
static inline void set(sphere_type& s, RadiusType const& value)
{
s.template set_radius<Dimension>(value);
}
};
} // namespace traits
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_SRS_HPP

View File

@ -0,0 +1,69 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 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_CORE_TAG_HPP
#define BOOST_GEOMETRY_CORE_TAG_HPP
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/util/bare_type.hpp>
namespace boost { namespace geometry
{
namespace traits
{
/*!
\brief Traits class to attach a tag to a geometry
\details All geometries should implement a traits::tag<G>::type metafunction to indicate their
own geometry type.
\ingroup traits
\par Geometries:
- all geometries
\par Specializations should provide:
- typedef XXX_tag type; (point_tag, box_tag, ...)
\tparam Geometry geometry
*/
template <typename Geometry, typename Enable = void>
struct tag
{
typedef void type;
};
} // namespace traits
/*!
\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
\qbk{[include reference/core/tag.qbk]}
*/
template <typename Geometry>
struct tag
{
typedef typename traits::tag
<
typename geometry::util::bare_type<Geometry>::type
>::type type;
};
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_TAG_HPP

View File

@ -0,0 +1,84 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 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_CORE_TAG_CAST_HPP
#define BOOST_GEOMETRY_CORE_TAG_CAST_HPP
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_base_of.hpp>
namespace boost { namespace geometry
{
/*!
\brief Metafunction defining a type being either the specified tag, or one
of the specified basetags if the type inherits from them.
\details Tags can inherit each other. A multi_point inherits, for example,
both the multi_tag and the pointlike_tag. Often behaviour can be shared
between different geometry types. A tag, found by the metafunction tag,
can be casted to a more basic tag, and then dispatched by that tag.
\ingroup core
\tparam Tag The tag to be casted to one of the base tags
\tparam BaseTag First base tag
\tparam BaseTag2 Optional second base tag
\tparam BaseTag3 Optional third base tag
\tparam BaseTag4 Optional fourth base tag
\tparam BaseTag5 Optional fifth base tag
\tparam BaseTag6 Optional sixth base tag
\tparam BaseTag7 Optional seventh base tag
\qbk{[include reference/core/tag_cast.qbk]}
*/
template
<
typename Tag,
typename BaseTag,
typename BaseTag2 = void,
typename BaseTag3 = void,
typename BaseTag4 = void,
typename BaseTag5 = void,
typename BaseTag6 = void,
typename BaseTag7 = void
>
struct tag_cast
{
typedef typename boost::mpl::if_
<
typename boost::is_base_of<BaseTag, Tag>::type,
BaseTag,
// Try next one in line:
typename tag_cast
<
Tag, BaseTag2, BaseTag3, BaseTag4,
BaseTag5, BaseTag6, BaseTag7, void
>::type
>::type type;
};
#ifndef DOXYGEN_NO_SPECIALIZATIONS
// Specialization for last one
template <typename Tag>
struct tag_cast<Tag, void, void, void, void, void, void, void>
{
// If not found, take specified tag, so do not cast
typedef Tag type;
};
#endif // DOXYGEN_NO_SPECIALIZATIONS
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_TAG_CAST_HPP

View File

@ -0,0 +1,150 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2014.
// Modifications copyright (c) 2014 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// 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_CORE_TAGS_HPP
#define BOOST_GEOMETRY_CORE_TAGS_HPP
namespace boost { namespace geometry
{
// Tags defining strategies linked to coordinate systems
/// Tag used for casting spherical/geographic coordinate systems
struct spherical_tag {};
/// Tag indicating Cartesian coordinate system family (cartesian,epsg)
struct cartesian_tag {};
/// Tag indicating Spherical polar coordinate system family
struct spherical_polar_tag : spherical_tag {};
/// Tag indicating Spherical equatorial coordinate system family
struct spherical_equatorial_tag : spherical_tag {};
/// Tag indicating Geographic coordinate system family (geographic)
struct geographic_tag : spherical_tag {};
// Tags defining coordinate systems reference models
/// For reference spheroid defining parameters of geographical coordinate system
struct srs_spheroid_tag {};
/// For reference sphere defining parameters of spherical coordinate system
struct srs_sphere_tag : srs_spheroid_tag {};
// Tags defining tag hierarchy
/// For single-geometries (point, linestring, polygon, box, ring, segment)
struct single_tag {};
/// For multiple-geometries (multi_point, multi_linestring, multi_polygon)
struct multi_tag {};
/// For point-like types (point, multi_point)
struct pointlike_tag {};
/// For linear types (linestring, multi-linestring, segment)
struct linear_tag {};
/// For areal types (polygon, multi_polygon, box, ring)
struct areal_tag {};
// Subset of areal types (polygon, multi_polygon, ring)
struct polygonal_tag : areal_tag {};
/// For volume types (also box (?), polyhedron)
struct volumetric_tag {};
// Tags defining geometry types
/// "default" tag
struct geometry_not_recognized_tag {};
/// OGC Point identifying tag
struct point_tag : single_tag, pointlike_tag {};
/// OGC Linestring identifying tag
struct linestring_tag : single_tag, linear_tag {};
/// OGC Polygon identifying tag
struct polygon_tag : single_tag, polygonal_tag {};
/// Convenience (linear) ring identifying tag
struct ring_tag : single_tag, polygonal_tag {};
/// Convenience 2D or 3D box (mbr / aabb) identifying tag
struct box_tag : single_tag, areal_tag {};
/// Convenience segment (2-points) identifying tag
struct segment_tag : single_tag, linear_tag {};
/// OGC Multi point identifying tag
struct multi_point_tag : multi_tag, pointlike_tag {};
/// OGC Multi linestring identifying tag
struct multi_linestring_tag : multi_tag, linear_tag {};
/// OGC Multi polygon identifying tag
struct multi_polygon_tag : multi_tag, polygonal_tag {};
/// OGC Geometry Collection identifying tag
struct geometry_collection_tag : multi_tag {};
/*!
\brief Meta-function to get for a tag of a multi-geometry
the tag of the corresponding single-geometry
*/
template <typename Tag>
struct single_tag_of
{};
#ifndef DOXYGEN_NO_DETAIL
template <>
struct single_tag_of<multi_point_tag>
{
typedef point_tag type;
};
template <>
struct single_tag_of<multi_linestring_tag>
{
typedef linestring_tag type;
};
template <>
struct single_tag_of<multi_polygon_tag>
{
typedef polygon_tag type;
};
#endif
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_TAGS_HPP

View File

@ -0,0 +1,101 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 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_CORE_TOPOLOGICAL_DIMENSION_HPP
#define BOOST_GEOMETRY_CORE_TOPOLOGICAL_DIMENSION_HPP
#include <boost/mpl/int.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DISPATCH
namespace core_dispatch
{
template <typename GeometryTag>
struct top_dim {};
template <>
struct top_dim<point_tag> : boost::mpl::int_<0> {};
template <>
struct top_dim<linestring_tag> : boost::mpl::int_<1> {};
template <>
struct top_dim<segment_tag> : boost::mpl::int_<1> {};
// ring: topological dimension of two, but some people say: 1 !!
// NOTE: This is not OGC LinearRing!
template <>
struct top_dim<ring_tag> : boost::mpl::int_<2> {};
// TODO: This is wrong! Boxes may have various topological dimensions
template <>
struct top_dim<box_tag> : boost::mpl::int_<2> {};
template <>
struct top_dim<polygon_tag> : boost::mpl::int_<2> {};
template <>
struct top_dim<multi_point_tag> : boost::mpl::int_<0> {};
template <>
struct top_dim<multi_linestring_tag> : boost::mpl::int_<1> {};
template <>
struct top_dim<multi_polygon_tag> : boost::mpl::int_<2> {};
} // namespace core_dispatch
#endif
/*!
\brief Meta-function returning the topological dimension of a geometry
\details The topological dimension defines a point as 0-dimensional,
a linestring as 1-dimensional,
and a ring or polygon as 2-dimensional.
\see http://www.math.okstate.edu/mathdept/dynamics/lecnotes/node36.html
\ingroup core
*/
template <typename Geometry>
struct topological_dimension
: core_dispatch::top_dim<typename tag<Geometry>::type> {};
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_TOPOLOGICAL_DIMENSION_HPP